#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
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);
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
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.");
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
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.");
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.");
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
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.");
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);
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.");
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);
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;
, "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;
}
_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;
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;
}
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
, 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;
}
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
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.");
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;
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;
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);
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);
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);
_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;
_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;
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;
}
}
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;
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;
}
}
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);
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));
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);
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);
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;
_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;
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;
}
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;
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;
}
}
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);
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;
}
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();
__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.");
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));
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);
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;
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));
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);
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;
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;
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);
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;
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));
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);
}
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));
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);
}
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);
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);
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);
{
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;
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;
}
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);
// 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);
}
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)
{
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();
// 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)
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;
}
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));
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
{
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));
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
{
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);
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;
}
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);
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;
}
_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);
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);
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);
}
{
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);
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;
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);
}
_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);
// 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));
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--;
}
{
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);
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;
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--;
}
// 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);
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);
{
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);
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;
}
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);
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);
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);
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;
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;
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;
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;
}
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);
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);
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);
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;
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;
}
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);
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);
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);
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;
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);
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;
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);
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));
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);
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));
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);
}
_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)
{
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;
}
_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)
{
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;
}