//
-// Open Service Platform
// Copyright (c) 2012 Samsung Electronics Co., Ltd.
//
// Licensed under the Apache License, Version 2.0 (the License);
#include <typeinfo>
#include <unique_ptr.h>
+#include <bundle.h>
#include <appsvc/appsvc.h>
#include <FBaseSysLog.h>
#include <FBaseString.h>
#include <FBaseColIList.h>
+#include <FBaseColIMap.h>
#include <FBaseColIEnumerator.h>
+#include <FBaseColArrayList.h>
#include <FBase_StringConverter.h>
SysAssert(__pBundle != NULL);
}
+_AppMessageImpl::_AppMessageImpl(const bundle* pBundle)
+: __pBundle(bundle_dup(const_cast<bundle*>(pBundle)))
+{
+ SysAssert(__pBundle != NULL);
+}
+
_AppMessageImpl::_AppMessageImpl(const _AppMessageImpl&rhs)
: __pBundle(bundle_dup(rhs.__pBundle))
{
SysAssert(__pBundle != NULL);
}
-_AppMessageImpl::~_AppMessageImpl(void)
+_AppMessageImpl::_AppMessageImpl(const String& appId, const String& oId, const String* pUri, const String* pMime, const IMap* pMap)
+: __pBundle(bundle_create())
{
SysAssert(__pBundle != NULL);
+
+ SetApplicationId(__pBundle, appId);
+
+ SetOperation(__pBundle, oId);
+
+ if (pUri)
+ {
+ SetUri(__pBundle, *pUri);
+ }
+
+ if (pMime)
+ {
+ SetMime(__pBundle, *pMime);
+ }
+
+ AddData(pMap);
+}
+
+_AppMessageImpl::~_AppMessageImpl(void)
+{
bundle_free(__pBundle);
}
return E_SUCCESS;
}
+String
+_AppMessageImpl::GetApplicationId(const bundle* pBundle)
+{
+ return String(appsvc_get_appid(const_cast<bundle*>(pBundle)));
+}
+
+result
+_AppMessageImpl::SetApplicationId(bundle* pBundle, const String& appId)
+{
+ std::unique_ptr<char[]> pVal(_StringConverter::CopyToCharArrayN(appId));
+
+ // alias appid handling is done internally
+ appsvc_set_appid(pBundle, pVal.get());
+
+ return E_SUCCESS;
+}
+
+String
+_AppMessageImpl::GetOperation(const bundle* pBundle)
+{
+ return String(appsvc_get_operation(const_cast<bundle*>(pBundle)));
+}
+
+result
+_AppMessageImpl::SetOperation(bundle* pBundle, const char* pOperation)
+{
+ appsvc_set_operation(pBundle, pOperation);
+
+ return E_SUCCESS;
+}
+
result
_AppMessageImpl::SetOperation(bundle* pBundle, const String& operation)
{
std::unique_ptr<char[]> pVal(_StringConverter::CopyToCharArrayN(operation));
- appsvc_set_operation(pBundle, pVal.get());
+ return SetOperation(pBundle, pVal.get());
+}
- return E_SUCCESS;
+String
+_AppMessageImpl::GetUri(const bundle* pBundle)
+{
+ return String(appsvc_get_uri(const_cast<bundle*>(pBundle)));
}
result
return E_SUCCESS;
}
+String
+_AppMessageImpl::GetMime(const bundle* pBundle)
+{
+ return String(appsvc_get_mime(const_cast<bundle*>(pBundle)));
+}
+
result
_AppMessageImpl::SetMime(bundle* pBundle, const String& mime)
{
const int count = pList->GetCount();
const char** pSa = new (std::nothrow) const char*[count];
- SysTryReturnResult(NID_APP, pSa != null, E_OUT_OF_MEMORY, "Memory allocation failure with cound %d.", count);
+ SysTryReturnResult(NID_APP, pSa != null, E_OUT_OF_MEMORY, "Memory allocation failure with count %d.", count);
// element is deliverately iterate with GetAt() for IList
for (i = 0; i < count; i++)