summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManasij Sur Roy <manasij.r@samsung.com>2013-08-19 13:48:23 +0900
committerManasij Sur Roy <manasij.r@samsung.com>2013-08-19 17:02:41 +0900
commit6f143a99eda02e40c99dc3e7af27097cbf513d27 (patch)
tree39ac1275bc4a1b7a15bf7a9c57774e38d83838cc
parent52f27744055ca7112e82ec95bfec7927a71fd69b (diff)
downloadsocial-6f143a99eda02e40c99dc3e7af27097cbf513d27.tar.gz
social-6f143a99eda02e40c99dc3e7af27097cbf513d27.tar.bz2
social-6f143a99eda02e40c99dc3e7af27097cbf513d27.zip
Modifying CalendarbookImpl and CalendarImpl codes according to coding idioms
Change-Id: Ie685a35e254c43712ce226f4434657c7f0d45b98 Signed-off-by: Manasij Sur Roy <manasij.r@samsung.com>
-rw-r--r--src/FScl_CalendarImpl.cpp57
-rw-r--r--src/FScl_CalendarbookImpl.cpp811
-rw-r--r--src/inc/FScl_CalendarImpl.h2
-rw-r--r--src/inc/FScl_CalendarbookImpl.h34
4 files changed, 418 insertions, 486 deletions
diff --git a/src/FScl_CalendarImpl.cpp b/src/FScl_CalendarImpl.cpp
index 8dcd8c7..b719498 100644
--- a/src/FScl_CalendarImpl.cpp
+++ b/src/FScl_CalendarImpl.cpp
@@ -20,15 +20,15 @@
* This file contains definitions of @e _CalendarImpl class.
*/
+#include <FBaseInteger.h>
#include <FBaseString.h>
#include <FBaseSysLog.h>
#include <FBaseUtilStringTokenizer.h>
-#include <FBaseInteger.h>
-#include <FSclCalendar.h>
#include <FBase_StringConverter.h>
+#include <FSclCalendar.h>
+#include "FScl_CalendarbookDbConnector.h"
#include "FScl_CalendarImpl.h"
#include "FScl_RecordImpl.h"
-#include "FScl_CalendarbookDbConnector.h"
using namespace Tizen::Base;
using namespace Tizen::Base::Utility;
@@ -42,14 +42,12 @@ static const int _NUM_OF_COLOR_FACTOR = 3;
_CalendarImpl::_CalendarImpl(CalendarItemType itemType)
{
- int errorCode = CALENDAR_ERROR_NONE;
- calendar_record_h calendarHandle = null;
-
result r = _CalendarbookDbConnector::Connect();
- SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
- errorCode = calendar_record_create(_calendar_book._uri, &calendarHandle);
- SysTryReturnVoidResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ calendar_record_h calendarHandle = null;
+ int errorCode = calendar_record_create(_calendar_book._uri, &calendarHandle);
+ SysTryReturnVoidResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
calendar_record_set_int(calendarHandle, _calendar_book.store_type, _CalendarbookUtil::ConvertCalendarItemTypeToCSCalendarbookType(itemType));
@@ -59,14 +57,12 @@ _CalendarImpl::_CalendarImpl(CalendarItemType itemType)
_CalendarImpl::_CalendarImpl(const _CalendarImpl& rhs)
{
- int errorCode = CALENDAR_ERROR_NONE;
- calendar_record_h calendarHandle = null;
-
result r = _CalendarbookDbConnector::Connect();
- SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
- errorCode = calendar_record_clone(rhs.__calendarRecord.GetHandle(), &calendarHandle);
- SysTryReturnVoidResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ calendar_record_h calendarHandle = null;
+ int errorCode = calendar_record_clone(rhs.__calendarRecord.GetHandle(), &calendarHandle);
+ SysTryReturnVoidResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
__calendarRecord.ResetHandle(calendarHandle);
}
@@ -76,7 +72,7 @@ _CalendarImpl::~_CalendarImpl(void)
calendar_record_destroy(__calendarRecord.ReleaseHandle(), true);
result r = _CalendarbookDbConnector::Disconnect();
- SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
}
_CalendarImpl&
@@ -87,11 +83,10 @@ _CalendarImpl::operator =(const _CalendarImpl& rhs)
return *this;
}
- int errorCode = CALENDAR_ERROR_NONE;
calendar_record_h calendarHandle = null;
- errorCode = calendar_record_clone(rhs.__calendarRecord.GetHandle(), &calendarHandle);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, *this, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ int errorCode = calendar_record_clone(rhs.__calendarRecord.GetHandle(), &calendarHandle);
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, *this, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
__calendarRecord.ResetHandle(calendarHandle);
@@ -187,11 +182,10 @@ void
_CalendarImpl::SetName(const String& name)
{
std::unique_ptr<char[]> pConvertedName(_StringConverter::CopyToCharArrayN(name));
- SysTryReturnVoidResult(NID_SCL, pConvertedName != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturnVoidResult(NID_SCL, pConvertedName != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
- int errorCode = CALENDAR_ERROR_NONE;
- errorCode = calendar_record_set_str(__calendarRecord.GetHandle(), _calendar_book.name, pConvertedName.get());
- SysTryReturnVoidResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ int errorCode = calendar_record_set_str(__calendarRecord.GetHandle(), _calendar_book.name, pConvertedName.get());
+ SysTryReturnVoidResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
}
void
@@ -207,24 +201,17 @@ _CalendarImpl::SetColor(byte red, byte green, byte blue)
color.Append(255); // alpha
std::unique_ptr<char[]> pConvertedColor(_StringConverter::CopyToCharArrayN(color));
- SysTryReturnVoidResult(NID_SCL, pConvertedColor != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturnVoidResult(NID_SCL, pConvertedColor != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
- int errorCode = CALENDAR_ERROR_NONE;
- errorCode = calendar_record_set_str(__calendarRecord.GetHandle(), _calendar_book.color, pConvertedColor.get());
- SysTryReturnVoidResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ int errorCode = calendar_record_set_str(__calendarRecord.GetHandle(), _calendar_book.color, pConvertedColor.get());
+ SysTryReturnVoidResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
}
void
_CalendarImpl::ClearColor(void)
{
- String color;
-
- std::unique_ptr<char[]> pConvertedColor(_StringConverter::CopyToCharArrayN(color));
- SysTryReturnVoidResult(NID_SCL, pConvertedColor != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
-
- int errorCode = CALENDAR_ERROR_NONE;
- errorCode = calendar_record_set_str(__calendarRecord.GetHandle(), _calendar_book.color, pConvertedColor.get());
- SysTryReturnVoidResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ int errorCode = calendar_record_set_str(__calendarRecord.GetHandle(), _calendar_book.color, null);
+ SysTryReturnVoidResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
}
void
diff --git a/src/FScl_CalendarbookImpl.cpp b/src/FScl_CalendarbookImpl.cpp
index 834e56f..9bd4f32 100644
--- a/src/FScl_CalendarbookImpl.cpp
+++ b/src/FScl_CalendarbookImpl.cpp
@@ -22,42 +22,42 @@
#include <new>
#include <unique_ptr.h>
-#include <FBaseDateTime.h>
#include <FBaseColArrayList.h>
#include <FBaseColHashMapT.h>
+#include <FBaseDateTime.h>
+#include <FBaseSysLog.h>
+#include <FBase_StringConverter.h>
#include <FBaseUtilStringUtil.h>
-#include <FLclTimeZone.h>
#include <FIoFile.h>
+#include <FLclTimeZone.h>
+#include <FSclCalendar.h>
#include <FSclCalendarbook.h>
#include <FSclCalEvent.h>
-#include <FSclCalTodo.h>
-#include <FSclCalendar.h>
-#include <FSclCalEventInstance.h>
#include <FSclCalEventChangeInfo.h>
+#include <FSclCalEventInstance.h>
+#include <FSclCalTodo.h>
#include <FSclCalTodoChangeInfo.h>
+#include <FSclICalendarbookEventListener.h>
#include <FSclIRecordEventListener.h>
#include <FSclIRecordListener.h>
-#include <FSclICalendarbookEventListener.h>
-#include <FBaseSysLog.h>
-#include <FBase_StringConverter.h>
#include "FScl_CalendarbookImpl.h"
-#include "FScl_RecordImpl.h"
-#include "FScl_CalEventImpl.h"
-#include "FScl_CalTodoImpl.h"
-#include "FScl_CalendarImpl.h"
-#include "FScl_CalEventInstanceImpl.h"
-#include "FScl_CalEventChangeInfoImpl.h"
-#include "FScl_CalTodoChangeInfoImpl.h"
#include "FScl_CalendarbookFilterImpl.h"
-#include "FScl_CalendarbookUtil.h"
-#include "FScl_CalendarbookDbMonitor.h"
#include "FScl_CalendarbookDbConnector.h"
-#include "FScl_CalendarbookRecordRetrivalThread.h"
+#include "FScl_CalendarbookDbMonitor.h"
#include "FScl_CalendarbookRecordRetrivalEvent.h"
+#include "FScl_CalendarbookRecordRetrivalThread.h"
+#include "FScl_CalendarbookUtil.h"
+#include "FScl_CalEventChangeInfoImpl.h"
+#include "FScl_CalendarImpl.h"
+#include "FScl_CalEventImpl.h"
+#include "FScl_CalEventInstanceImpl.h"
+#include "FScl_CalTodoChangeInfoImpl.h"
+#include "FScl_CalTodoImpl.h"
+#include "FScl_RecordImpl.h"
using namespace Tizen::Base;
-using namespace Tizen::Base::Utility;
using namespace Tizen::Base::Collection;
+using namespace Tizen::Base::Utility;
using namespace Tizen::Io;
namespace Tizen { namespace Social
@@ -291,16 +291,14 @@ CATCH:
result
_CalendarbookImpl::Construct(ICalendarbookEventListener& listener)
{
- result r = E_SUCCESS;
- _CalendarbookDbMonitor* pCalendarbookDbMonitor = null;
- int dbVersion = -1;
-
ClearLastResult();
- pCalendarbookDbMonitor = _CalendarbookDbMonitor::GetInstance();
+ _CalendarbookDbMonitor* pCalendarbookDbMonitor = _CalendarbookDbMonitor::GetInstance();
SysTryReturnResult(NID_SCL, pCalendarbookDbMonitor != null, E_SYSTEM, "A system error has been occurred.");
- dbVersion = GetLatestVersion();
+ result r = E_SUCCESS;
+
+ int dbVersion = GetLatestVersion();
SysTryCatch(NID_SCL, dbVersion != -1, r = GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
r = pCalendarbookDbMonitor->AddListener(*this);
@@ -323,9 +321,6 @@ CATCH:
result
_CalendarbookImpl::AddEvent(CalEvent& event)
{
- int errorCode = CALENDAR_ERROR_NONE;
- int dbIndex = -1;
-
SysTryReturnResult(NID_SCL, event.GetRecordId() == INVALID_RECORD_ID, E_INVALID_ARG
, "Invalid argument is used. The specified recordId is not INVALID_RECORD_ID.");
SysTryReturnResult(NID_SCL, !event.IsInstance(), E_INVALID_ARG
@@ -333,7 +328,10 @@ _CalendarbookImpl::AddEvent(CalEvent& event)
calendar_record_h eventHandle = _CalEventImpl::GetInstance(event)->GetRecordHandle();
- calendar_record_set_int(eventHandle, _calendar_event.calendar_book_id, _DEFAULT_EVENT_CALENDAR_DB_ID);
+ int errorCode = calendar_record_set_int(eventHandle, _calendar_event.calendar_book_id, _DEFAULT_EVENT_CALENDAR_DB_ID);
+ SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_SYSTEM, "A system error has been occurred.");
+
+ int dbIndex = -1;
errorCode = calendar_db_insert_record(eventHandle, &dbIndex);
SysTryReturnResult(NID_SCL, errorCode != CALENDAR_ERROR_FILE_NO_SPACE, E_STORAGE_FULL, "The storage is insufficient.");
SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_SYSTEM, "A system error has been occurred.");
@@ -350,9 +348,6 @@ _CalendarbookImpl::AddEvent(CalEvent& event)
result
_CalendarbookImpl::AddEvent(CalEvent& event, RecordId calendarId)
{
- int errorCode = CALENDAR_ERROR_NONE;
- int dbIndex = -1;
-
SysTryReturnResult(NID_SCL, event.GetRecordId() == INVALID_RECORD_ID, E_INVALID_ARG
, "Invalid argument is used. The specified recordId is not INVALID_RECORD_ID.");
SysTryReturnResult(NID_SCL, !event.IsInstance(), E_INVALID_ARG
@@ -366,7 +361,10 @@ _CalendarbookImpl::AddEvent(CalEvent& event, RecordId calendarId)
calendar_record_h eventHandle = _CalEventImpl::GetInstance(event)->GetRecordHandle();
- calendar_record_set_int(eventHandle, _calendar_event.calendar_book_id, calendarId);
+ int errorCode = calendar_record_set_int(eventHandle, _calendar_event.calendar_book_id, calendarId);
+ SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_SYSTEM, "A system error has been occurred.");
+
+ int dbIndex = -1;
errorCode = calendar_db_insert_record(eventHandle, &dbIndex);
SysTryReturnResult(NID_SCL, errorCode != CALENDAR_ERROR_FILE_NO_SPACE, E_STORAGE_FULL, "The storage is insufficient.");
SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_SYSTEM, "A system error has been occurred.");
@@ -383,15 +381,15 @@ _CalendarbookImpl::AddEvent(CalEvent& event, RecordId calendarId)
result
_CalendarbookImpl::AddTodo(CalTodo& todo)
{
- int errorCode = CALENDAR_ERROR_NONE;
- int dbIndex = -1;
-
SysTryReturnResult(NID_SCL, todo.GetRecordId() == INVALID_RECORD_ID, E_INVALID_ARG
, "Invalid argument is used. The specified recordId is not INVALID_RECORD_ID.");
calendar_record_h todoHandle = _CalTodoImpl::GetInstance(todo)->GetRecordHandle();
- calendar_record_set_int(todoHandle, _calendar_todo.calendar_book_id, _DEFAULT_TODO_CALENDAR_DB_ID);
+ int errorCode = calendar_record_set_int(todoHandle, _calendar_todo.calendar_book_id, _DEFAULT_TODO_CALENDAR_DB_ID);
+ SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_SYSTEM, "A system error has been occurred.");
+
+ int dbIndex = -1;
errorCode = calendar_db_insert_record(todoHandle, &dbIndex);
SysTryReturnResult(NID_SCL, errorCode != CALENDAR_ERROR_FILE_NO_SPACE, E_STORAGE_FULL, "The storage is insufficient.");
SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_SYSTEM, "A system error has been occurred.");
@@ -408,9 +406,6 @@ _CalendarbookImpl::AddTodo(CalTodo& todo)
result
_CalendarbookImpl::AddTodo(CalTodo& todo, RecordId calendarId)
{
- int errorCode = CALENDAR_ERROR_NONE;
- int dbIndex = -1;
-
SysTryReturnResult(NID_SCL, todo.GetRecordId() == INVALID_RECORD_ID, E_INVALID_ARG
, "Invalid argument is used. The specified recordId is not INVALID_RECORD_ID.");
SysTryReturnResult(NID_SCL, calendarId != INVALID_RECORD_ID, E_INVALID_ARG
@@ -422,7 +417,9 @@ _CalendarbookImpl::AddTodo(CalTodo& todo, RecordId calendarId)
calendar_record_h todoHandle = _CalTodoImpl::GetInstance(todo)->GetRecordHandle();
- calendar_record_set_int(todoHandle, _calendar_todo.calendar_book_id, calendarId);
+ int errorCode = calendar_record_set_int(todoHandle, _calendar_todo.calendar_book_id, calendarId);
+
+ int dbIndex = -1;
errorCode = calendar_db_insert_record(todoHandle, &dbIndex);
SysTryReturnResult(NID_SCL, errorCode != CALENDAR_ERROR_FILE_NO_SPACE, E_STORAGE_FULL, "The storage is insufficient.");
SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_SYSTEM, "A system error has been occurred.");
@@ -439,15 +436,13 @@ _CalendarbookImpl::AddTodo(CalTodo& todo, RecordId calendarId)
result
_CalendarbookImpl::AddCalendar(Calendar& calendar)
{
- int errorCode = CALENDAR_ERROR_NONE;
- int dbIndex = -1;
-
SysTryReturnResult(NID_SCL, calendar.GetRecordId() == INVALID_RECORD_ID, E_INVALID_ARG
, "Invalid argument is used. The specified recordId is not INVALID_RECORD_ID.");
calendar_record_h calendarHandle = _CalendarImpl::GetInstance(calendar)->GetRecordHandle();
- errorCode = calendar_db_insert_record(calendarHandle, &dbIndex);
+ int dbIndex = -1;
+ int errorCode = calendar_db_insert_record(calendarHandle, &dbIndex);
SysTryReturnResult(NID_SCL, errorCode != CALENDAR_ERROR_FILE_NO_SPACE, E_STORAGE_FULL, "The storage is insufficient.");
SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_SYSTEM, "A system error has been occurred.");
_RecordImpl::GetInstance(calendar)->SetRecordId(dbIndex);
@@ -463,17 +458,16 @@ _CalendarbookImpl::AddCalendar(Calendar& calendar)
result
_CalendarbookImpl::AddCalendar(Calendar& calendar, AccountId accountId)
{
- int errorCode = CALENDAR_ERROR_NONE;
- int dbIndex = -1;
-
SysTryReturnResult(NID_SCL, calendar.GetRecordId() == INVALID_RECORD_ID, E_INVALID_ARG
, "Invalid argument is used. The specified recordId is not INVALID_RECORD_ID.");
SysTryReturnResult(NID_SCL, accountId >= 0, E_INVALID_ARG, "Invalid argument is used.");
calendar_record_h calendarHandle = _CalendarImpl::GetInstance(calendar)->GetRecordHandle();
- calendar_record_set_int(calendarHandle, _calendar_book.account_id, accountId);
+ int errorCode = calendar_record_set_int(calendarHandle, _calendar_book.account_id, accountId);
+ SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_SYSTEM, "A system error has been occurred.");
+ int dbIndex = -1;
errorCode = calendar_db_insert_record(calendarHandle, &dbIndex);
SysTryReturnResult(NID_SCL, errorCode != CALENDAR_ERROR_FILE_NO_SPACE, E_STORAGE_FULL, "The storage is insufficient.");
SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_SYSTEM, "A system error has been occurred.");
@@ -490,21 +484,19 @@ _CalendarbookImpl::AddCalendar(Calendar& calendar, AccountId accountId)
result
_CalendarbookImpl::RemoveEvent(CalEvent& event)
{
- int errorCode = CALENDAR_ERROR_NONE;
-
SysTryReturnResult(NID_SCL, event.GetRecordId() != INVALID_RECORD_ID, E_INVALID_ARG
, "Invalid argument is used. The specified eventId is INVALID_RECORD_ID.");
calendar_record_h eventHandle = _CalEventImpl::GetInstance(event)->GetRecordHandle();
int baseEventId = _INVALID_EVENT_DB_ID;
- errorCode = calendar_record_get_int(eventHandle, _calendar_event.original_event_id, &baseEventId);
+ int errorCode = calendar_record_get_int(eventHandle, _calendar_event.original_event_id, &baseEventId);
SysTryReturnResult(NID_SCL, baseEventId == _INVALID_EVENT_DB_ID, E_INVALID_OPERATION
, "Invalid argument is used. The event has the base event id.");
errorCode = calendar_db_delete_record(_calendar_event._uri, event.GetRecordId());
SysTryReturnResult(NID_SCL, errorCode != CALENDAR_ERROR_DB_RECORD_NOT_FOUND, E_OBJ_NOT_FOUND, "The specified record is not found.");
- SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_SYSTEM, "A system error has been occurred.");
_RecordImpl* pRecordImpl = _RecordImpl::GetInstance(event);
pRecordImpl->SetRecordId(INVALID_RECORD_ID);
@@ -515,14 +507,12 @@ _CalendarbookImpl::RemoveEvent(CalEvent& event)
result
_CalendarbookImpl::RemoveEvent(RecordId eventId)
{
- int errorCode = CALENDAR_ERROR_NONE;
-
SysTryReturnResult(NID_SCL, eventId != INVALID_RECORD_ID, E_INVALID_ARG
, "Invalid argument is used. The specified eventId is INVALID_RECORD_ID.");
calendar_record_h eventHandle = null;
- errorCode = calendar_db_get_record(_calendar_event._uri, eventId, &eventHandle);
+ int errorCode = calendar_db_get_record(_calendar_event._uri, eventId, &eventHandle);
SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OBJ_NOT_FOUND, "The specified record is not found.");
int baseEventId = _INVALID_EVENT_DB_ID;
@@ -534,7 +524,7 @@ _CalendarbookImpl::RemoveEvent(RecordId eventId)
, "Invalid argument is used. The event of eventId has the base event id.");
errorCode = calendar_db_delete_record(_calendar_event._uri, eventId);
- SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_SYSTEM, "A system error has been occurred.");
return E_SUCCESS;
}
@@ -545,6 +535,7 @@ _CalendarbookImpl::RemoveTodo(CalTodo& todo)
_RecordImpl* pRecordImpl = _RecordImpl::GetInstance(todo);
result r = RemoveTodo(todo.GetRecordId());
+ SysTryReturnResult(NID_SCL, !IsFailed(r), r, "Failed to remove the todo.");
pRecordImpl->SetRecordId(INVALID_RECORD_ID);
return r;
@@ -553,14 +544,12 @@ _CalendarbookImpl::RemoveTodo(CalTodo& todo)
result
_CalendarbookImpl::RemoveTodo(RecordId todoId)
{
- int errorCode = CALENDAR_ERROR_NONE;
-
SysTryReturnResult(NID_SCL, todoId != INVALID_RECORD_ID, E_INVALID_ARG
, "Invalid argument is used. The specified todoId is INVALID_RECORD_ID.");
- errorCode = calendar_db_delete_record(_calendar_todo._uri, todoId);
+ int errorCode = calendar_db_delete_record(_calendar_todo._uri, todoId);
SysTryReturnResult(NID_SCL, errorCode != CALENDAR_ERROR_DB_RECORD_NOT_FOUND, E_OBJ_NOT_FOUND, "The specified record is not found.");
- SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_SYSTEM, "A system error has been occurred.");
return E_SUCCESS;
}
@@ -568,8 +557,6 @@ _CalendarbookImpl::RemoveTodo(RecordId todoId)
result
_CalendarbookImpl::RemoveCalendar(RecordId calendarId)
{
- int errorCode = CALENDAR_ERROR_NONE;
-
SysTryReturnResult(NID_SCL, calendarId != INVALID_RECORD_ID, E_INVALID_ARG
, "The specified calendarId is INVALID_RECORD_ID.");
SysTryReturnResult(NID_SCL, calendarId != _DEFAULT_EVENT_CALENDAR_DB_ID
@@ -578,8 +565,8 @@ _CalendarbookImpl::RemoveCalendar(RecordId calendarId)
, E_INVALID_ARG, "Invalid argument is used. The calendar represents default calendar.");
SysTryReturnResult(NID_SCL, CheckCalendarExistance(calendarId), E_OBJ_NOT_FOUND, "The specified record is not found.");
- errorCode = calendar_db_delete_record(_calendar_book._uri, calendarId);
- SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ int errorCode = calendar_db_delete_record(_calendar_book._uri, calendarId);
+ SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_SYSTEM, "A system error has been occurred.");
return E_SUCCESS;
}
@@ -587,8 +574,6 @@ _CalendarbookImpl::RemoveCalendar(RecordId calendarId)
result
_CalendarbookImpl::UpdateEvent(const CalEvent& event)
{
- int errorCode = CALENDAR_ERROR_NONE;
-
SysTryReturnResult(NID_SCL, event.GetRecordId() != INVALID_RECORD_ID, E_INVALID_ARG
, "Invalid argument is used. The specified recordId is INVALID_RECORD_ID.");
SysTryReturnResult(NID_SCL, !event.IsInstance(), E_INVALID_ARG
@@ -597,7 +582,7 @@ _CalendarbookImpl::UpdateEvent(const CalEvent& event)
calendar_record_h eventHandle = _CalEventImpl::GetInstance(event)->GetRecordHandle();
int baseEventId = _INVALID_EVENT_DB_ID;
- errorCode = calendar_record_get_int(eventHandle, _calendar_event.original_event_id, &baseEventId);
+ int errorCode = calendar_record_get_int(eventHandle, _calendar_event.original_event_id, &baseEventId);
SysTryReturnResult(NID_SCL, baseEventId == _INVALID_EVENT_DB_ID, E_INVALID_OPERATION
, "Invalid argument is used. The event has the base event id.");
@@ -613,14 +598,12 @@ _CalendarbookImpl::UpdateEvent(const CalEvent& event)
result
_CalendarbookImpl::UpdateTodo(const CalTodo& todo)
{
- int errorCode = CALENDAR_ERROR_NONE;
-
SysTryReturnResult(NID_SCL, todo.GetRecordId() != INVALID_RECORD_ID, E_INVALID_ARG
, "Invalid argument is used. The specified recordId is INVALID_RECORD_ID.");
SysTryReturnResult(NID_SCL, CheckTodoExistance(todo.GetRecordId()), E_OBJ_NOT_FOUND, "The specified record is not found.");
calendar_record_h todoHandle = _CalTodoImpl::GetInstance(todo)->GetRecordHandle();
- errorCode = calendar_db_update_record(todoHandle);
+ int errorCode = calendar_db_update_record(todoHandle);
SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_SYSTEM, "A system error has been occurred.");
return E_SUCCESS;
@@ -629,14 +612,12 @@ _CalendarbookImpl::UpdateTodo(const CalTodo& todo)
result
_CalendarbookImpl::UpdateCalendar(const Calendar& calendar)
{
- int errorCode = CALENDAR_ERROR_NONE;
-
SysTryReturnResult(NID_SCL, calendar.GetRecordId() != INVALID_RECORD_ID, E_INVALID_ARG
, "The specified recordId is INVALID_RECORD_ID.");
SysTryReturnResult(NID_SCL, CheckCalendarExistance(calendar.GetRecordId()), E_OBJ_NOT_FOUND, "The specified record is not found.");
calendar_record_h calendarHandle = _CalendarImpl::GetInstance(calendar)->GetRecordHandle();
- errorCode = calendar_db_update_record(calendarHandle);
+ int errorCode = calendar_db_update_record(calendarHandle);
SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_SYSTEM, "A system error has been occurred.");
return E_SUCCESS;
@@ -645,20 +626,18 @@ _CalendarbookImpl::UpdateCalendar(const Calendar& calendar)
CalEvent*
_CalendarbookImpl::GetEventN(RecordId eventId) const
{
- int errorCode = CALENDAR_ERROR_NONE;
- calendar_record_h eventHandle = null;
-
ClearLastResult();
SysTryReturn(NID_SCL, eventId != INVALID_RECORD_ID, null, E_INVALID_ARG
- , "[E_INVALID_ARG] Invalid argument is used. The specified recordId is INVALID_RECORD_ID.");
+ , "[%s] Invalid argument is used. The specified recordId is INVALID_RECORD_ID.", GetErrorMessage(E_INVALID_ARG));
std::unique_ptr<CalEvent> pEvent(new (std::nothrow) CalEvent());
- SysTryReturn(NID_SCL, pEvent != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, pEvent != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
- errorCode = calendar_db_get_record(_calendar_event._uri, eventId, &eventHandle);
- SysTryReturn(NID_SCL, errorCode != CALENDAR_ERROR_DB_FAILED, null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The specified record is not found.");
+ calendar_record_h eventHandle = null;
+ int errorCode = calendar_db_get_record(_calendar_event._uri, eventId, &eventHandle);
+ SysTryReturn(NID_SCL, errorCode != CALENDAR_ERROR_DB_FAILED, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OBJ_NOT_FOUND, "[%s] The specified record is not found.", GetErrorMessage(E_OBJ_NOT_FOUND));
_CalEventImpl::GetInstance(*pEvent.get())->SetRecordHandle(eventHandle);
_RecordImpl::GetInstance(*pEvent.get())->SetRecordId(eventId);
@@ -669,20 +648,18 @@ _CalendarbookImpl::GetEventN(RecordId eventId) const
CalTodo*
_CalendarbookImpl::GetTodoN(RecordId todoId) const
{
- int errorCode = CALENDAR_ERROR_NONE;
- calendar_record_h todoHandle = null;
-
ClearLastResult();
SysTryReturn(NID_SCL, todoId != INVALID_RECORD_ID, null, E_INVALID_ARG
- , "[E_INVALID_ARG] Invalid argument is used. The specified recordId is INVALID_RECORD_ID.");
+ , "[%s] Invalid argument is used. The specified recordId is INVALID_RECORD_ID.", GetErrorMessage(E_INVALID_ARG));
std::unique_ptr<CalTodo> pTodo(new (std::nothrow) CalTodo());
- SysTryReturn(NID_SCL, pTodo != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, pTodo != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
- errorCode = calendar_db_get_record(_calendar_todo._uri, todoId, &todoHandle);
- SysTryReturn(NID_SCL, errorCode != CALENDAR_ERROR_DB_FAILED, null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The specified record is not found.");
+ calendar_record_h todoHandle = null;
+ int errorCode = calendar_db_get_record(_calendar_todo._uri, todoId, &todoHandle);
+ SysTryReturn(NID_SCL, errorCode != CALENDAR_ERROR_DB_FAILED, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OBJ_NOT_FOUND, "[%s] The specified record is not found.", GetErrorMessage(E_OBJ_NOT_FOUND));
_CalTodoImpl::GetInstance(*pTodo.get())->SetRecordHandle(todoHandle);
_RecordImpl::GetInstance(*pTodo.get())->SetRecordId(todoId);
@@ -693,20 +670,18 @@ _CalendarbookImpl::GetTodoN(RecordId todoId) const
Calendar*
_CalendarbookImpl::GetCalendarN(RecordId calendarId) const
{
- int errorCode = CALENDAR_ERROR_NONE;
- calendar_record_h calendarHandle = null;
-
ClearLastResult();
SysTryReturn(NID_SCL, calendarId != INVALID_RECORD_ID, null, E_INVALID_ARG
- , "[E_INVALID_ARG] Invalid argument is used. The specified recordId is INVALID_RECORD_ID.");
+ , "[%s] Invalid argument is used. The specified recordId is INVALID_RECORD_ID.", GetErrorMessage(E_INVALID_ARG));
std::unique_ptr<Calendar> pCalendar(new (std::nothrow) Calendar(CALENDAR_ITEM_TYPE_EVENT_AND_TODO));
- SysTryReturn(NID_SCL, pCalendar != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, pCalendar != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
- errorCode = calendar_db_get_record(_calendar_book._uri, calendarId, &calendarHandle);
- SysTryReturn(NID_SCL, errorCode != CALENDAR_ERROR_DB_FAILED, null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The specified record is not found.");
+ calendar_record_h calendarHandle = null;
+ int errorCode = calendar_db_get_record(_calendar_book._uri, calendarId, &calendarHandle);
+ SysTryReturn(NID_SCL, errorCode != CALENDAR_ERROR_DB_FAILED, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OBJ_NOT_FOUND, "[%s] The specified record is not found.", GetErrorMessage(E_OBJ_NOT_FOUND));
_CalendarImpl::GetInstance(*pCalendar.get())->SetRecordHandle(calendarHandle);
_RecordImpl::GetInstance(*pCalendar.get())->SetRecordId(calendarId);
@@ -718,16 +693,14 @@ IList*
_CalendarbookImpl::GetTodosN(const DateTime& start, const DateTime& end, int pageNo, int countPerPage, unsigned long status,
unsigned long priority) const
{
- int errorCode = CALENDAR_ERROR_NONE;
-
ClearLastResult();
- SysTryReturn(NID_SCL, pageNo > 0 && countPerPage > 0, null, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. The pageNo or countPerPage is less than 1.");
- SysTryReturn(NID_SCL, start <= end, null, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. The start time is later than the end date.");
- SysTryReturn(NID_SCL, _CalendarbookUtil::CheckValidDateTime(start), null, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. start = %S", start.ToString().GetPointer());
- SysTryReturn(NID_SCL, _CalendarbookUtil::CheckValidDateTime(end), null, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. end = %S", end.ToString().GetPointer());
- SysTryReturn(NID_SCL, CheckValidTodoStatus(status), null, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. status = %ld", status);
- SysTryReturn(NID_SCL, CheckValidTodoPriority(priority), null, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. priority = %ld", priority);
+ SysTryReturn(NID_SCL, pageNo > 0 && countPerPage > 0, null, E_INVALID_ARG, "[%s] Invalid argument is used. The pageNo or countPerPage is less than 1.", GetErrorMessage(E_INVALID_ARG));
+ SysTryReturn(NID_SCL, start <= end, null, E_INVALID_ARG, "[%s] Invalid argument is used. The start time is later than the end date.", GetErrorMessage(E_INVALID_ARG));
+ SysTryReturn(NID_SCL, _CalendarbookUtil::CheckValidDateTime(start), null, E_INVALID_ARG, "[%s] Invalid argument is used. start = %S", GetErrorMessage(E_INVALID_ARG), start.ToString().GetPointer());
+ SysTryReturn(NID_SCL, _CalendarbookUtil::CheckValidDateTime(end), null, E_INVALID_ARG, "[%s] Invalid argument is used. end = %S", GetErrorMessage(E_INVALID_ARG), end.ToString().GetPointer());
+ SysTryReturn(NID_SCL, CheckValidTodoStatus(status), null, E_INVALID_ARG, "[%s] Invalid argument is used. status = %ld", GetErrorMessage(E_INVALID_ARG), status);
+ SysTryReturn(NID_SCL, CheckValidTodoPriority(priority), null, E_INVALID_ARG, "[%s] Invalid argument is used. priority = %ld", GetErrorMessage(E_INVALID_ARG), priority);
DateTime tmpStart;
DateTime tmpEnd;
@@ -739,24 +712,24 @@ _CalendarbookImpl::GetTodosN(const DateTime& start, const DateTime& end, int pag
_CalendarbookUtil::ConvertDateTimeToCalTime(tmpEnd, convertedEndTime);
calendar_filter_h mainFilterHandle = null;
- errorCode = calendar_filter_create(_calendar_todo._uri, &mainFilterHandle);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ int errorCode = calendar_filter_create(_calendar_todo._uri, &mainFilterHandle);
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
_CalendarFilter mainFilter(mainFilterHandle);
// Condition : Due time of the item >= start time of filter
errorCode = calendar_filter_add_caltime(mainFilterHandle, _calendar_todo.due_time, CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, convertedStartTime);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
// Condition : Due time of the item <= end time of filter
errorCode = calendar_filter_add_operator(mainFilterHandle, CALENDAR_FILTER_OPERATOR_AND);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
errorCode = calendar_filter_add_caltime(mainFilterHandle, _calendar_todo.due_time, CALENDAR_MATCH_LESS_THAN_OR_EQUAL, convertedEndTime);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
// Condition : status
calendar_filter_h subFilterHandle = null;
errorCode = calendar_filter_create(_calendar_todo._uri, &subFilterHandle);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
_CalendarFilter subFilter(subFilterHandle);
subFilterHandle = null;
@@ -769,11 +742,11 @@ _CalendarbookImpl::GetTodosN(const DateTime& start, const DateTime& end, int pag
if (alreadyAdded)
{
errorCode = calendar_filter_add_operator(subFilter.GetHandle(), CALENDAR_FILTER_OPERATOR_OR);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
}
errorCode = calendar_filter_add_int(subFilter.GetHandle(), _calendar_todo.todo_status, CALENDAR_MATCH_EQUAL, ConvertTodoStatusToCalendarTodoStatus(tmpStatus));
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
alreadyAdded = true;
}
@@ -782,13 +755,13 @@ _CalendarbookImpl::GetTodosN(const DateTime& start, const DateTime& end, int pag
}
errorCode = calendar_filter_add_operator(mainFilterHandle, CALENDAR_FILTER_OPERATOR_AND);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
errorCode = calendar_filter_add_filter(mainFilterHandle, subFilter.GetHandle());
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
// Condition : priority
errorCode = calendar_filter_create(_calendar_todo._uri, &subFilterHandle);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
subFilter.ResetHandle(subFilterHandle);
subFilterHandle = null;
@@ -801,11 +774,11 @@ _CalendarbookImpl::GetTodosN(const DateTime& start, const DateTime& end, int pag
if (alreadyAdded)
{
errorCode = calendar_filter_add_operator(subFilter.GetHandle(), CALENDAR_FILTER_OPERATOR_OR);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
}
errorCode = calendar_filter_add_int(subFilter.GetHandle(), _calendar_todo.priority, CALENDAR_MATCH_EQUAL, ConvertTodoPriorityToCalendarTodoPriority(tmpPriority));
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
alreadyAdded = true;
}
@@ -813,14 +786,14 @@ _CalendarbookImpl::GetTodosN(const DateTime& start, const DateTime& end, int pag
}
errorCode = calendar_filter_add_operator(mainFilterHandle, CALENDAR_FILTER_OPERATOR_AND);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
errorCode = calendar_filter_add_filter(mainFilterHandle, subFilter.GetHandle());
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
// Create query
calendar_query_h queryHandle = null;
errorCode = calendar_query_create(_calendar_todo._uri, &queryHandle);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
_CalendarQuery query(queryHandle);
calendar_query_set_sort(queryHandle, _calendar_todo.due_time, true);
@@ -828,12 +801,13 @@ _CalendarbookImpl::GetTodosN(const DateTime& start, const DateTime& end, int pag
calendar_list_h calendarListHandle = null;
errorCode = calendar_db_get_records_with_query(queryHandle, (pageNo - 1) * countPerPage, countPerPage, &calendarListHandle);
- SysTryReturn(NID_SCL, errorCode != CALENDAR_ERROR_OUT_OF_MEMORY, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ SysTryReturn(NID_SCL, errorCode != CALENDAR_ERROR_OUT_OF_MEMORY, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
_CalendarList calendarList(calendarListHandle);
+ // TODO:- Should we use SingleObjectDeleter instead ?
std::unique_ptr<ArrayList, AllElementsDeleter> pList(new (std::nothrow) ArrayList());
- SysTryReturn(NID_SCL, pList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, pList != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
result r = pList->Construct();
SysTryReturn(NID_SCL, !IsFailed(r), null, r, "[%s] Propagating.", GetErrorMessage(r));
@@ -843,10 +817,11 @@ _CalendarbookImpl::GetTodosN(const DateTime& start, const DateTime& end, int pag
for (int i = 0; i < count; i++)
{
std::unique_ptr<CalTodo> pTmpTodo(new (std::nothrow) CalTodo());
- SysTryReturn(NID_SCL, pTmpTodo != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, pTmpTodo != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
- r = pList->Add(*pTmpTodo.release());
- SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ r = pList->Add(pTmpTodo.get());
+ SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ pTmpTodo.release();
}
calendar_list_first(calendarListHandle);
@@ -856,12 +831,14 @@ _CalendarbookImpl::GetTodosN(const DateTime& start, const DateTime& end, int pag
CalTodo* pTmpTodo = static_cast<CalTodo*>(pEnum->GetCurrent());
calendar_record_h tmpRecordHandle = null;
- calendar_list_get_current_record_p(calendarListHandle, &tmpRecordHandle);
+ errorCode = calendar_list_get_current_record_p(calendarListHandle, &tmpRecordHandle);
+ SysTryReturn(NID_SCL, errorCode != CALENDAR_ERROR_DB_FAILED, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
_CalTodoImpl::GetInstance(*pTmpTodo)->SetRecordHandle(tmpRecordHandle);
int dbIndex = -1;
- calendar_record_get_int(tmpRecordHandle, _calendar_todo.id, &dbIndex);
+ errorCode = calendar_record_get_int(tmpRecordHandle, _calendar_todo.id, &dbIndex);
+ SysTryReturn(NID_SCL, errorCode != CALENDAR_ERROR_DB_FAILED, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
_RecordImpl::GetInstance(*pTmpTodo)->SetRecordId(dbIndex);
calendar_list_next(calendarListHandle);
@@ -875,20 +852,18 @@ _CalendarbookImpl::GetTodosN(const DateTime& start, const DateTime& end, int pag
int
_CalendarbookImpl::GetTodoCount(const DateTime& start, const DateTime& end, unsigned long status, unsigned long priority) const
{
- int errorCode = CALENDAR_ERROR_NONE;
-
ClearLastResult();
SysTryReturn(NID_SCL, start <= end, _INVALID_COUNT
- , E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. The start time is later than the end date.");
+ , E_INVALID_ARG, "[%s] Invalid argument is used. The start time is later than the end date.", GetErrorMessage(E_INVALID_ARG));
SysTryReturn(NID_SCL, _CalendarbookUtil::CheckValidDateTime(start), _INVALID_COUNT
- , E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. start = %S", start.ToString().GetPointer());
+ , E_INVALID_ARG, "[%s] Invalid argument is used. start = %S", GetErrorMessage(E_INVALID_ARG), start.ToString().GetPointer());
SysTryReturn(NID_SCL, _CalendarbookUtil::CheckValidDateTime(end), _INVALID_COUNT
- , E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. end = %S", end.ToString().GetPointer());
+ , E_INVALID_ARG, "[%s] Invalid argument is used. end = %S", GetErrorMessage(E_INVALID_ARG), end.ToString().GetPointer());
SysTryReturn(NID_SCL, CheckValidTodoStatus(status), _INVALID_COUNT
- , E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. status = %ld", status);
+ , E_INVALID_ARG, "[%s] Invalid argument is used. status = %ld", GetErrorMessage(E_INVALID_ARG), status);
SysTryReturn(NID_SCL, CheckValidTodoPriority(priority), _INVALID_COUNT
- , E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. priority = %ld", priority);
+ , E_INVALID_ARG, "[%s] Invalid argument is used. priority = %ld", GetErrorMessage(E_INVALID_ARG), priority);
DateTime tmpStart;
DateTime tmpEnd;
@@ -900,24 +875,24 @@ _CalendarbookImpl::GetTodoCount(const DateTime& start, const DateTime& end, unsi
_CalendarbookUtil::ConvertDateTimeToCalTime(tmpEnd, convertedEndTime);
calendar_filter_h mainFilterHandle = null;
- errorCode = calendar_filter_create(_calendar_todo._uri, &mainFilterHandle);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, _INVALID_COUNT, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ int errorCode = calendar_filter_create(_calendar_todo._uri, &mainFilterHandle);
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, _INVALID_COUNT, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
_CalendarFilter mainFilter(mainFilterHandle);
// Condition : Due time of the item => start time of filter
errorCode = calendar_filter_add_caltime(mainFilterHandle, _calendar_todo.due_time, CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, convertedStartTime);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
// Condition : Due time of the item <= end time of filter
errorCode = calendar_filter_add_operator(mainFilterHandle, CALENDAR_FILTER_OPERATOR_AND);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
errorCode = calendar_filter_add_caltime(mainFilterHandle, _calendar_todo.due_time, CALENDAR_MATCH_LESS_THAN_OR_EQUAL, convertedEndTime);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
// Condition : status
calendar_filter_h subFilterHandle = null;
errorCode = calendar_filter_create(_calendar_todo._uri, &subFilterHandle);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, _INVALID_COUNT, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, _INVALID_COUNT, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
_CalendarFilter subFilter(subFilterHandle);
subFilterHandle = null;
@@ -930,11 +905,11 @@ _CalendarbookImpl::GetTodoCount(const DateTime& start, const DateTime& end, unsi
if (alreadyAdded)
{
errorCode = calendar_filter_add_operator(subFilter.GetHandle(), CALENDAR_FILTER_OPERATOR_OR);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
}
errorCode = calendar_filter_add_int(subFilter.GetHandle(), _calendar_todo.todo_status, CALENDAR_MATCH_EQUAL, ConvertTodoStatusToCalendarTodoStatus(tmpStatus));
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
alreadyAdded = true;
}
@@ -942,13 +917,13 @@ _CalendarbookImpl::GetTodoCount(const DateTime& start, const DateTime& end, unsi
tmpStatus <<= 1;
}
errorCode = calendar_filter_add_operator(mainFilterHandle, CALENDAR_FILTER_OPERATOR_AND);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
errorCode = calendar_filter_add_filter(mainFilterHandle, subFilter.GetHandle());
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
// Condition : priority
errorCode = calendar_filter_create(_calendar_todo._uri, &subFilterHandle);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, _INVALID_COUNT, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, _INVALID_COUNT, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
subFilter.ResetHandle(subFilterHandle);
subFilterHandle = null;
@@ -961,11 +936,11 @@ _CalendarbookImpl::GetTodoCount(const DateTime& start, const DateTime& end, unsi
if (alreadyAdded)
{
errorCode = calendar_filter_add_operator(subFilter.GetHandle(), CALENDAR_FILTER_OPERATOR_OR);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
}
errorCode = calendar_filter_add_int(subFilter.GetHandle(), _calendar_todo.priority, CALENDAR_MATCH_EQUAL, ConvertTodoPriorityToCalendarTodoPriority(tmpPriority));
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
alreadyAdded = true;
}
@@ -973,14 +948,14 @@ _CalendarbookImpl::GetTodoCount(const DateTime& start, const DateTime& end, unsi
}
errorCode = calendar_filter_add_operator(mainFilterHandle, CALENDAR_FILTER_OPERATOR_AND);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
errorCode = calendar_filter_add_filter(mainFilterHandle, subFilter.GetHandle());
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
// Create query
calendar_query_h queryHandle = null;
errorCode = calendar_query_create(_calendar_todo._uri, &queryHandle);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, _INVALID_COUNT, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, _INVALID_COUNT, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
_CalendarQuery query(queryHandle);
calendar_query_set_filter(queryHandle, mainFilterHandle);
@@ -988,7 +963,7 @@ _CalendarbookImpl::GetTodoCount(const DateTime& start, const DateTime& end, unsi
int count = _INVALID_COUNT;
errorCode = calendar_db_get_count_with_query(queryHandle, &count);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
return count;
}
@@ -998,18 +973,16 @@ _CalendarbookImpl::GetEventInstancesN(const DateTime& start, const DateTime& end
const Tizen::Locales::TimeZone& timeZone, int pageNo, int countPerPage,
unsigned long category) const
{
- result r = E_SUCCESS;
-
ClearLastResult();
- SysTryReturn(NID_SCL, pageNo > 0 && countPerPage > 0, null, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. The pageNo or countPerPage is less than 1.");
- SysTryReturn(NID_SCL, start <= end, null, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. The start time is later than the end date.");
- SysTryReturn(NID_SCL, _CalendarbookUtil::CheckValidDateTime(start), null, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. start = %S", start.ToString().GetPointer());
- SysTryReturn(NID_SCL, _CalendarbookUtil::CheckValidDateTime(end), null, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. end = %S", end.ToString().GetPointer());
- SysTryReturn(NID_SCL, (category & EVENT_CATEGORY_APPOINTMENT) || (category & EVENT_CATEGORY_ANNIVERSARY), null, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. category = %ld", category);
+ SysTryReturn(NID_SCL, pageNo > 0 && countPerPage > 0, null, E_INVALID_ARG, "[%s] Invalid argument is used. The pageNo or countPerPage is less than 1.", GetErrorMessage(E_INVALID_ARG));
+ SysTryReturn(NID_SCL, start <= end, null, E_INVALID_ARG, "[%s] Invalid argument is used. The start time is later than the end date.", GetErrorMessage(E_INVALID_ARG));
+ SysTryReturn(NID_SCL, _CalendarbookUtil::CheckValidDateTime(start), null, E_INVALID_ARG, "[%s] Invalid argument is used. start = %S", GetErrorMessage(E_INVALID_ARG), start.ToString().GetPointer());
+ SysTryReturn(NID_SCL, _CalendarbookUtil::CheckValidDateTime(end), null, E_INVALID_ARG, "[%s] Invalid argument is used. end = %S", GetErrorMessage(E_INVALID_ARG), end.ToString().GetPointer());
+ SysTryReturn(NID_SCL, (category & EVENT_CATEGORY_APPOINTMENT) || (category & EVENT_CATEGORY_ANNIVERSARY), null, E_INVALID_ARG, "[%s] Invalid argument is used. category = %ld", GetErrorMessage(E_INVALID_ARG), category);
std::unique_ptr<IList, AllElementsDeleter> pList(GetEventInstancesCommonN(start, end, timeZone, pageNo, countPerPage, category));
- r = GetLastResult();
+ result r = GetLastResult();
SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
return pList.release();
@@ -1023,17 +996,15 @@ _CalendarbookImpl::GetEventInstances(const DateTime& start, const DateTime& end,
__requestId++;
reqId = __requestId;
- result r = E_SUCCESS;
-
- SysTryReturn(NID_SCL, pageNo > 0 && countPerPage > 0, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. The pageNo or countPerPage is less than 1.");
- SysTryReturn(NID_SCL, start <= end, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. The start time is later than the end date.");
- SysTryReturn(NID_SCL, _CalendarbookUtil::CheckValidDateTime(start), E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. start = %S", start.ToString().GetPointer());
- SysTryReturn(NID_SCL, _CalendarbookUtil::CheckValidDateTime(end), E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. end = %S", end.ToString().GetPointer());
- SysTryReturn(NID_SCL, (category & EVENT_CATEGORY_APPOINTMENT) || (category & EVENT_CATEGORY_ANNIVERSARY), E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. category = %ld", category);
+ SysTryReturn(NID_SCL, pageNo > 0 && countPerPage > 0, E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument is used. The pageNo or countPerPage is less than 1.", GetErrorMessage(E_INVALID_ARG));
+ SysTryReturn(NID_SCL, start <= end, E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument is used. The start time is later than the end date.", GetErrorMessage(E_INVALID_ARG));
+ SysTryReturn(NID_SCL, _CalendarbookUtil::CheckValidDateTime(start), E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument is used. start = %S", GetErrorMessage(E_INVALID_ARG), start.ToString().GetPointer());
+ SysTryReturn(NID_SCL, _CalendarbookUtil::CheckValidDateTime(end), E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument is used. end = %S", GetErrorMessage(E_INVALID_ARG), end.ToString().GetPointer());
+ SysTryReturn(NID_SCL, (category & EVENT_CATEGORY_APPOINTMENT) || (category & EVENT_CATEGORY_ANNIVERSARY), E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument is used. category = %ld", GetErrorMessage(E_INVALID_ARG), category);
std::unique_ptr<_CalendarbookRecordRetrivalEvent> pEvent(new (std::nothrow) _CalendarbookRecordRetrivalEvent());
SysTryReturnResult(NID_SCL, pEvent != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
- r = pEvent->Construct();
+ result r = pEvent->Construct();
SysTryReturnResult(NID_SCL, r == E_SUCCESS, E_SYSTEM, "A system error has been occurred.");
r = pEvent->AddListener(listener);
SysTryReturnResult(NID_SCL, r == E_SUCCESS, E_SYSTEM, "A system error has been occurred.");
@@ -1061,17 +1032,15 @@ _CalendarbookImpl::GetEventInstances(const DateTime& start, const DateTime& end,
IList*
_CalendarbookImpl::GetAllEventsN(void) const
{
- int errorCode = CALENDAR_ERROR_NONE;
-
calendar_list_h calendarListHandle = null;
- errorCode = calendar_db_get_all_records(_calendar_event._uri, 0, 0, &calendarListHandle);
- SysTryReturn(NID_SCL, errorCode != CALENDAR_ERROR_OUT_OF_MEMORY, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ int errorCode = calendar_db_get_all_records(_calendar_event._uri, 0, 0, &calendarListHandle);
+ SysTryReturn(NID_SCL, errorCode != CALENDAR_ERROR_OUT_OF_MEMORY, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
_CalendarList calendarList(calendarListHandle);
result r = E_SUCCESS;
std::unique_ptr<ArrayList, AllElementsDeleter> pList(new (std::nothrow) ArrayList());
- SysTryReturn(NID_SCL, pList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, pList != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
r = pList->Construct();
SysTryReturn(NID_SCL, !IsFailed(r), null, r, "[%s] Propagating.", GetErrorMessage(r));
@@ -1081,10 +1050,11 @@ _CalendarbookImpl::GetAllEventsN(void) const
for (int i = 0; i < count; i++)
{
std::unique_ptr<CalEvent> pTmpEvent(new (std::nothrow) CalEvent());
- SysTryReturn(NID_SCL, pTmpEvent != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, pTmpEvent != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
- r = pList->Add(*pTmpEvent.release());
- SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ r = pList->Add(pTmpEvent.get());
+ SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ pTmpEvent.release();
}
calendar_list_first(calendarListHandle);
@@ -1094,7 +1064,9 @@ _CalendarbookImpl::GetAllEventsN(void) const
CalEvent* pTmpEvent = static_cast<CalEvent*>(pEnum->GetCurrent());
calendar_record_h tmpRecordHandle = null;
- calendar_list_get_current_record_p(calendarListHandle, &tmpRecordHandle);
+ errorCode = calendar_list_get_current_record_p(calendarListHandle, &tmpRecordHandle);
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
+
_CalEventImpl::GetInstance(*pTmpEvent)->SetRecordHandle(tmpRecordHandle);
int dbIndex = -1;
@@ -1112,17 +1084,15 @@ _CalendarbookImpl::GetAllEventsN(void) const
IList*
_CalendarbookImpl::GetAllTodosN(void) const
{
- int errorCode = CALENDAR_ERROR_NONE;
-
calendar_list_h calendarListHandle = null;
- errorCode = calendar_db_get_all_records(_calendar_todo._uri, 0, 0, &calendarListHandle);
- SysTryReturn(NID_SCL, errorCode != CALENDAR_ERROR_OUT_OF_MEMORY, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ int errorCode = calendar_db_get_all_records(_calendar_todo._uri, 0, 0, &calendarListHandle);
+ SysTryReturn(NID_SCL, errorCode != CALENDAR_ERROR_OUT_OF_MEMORY, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
_CalendarList calendarList(calendarListHandle);
result r = E_SUCCESS;
std::unique_ptr<ArrayList, AllElementsDeleter> pList(new (std::nothrow) ArrayList());
- SysTryReturn(NID_SCL, pList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, pList != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
r = pList->Construct();
SysTryReturn(NID_SCL, !IsFailed(r), null, r, "[%s] Propagating.", GetErrorMessage(r));
@@ -1132,10 +1102,11 @@ _CalendarbookImpl::GetAllTodosN(void) const
for (int i = 0; i < count; i++)
{
std::unique_ptr<CalTodo> pTmpTodo(new (std::nothrow) CalTodo());
- SysTryReturn(NID_SCL, pTmpTodo != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, pTmpTodo != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
- r = pList->Add(*pTmpTodo.release());
- SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ r = pList->Add(pTmpTodo.get());
+ SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ pTmpTodo.release();
}
calendar_list_first(calendarListHandle);
@@ -1145,7 +1116,9 @@ _CalendarbookImpl::GetAllTodosN(void) const
CalTodo* pTmpTodo = static_cast<CalTodo*>(pEnum->GetCurrent());
calendar_record_h tmpRecordHandle = null;
- calendar_list_get_current_record_p(calendarListHandle, &tmpRecordHandle);
+ errorCode = calendar_list_get_current_record_p(calendarListHandle, &tmpRecordHandle);
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
+
_CalTodoImpl::GetInstance(*pTmpTodo)->SetRecordHandle(tmpRecordHandle);
int dbIndex = -1;
@@ -1163,18 +1136,15 @@ _CalendarbookImpl::GetAllTodosN(void) const
IList*
_CalendarbookImpl::GetAllCalendarsN(void) const
{
- int errorCode = CALENDAR_ERROR_NONE;
-
calendar_list_h calendarListHandle = null;
- errorCode = calendar_db_get_all_records(_calendar_book._uri, 0, 0, &calendarListHandle);
- SysTryReturn(NID_SCL, errorCode != CALENDAR_ERROR_OUT_OF_MEMORY, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ int errorCode = calendar_db_get_all_records(_calendar_book._uri, 0, 0, &calendarListHandle);
+ SysTryReturn(NID_SCL, errorCode != CALENDAR_ERROR_OUT_OF_MEMORY, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
_CalendarList calendarList(calendarListHandle);
- result r = E_SUCCESS;
std::unique_ptr<ArrayList, AllElementsDeleter> pList(new (std::nothrow) ArrayList());
- SysTryReturn(NID_SCL, pList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
- r = pList->Construct();
+ SysTryReturn(NID_SCL, pList != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ result r = pList->Construct();
SysTryReturn(NID_SCL, !IsFailed(r), null, r, "[%s] Propagating.", GetErrorMessage(r));
int count = 0;
@@ -1183,10 +1153,11 @@ _CalendarbookImpl::GetAllCalendarsN(void) const
for (int i = 0; i < count; i++)
{
std::unique_ptr<Calendar> pTmpCalendar(_CalendarImpl::CreateDefaultInstanceN());
- SysTryReturn(NID_SCL, pTmpCalendar != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, pTmpCalendar != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
- r = pList->Add(*pTmpCalendar.release());
- SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ r = pList->Add(pTmpCalendar.get());
+ SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ pTmpCalendar.release();
}
calendar_list_first(calendarListHandle);
@@ -1196,7 +1167,8 @@ _CalendarbookImpl::GetAllCalendarsN(void) const
Calendar* pTmpCalendar = static_cast<Calendar*>(pEnum->GetCurrent());
calendar_record_h tmpRecordHandle = null;
- calendar_list_get_current_record_p(calendarListHandle, &tmpRecordHandle);
+ errorCode = calendar_list_get_current_record_p(calendarListHandle, &tmpRecordHandle);
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
_CalendarImpl::GetInstance(*pTmpCalendar)->SetRecordHandle(tmpRecordHandle);
int dbIndex = -1;
@@ -1214,22 +1186,20 @@ _CalendarbookImpl::GetAllCalendarsN(void) const
IList*
_CalendarbookImpl::GetChangedEventsAfterN(int version, int& latestVersion) const
{
- int errorCode = CALENDAR_ERROR_NONE;
-
ClearLastResult();
SysTryReturn(NID_SCL, version >= 0, null, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. version = %d", version);
calendar_list_h calendarListHandle = null;
int tmpLatestVersion = 0;
- errorCode = calendar_db_get_changes_by_version(_calendar_event._uri, CALENDAR_BOOK_FILTER_ALL, version
+ int errorCode = calendar_db_get_changes_by_version(_calendar_event._uri, CALENDAR_BOOK_FILTER_ALL, version
, &calendarListHandle, &tmpLatestVersion);
SysTryReturn(NID_SCL, errorCode != CALENDAR_ERROR_OUT_OF_MEMORY, null
- , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
std::unique_ptr<ArrayList, AllElementsDeleter> pList(new (std::nothrow) ArrayList());
- SysTryReturn(NID_SCL, pList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, pList != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
result r = pList->Construct();
SysTryReturn(NID_SCL, !IsFailed(r), null, r, "[%s] Propagating.", GetErrorMessage(r));
@@ -1240,13 +1210,15 @@ _CalendarbookImpl::GetChangedEventsAfterN(int version, int& latestVersion) const
for (int i = 0; i < count; i++)
{
calendar_record_h tmpRecordHandle = null;
- calendar_list_get_current_record_p(calendarListHandle, &tmpRecordHandle);
+ errorCode = calendar_list_get_current_record_p(calendarListHandle, &tmpRecordHandle);
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
std::unique_ptr<CalEventChangeInfo> pChangedInfo(_CalendarbookImpl::ConvertModifiedEventToCalEventChangeInfoN(tmpRecordHandle));
- SysTryReturn(NID_SCL, pChangedInfo != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, pChangedInfo != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
- r = pList->Add(*pChangedInfo.release());
- SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ r = pList->Add(pChangedInfo.get());
+ SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ pChangedInfo.release();
calendar_list_next(calendarListHandle);
}
@@ -1259,23 +1231,21 @@ _CalendarbookImpl::GetChangedEventsAfterN(int version, int& latestVersion) const
IList*
_CalendarbookImpl::GetChangedTodosAfterN(int version, int& latestVersion) const
{
- int errorCode = CALENDAR_ERROR_NONE;
-
ClearLastResult();
- SysTryReturn(NID_SCL, version >= 0, null, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. version = %d", version);
+ SysTryReturn(NID_SCL, version >= 0, null, E_INVALID_ARG, "[%s] Invalid argument is used. version = %d", GetErrorMessage(E_INVALID_ARG), version);
calendar_list_h calendarListHandle = null;
int tmpLatestVersion = 0;
- errorCode = calendar_db_get_changes_by_version(_calendar_todo._uri, CALENDAR_BOOK_FILTER_ALL, version
+ int errorCode = calendar_db_get_changes_by_version(_calendar_todo._uri, CALENDAR_BOOK_FILTER_ALL, version
, &calendarListHandle, &tmpLatestVersion);
SysTryReturn(NID_SCL, errorCode != CALENDAR_ERROR_OUT_OF_MEMORY, null
- , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
_CalendarList calendarList(calendarListHandle);
std::unique_ptr<ArrayList, AllElementsDeleter> pList(new (std::nothrow) ArrayList());
- SysTryReturn(NID_SCL, pList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, pList != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
result r = pList->Construct();
SysTryReturn(NID_SCL, !IsFailed(r), null, r, "[%s] Propagating.", GetErrorMessage(r));
@@ -1286,13 +1256,15 @@ _CalendarbookImpl::GetChangedTodosAfterN(int version, int& latestVersion) const
for (int i = 0; i < count; i++)
{
calendar_record_h tmpRecordHandle = null;
- calendar_list_get_current_record_p(calendarListHandle, &tmpRecordHandle);
+ errorCode = calendar_list_get_current_record_p(calendarListHandle, &tmpRecordHandle);
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
std::unique_ptr<CalTodoChangeInfo> pChangedInfo(_CalendarbookImpl::ConvertModifiedTodoToCalTodoChangeInfoN(tmpRecordHandle));
- SysTryReturn(NID_SCL, pChangedInfo != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, pChangedInfo != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
- r = pList->Add(*pChangedInfo.release());
- SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ r = pList->Add(pChangedInfo.get());
+ SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ pChangedInfo.release();
calendar_list_next(calendarListHandle);
}
@@ -1305,13 +1277,10 @@ _CalendarbookImpl::GetChangedTodosAfterN(int version, int& latestVersion) const
result
_CalendarbookImpl::RemoveEventInstance(const CalEventInstance& eventInstance)
{
- int errorCode = CALENDAR_ERROR_NONE;
-
calendar_record_h eventHandle = null;
- char* pExdate = null;
// Get event handle from DB
- errorCode = calendar_db_get_record(_calendar_event._uri, eventInstance.GetOriginalEventId(), &eventHandle);
+ int errorCode = calendar_db_get_record(_calendar_event._uri, eventInstance.GetOriginalEventId(), &eventHandle);
SysTryReturnResult(NID_SCL, errorCode != CALENDAR_ERROR_DB_FAILED, E_SYSTEM, "A system error has been occurred.");
SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OBJ_NOT_FOUND, "The specified record is not found.");
_CalendarRecord eventRecord(eventHandle);
@@ -1322,10 +1291,12 @@ _CalendarbookImpl::RemoveEventInstance(const CalEventInstance& eventInstance)
if (baseEventId != _INVALID_EVENT_DB_ID)
{
errorCode = calendar_db_delete_record(_calendar_event._uri, eventInstance.GetOriginalEventId());
- SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_SYSTEM, "A system error has been occurred.");
}
else
{
+ char* pExdate = null;
+
// Append exdate
calendar_record_get_str_p(eventHandle, _calendar_event.exdate, &pExdate);
@@ -1355,16 +1326,14 @@ _CalendarbookImpl::RemoveEventInstance(const CalEventInstance& eventInstance)
result
_CalendarbookImpl::UpdateEventInstance(const CalEventInstance& eventInstance, CalEvent& event)
{
- int errorCode = CALENDAR_ERROR_NONE;
-
SysTryReturnResult(NID_SCL, event.GetRecordId() != INVALID_RECORD_ID, E_INVALID_ARG
, "Invalid argument is used. The event's recordId is INVALID_RECORD_ID.");
SysTryReturnResult(NID_SCL, eventInstance.GetOriginalEventId() == event.GetRecordId(), E_INVALID_ARG
- , "Invalid argument is used. The event's recordId is not equal to eventInstance's original event ID.");
+ , "[%s] Invalid argument is used. The event's recordId is not equal to eventInstance's original event ID.", GetErrorMessage(E_INVALID_ARG));
SysTryReturnResult(NID_SCL, CheckEventExistance(event.GetRecordId()), E_OBJ_NOT_FOUND, "The specified event is not found.");
calendar_record_h eventHandle = null;
- errorCode = calendar_record_clone(_CalEventImpl::GetInstance(event)->GetRecordHandle(), &eventHandle);
+ int errorCode = calendar_record_clone(_CalEventImpl::GetInstance(event)->GetRecordHandle(), &eventHandle);
SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "Memory allocation failed.");
_CalendarRecord eventRecord(eventHandle);
@@ -1380,8 +1349,8 @@ _CalendarbookImpl::UpdateEventInstance(const CalEventInstance& eventInstance, Ca
{
errorCode = calendar_db_get_record(_calendar_event._uri, baseEventId, &baseEventHandle);
}
- SysTryReturn(NID_SCL, errorCode != CALENDAR_ERROR_DB_FAILED, null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The base event is not found.");
+ SysTryReturn(NID_SCL, errorCode != CALENDAR_ERROR_DB_FAILED, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OBJ_NOT_FOUND, "[%s] The base event is not found.", GetErrorMessage(E_OBJ_NOT_FOUND));
_CalendarRecord baseEventRecord(baseEventHandle);
int tmpIntValue = 0;
@@ -1470,13 +1439,11 @@ _CalendarbookImpl::UpdateEventInstance(const CalEventInstance& eventInstance, Ca
int
_CalendarbookImpl::GetLatestVersion(void) const
{
- int errorCode = CALENDAR_ERROR_NONE;
- int dbVersion = 0;
-
ClearLastResult();
- errorCode = calendar_db_get_current_version(&dbVersion);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, 0, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ int dbVersion = 0;
+ int errorCode = calendar_db_get_current_version(&dbVersion);
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, 0, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
return dbVersion;
}
@@ -1484,15 +1451,10 @@ _CalendarbookImpl::GetLatestVersion(void) const
IList*
_CalendarbookImpl::SearchN(const CalendarbookFilter& filter, unsigned long propertySortedBy, SortOrder sortOrder, int offset, int maxCount) const
{
- int errorCode = CALENDAR_ERROR_NONE;
-
- bool ascending = false;
- unsigned int viewSortPropertyId = 0;
-
CalendarbookFilterType type = _CalendarbookFilterImpl::GetInstance(filter)->GetType();
calendar_filter_h filterHandle = _CalendarbookFilterImpl::GetInstance(filter)->GetFilterHandle();
- SysTryReturn(NID_SCL, offset >= 0 && maxCount >= 0, null, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. The specified offset or maxCount is less than 0.");
+ SysTryReturn(NID_SCL, offset >= 0 && maxCount >= 0, null, E_INVALID_ARG, "[%s] Invalid argument is used. The specified offset or maxCount is less than 0.", GetErrorMessage(E_INVALID_ARG));
SysTryReturn(NID_SCL, propertySortedBy == 0 || _CalendarbookFilterImpl::IsValidProperty(type, propertySortedBy), null, E_INVALID_ARG
, "[%s] Invalid argument is used. propertySortedBy = %d", GetErrorMessage(E_INVALID_ARG), propertySortedBy);
@@ -1500,14 +1462,14 @@ _CalendarbookImpl::SearchN(const CalendarbookFilter& filter, unsigned long prope
// Create query
calendar_query_h queryHandle = null;
- errorCode = calendar_query_create(pViewUri, &queryHandle);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ int errorCode = calendar_query_create(pViewUri, &queryHandle);
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
_CalendarQuery query(queryHandle);
if (propertySortedBy != 0 && sortOrder != SORT_ORDER_NONE)
{
- viewSortPropertyId = _CalendarbookFilterImpl::GetViewPropertyId(type, propertySortedBy);
- ascending = (sortOrder == SORT_ORDER_ASCENDING) ? true : false;
+ unsigned int viewSortPropertyId = _CalendarbookFilterImpl::GetViewPropertyId(type, propertySortedBy);
+ bool ascending = (sortOrder == SORT_ORDER_ASCENDING) ? true : false;
calendar_query_set_sort(queryHandle, viewSortPropertyId, ascending);
}
@@ -1519,11 +1481,11 @@ _CalendarbookImpl::SearchN(const CalendarbookFilter& filter, unsigned long prope
calendar_list_h resultListHandle = null;
errorCode = calendar_db_get_records_with_query(queryHandle, offset, maxCount, &resultListHandle);
- SysTryReturn(NID_SCL, errorCode != CALENDAR_ERROR_OUT_OF_MEMORY, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ SysTryReturn(NID_SCL, errorCode != CALENDAR_ERROR_OUT_OF_MEMORY, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
_CalendarList calendarList(resultListHandle);
- std::unique_ptr<IList, AllElementsDeleter> pList;
+ std::unique_ptr<IList, AllElementsDeleter> pList(null);
switch(type)
{
@@ -1571,8 +1533,6 @@ _CalendarbookImpl::SearchN(const CalendarbookFilter& filter, unsigned long prope
int
_CalendarbookImpl::GetMatchedItemCount(const CalendarbookFilter& filter) const
{
- int errorCode = CALENDAR_ERROR_NONE;
-
CalendarbookFilterType type = _CalendarbookFilterImpl::GetInstance(filter)->GetType();
calendar_filter_h filterHandle = _CalendarbookFilterImpl::GetInstance(filter)->GetFilterHandle();
@@ -1580,8 +1540,8 @@ _CalendarbookImpl::GetMatchedItemCount(const CalendarbookFilter& filter) const
// Create query
calendar_query_h queryHandle = null;
- errorCode = calendar_query_create(pViewUri, &queryHandle);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ int errorCode = calendar_query_create(pViewUri, &queryHandle);
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
_CalendarQuery query(queryHandle);
if (filterHandle)
@@ -1592,7 +1552,7 @@ _CalendarbookImpl::GetMatchedItemCount(const CalendarbookFilter& filter) const
int count = _INVALID_COUNT;
errorCode = calendar_db_get_count_with_query(queryHandle, &count);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
return count;
}
@@ -1600,51 +1560,48 @@ _CalendarbookImpl::GetMatchedItemCount(const CalendarbookFilter& filter) const
IList*
_CalendarbookImpl::ParseEventsFromVcalendarN(const String& vCalFilePath)
{
- result r = E_SUCCESS;
- int errorCode = CALENDAR_ERROR_NONE;
-
ClearLastResult();
File vCalFile;
- r = vCalFile.Construct(vCalFilePath, L"r");
+ result r = vCalFile.Construct(vCalFilePath, L"r");
SysTryReturn(NID_SCL, r != E_INVALID_ARG && r != E_ILLEGAL_ACCESS && r != E_FILE_NOT_FOUND && r != E_OUT_OF_MEMORY
, null, r, "[%s] Propagating.", GetErrorMessage(r));
- SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
r = vCalFile.Seek(FILESEEKPOSITION_END, 0);
SysTryReturn(NID_SCL, r != E_ILLEGAL_ACCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
- SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
int fileLength = vCalFile.Tell();
- SysTryReturn(NID_SCL, fileLength > 0, null, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. The vCal file is empty.");
+ SysTryReturn(NID_SCL, fileLength > 0, null, E_INVALID_ARG, "[%s] Invalid argument is used. The vCal file is empty.", GetErrorMessage(E_INVALID_ARG));
r = vCalFile.Seek(FILESEEKPOSITION_BEGIN, 0);
SysTryReturn(NID_SCL, r != E_ILLEGAL_ACCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
- SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
std::unique_ptr<ByteBuffer> pBuffer(new (std::nothrow) ByteBuffer());
- SysTryReturn(NID_SCL, pBuffer != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, pBuffer != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
r = pBuffer->Construct(fileLength);
- SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
r = vCalFile.Read(*pBuffer);
SysTryReturn(NID_SCL, r != E_ILLEGAL_ACCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
- SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
_CalendarConnector connector;
r = connector.GetResult();
- SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_SYSTEM, "[E_SYSTEM]A system error has been occurred.");
+ SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_SYSTEM, "[%s]A system error has been occurred.", GetErrorMessage(E_SYSTEM));
pBuffer->Rewind();
calendar_list_h calendarListHandle = null;
- errorCode = calendar_vcalendar_parse_to_calendar(reinterpret_cast<char*>(const_cast<byte*>(pBuffer->GetPointer())), &calendarListHandle);
- SysTryReturn(NID_SCL, errorCode != CALENDAR_ERROR_OUT_OF_MEMORY, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
- SysTryReturn(NID_SCL, errorCode != CALENDAR_ERROR_INVALID_PARAMETER, null, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. The vCal file is invalid.");
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE || errorCode == CALENDAR_ERROR_NO_DATA, null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ int errorCode = calendar_vcalendar_parse_to_calendar(reinterpret_cast<char*>(const_cast<byte*>(pBuffer->GetPointer())), &calendarListHandle);
+ SysTryReturn(NID_SCL, errorCode != CALENDAR_ERROR_OUT_OF_MEMORY, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ SysTryReturn(NID_SCL, errorCode != CALENDAR_ERROR_INVALID_PARAMETER, null, E_INVALID_ARG, "[%s] Invalid argument is used. The vCal file is invalid.", GetErrorMessage(E_INVALID_ARG));
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE || errorCode == CALENDAR_ERROR_NO_DATA, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
_CalendarList calendarList(calendarListHandle);
std::unique_ptr<ArrayList, AllElementsDeleter> pList(new (std::nothrow) ArrayList());
- SysTryReturn(NID_SCL, pList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, pList != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
r = pList->Construct();
SysTryReturn(NID_SCL, !IsFailed(r), null, r, "[%s] Propagating.", GetErrorMessage(r));
@@ -1666,8 +1623,9 @@ _CalendarbookImpl::ParseEventsFromVcalendarN(const String& vCalFilePath)
std::unique_ptr<CalEvent> pTmpEvent(new (std::nothrow) CalEvent());
SysTryReturn(NID_SCL, pTmpEvent != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
- r = pList->Add(*pTmpEvent.release());
+ r = pList->Add(pTmpEvent.get());
SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ pTmpEvent.release();
}
else
{
@@ -1697,51 +1655,48 @@ _CalendarbookImpl::ParseEventsFromVcalendarN(const String& vCalFilePath)
IList*
_CalendarbookImpl::ParseTodosFromVcalendarN(const String& vCalFilePath)
{
- result r = E_SUCCESS;
- int errorCode = CALENDAR_ERROR_NONE;
-
ClearLastResult();
File vCalFile;
- r = vCalFile.Construct(vCalFilePath, L"r");
+ result r = vCalFile.Construct(vCalFilePath, L"r");
SysTryReturn(NID_SCL, r != E_INVALID_ARG && r != E_ILLEGAL_ACCESS && r != E_FILE_NOT_FOUND && r != E_OUT_OF_MEMORY
, null, r, "[%s] Propagating.", GetErrorMessage(r));
- SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
r = vCalFile.Seek(FILESEEKPOSITION_END, 0);
SysTryReturn(NID_SCL, r != E_ILLEGAL_ACCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
- SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
int fileLength = vCalFile.Tell();
- SysTryReturn(NID_SCL, fileLength > 0, null, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. The vCal file is empty.");
+ SysTryReturn(NID_SCL, fileLength > 0, null, E_INVALID_ARG, "[%s] Invalid argument is used. The vCal file is empty.", GetErrorMessage(E_INVALID_ARG));
r = vCalFile.Seek(FILESEEKPOSITION_BEGIN, 0);
SysTryReturn(NID_SCL, r != E_ILLEGAL_ACCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
- SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
std::unique_ptr<ByteBuffer> pBuffer(new (std::nothrow) ByteBuffer());
- SysTryReturn(NID_SCL, pBuffer != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, pBuffer != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
r = pBuffer->Construct(fileLength);
- SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
r = vCalFile.Read(*pBuffer);
SysTryReturn(NID_SCL, r != E_ILLEGAL_ACCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
- SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
_CalendarConnector connector;
r = connector.GetResult();
- SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_SYSTEM, "[E_SYSTEM]A system error has been occurred.");
+ SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
pBuffer->Rewind();
calendar_list_h calendarListHandle = null;
- errorCode = calendar_vcalendar_parse_to_calendar(reinterpret_cast<char*>(const_cast<byte*>(pBuffer->GetPointer())), &calendarListHandle);
- SysTryReturn(NID_SCL, errorCode != CALENDAR_ERROR_OUT_OF_MEMORY, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
- SysTryReturn(NID_SCL, errorCode != CALENDAR_ERROR_INVALID_PARAMETER, null, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. The vCal file is invalid.");
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE || errorCode == CALENDAR_ERROR_NO_DATA, null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ int errorCode = calendar_vcalendar_parse_to_calendar(reinterpret_cast<char*>(const_cast<byte*>(pBuffer->GetPointer())), &calendarListHandle);
+ SysTryReturn(NID_SCL, errorCode != CALENDAR_ERROR_OUT_OF_MEMORY, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ SysTryReturn(NID_SCL, errorCode != CALENDAR_ERROR_INVALID_PARAMETER, null, E_INVALID_ARG, "[%s] Invalid argument is used. The vCal file is invalid.", GetErrorMessage(E_INVALID_ARG));
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE || errorCode == CALENDAR_ERROR_NO_DATA, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
_CalendarList calendarList(calendarListHandle);
std::unique_ptr<ArrayList, AllElementsDeleter> pList(new (std::nothrow) ArrayList());
- SysTryReturn(NID_SCL, pList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, pList != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
r = pList->Construct();
SysTryReturn(NID_SCL, !IsFailed(r), null, r, "[%s] Propagating.", GetErrorMessage(r));
@@ -1761,10 +1716,11 @@ _CalendarbookImpl::ParseTodosFromVcalendarN(const String& vCalFilePath)
if (strcmp(pUri, _calendar_todo._uri) == 0)
{
std::unique_ptr<CalTodo> pTmpTodo(new (std::nothrow) CalTodo());
- SysTryReturn(NID_SCL, pTmpTodo != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, pTmpTodo != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
- r = pList->Add(*pTmpTodo.release());
- SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ r = pList->Add(pTmpTodo.get());
+ SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ pTmpTodo.release();
}
else
{
@@ -1794,19 +1750,16 @@ _CalendarbookImpl::ParseTodosFromVcalendarN(const String& vCalFilePath)
result
_CalendarbookImpl::ExportEventsToVcalendar(const IList& eventList, const String& vCalFilePath)
{
- result r = E_SUCCESS;
- int errorCode = CALENDAR_ERROR_NONE;
-
SysTryReturnResult(NID_SCL, !File::IsFileExist(vCalFilePath), E_FILE_ALREADY_EXIST, "The vCalendar file already exists.");
- r = GetLastResult();
+ result r = GetLastResult();
SysTryReturn(NID_SCL, r != E_INVALID_ARG && r != E_ILLEGAL_ACCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
_CalendarConnector connector;
r = connector.GetResult();
- SysTryReturn(NID_SCL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[E_SYSTEM]A system error has been occurred.");
+ SysTryReturn(NID_SCL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
calendar_list_h calendarListHandle = null;
- errorCode = calendar_list_create(&calendarListHandle);
+ int errorCode = calendar_list_create(&calendarListHandle);
SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "Memory allocation failed.");
_CalendarList calendarList(calendarListHandle, false);
@@ -1831,12 +1784,12 @@ _CalendarbookImpl::ExportEventsToVcalendar(const IList& eventList, const String&
r = vCalFile.Construct(vCalFilePath, L"w");
SysTryReturn(NID_SCL, r != E_INVALID_ARG && r != E_ILLEGAL_ACCESS && r != E_STORAGE_FULL && r != E_FILE_NOT_FOUND && r != E_OUT_OF_MEMORY
, r, r, "[%s] Propagating.", GetErrorMessage(r));
- SysTryReturn(NID_SCL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ SysTryReturn(NID_SCL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
int pVCalBufferLength = strlen(pVCalBuffer);
r = vCalFile.Write(static_cast<void*>(pVCalBuffer), pVCalBufferLength);
SysTryReturn(NID_SCL, r != E_ILLEGAL_ACCESS && r != E_STORAGE_FULL, r, r, "[%s] Propagating.", GetErrorMessage(r));
- SysTryReturn(NID_SCL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ SysTryReturn(NID_SCL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
return E_SUCCESS;
}
@@ -1844,19 +1797,16 @@ _CalendarbookImpl::ExportEventsToVcalendar(const IList& eventList, const String&
result
_CalendarbookImpl::ExportTodosToVcalendar(const IList& todoList, const String& vCalFilePath)
{
- result r = E_SUCCESS;
- int errorCode = CALENDAR_ERROR_NONE;
-
SysTryReturnResult(NID_SCL, !File::IsFileExist(vCalFilePath), E_FILE_ALREADY_EXIST, "The vCalendar file already exists.");
- r = GetLastResult();
+ result r = GetLastResult();
SysTryReturn(NID_SCL, r != E_INVALID_ARG && r != E_ILLEGAL_ACCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
_CalendarConnector connector;
r = connector.GetResult();
- SysTryReturn(NID_SCL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[E_SYSTEM]A system error has been occurred.");
+ SysTryReturn(NID_SCL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
calendar_list_h calendarListHandle = null;
- errorCode = calendar_list_create(&calendarListHandle);
+ int errorCode = calendar_list_create(&calendarListHandle);
SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "Memory allocation failed.");
_CalendarList calendarList(calendarListHandle, false);
@@ -1881,12 +1831,12 @@ _CalendarbookImpl::ExportTodosToVcalendar(const IList& todoList, const String& v
r = vCalFile.Construct(vCalFilePath, L"w");
SysTryReturn(NID_SCL, r != E_INVALID_ARG && r != E_ILLEGAL_ACCESS && r != E_STORAGE_FULL && r != E_FILE_NOT_FOUND && r != E_OUT_OF_MEMORY
, r, r, "[%s] Propagating.", GetErrorMessage(r));
- SysTryReturn(NID_SCL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ SysTryReturn(NID_SCL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
int pVCalBufferLength = strlen(pVCalBuffer);
r = vCalFile.Write(static_cast<void*>(pVCalBuffer), pVCalBufferLength);
SysTryReturn(NID_SCL, r != E_ILLEGAL_ACCESS && r != E_STORAGE_FULL, r, r, "[%s] Propagating.", GetErrorMessage(r));
- SysTryReturn(NID_SCL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ SysTryReturn(NID_SCL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
return E_SUCCESS;
}
@@ -1947,29 +1897,27 @@ IList*
_CalendarbookImpl::GetEventInstancesOfAllCategoriesN(const calendar_time_s& startTime, const calendar_time_s& endTime,
const calendar_time_s& localStartTime, const calendar_time_s& localEndTime, int pageNo, int countPerPage) const
{
- int errorCode = CALENDAR_ERROR_NONE;
-
ClearLastResult();
calendar_filter_h allDayEventInstanceMainFilterHandle = null;
- errorCode = calendar_filter_create(_calendar_instance_allday_calendar_book._uri, &allDayEventInstanceMainFilterHandle);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ int errorCode = calendar_filter_create(_calendar_instance_allday_calendar_book._uri, &allDayEventInstanceMainFilterHandle);
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
_CalendarFilter allDayEventInstanceMainFilter(allDayEventInstanceMainFilterHandle);
// Condition : End time of the item > start time of filter
errorCode = calendar_filter_add_caltime(allDayEventInstanceMainFilterHandle, _calendar_instance_allday_calendar_book.end_time, CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, localStartTime);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
// Condition : Start time of the item < end time of filter
errorCode = calendar_filter_add_operator(allDayEventInstanceMainFilterHandle, CALENDAR_FILTER_OPERATOR_AND);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
errorCode = calendar_filter_add_caltime(allDayEventInstanceMainFilterHandle, _calendar_instance_allday_calendar_book.start_time, CALENDAR_MATCH_LESS_THAN_OR_EQUAL, localEndTime);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
// Create query
calendar_query_h allDayEventInstanceQueryHandle = null;
errorCode = calendar_query_create(_calendar_instance_allday_calendar_book._uri, &allDayEventInstanceQueryHandle);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
_CalendarQuery allDayEventInstanceQuery(allDayEventInstanceQueryHandle);
calendar_query_set_sort(allDayEventInstanceQueryHandle, _calendar_instance_allday_calendar_book.start_time, true);
@@ -1979,18 +1927,18 @@ _CalendarbookImpl::GetEventInstancesOfAllCategoriesN(const calendar_time_s& star
calendar_list_h allDayEventInstanceListHandle = null;
errorCode = calendar_db_get_records_with_query(allDayEventInstanceQueryHandle, startIndex, countPerPage, &allDayEventInstanceListHandle);
- SysTryReturn(NID_SCL, errorCode != CALENDAR_ERROR_OUT_OF_MEMORY, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ SysTryReturn(NID_SCL, errorCode != CALENDAR_ERROR_OUT_OF_MEMORY, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
_CalendarList allDayEventList(allDayEventInstanceListHandle);
std::unique_ptr<ArrayList, AllElementsDeleter> pList(new (std::nothrow) ArrayList());
- SysTryReturn(NID_SCL, pList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, pList != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
result r = pList->Construct();
SysTryReturn(NID_SCL, !IsFailed(r), null, r, "[%s] Propagating.", GetErrorMessage(r));
int allDayEventInstanceCount = 0;
errorCode = calendar_db_get_count_with_query(allDayEventInstanceQueryHandle, &allDayEventInstanceCount);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
int count = 0;
calendar_list_get_count(allDayEventInstanceListHandle, &count);
@@ -2005,10 +1953,10 @@ _CalendarbookImpl::GetEventInstancesOfAllCategoriesN(const calendar_time_s& star
calendar_list_get_current_record_p(allDayEventInstanceListHandle, &tmpRecordHandle);
std::unique_ptr<CalEvent> pTmpEventInstance(_CalendarbookImpl::ConvertAllDayEventInstanceHandleToCalEventN(tmpRecordHandle));
- SysTryReturn(NID_SCL, pTmpEventInstance != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, pTmpEventInstance != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
r = pList->Add(*pTmpEventInstance.release());
- SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
calendar_list_next(allDayEventInstanceListHandle);
}
@@ -2017,50 +1965,50 @@ _CalendarbookImpl::GetEventInstancesOfAllCategoriesN(const calendar_time_s& star
{
calendar_filter_h nonAllDayEventInstanceMainFilterHandle = null;
errorCode = calendar_filter_create(_calendar_instance_normal_calendar_book._uri, &nonAllDayEventInstanceMainFilterHandle);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
_CalendarFilter nonAllDayEventInstanceMainFilter(nonAllDayEventInstanceMainFilterHandle);
calendar_filter_h subFilterHandle = null;
errorCode = calendar_filter_create(_calendar_instance_normal_calendar_book._uri, &subFilterHandle);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
_CalendarFilter subFilter(subFilterHandle);
subFilterHandle = null;
// Condition : End time of the item > start time of filter
errorCode = calendar_filter_add_caltime(subFilter.GetHandle(), _calendar_instance_normal_calendar_book.end_time, CALENDAR_MATCH_GREATER_THAN, startTime);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
// Condition : Start time of the item < end time of filter
errorCode = calendar_filter_add_operator(subFilter.GetHandle(), CALENDAR_FILTER_OPERATOR_AND);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
errorCode = calendar_filter_add_caltime(subFilter.GetHandle(), _calendar_instance_normal_calendar_book.start_time, CALENDAR_MATCH_LESS_THAN, endTime);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
errorCode = calendar_filter_add_filter(nonAllDayEventInstanceMainFilterHandle, subFilter.GetHandle());
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
// Condition : Start time of the item = start time of filter AND Start time of the item = end time of filter
errorCode = calendar_filter_create(_calendar_instance_normal_calendar_book._uri, &subFilterHandle);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
subFilter.ResetHandle(subFilterHandle);
subFilterHandle = null;
errorCode = calendar_filter_add_caltime(subFilter.GetHandle(), _calendar_instance_normal_calendar_book.start_time, CALENDAR_MATCH_EQUAL, startTime);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
errorCode = calendar_filter_add_operator(subFilter.GetHandle(), CALENDAR_FILTER_OPERATOR_AND);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
errorCode = calendar_filter_add_caltime(subFilter.GetHandle(), _calendar_instance_normal_calendar_book.start_time, CALENDAR_MATCH_EQUAL, endTime);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
errorCode = calendar_filter_add_operator(nonAllDayEventInstanceMainFilterHandle, CALENDAR_FILTER_OPERATOR_OR);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
errorCode = calendar_filter_add_filter(nonAllDayEventInstanceMainFilterHandle, subFilter.GetHandle());
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
// Create query
calendar_query_h nonAllDayEventInstanceQueryHandle = null;
errorCode = calendar_query_create(_calendar_instance_normal_calendar_book._uri, &nonAllDayEventInstanceQueryHandle);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
_CalendarQuery nonAllDayEventInstanceQuery(nonAllDayEventInstanceQueryHandle);
calendar_query_set_sort(nonAllDayEventInstanceQueryHandle, _calendar_instance_normal_calendar_book.start_time, true);
@@ -2077,8 +2025,8 @@ _CalendarbookImpl::GetEventInstancesOfAllCategoriesN(const calendar_time_s& star
calendar_list_h nonAllDayEventInstanceListHandle = null;
errorCode = calendar_db_get_records_with_query(nonAllDayEventInstanceQueryHandle, startIndex, remainingCount, &nonAllDayEventInstanceListHandle);
- SysTryReturn(NID_SCL, errorCode != CALENDAR_ERROR_OUT_OF_MEMORY, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ SysTryReturn(NID_SCL, errorCode != CALENDAR_ERROR_OUT_OF_MEMORY, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
_CalendarList nonAllDayEventList(nonAllDayEventInstanceListHandle);
count = 0;
@@ -2090,10 +2038,12 @@ _CalendarbookImpl::GetEventInstancesOfAllCategoriesN(const calendar_time_s& star
calendar_list_get_current_record_p(nonAllDayEventInstanceListHandle, &tmpRecordHandle);
std::unique_ptr<CalEvent> pTmpEventInstance(_CalendarbookImpl::ConvertNonAllDayEventInstanceHandleToCalEventN(tmpRecordHandle));
- SysTryReturn(NID_SCL, pTmpEventInstance != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, pTmpEventInstance != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
- r = pList->Add(*pTmpEventInstance.release());
- SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ r = pList->Add(pTmpEventInstance.get());
+ SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ pTmpEventInstance.release();
calendar_list_next(nonAllDayEventInstanceListHandle);
}
@@ -2106,29 +2056,27 @@ IList*
_CalendarbookImpl::GetEventInstancesOfCategoryN(const calendar_time_s& startTime, const calendar_time_s& endTime,
const calendar_time_s& localStartTime, const calendar_time_s& localEndTime, int pageNo, int countPerPage, unsigned long category) const
{
- int errorCode = CALENDAR_ERROR_NONE;
-
ClearLastResult();
calendar_filter_h allDayEventInstanceMainFilterHandle = null;
- errorCode = calendar_filter_create(_calendar_instance_allday_calendar_book._uri, &allDayEventInstanceMainFilterHandle);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ int errorCode = calendar_filter_create(_calendar_instance_allday_calendar_book._uri, &allDayEventInstanceMainFilterHandle);
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
_CalendarFilter allDayEventInstanceMainFilter(allDayEventInstanceMainFilterHandle);
// Condition : End time of the item > start time of filter
errorCode = calendar_filter_add_caltime(allDayEventInstanceMainFilterHandle, _calendar_instance_allday_calendar_book.end_time, CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, localStartTime);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
// Condition : Start time of the item < end time of filter
errorCode = calendar_filter_add_operator(allDayEventInstanceMainFilterHandle, CALENDAR_FILTER_OPERATOR_AND);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
errorCode = calendar_filter_add_caltime(allDayEventInstanceMainFilterHandle, _calendar_instance_allday_calendar_book.start_time, CALENDAR_MATCH_LESS_THAN_OR_EQUAL, localEndTime);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
// Create query
calendar_query_h allDayEventInstanceQueryHandle = null;
errorCode = calendar_query_create(_calendar_instance_allday_calendar_book._uri, &allDayEventInstanceQueryHandle);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
_CalendarQuery allDayEventInstanceQuery(allDayEventInstanceQueryHandle);
calendar_query_set_sort(allDayEventInstanceQueryHandle, _calendar_instance_allday_calendar_book.start_time, true);
@@ -2136,18 +2084,18 @@ _CalendarbookImpl::GetEventInstancesOfCategoryN(const calendar_time_s& startTime
// Generate event : category map
std::unique_ptr< HashMapT<int, int> > pEventCategoryMap(GenerateEventCategoryMapN());
- SysTryReturn(NID_SCL, pEventCategoryMap != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, pEventCategoryMap != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
int startIndex = (pageNo - 1) * countPerPage;
calendar_list_h allDayEventInstanceListHandle = null;
errorCode = calendar_db_get_records_with_query(allDayEventInstanceQueryHandle, 0, 0, &allDayEventInstanceListHandle);
- SysTryReturn(NID_SCL, errorCode != CALENDAR_ERROR_OUT_OF_MEMORY, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ SysTryReturn(NID_SCL, errorCode != CALENDAR_ERROR_OUT_OF_MEMORY, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
_CalendarList allDayEventList(allDayEventInstanceListHandle);
std::unique_ptr<ArrayList, AllElementsDeleter> pList(new (std::nothrow) ArrayList());
- SysTryReturn(NID_SCL, pList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, pList != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
result r = pList->Construct();
SysTryReturn(NID_SCL, !IsFailed(r), null, r, "[%s] Propagating.", GetErrorMessage(r));
@@ -2171,10 +2119,11 @@ _CalendarbookImpl::GetEventInstancesOfCategoryN(const calendar_time_s& startTime
if (candidateCount >= startIndex)
{
std::unique_ptr<CalEvent> pTmpEventInstance(_CalendarbookImpl::ConvertAllDayEventInstanceHandleToCalEventN(tmpRecordHandle));
- SysTryReturn(NID_SCL, pTmpEventInstance != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, pTmpEventInstance != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
- r = pList->Add(*pTmpEventInstance.release());
- SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ r = pList->Add(pTmpEventInstance.get());
+ SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ pTmpEventInstance.release();
remainingCount--;
}
@@ -2189,50 +2138,50 @@ _CalendarbookImpl::GetEventInstancesOfCategoryN(const calendar_time_s& startTime
{
calendar_filter_h nonAllDayEventInstanceMainFilterHandle = null;
errorCode = calendar_filter_create(_calendar_instance_normal_calendar_book._uri, &nonAllDayEventInstanceMainFilterHandle);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
_CalendarFilter nonAllDayEventInstanceMainFilter(nonAllDayEventInstanceMainFilterHandle);
calendar_filter_h subFilterHandle = null;
errorCode = calendar_filter_create(_calendar_instance_normal_calendar_book._uri, &subFilterHandle);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
_CalendarFilter subFilter(subFilterHandle);
subFilterHandle = null;
// Condition : End time of the item > start time of filter
errorCode = calendar_filter_add_caltime(subFilter.GetHandle(), _calendar_instance_normal_calendar_book.end_time, CALENDAR_MATCH_GREATER_THAN, startTime);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
// Condition : Start time of the item < end time of filter
errorCode = calendar_filter_add_operator(subFilter.GetHandle(), CALENDAR_FILTER_OPERATOR_AND);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
errorCode = calendar_filter_add_caltime(subFilter.GetHandle(), _calendar_instance_normal_calendar_book.start_time, CALENDAR_MATCH_LESS_THAN, endTime);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
errorCode = calendar_filter_add_filter(nonAllDayEventInstanceMainFilterHandle, subFilter.GetHandle());
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
// Condition : Start time of the item = start time of filter AND Start time of the item = end time of filter
errorCode = calendar_filter_create(_calendar_instance_normal_calendar_book._uri, &subFilterHandle);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
subFilter.ResetHandle(subFilterHandle);
subFilterHandle = null;
errorCode = calendar_filter_add_caltime(subFilter.GetHandle(), _calendar_instance_normal_calendar_book.start_time, CALENDAR_MATCH_EQUAL, startTime);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
errorCode = calendar_filter_add_operator(subFilter.GetHandle(), CALENDAR_FILTER_OPERATOR_AND);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
errorCode = calendar_filter_add_caltime(subFilter.GetHandle(), _calendar_instance_normal_calendar_book.start_time, CALENDAR_MATCH_EQUAL, endTime);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
errorCode = calendar_filter_add_operator(nonAllDayEventInstanceMainFilterHandle, CALENDAR_FILTER_OPERATOR_OR);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
errorCode = calendar_filter_add_filter(nonAllDayEventInstanceMainFilterHandle, subFilter.GetHandle());
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
// Create query
calendar_query_h nonAllDayEventInstanceQueryHandle = null;
errorCode = calendar_query_create(_calendar_instance_normal_calendar_book._uri, &nonAllDayEventInstanceQueryHandle);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
_CalendarQuery nonAllDayEventInstanceQuery(nonAllDayEventInstanceQueryHandle);
calendar_query_set_sort(nonAllDayEventInstanceQueryHandle, _calendar_instance_normal_calendar_book.start_time, true);
@@ -2250,8 +2199,8 @@ _CalendarbookImpl::GetEventInstancesOfCategoryN(const calendar_time_s& startTime
calendar_list_h nonAllDayEventInstanceListHandle = null;
errorCode = calendar_db_get_records_with_query(nonAllDayEventInstanceQueryHandle, 0, 0, &nonAllDayEventInstanceListHandle);
- SysTryReturn(NID_SCL, errorCode != CALENDAR_ERROR_OUT_OF_MEMORY, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ SysTryReturn(NID_SCL, errorCode != CALENDAR_ERROR_OUT_OF_MEMORY, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
_CalendarList nonAllDayEventList(nonAllDayEventInstanceListHandle);
candidateCount = 0;
@@ -2274,10 +2223,10 @@ _CalendarbookImpl::GetEventInstancesOfCategoryN(const calendar_time_s& startTime
if (candidateCount >= startIndex)
{
std::unique_ptr<CalEvent> pTmpEventInstance(_CalendarbookImpl::ConvertNonAllDayEventInstanceHandleToCalEventN(tmpRecordHandle));
- SysTryReturn(NID_SCL, pTmpEventInstance != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, pTmpEventInstance != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
r = pList->Add(*pTmpEventInstance.release());
- SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
remainingCount--;
}
@@ -2303,7 +2252,7 @@ _CalendarbookImpl::GenerateEventCategoryMapN(void) const
// Create query
calendar_query_h queryHandle = null;
errorCode = calendar_query_create(_calendar_event._uri, &queryHandle);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
_CalendarQuery query(queryHandle);
calendar_query_set_projection(queryHandle, projectionList, _NUMBER_OF_EVENT_CATEGORY_MAP_PROJECTION);
@@ -2311,14 +2260,14 @@ _CalendarbookImpl::GenerateEventCategoryMapN(void) const
calendar_list_h calendarListHandle = null;
errorCode = calendar_db_get_records_with_query(queryHandle, 0, 0, &calendarListHandle);
- SysTryReturn(NID_SCL, errorCode != CALENDAR_ERROR_OUT_OF_MEMORY, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ SysTryReturn(NID_SCL, errorCode != CALENDAR_ERROR_OUT_OF_MEMORY, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
_CalendarList calendarList(calendarListHandle);
std::unique_ptr< HashMapT<int, int> > pEventCategoryMap(new HashMapT<int, int>());
- SysTryReturn(NID_SCL, pEventCategoryMap != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, pEventCategoryMap != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
r = pEventCategoryMap->Construct();
- SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
int count = 0;
calendar_list_get_count(calendarListHandle, &count);
@@ -2349,12 +2298,11 @@ _CalendarbookImpl::GetCalendarItemTypeByCalendarId(RecordId calendarId) const
{
CalendarItemType calendarItemType = CALENDAR_ITEM_TYPE_EVENT_AND_TODO;
- int errorCode = CALENDAR_ERROR_NONE;
calendar_record_h calendarHandle = null;
int storeType = CALENDAR_BOOK_TYPE_NONE;
- errorCode = calendar_db_get_record(_calendar_book._uri, calendarId, &calendarHandle);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, CALENDAR_ITEM_TYPE_EVENT_AND_TODO, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ int errorCode = calendar_db_get_record(_calendar_book._uri, calendarId, &calendarHandle);
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, CALENDAR_ITEM_TYPE_EVENT_AND_TODO, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
calendar_record_get_int(calendarHandle, _calendar_book.store_type, &storeType);
@@ -2373,7 +2321,7 @@ _CalendarbookImpl::GetCalendarItemTypeByCalendarId(RecordId calendarId) const
else
{
SetLastResult(E_SYSTEM);
- SysLogException(NID_SCL, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ SysLogException(NID_SCL, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
calendar_record_destroy(calendarHandle, true);
return CALENDAR_ITEM_TYPE_EVENT_AND_TODO;
}
@@ -2386,11 +2334,10 @@ _CalendarbookImpl::GetCalendarItemTypeByCalendarId(RecordId calendarId) const
bool
_CalendarbookImpl::CheckEventExistance(RecordId eventId) const
{
- int errorCode = CALENDAR_ERROR_NONE;
calendar_record_h eventHandle = null;
- errorCode = calendar_db_get_record(_calendar_event._uri, eventId, &eventHandle);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, false, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ int errorCode = calendar_db_get_record(_calendar_event._uri, eventId, &eventHandle);
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, false, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
calendar_record_destroy(eventHandle, true);
@@ -2400,11 +2347,10 @@ _CalendarbookImpl::CheckEventExistance(RecordId eventId) const
bool
_CalendarbookImpl::CheckTodoExistance(RecordId todoId) const
{
- int errorCode = CALENDAR_ERROR_NONE;
calendar_record_h todoHandle = null;
- errorCode = calendar_db_get_record(_calendar_todo._uri, todoId, &todoHandle);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, false, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ int errorCode = calendar_db_get_record(_calendar_todo._uri, todoId, &todoHandle);
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, false, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
calendar_record_destroy(todoHandle, true);
@@ -2414,11 +2360,10 @@ _CalendarbookImpl::CheckTodoExistance(RecordId todoId) const
bool
_CalendarbookImpl::CheckCalendarExistance(RecordId calendarId) const
{
- int errorCode = CALENDAR_ERROR_NONE;
calendar_record_h calendarHandle = null;
- errorCode = calendar_db_get_record(_calendar_book._uri, calendarId, &calendarHandle);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, false, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ int errorCode = calendar_db_get_record(_calendar_book._uri, calendarId, &calendarHandle);
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, false, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
calendar_record_destroy(calendarHandle, true);
@@ -2478,19 +2423,18 @@ _CalendarbookImpl::ConvertTodoPriorityToCalendarTodoPriority(unsigned long todoP
CalEvent*
_CalendarbookImpl::ConvertAllDayEventInstanceHandleToCalEventN(calendar_record_h instanceHandle)
{
- int errorCode = CALENDAR_ERROR_NONE;
int originalEventDBId = _INVALID_EVENT_DB_ID;
calendar_record_h eventHandle = null;
- errorCode = calendar_record_get_int(instanceHandle, _calendar_instance_allday_calendar_book.event_id, &originalEventDBId);
+ int errorCode = calendar_record_get_int(instanceHandle, _calendar_instance_allday_calendar_book.event_id, &originalEventDBId);
SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. The instanceHandle is invalid record.");
std::unique_ptr<CalEvent> pEvent(new (std::nothrow) CalEvent());
- SysTryReturn(NID_SCL, pEvent != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, pEvent != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
_CalEventImpl* pEventImpl = _CalEventImpl::GetInstance(*pEvent.get());
errorCode = calendar_db_get_record(_calendar_event._uri, originalEventDBId, &eventHandle);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
calendar_time_s startCalendarTime;
calendar_time_s endCalendarTime;
@@ -2508,19 +2452,18 @@ _CalendarbookImpl::ConvertAllDayEventInstanceHandleToCalEventN(calendar_record_h
CalEvent*
_CalendarbookImpl::ConvertNonAllDayEventInstanceHandleToCalEventN(calendar_record_h instanceHandle)
{
- int errorCode = CALENDAR_ERROR_NONE;
int originalEventDBId = _INVALID_EVENT_DB_ID;
calendar_record_h eventHandle = null;
- errorCode = calendar_record_get_int(instanceHandle, _calendar_instance_normal_calendar_book.event_id, &originalEventDBId);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. The instanceHandle is invalid record.");
+ int errorCode = calendar_record_get_int(instanceHandle, _calendar_instance_normal_calendar_book.event_id, &originalEventDBId);
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_INVALID_ARG, "[%s] Invalid argument is used. The instanceHandle is invalid record.", GetErrorMessage(E_INVALID_ARG));
std::unique_ptr<CalEvent> pEvent(new (std::nothrow) CalEvent());
- SysTryReturn(NID_SCL, pEvent != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, pEvent != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
_CalEventImpl* pEventImpl = _CalEventImpl::GetInstance(*pEvent.get());
errorCode = calendar_db_get_record(_calendar_event._uri, originalEventDBId, &eventHandle);
- SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
calendar_time_s startCalendarTime;
calendar_time_s endCalendarTime;
@@ -2541,7 +2484,7 @@ _CalendarbookImpl::ConvertAllDayEventInstanceHandleToCalEventInstanceN(calendar_
ClearLastResult();
std::unique_ptr<CalEventInstance> pEventInstance(new (std::nothrow) CalEventInstance());
- SysTryReturn(NID_SCL, pEventInstance != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, pEventInstance != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
_CalEventInstanceImpl* pEventInstanceImpl = _CalEventInstanceImpl::GetInstance(*pEventInstance.get());
int originalEventDBId = _INVALID_EVENT_DB_ID;
@@ -2570,7 +2513,7 @@ _CalendarbookImpl::ConvertAllDayEventInstanceHandleToCalEventInstanceN(calendar_
busyStatus = BUSY_STATUS_TENTATIVE;
break;
default :
- SysLogException(NID_SCL, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. busy status = %d", srcEventBusyStatus);
+ SysLogException(NID_SCL, E_INVALID_ARG, "[%s] Invalid argument is used. busy status = %d", GetErrorMessage(E_INVALID_ARG), srcEventBusyStatus);
busyStatus = BUSY_STATUS_FREE;
break;
}
@@ -2594,7 +2537,7 @@ _CalendarbookImpl::ConvertAllDayEventInstanceHandleToCalEventInstanceN(calendar_
eventStatus = EVENT_STATUS_CANCELLED;
break;
default :
- SysLogException(NID_SCL, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. status = %d", srcEventStatus);
+ SysLogException(NID_SCL, E_INVALID_ARG, "[%s] Invalid argument is used. status = %d", GetErrorMessage(E_INVALID_ARG), srcEventStatus);
eventStatus = EVENT_STATUS_NONE;
}
pEventInstanceImpl->SetStatus(eventStatus);
@@ -2616,7 +2559,7 @@ _CalendarbookImpl::ConvertAllDayEventInstanceHandleToCalEventInstanceN(calendar_
priority = EVENT_PRIORITY_HIGH;
break;
default :
- SysLogException(NID_SCL, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. priority = %d", srcPriority);
+ SysLogException(NID_SCL, E_INVALID_ARG, "[%s] Invalid argument is used. priority = %d", GetErrorMessage(E_INVALID_ARG), srcPriority);
priority = EVENT_PRIORITY_NORMAL;
}
pEventInstanceImpl->SetPriority(priority);
@@ -2636,7 +2579,7 @@ _CalendarbookImpl::ConvertAllDayEventInstanceHandleToCalEventInstanceN(calendar_
sensitivity = SENSITIVITY_CONFIDENTIAL;
break;
default :
- SysLogException(NID_SCL, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. sensitivity = %d", srcSensitivity);
+ SysLogException(NID_SCL, E_INVALID_ARG, "[%s] Invalid argument is used. sensitivity = %d", GetErrorMessage(E_INVALID_ARG), srcSensitivity);
sensitivity = SENSITIVITY_PUBLIC;
}
pEventInstanceImpl->SetSensitivity(sensitivity);
@@ -2684,7 +2627,7 @@ _CalendarbookImpl::ConvertNonAllDayEventInstanceHandleToCalEventInstanceN(calend
ClearLastResult();
std::unique_ptr<CalEventInstance> pEventInstance(new (std::nothrow) CalEventInstance());
- SysTryReturn(NID_SCL, pEventInstance != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, pEventInstance != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
_CalEventInstanceImpl* pEventInstanceImpl = _CalEventInstanceImpl::GetInstance(*pEventInstance.get());
int originalEventDBId = _INVALID_EVENT_DB_ID;
@@ -2713,7 +2656,7 @@ _CalendarbookImpl::ConvertNonAllDayEventInstanceHandleToCalEventInstanceN(calend
busyStatus = BUSY_STATUS_TENTATIVE;
break;
default :
- SysLogException(NID_SCL, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. busy status = %d", srcEventBusyStatus);
+ SysLogException(NID_SCL, E_INVALID_ARG, "[%s] Invalid argument is used. busy status = %d", GetErrorMessage(E_INVALID_ARG), srcEventBusyStatus);
busyStatus = BUSY_STATUS_FREE;
break;
}
@@ -2738,7 +2681,7 @@ _CalendarbookImpl::ConvertNonAllDayEventInstanceHandleToCalEventInstanceN(calend
eventStatus = EVENT_STATUS_CANCELLED;
break;
default :
- SysLogException(NID_SCL, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. status = %d", srcEventStatus);
+ SysLogException(NID_SCL, E_INVALID_ARG, "[%s] Invalid argument is used. status = %d", GetErrorMessage(E_INVALID_ARG), srcEventStatus);
eventStatus = EVENT_STATUS_NONE;
}
pEventInstanceImpl->SetStatus(eventStatus);
@@ -2760,7 +2703,7 @@ _CalendarbookImpl::ConvertNonAllDayEventInstanceHandleToCalEventInstanceN(calend
priority = EVENT_PRIORITY_HIGH;
break;
default :
- SysLogException(NID_SCL, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. priority = %d", srcPriority);
+ SysLogException(NID_SCL, E_INVALID_ARG, "[%s] Invalid argument is used. priority = %d", GetErrorMessage(E_INVALID_ARG), srcPriority);
priority = EVENT_PRIORITY_NORMAL;
}
pEventInstanceImpl->SetPriority(priority);
@@ -2780,7 +2723,7 @@ _CalendarbookImpl::ConvertNonAllDayEventInstanceHandleToCalEventInstanceN(calend
sensitivity = SENSITIVITY_CONFIDENTIAL;
break;
default :
- SysLogException(NID_SCL, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. sensitivity = %d", srcSensitivity);
+ SysLogException(NID_SCL, E_INVALID_ARG, "[%s] Invalid argument is used. sensitivity = %d", GetErrorMessage(E_INVALID_ARG), srcSensitivity);
sensitivity = SENSITIVITY_PUBLIC;
}
pEventInstanceImpl->SetSensitivity(sensitivity);
@@ -2828,7 +2771,7 @@ _CalendarbookImpl::ConvertModifiedEventToCalEventChangeInfoN(calendar_record_h m
ClearLastResult();
std::unique_ptr<CalEventChangeInfo> pEventChangeInfo(new (std::nothrow) CalEventChangeInfo());
- SysTryReturn(NID_SCL, pEventChangeInfo != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, pEventChangeInfo != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
_CalEventChangeInfoImpl* pEventChangeInfoImpl = _CalEventChangeInfoImpl::GetInstance(*pEventChangeInfo.get());
int eventId = 0;
@@ -2854,7 +2797,7 @@ _CalendarbookImpl::ConvertModifiedEventToCalEventChangeInfoN(calendar_record_h m
recordChangeType = RECORD_CHANGE_TYPE_REMOVED;
break;
default:
- SysLogException(NID_SCL, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. modified status = %d", modifiedStatus);
+ SysLogException(NID_SCL, E_INVALID_ARG, "[%s] Invalid argument is used. modified status = %d", GetErrorMessage(E_INVALID_ARG), modifiedStatus);
return null;
}
pEventChangeInfoImpl->SetChangeType(recordChangeType);
@@ -2872,7 +2815,7 @@ _CalendarbookImpl::ConvertModifiedTodoToCalTodoChangeInfoN(calendar_record_h mod
ClearLastResult();
std::unique_ptr<CalTodoChangeInfo> pTodoChangeInfo(new (std::nothrow) CalTodoChangeInfo());
- SysTryReturn(NID_SCL, pTodoChangeInfo != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, pTodoChangeInfo != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
_CalTodoChangeInfoImpl* pTodoChangeInfoImpl = _CalTodoChangeInfoImpl::GetInstance(*pTodoChangeInfo.get());
int todoId = 0;
@@ -2899,7 +2842,7 @@ _CalendarbookImpl::ConvertModifiedTodoToCalTodoChangeInfoN(calendar_record_h mod
recordChangeType = RECORD_CHANGE_TYPE_REMOVED;
break;
default:
- SysLogException(NID_SCL, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. modified status = %d", modifiedStatus);
+ SysLogException(NID_SCL, E_INVALID_ARG, "[%s] Invalid argument is used. modified status = %d", GetErrorMessage(E_INVALID_ARG), modifiedStatus);
return null;
}
pTodoChangeInfoImpl->SetChangeType(recordChangeType);
@@ -2918,7 +2861,7 @@ _CalendarbookImpl::ConvertRecordListN(calendar_list_h resultListHandle, RecordVi
result r = E_SUCCESS;
std::unique_ptr<ArrayList, AllElementsDeleter> pList(new (std::nothrow) ArrayList());
- SysTryReturn(NID_SCL, pList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, pList != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
r = pList->Construct();
SysTryReturn(NID_SCL, !IsFailed(r), null, r, "[%s] Propagating.", GetErrorMessage(r));
@@ -2928,10 +2871,11 @@ _CalendarbookImpl::ConvertRecordListN(calendar_list_h resultListHandle, RecordVi
for (int i = 0; i < count; i++)
{
std::unique_ptr<RecordType> pTmpRecord(RecordTypeImpl::CreateDefaultInstanceN());
- SysTryReturn(NID_SCL, pTmpRecord != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, pTmpRecord != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
- r = pList->Add(*pTmpRecord.release());
- SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ r = pList->Add(pTmpRecord.get());
+ SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ pTmpRecord.release();
}
calendar_list_first(resultListHandle);
@@ -2960,7 +2904,7 @@ _CalendarbookImpl::ConvertEventInstanceListN(calendar_list_h resultListHandle, b
result r = E_SUCCESS;
std::unique_ptr<ArrayList, AllElementsDeleter> pList(new (std::nothrow) ArrayList());
- SysTryReturn(NID_SCL, pList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, pList != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
r = pList->Construct();
SysTryReturn(NID_SCL, !IsFailed(r), null, r, "[%s] Propagating.", GetErrorMessage(r));
@@ -2977,16 +2921,17 @@ _CalendarbookImpl::ConvertEventInstanceListN(calendar_list_h resultListHandle, b
if (isAllDay)
{
pTmpEventInstance.reset(_CalendarbookImpl::ConvertAllDayEventInstanceHandleToCalEventInstanceN(tmpRecordHandle));
- SysTryReturn(NID_SCL, pTmpEventInstance != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, pTmpEventInstance != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
}
else
{
pTmpEventInstance.reset(_CalendarbookImpl::ConvertNonAllDayEventInstanceHandleToCalEventInstanceN(tmpRecordHandle));
- SysTryReturn(NID_SCL, pTmpEventInstance != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_SCL, pTmpEventInstance != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
}
- r = pList->Add(*pTmpEventInstance.release());
- SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ r = pList->Add(pTmpEventInstance.get());
+ SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ pTmpEventInstance.release();
calendar_list_next(resultListHandle);
}
@@ -3004,11 +2949,11 @@ _CalendarbookImpl::OnCalEventChanged(void)
_CalendarConnector connector;
result r = connector.GetResult();
- SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
std::unique_ptr<IList, AllElementsDeleter> pChangedEventList(GetChangedEventsAfterN(__dbVersionForEvent, __dbVersionForEvent));
- SysTryReturnVoidResult(NID_SCL, GetLastResult() != E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Propagating.");
- SysTryReturnVoidResult(NID_SCL, GetLastResult() == E_SUCCESS, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ SysTryReturnVoidResult(NID_SCL, GetLastResult() != E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ SysTryReturnVoidResult(NID_SCL, GetLastResult() == E_SUCCESS, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
if (pChangedEventList->GetCount() > 0)
{
@@ -3064,7 +3009,7 @@ _CalendarbookImpl::OnCalEventChanged(void)
pEvent = new (std::nothrow) CalEvent();
if (pEvent == null)
{
- SysLogException(NID_SCL, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysLogException(NID_SCL, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
break;
}
@@ -3091,11 +3036,11 @@ _CalendarbookImpl::OnCalTodoChanged(void)
_CalendarConnector connector;
result r = connector.GetResult();
- SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
std::unique_ptr<IList, AllElementsDeleter> pChangedTodoList(GetChangedTodosAfterN(__dbVersionForTodo, __dbVersionForTodo));
- SysTryReturnVoidResult(NID_SCL, GetLastResult() != E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Propagating.");
- SysTryReturnVoidResult(NID_SCL, GetLastResult() == E_SUCCESS, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+ SysTryReturnVoidResult(NID_SCL, GetLastResult() != E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ SysTryReturnVoidResult(NID_SCL, GetLastResult() == E_SUCCESS, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
if (pChangedTodoList->GetCount() > 0)
{
@@ -3151,7 +3096,7 @@ _CalendarbookImpl::OnCalTodoChanged(void)
pTodo = new (std::nothrow) CalTodo();
if (pTodo == null)
{
- SysLogException(NID_SCL, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysLogException(NID_SCL, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
break;
}
diff --git a/src/inc/FScl_CalendarImpl.h b/src/inc/FScl_CalendarImpl.h
index df53d05..4c040c8 100644
--- a/src/inc/FScl_CalendarImpl.h
+++ b/src/inc/FScl_CalendarImpl.h
@@ -25,8 +25,8 @@
#include <unique_ptr.h>
#include <calendar2.h>
-#include <FBaseObject.h>
#include <FBaseDataType.h>
+#include <FBaseObject.h>
#include <FSclTypes.h>
#include "FScl_CalendarbookUtil.h"
diff --git a/src/inc/FScl_CalendarbookImpl.h b/src/inc/FScl_CalendarbookImpl.h
index fdb0c8b..2da3719 100644
--- a/src/inc/FScl_CalendarbookImpl.h
+++ b/src/inc/FScl_CalendarbookImpl.h
@@ -675,6 +675,16 @@ public:
int GetMatchedItemCount(const CalendarbookFilter& filter) const;
/**
+ * Gets the instances.
+ */
+ Tizen::Base::Collection::IList* GetEventInstancesCommonN(const Tizen::Base::DateTime& start, const Tizen::Base::DateTime& end,
+ const Tizen::Locales::TimeZone& timeZone, int pageNo, int countPerPage, unsigned long category) const;
+
+ virtual void OnCalEventChanged(void);
+
+ virtual void OnCalTodoChanged(void);
+
+ /**
* Parses the events from specific vCalendar file.
* This method supports to parse for vCalendar version 1.0 and 2.0 (iCalendar).
*
@@ -753,12 +763,6 @@ public:
static result ExportTodosToVcalendar(const Tizen::Base::Collection::IList& todoList, const Tizen::Base::String& vCalFilePath);
/**
- * Gets the instances.
- */
- Tizen::Base::Collection::IList* GetEventInstancesCommonN(const Tizen::Base::DateTime& start, const Tizen::Base::DateTime& end,
- const Tizen::Locales::TimeZone& timeZone, int pageNo, int countPerPage, unsigned long category) const;
-
- /**
* Gets the maximum allowable date and time in the calendarbook (i.e "December 31 2100 23:59:59").
*
* @return An instance of %DateTime
@@ -772,10 +776,6 @@ public:
*/
static Tizen::Base::DateTime GetMinDateTime(void);
- virtual void OnCalEventChanged(void);
-
- virtual void OnCalTodoChanged(void);
-
/**
* Gets the Impl instance.
*
@@ -836,15 +836,15 @@ private:
static Tizen::Base::Collection::IList* ConvertEventInstanceListN(calendar_list_h resultListHandle, bool isAllDay);
private:
- IRecordEventListener* __pIRecordEventListener;
- ICalendarbookEventListener* __pICalendarbookEventListener;
- int __dbVersionForEvent;
- int __dbVersionForTodo;
+ IRecordEventListener* __pIRecordEventListener;
+ ICalendarbookEventListener* __pICalendarbookEventListener;
+ int __dbVersionForEvent;
+ int __dbVersionForTodo;
- _CalendarbookDbMonitor* __pCalendarbookDbMonitor;
+ _CalendarbookDbMonitor* __pCalendarbookDbMonitor;
- static RequestId __requestId;
- static _CalendarbookRecordRetrivalThread* __pRecordRetrivalThread;
+ static RequestId __requestId;
+ static _CalendarbookRecordRetrivalThread* __pRecordRetrivalThread;
}; // _CalendarbookImpl
}} // Tizen::Social