diff options
author | Dongeup Ham <dongeup.ham@samsung.com> | 2013-01-03 10:19:00 +0900 |
---|---|---|
committer | Dongeup Ham <dongeup.ham@samsung.com> | 2013-01-03 11:21:50 +0900 |
commit | d022ec4cda436708492eca82f2af43f290fe1f26 (patch) | |
tree | 51272c244c021d471aed0d57bad4128b1b126b2e /src/XmlHandler | |
parent | 89c8b72b28db94d693be40e2840810a4c9ef9a8f (diff) | |
download | installer-d022ec4cda436708492eca82f2af43f290fe1f26.tar.gz installer-d022ec4cda436708492eca82f2af43f290fe1f26.tar.bz2 installer-d022ec4cda436708492eca82f2af43f290fe1f26.zip |
Implementation Livebox, Accounts parsers.
Change-Id: Iee2b4bf218636a2ece19a7cd2378ec04d39b8a09
Signed-off-by: Dongeup Ham <dongeup.ham@samsung.com>
Diffstat (limited to 'src/XmlHandler')
-rwxr-xr-x | src/XmlHandler/ManifestGenerator.cpp | 32 | ||||
-rwxr-xr-x | src/XmlHandler/ManifestHandler.cpp | 255 | ||||
-rwxr-xr-x | src/XmlHandler/ManifestHandler.h | 27 | ||||
-rwxr-xr-x | src/XmlHandler/Parser/ManifestAccountsParser.cpp | 272 | ||||
-rwxr-xr-x | src/XmlHandler/Parser/ManifestAccountsParser.h | 69 | ||||
-rwxr-xr-x | src/XmlHandler/Parser/ManifestLiveboxesParser.cpp | 243 | ||||
-rwxr-xr-x | src/XmlHandler/Parser/ManifestLiveboxesParser.h | 70 | ||||
-rwxr-xr-x | src/XmlHandler/Parser/ManifestParser.cpp | 77 | ||||
-rwxr-xr-x | src/XmlHandler/Parser/ManifestParser.h | 60 | ||||
-rwxr-xr-x[-rw-r--r--] | src/XmlHandler/XmlHandler.h | 10 | ||||
-rwxr-xr-x | src/XmlHandler/XmlWriter.cpp | 2 |
11 files changed, 942 insertions, 175 deletions
diff --git a/src/XmlHandler/ManifestGenerator.cpp b/src/XmlHandler/ManifestGenerator.cpp index a1b2f71..1434954 100755 --- a/src/XmlHandler/ManifestGenerator.cpp +++ b/src/XmlHandler/ManifestGenerator.cpp @@ -237,34 +237,34 @@ ManifestGenerator::WriteLiveboxes(_PackageAppInfoImpl* pAppInfoImpl) const TryReturn(__pContext, false, "[osp-installer] __pContext is null."); TryReturn(__pWriter, false, "[osp-installer] __pWriter is null."); - ArrayList* pLiveboxList = __pContext->GetLiveBoxList(); + ArrayList* pLiveboxDataList = __pContext->GetLiveboxDataList(); _PackageInfoImpl* pPackageInfoImpl = __pContext->GetPackageInfoImpl(); String label("label"); - if (pLiveboxList == null) + if (pLiveboxDataList == null) { return true; } - for (int j = 0 ; j < pLiveboxList->GetCount(); j++) + for (int j = 0 ; j < pLiveboxDataList->GetCount(); j++) { - LiveboxInfo* pLiveboxInfo = dynamic_cast<LiveboxInfo*>(pLiveboxList->GetAt(j)); - if (pLiveboxInfo == null) + LiveboxData* pLiveboxData = dynamic_cast<LiveboxData*>(pLiveboxDataList->GetAt(j)); + if (pLiveboxData == null) { - AppLogTag(OSP_INSTALLER, "pLiveboxInfo is null [%d]", j); + AppLogTag(OSP_INSTALLER, "pLiveboxData is null [%d]", j); continue; } - long long updatePeriod = pLiveboxInfo->GetUpdatePeriod(); + long long updatePeriod = pLiveboxData->GetUpdatePeriod(); String period = LongLong::ToString(updatePeriod/1000); - IMap* pLiveboxNameList = pLiveboxInfo->GetNameList(); - ArrayList* pSizeList = pLiveboxInfo->GetSizeList(); - String popupEnabled = pLiveboxInfo->GetPopupEnabled(); - String primary = pLiveboxInfo->__main; + IMap* pLiveboxNameList = pLiveboxData->GetNameList(); + ArrayList* pSizeList = pLiveboxData->GetSizeList(); + String popupEnabled = pLiveboxData->GetPopupEnabled(); + String primary = pLiveboxData->__main; __pWriter->StartElement("livebox"); - __pWriter->WriteAttribute("appid", pAppInfoImpl->GetPackageName() + "." + pLiveboxInfo->GetName() ); + __pWriter->WriteAttribute("appid", pAppInfoImpl->GetPackageName() + "." + pLiveboxData->GetName() ); __pWriter->WriteAttribute("period", period); __pWriter->WriteAttribute("pinup", "false"); @@ -279,10 +279,10 @@ ManifestGenerator::WriteLiveboxes(_PackageAppInfoImpl* pAppInfoImpl) const WriteLanguageValue(pLiveboxNameList, label); -// if (pLiveboxInfo->GetIcon().IsEmpty() == false) +// if (pLiveboxData->GetIcon().IsEmpty() == false) // { // String liveboxIcon; -// liveboxIcon.Format(1024, L"%ls%ls/%ls", pPackageInfoImpl->GetAppRootPath().GetPointer(), DIR_SHARED_RES, pLiveboxInfo->GetIcon().GetPointer()); +// liveboxIcon.Format(1024, L"%ls%ls/%ls", pPackageInfoImpl->GetAppRootPath().GetPointer(), DIR_SHARED_RES, pLiveboxData->GetIcon().GetPointer()); // // __pWriter->StartElement("icon"); // __pWriter->WriteString(liveboxIcon); @@ -321,10 +321,10 @@ ManifestGenerator::WriteLiveboxes(_PackageAppInfoImpl* pAppInfoImpl) const __pWriter->EndElement(); } - if (pLiveboxInfo->__configurationAppControlAppId.IsEmpty() == false) + if (pLiveboxData->__configurationAppControlAppId.IsEmpty() == false) { __pWriter->StartElement("setup"); - __pWriter->WriteString(pLiveboxInfo->__configurationAppControlAppId); + __pWriter->WriteString(pLiveboxData->__configurationAppControlAppId); __pWriter->EndElement(); } diff --git a/src/XmlHandler/ManifestHandler.cpp b/src/XmlHandler/ManifestHandler.cpp index d70f1bd..6e23824 100755 --- a/src/XmlHandler/ManifestHandler.cpp +++ b/src/XmlHandler/ManifestHandler.cpp @@ -27,7 +27,8 @@ #include "ManifestHandler.h" #include "PrivilegeHandler.h" #include "InstallerUtil.h" - +#include "ManifestAccountsParser.h" +#include "ManifestLiveboxesParser.h" using namespace Tizen::Base; using namespace Tizen::Base::Collection; @@ -39,8 +40,7 @@ using namespace Tizen::System; ManifestHandler::ManifestHandler(void) :__pContext(null) ,__pPrivilegeList(null) -,__pLiveBoxList(null) -,__pContentInfoList(null) +,__pContentDataList(null) ,__pPackageInfoImpl(null) ,__pPackageAppInfoImpl(null) ,__pAppControlInfoImpl(null) @@ -50,8 +50,7 @@ ManifestHandler::ManifestHandler(void) ,__pDataControlTypeImpl(null) ,__pLaunchConditionImpl(null) ,__pNotificationImpl(null) -,__pLiveboxInfo(null) -,__pContentInfo(null) +,__pContentData(null) ,__pDefaultIconType(null) ,__isDefaultMainmenu(false) ,__isDefaultSetting(false) @@ -63,11 +62,15 @@ ManifestHandler::ManifestHandler(void) ,__pAppData(null) ,__pSubModeAppControlData(null) ,__pOperationData(null) +,__isParserMode(false) { } ManifestHandler::~ManifestHandler(void) { + delete[] __pDefaultIconType; + __pDefaultIconType = null; + if (__pPackageAppInfoImpl) { delete __pPackageAppInfoImpl; @@ -84,6 +87,12 @@ ManifestHandler::Construct(InstallationContext* pContext) return true; } +InstallationContext* +ManifestHandler::GetContext(void) +{ + return __pContext; +} + bool ManifestHandler::Parse(const char *pFilepath) { @@ -97,6 +106,12 @@ ManifestHandler::OnStartElement(const char *pName) bool status = true; + if (__isParserMode == true) + { + TryReturn(__pParser, false, "[osp-installer] __pParser is null"); + return __pParser->OnStartElement(pName); + } + if (strcasecmp(pName, "Manifest") == 0) { AppLogTag(OSP_INSTALLER, "------------------------------------------"); @@ -148,14 +163,6 @@ ManifestHandler::OnStartElement(const char *pName) { status = OnIconsStartElement(); } - else if (strcasecmp(pName, "LiveBoxes") == 0) - { - status = OnLiveBoxesStartElement(); - } - else if (strcasecmp(pName, "LiveBox") == 0) - { - status = OnLiveBoxStartElement(); - } else if (strcasecmp(pName, "Contents") == 0) { status = OnContentsStartElement(); @@ -168,9 +175,18 @@ ManifestHandler::OnStartElement(const char *pName) { status = OnOperationStartElement(); } + else if (strcasecmp(pName, "Liveboxes") == 0) + { + status = OnLiveboxesStartElement(pName); + } + else if (strcasecmp(pName, "Accounts") == 0) + { + status = OnAccountsStartElement(pName); + } if (!status) { + __isParserMode = false; return false; } @@ -184,6 +200,23 @@ ManifestHandler::OnEndElement(const char *pName) bool status = true; + if (__isParserMode == true) + { + TryReturn(__pParser, false, "[osp-installer] __pParser is null"); + __pParser->OnEndElement(pName); + + if (strcasecmp(pName, "Accounts") == 0) + { + status = OnAccountsEndElement(); + } + else if (strcasecmp(pName, "Liveboxes") == 0) + { + status = OnLiveboxesEndElement(); + } + + return status; + } + if (strcasecmp(pName, "Privileges") == 0) { status = OnPrivilegesEndElement(); @@ -236,18 +269,10 @@ ManifestHandler::OnEndElement(const char *pName) { status = OnIconsEndElement(); } - else if (strcasecmp(pName, "LiveBoxes") == 0) - { - status = OnLiveBoxesEndElement(); - } else if (strcasecmp(pName, "Contents") == 0) { status = OnContentsEndElement(); } - else if (strcasecmp(pName, "LiveBox") == 0) - { - status = OnLiveBoxEndElement(); - } else if (strcasecmp(pName, "Content") == 0) { status = OnContentEndElement(); @@ -273,9 +298,14 @@ bool ManifestHandler::OnCharacters(const char *pCharacters) { bool status = true; - char *pName = 0; - pName = GetElementName(); + if (__isParserMode == true) + { + TryReturn(__pParser, false, "[osp-installer] __pParser is null"); + return __pParser->OnCharacters(pCharacters); + } + + char *pName = GetElementName(); TryReturn(pName, false, "[osp-installer] pName is null."); if (strcasecmp(pName, "Id") == 0) @@ -334,10 +364,6 @@ ManifestHandler::OnCharacters(const char *pCharacters) { status = OnNotificationValue(pCharacters); } - else if (strcasecmp(pName, "Size") == 0) - { - status = OnSizeValue(pCharacters); - } else if (strcasecmp(pName, "InstallationLocation") == 0) { status = OnInstallationLocationValue(pCharacters); @@ -354,10 +380,6 @@ ManifestHandler::OnCharacters(const char *pCharacters) { status = OnUriValue(pCharacters); } - else if (strcasecmp(pName, "ConfigurationAppControlAppId") == 0) - { - status = OnConfigurationAppControlAppIdValue(pCharacters); - } if (!status) { @@ -686,8 +708,8 @@ ManifestHandler::OnDataControlStartElement(void) bool ManifestHandler::OnContentsStartElement(void) { - __pContentInfoList = new (std::nothrow) ArrayList; - TryReturn(__pContentInfoList, false, "[osp-installer] __pContentInfoList is null"); + __pContentDataList = new (std::nothrow) ArrayList; + TryReturn(__pContentDataList, false, "[osp-installer] __pContentDataList is null"); AppLogTag(OSP_INSTALLER, "<Contents>"); @@ -697,13 +719,13 @@ ManifestHandler::OnContentsStartElement(void) bool ManifestHandler::OnContentStartElement(void) { - TryReturn(__pContentInfo == null, false, "[osp-installer] __pContentInfo is not null"); + TryReturn(__pContentData == null, false, "[osp-installer] __pContentData is not null"); XmlAttribute *pAttr = null; char *pDefault = null; - __pContentInfo = new (std::nothrow) ContentInfo; - TryReturn(__pContentInfo, false, "[osp-installer] __pLiveboxInfo is null"); + __pContentData = new (std::nothrow) ContentData; + TryReturn(__pContentData, false, "[osp-installer] __pContentData is null"); pAttr = GetAttribute(); TryReturn(pAttr, true, "[osp-installer] pAttr is null"); @@ -711,13 +733,13 @@ ManifestHandler::OnContentStartElement(void) char* pId = pAttr->Find("Id"); if (pId) { - __pContentInfo->SetContentId(pId); + __pContentData->SetContentId(pId); } char* pEntryName = pAttr->Find("EntryName"); if (pEntryName) { - __pContentInfo->SetContentId(pEntryName); + __pContentData->SetContentId(pEntryName); } pDefault = pAttr->Find("Default"); @@ -735,61 +757,29 @@ ManifestHandler::OnContentStartElement(void) } bool -ManifestHandler::OnLiveBoxesStartElement(void) +ManifestHandler::OnLiveboxesStartElement(const char *pName) { - __pLiveBoxList = new (std::nothrow) ArrayList; - TryReturn(__pLiveBoxList, false, "[osp-installer] __pLiveBoxList is null"); + __pParser = new (std::nothrow) ManifestLiveboxesParser; + TryReturn(__pParser, false, "[osp-installer] __pParser is null"); - AppLogTag(OSP_INSTALLER, "<LiveBoxes>"); + __isParserMode = true; + AppLogTag(OSP_INSTALLER, "------------------------------------------"); + __pParser->Construct(this); - return true; + return __pParser->OnStartElement(pName); } bool -ManifestHandler::OnLiveBoxStartElement(void) +ManifestHandler::OnAccountsStartElement(const char *pName) { - TryReturn(__pLiveboxInfo == null, false, "[osp-installer] __pLiveboxInfo is not null"); - - XmlAttribute *pAttr = null; - - __pLiveboxInfo = new (std::nothrow) LiveboxInfo; - TryReturn(__pLiveboxInfo, false, "[osp-installer] __pLiveboxInfo is null"); - - pAttr = GetAttribute(); - TryReturn(pAttr, true, "[osp-installer] pAttr is null"); - - AppLogTag(OSP_INSTALLER, "<Livebox>"); + __pParser = new (std::nothrow) ManifestAccountsParser; + TryReturn(__pParser, false, "[osp-installer] __pParser is null"); - char *pProviderName = pAttr->Find("ProviderName"); - if (pProviderName) - { - __pLiveboxInfo->SetName(pProviderName); - AppLogTag(OSP_INSTALLER, " - ProviderName=%s", pProviderName); - } + __isParserMode = true; + AppLogTag(OSP_INSTALLER, "------------------------------------------"); + __pParser->Construct(this); - char *pUpdatePeriod = pAttr->Find("UpdatePeriod"); - if (pUpdatePeriod) - { - long long updatePeriod = atoll(pUpdatePeriod); - __pLiveboxInfo->SetUpdatePeriod(updatePeriod); - AppLogTag(OSP_INSTALLER, " - UpdatePeriod=%lld", updatePeriod); - } - - char *pLiveboxPopupEnabled = pAttr->Find("LiveBoxPopupEnabled"); - if (pLiveboxPopupEnabled) - { - __pLiveboxInfo->SetPopupEnabled(pLiveboxPopupEnabled); - AppLogTag(OSP_INSTALLER, " - LiveBoxPopupEnabled=%s", pLiveboxPopupEnabled); - } - - char *pMain = pAttr->Find("Main"); - if (pMain) - { - __pLiveboxInfo->__main = pMain; - AppLogTag(OSP_INSTALLER, " - Main=%s", pMain); - } - - return true; + return __pParser->OnStartElement(pName); } bool @@ -797,7 +787,7 @@ ManifestHandler::OnPrivilegesEndElement(void) { if (__pContext->IsVerificationMode() == false) { - AppLogTag(OSP_INSTALLER, "Signature file not found. [%ls]\n", __pContext->GetSignatureXmlPath().GetPointer()); + AppLogTag(OSP_INSTALLER, "no signature file[%ls]\n", __pContext->GetSignatureXmlPath().GetPointer()); result r = E_SUCCESS; String privileges; @@ -874,8 +864,6 @@ ManifestHandler::OnAppsEndElement(void) bool ManifestHandler::OnIconsEndElement(void) { - delete[] __pDefaultIconType; - __pDefaultIconType = null; AppLogTag(OSP_INSTALLER, "</Icons>"); return true; @@ -971,8 +959,8 @@ ManifestHandler::OnNotificationEndElement(void) bool ManifestHandler::OnContentsEndElement(void) { - __pContext->SetContentInfoList(__pContentInfoList); - __pContentInfoList = null; + __pContext->SetContentDataList(__pContentDataList); + __pContentDataList = null; AppLogTag(OSP_INSTALLER, "</Contents>"); return true; @@ -981,29 +969,29 @@ ManifestHandler::OnContentsEndElement(void) bool ManifestHandler::OnContentEndElement(void) { - __pContentInfoList->Add(*__pContentInfo); - __pContentInfo = null; + __pContentDataList->Add(*__pContentData); + __pContentData = null; AppLogTag(OSP_INSTALLER, "</Content>"); return true; } bool -ManifestHandler::OnLiveBoxesEndElement(void) +ManifestHandler::OnAccountsEndElement(void) { - __pContext->SetLiveBoxList(__pLiveBoxList); - __pLiveBoxList = null; - AppLogTag(OSP_INSTALLER, "</LiveBoxes>"); + delete __pParser; + __isParserMode = false; + AppLogTag(OSP_INSTALLER, "------------------------------------------"); return true; } bool -ManifestHandler::OnLiveBoxEndElement(void) +ManifestHandler::OnLiveboxesEndElement(void) { - __pLiveBoxList->Add(*__pLiveboxInfo); - __pLiveboxInfo = null; - AppLogTag(OSP_INSTALLER, "</LiveBox>"); + delete __pParser; + __isParserMode = false; + AppLogTag(OSP_INSTALLER, "------------------------------------------"); return true; } @@ -1024,8 +1012,8 @@ ManifestHandler::OnManifestEndElement(void) bool ManifestHandler::OnIdValue(const char *pCharacters) { - __pPackageInfoImpl->SetAppId(pCharacters); AppLogTag(OSP_INSTALLER, "<Id>%s</Id>", pCharacters); + __pPackageInfoImpl->SetAppId(pCharacters); return true; } @@ -1033,8 +1021,8 @@ ManifestHandler::OnIdValue(const char *pCharacters) bool ManifestHandler::OnVersionValue(const char *pCharacters) { - __pPackageInfoImpl->SetAppVersion(pCharacters); AppLogTag(OSP_INSTALLER, "<Version>%s</Version>", pCharacters); + __pPackageInfoImpl->SetAppVersion(pCharacters); return true; } @@ -1042,6 +1030,7 @@ ManifestHandler::OnVersionValue(const char *pCharacters) bool ManifestHandler::OnTypeValue(const char *pCharacters) { + AppLogTag(OSP_INSTALLER, "<Type>%s</Type>", pCharacters); __pPackageInfoImpl->SetAppType(pCharacters); if (strcasecmp(pCharacters, "Contents") == 0) @@ -1049,8 +1038,6 @@ ManifestHandler::OnTypeValue(const char *pCharacters) __pPackageInfoImpl->SetAppApiVersion("3.0"); } - AppLogTag(OSP_INSTALLER, "<Type>%s</Type>", pCharacters); - return true; } @@ -1072,8 +1059,8 @@ ManifestHandler::OnAuthorValue(const char *pCharacters) // __pPackageInfoImpl->SetAppVendor(pCharacters); // } - __pPackageInfoImpl->SetAppVendor(pCharacters); AppLogTag(OSP_INSTALLER, "<Author>%s</Author>", pCharacters); + __pPackageInfoImpl->SetAppVendor(pCharacters); return true; } @@ -1137,15 +1124,10 @@ ManifestHandler::OnIconValue(const char *pCharacters) return false; } - if (FindElement("Livebox") == true) - { - TryReturn(__pLiveboxInfo, false, "[osp-installer] __pLiveboxInfo is null"); - __pLiveboxInfo->SetIcon(icon); - } - else if (FindElement("Content") == true) + if (FindElement("Content") == true) { - TryReturn(__pContentInfo, false, "[osp-installer] __pContentInfo is null"); - __pContentInfo->SetIcon(icon); + TryReturn(__pContentData, false, "[osp-installer] __pContentData is null"); + __pContentData->SetIcon(icon); } else { @@ -1204,21 +1186,13 @@ ManifestHandler::OnNameValue(const char *pCharacters) pAttrValue = pAttr->Find("Locale"); TryReturn(pAttrValue, true, "[osp-installer] pAttrValue is null"); - if (FindElement("Livebox") == true) + if (FindElement("Content") == true) { - TryReturn(__pLiveboxInfo, false, "[osp-installer] __pLiveboxInfo is null"); + TryReturn(__pContentData, false, "[osp-installer] __pContentData is null"); String* pValue = new (std::nothrow) String; StringUtil::Utf8ToString(pCharacters, *pValue); - __pLiveboxInfo->AddName(*(new (std::nothrow) String(pAttrValue)), *pValue); - } - else if (FindElement("Content") == true) - { - TryReturn(__pContentInfo, false, "[osp-installer] __pContentInfo is null"); - - String* pValue = new (std::nothrow) String; - StringUtil::Utf8ToString(pCharacters, *pValue); - __pContentInfo->AddName(*(new (std::nothrow) String(pAttrValue)), *pValue); + __pContentData->AddName(*(new (std::nothrow) String(pAttrValue)), *pValue); } else { @@ -1336,17 +1310,6 @@ ManifestHandler::OnNotificationValue(const char *pCharacters) } bool -ManifestHandler::OnSizeValue(const char *pCharacters) -{ - TryReturn(__pLiveboxInfo, false, "[osp-installer] __pLiveboxInfo is null"); - - __pLiveboxInfo->AddSize(*(new (std::nothrow) String(pCharacters))); - AppLogTag(OSP_INSTALLER, "<Size>%s</Size>", pCharacters); - - return true; -} - -bool ManifestHandler::OnInstallationLocationValue(const char *pCharacters) { AppLogTag(OSP_INSTALLER, "<InstallationLocation>%s</InstallationLocation>", pCharacters); @@ -1391,17 +1354,6 @@ ManifestHandler::OnUriValue(const char* pCharacters) } bool -ManifestHandler::OnConfigurationAppControlAppIdValue(const char* pCharacters) -{ - TryReturn(__pLiveboxInfo, true, "[osp-installer] __pLiveboxInfo is null"); - - __pLiveboxInfo->__configurationAppControlAppId = pCharacters; - AppLogTag(OSP_INSTALLER, "<ConfigurationAppControlAppId>%s</ConfigurationAppControlAppId>", pCharacters); - - return true; -} - -bool ManifestHandler::FindElement(const char *pName) { bool res = false; @@ -1595,3 +1547,16 @@ ManifestHandler::ParseAppAttribute(XmlAttribute* pAttr, bool isUiApp) return true; } + +AppData* +ManifestHandler::GetAppData(void) +{ + return __pAppData; +} + +char* +ManifestHandler::GetDefaultIconType(void) +{ + return __pDefaultIconType; +} + diff --git a/src/XmlHandler/ManifestHandler.h b/src/XmlHandler/ManifestHandler.h index ac2a009..e2ef45d 100755 --- a/src/XmlHandler/ManifestHandler.h +++ b/src/XmlHandler/ManifestHandler.h @@ -29,6 +29,8 @@ #include "XmlHandler.h" #include "InstallationContext.h" +class ManifestParser; + /** * @class ManifestHandler * @brief This class represents the class of ManifestHandler. @@ -45,8 +47,12 @@ public: virtual ~ManifestHandler(void); bool Construct(InstallationContext *pConext); + InstallationContext* GetContext(void); bool Parse(const char *pFilepath); + AppData* GetAppData(void); + char* GetDefaultIconType(void); + private: ManifestHandler(const ManifestHandler& value); ManifestHandler& operator =(const ManifestHandler& source); @@ -71,8 +77,9 @@ private: bool OnContentsStartElement(void); bool OnContentStartElement(void); - bool OnLiveBoxesStartElement(void); - bool OnLiveBoxStartElement(void); + + bool OnLiveboxesStartElement(const char *pName); + bool OnAccountsStartElement(const char *pName); // EndElement bool OnPrivilegesEndElement(void); @@ -94,8 +101,10 @@ private: bool OnContentsEndElement(void); bool OnContentEndElement(void); - bool OnLiveBoxesEndElement(void); - bool OnLiveBoxEndElement(void); + + bool OnLiveboxesEndElement(void); + bool OnAccountsEndElement(void); + bool OnManifestEndElement(void); // OnValue @@ -129,8 +138,7 @@ private: private: InstallationContext* __pContext; Tizen::Base::Collection::ArrayList* __pPrivilegeList; - Tizen::Base::Collection::ArrayList* __pLiveBoxList; - Tizen::Base::Collection::ArrayList* __pContentInfoList; + Tizen::Base::Collection::ArrayList* __pContentDataList; Tizen::App::Package::_PackageInfoImpl* __pPackageInfoImpl; Tizen::App::Package::_PackageAppInfoImpl* __pPackageAppInfoImpl; Tizen::App::Package::_AppControlInfoImpl* __pAppControlInfoImpl; @@ -140,8 +148,8 @@ private: Tizen::App::Package::_DataControlTypeImpl* __pDataControlTypeImpl; Tizen::App::Package::_LaunchConditionInfoImpl* __pLaunchConditionImpl; Tizen::App::Package::_NotificationInfoImpl* __pNotificationImpl; - LiveboxInfo* __pLiveboxInfo; - ContentInfo* __pContentInfo; + + ContentData* __pContentData; char* __pDefaultIconType; bool __isDefaultMainmenu; @@ -156,6 +164,9 @@ private: AppControlData* __pSubModeAppControlData; OperationData* __pOperationData; + bool __isParserMode; + ManifestParser* __pParser; + }; // ManifestHandler #endif // _MANIFEST_HANDLER_H_ diff --git a/src/XmlHandler/Parser/ManifestAccountsParser.cpp b/src/XmlHandler/Parser/ManifestAccountsParser.cpp new file mode 100755 index 0000000..a50d680 --- /dev/null +++ b/src/XmlHandler/Parser/ManifestAccountsParser.cpp @@ -0,0 +1,272 @@ +// +// Open Service Platform +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +/** + * @file ManifestAccountsParser.cpp + * @brief This is the implementation file for %ManifestAccountsParser class. + */ + +#include <FIoFile.h> +#include <FSys_SystemInfoImpl.h> +#include <FAppPkg_PackageInfoImpl.h> +#include <FBase_StringConverter.h> + +#include "ManifestAccountsParser.h" +#include "InstallerUtil.h" +#include "InstallationContext.h" +#include "ManifestHandler.h" + +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Base::Utility; +using namespace Tizen::App::Package; +using namespace Tizen::Io; +using namespace Tizen::System; + +ManifestAccountsParser::ManifestAccountsParser(void) +:__pContext(null) +,__pAccountData(null) +,__isAccountIconSelected(false) +,__isAccountSmallIconSelected(false) +{ +} + +ManifestAccountsParser::~ManifestAccountsParser(void) +{ + delete __pAccountData; +} + +bool +ManifestAccountsParser::OnStartElement(const char *pName) +{ + TryReturn(pName, true, "[osp-installer] pName is null"); + bool status = true; + + if (strcasecmp(pName, "Accounts") == 0) + { + status = OnAccountsStartElement(); + } + else if (strcasecmp(pName, "AccountProvider") == 0) + { + status = OnAccountProviderStartElement(); + } + + return status; +} + +bool +ManifestAccountsParser::OnEndElement(const char *pName) +{ + TryReturn(pName, true, "[osp-installer] pName is null"); + bool status = true; + + if (strcasecmp(pName, "Accounts") == 0) + { + status = OnAccountsEndElement(); + } + else if (strcasecmp(pName, "AccountProvider") == 0) + { + status = OnAccountProviderEndElement(); + } + + return true; +} + +bool +ManifestAccountsParser::OnCharacters(const char *pCharacters) +{ + TryReturn(pCharacters, true, "[osp-installer] pCharacters is null"); + bool status = true; + + ManifestHandler* pHandler = GetHandler(); + TryReturn(pHandler, false, "[osp-installer] pHandler is null"); + + char *pName = pHandler->GetElementName(); + TryReturn(pName, false, "[osp-installer] pName is null"); + + if (strcasecmp(pName, "DisplayName") == 0) + { + status = OnDisplayNameValue(pCharacters); + } + else if (strcasecmp(pName, "Icon") == 0) + { + status = OnIconValue(pCharacters); + } + + return true; +} + +bool +ManifestAccountsParser::OnAccountsStartElement(void) +{ + ManifestHandler* __pHandler = GetHandler(); + TryReturn(__pHandler, false, "[osp-installer] __pHandler is null"); + + __pContext = __pHandler->GetContext(); + TryReturn(__pContext, false, "[osp-installer] __pContext is null"); + + AppLogTag(OSP_INSTALLER, " <Accounts>"); + + return true; +} + +bool +ManifestAccountsParser::OnAccountProviderStartElement(void) +{ + XmlAttribute *pAttr = null; + + __pAccountData = new (std::nothrow) AccountData; + TryReturn(__pAccountData, false, "[osp-installer] __pAccountData is null"); + + ManifestHandler* pHandler = GetHandler(); + TryReturn(pHandler, false, "[osp-installer] pHandler is null"); + + pAttr = pHandler->GetAttribute(); + TryReturn(pAttr, true, "[osp-installer] pAttr is null"); + + AppLogTag(OSP_INSTALLER, " <AccountProvider>"); + + char *pProviderId = pAttr->Find("ProviderId"); + if (pProviderId) + { + __pAccountData->__providerId = pProviderId; + AppLogTag(OSP_INSTALLER, " - ProviderId=%s", pProviderId); + } + + char *pMultipleAccountsSupport = pAttr->Find("MultipleAccountsSupport"); + if (pMultipleAccountsSupport) + { + __pAccountData->__multipleAccountsSupport = pMultipleAccountsSupport; + AppLogTag(OSP_INSTALLER, " - MultipleAccountsSupport=%s", pMultipleAccountsSupport); + } + + return true; +} + +bool +ManifestAccountsParser::OnAccountsEndElement(void) +{ + AppLogTag(OSP_INSTALLER, " </Accounts>"); + + return true; +} + +bool +ManifestAccountsParser::OnAccountProviderEndElement(void) +{ + ManifestHandler* pHandler = GetHandler(); + TryReturn(pHandler, false, "[osp-installer] pHandler is null"); + + AppData* pAppData = pHandler->GetAppData(); + TryReturn(pAppData, false, "[osp-installer] pAppData is null"); + + pAppData->__pAccountDataList->Add(__pAccountData); + __pAccountData = null; + AppLogTag(OSP_INSTALLER, " </AccountProvider>"); + + return true; +} + +bool +ManifestAccountsParser::OnDisplayNameValue(const char *pCharacters) +{ + XmlAttribute* pAttr = 0; + char* pAttrValue = 0; + + ManifestHandler* pHandler = GetHandler(); + TryReturn(pHandler, false, "[osp-installer] pHandler is null"); + + pAttr = pHandler->GetAttribute(); + TryReturn(pAttr, true, "[osp-installer] pAttr is null"); + + pAttrValue = pAttr->Find("Locale"); + TryReturn(pAttrValue, true, "[osp-installer] pAttrValue is null"); + + String* pValue = new (std::nothrow) String; + StringUtil::Utf8ToString(pCharacters, *pValue); + __pAccountData->__pNameList->Add(new (std::nothrow) String(pAttrValue), pValue); + + AppLogTag(OSP_INSTALLER, " <DisplayName>%s</DisplayName>", pCharacters); + + return true; +} + +bool +ManifestAccountsParser::OnIconValue(const char *pCharacters) +{ + XmlAttribute* pAttr = 0; + char* pSectionValue = 0; + char* pTypeValue = 0; + + ManifestHandler* pHandler = GetHandler(); + TryReturn(pHandler, false, "[osp-installer] pHandler is null"); + + pAttr = pHandler->GetAttribute(); + TryReturn(pAttr, true, "[osp-installer] pAttr is null"); + + pSectionValue = pAttr->Find("Section"); + TryReturn(pSectionValue, true, "[osp-installer] pSectionValue is null"); + + pTypeValue = pAttr->Find("Type"); + TryReturn(pTypeValue, true, "[osp-installer] pTypeValue is null"); + + char* pDefaultIconType = pHandler->GetDefaultIconType(); + TryReturn(pDefaultIconType, false, "[osp-installer] pDefaultIconType is null"); + + String icon; + if (strcasecmp(pTypeValue, "Xhigh") == 0) + { + icon.Format(1024, L"%s/%s", "screen-density-xhigh", pCharacters); + } + else if (strcasecmp(pTypeValue, "High") == 0) + { + icon.Format(1024, L"%s/%s", "screen-density-high", pCharacters); + } + else + { + AppLogTag(OSP_INSTALLER, "Invalid Type [%s]", pDefaultIconType); + return false; + } + + if (strcasecmp(pSectionValue, "Account") == 0) + { + if (__isAccountIconSelected == false) + { + __pAccountData->__accountIcon = icon; + } + + if (strcasecmp(pTypeValue, pDefaultIconType) == 0) + { + __isAccountIconSelected = true; + } + } + else if (strcasecmp(pSectionValue, "AccountSmall") == 0) + { + if (__isAccountSmallIconSelected == false) + { + __pAccountData->__accountSmallIcon = icon; + } + + if (strcasecmp(pTypeValue, pDefaultIconType) == 0) + { + __isAccountSmallIconSelected = true; + } + } + + AppLogTag(OSP_INSTALLER, " <Icon Section=\"%s\" Type=\"%s\">%s</Icon>", pSectionValue, pTypeValue, pCharacters); + + return true; +} diff --git a/src/XmlHandler/Parser/ManifestAccountsParser.h b/src/XmlHandler/Parser/ManifestAccountsParser.h new file mode 100755 index 0000000..74e90cb --- /dev/null +++ b/src/XmlHandler/Parser/ManifestAccountsParser.h @@ -0,0 +1,69 @@ +// +// Open Service Platform +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +/** + * @file ManifestAccountsParser.h + * @brief This is the header file for the %ManifestAccountsParser class. + * + * This header file contains the declarations of the %ManifestAccountsParser class. + */ +#ifndef _MANIFEST_ACCOUNTS_PARSER_H_ +#define _MANIFEST_ACCOUNTS_PARSER_H_ + +#include <FBaseString.h> + +#include <FAppPkg_PackageInfoImpl.h> + +#include "ManifestParser.h" +#include "InstallationContext.h" + +/** + * @class ManifestAccountsParser + * @brief This class represents the class of ManifestAccountsParser. + * @since 1.0 + * + * This class represents the class of ManifestAccountsParser. + * + */ +class ManifestAccountsParser + : public ManifestParser +{ +public: + ManifestAccountsParser(void); + virtual ~ManifestAccountsParser(void); + + virtual bool OnStartElement(const char *pName); + virtual bool OnEndElement(const char *pName); + virtual bool OnCharacters(const char *pCharacters); + +private: + bool OnAccountsStartElement(void); + bool OnAccountProviderStartElement(void); + bool OnAccountsEndElement(void); + bool OnAccountProviderEndElement(void); + + bool OnDisplayNameValue(const char *pCharacters); + bool OnIconValue(const char *pCharacters); + +private: + InstallationContext* __pContext; + AccountData* __pAccountData; + bool __isAccountIconSelected; + bool __isAccountSmallIconSelected; + +}; // ManifestAccountsParser + +#endif // _MANIFEST_ACCOUNTS_PARSER_H_ diff --git a/src/XmlHandler/Parser/ManifestLiveboxesParser.cpp b/src/XmlHandler/Parser/ManifestLiveboxesParser.cpp new file mode 100755 index 0000000..ce03cbc --- /dev/null +++ b/src/XmlHandler/Parser/ManifestLiveboxesParser.cpp @@ -0,0 +1,243 @@ +// +// Open Service Platform +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +/** + * @file ManifestLiveboxesParser.cpp + * @brief This is the implementation file for %ManifestLiveboxesParser class. + */ + +#include <FIoFile.h> +#include <FSys_SystemInfoImpl.h> +#include <FAppPkg_PackageInfoImpl.h> +#include <FBase_StringConverter.h> + +#include "ManifestLiveboxesParser.h" +#include "InstallerUtil.h" +#include "XmlAttribute.h" +#include "ManifestHandler.h" +#include "InstallationContextData.h" + +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Base::Utility; +using namespace Tizen::App::Package; +using namespace Tizen::Io; +using namespace Tizen::System; + +ManifestLiveboxesParser::ManifestLiveboxesParser(void) +:__pContext(null) +,__pLiveboxDataList(null) +,__pLiveboxData(null) +{ +} + +ManifestLiveboxesParser::~ManifestLiveboxesParser(void) +{ +} + +bool +ManifestLiveboxesParser::OnStartElement(const char *pName) +{ + TryReturn(pName, true, "[osp-installer] pName is null"); + + bool status = true; + + if (strcasecmp(pName, "Liveboxes") == 0) + { + status = OnLiveboxesStartElement(); + } + else if (strcasecmp(pName, "Livebox") == 0) + { + status = OnLiveboxStartElement(); + } + + return status; +} + +bool +ManifestLiveboxesParser::OnEndElement(const char *pName) +{ + TryReturn(pName, true, "[osp-installer] pName is null"); + + bool status = true; + + if (strcasecmp(pName, "Liveboxes") == 0) + { + status = OnLiveboxesEndElement(); + } + else if (strcasecmp(pName, "Livebox") == 0) + { + status = OnLiveboxEndElement(); + } + + return status; +} + +bool +ManifestLiveboxesParser::OnCharacters(const char *pCharacters) +{ + TryReturn(pCharacters, true, "[osp-installer] pCharacters is null"); + + bool status = true; + + ManifestHandler* pHandler = GetHandler(); + TryReturn(pHandler, false, "[osp-installer] pHandler is null"); + + char *pName = pHandler->GetElementName(); + TryReturn(pName, false, "[osp-installer] pName is null"); + + if (strcasecmp(pName, "DisplayName") == 0) + { + status = OnDisplayNameValue(pCharacters); + } + else if (strcasecmp(pName, "Size") == 0) + { + status = OnSizeValue(pCharacters); + } + else if (strcasecmp(pName, "ConfigurationAppControlAppId") == 0) + { + status = OnConfigurationAppControlAppIdValue(pCharacters); + } + + return status; +} + +bool +ManifestLiveboxesParser::OnLiveboxesStartElement() +{ + ManifestHandler* __pHandler = GetHandler(); + TryReturn(__pHandler, false, "[osp-installer] __pHandler is null"); + + __pContext = __pHandler->GetContext(); + TryReturn(__pContext, false, "[osp-installer] __pContext is null"); + + __pLiveboxDataList = new (std::nothrow) ArrayList; + TryReturn(__pLiveboxDataList, false, "[osp-installer] __pLiveboxDataList is null"); + + AppLogTag(OSP_INSTALLER, " <Liveboxes>"); + + return true; +} + +bool +ManifestLiveboxesParser::OnLiveboxStartElement(void) +{ + XmlAttribute *pAttr = null; + + __pLiveboxData = new (std::nothrow) LiveboxData; + TryReturn(__pLiveboxData, false, "[osp-installer] __pLiveboxData is null"); + + ManifestHandler* pHandler = GetHandler(); + TryReturn(pHandler, false, "[osp-installer] pHandler is null"); + + pAttr = pHandler->GetAttribute(); + TryReturn(pAttr, true, "[osp-installer] pAttr is null"); + + AppLogTag(OSP_INSTALLER, " <Livebox>"); + + char *pProviderName = pAttr->Find("ProviderName"); + if (pProviderName) + { + __pLiveboxData->SetName(pProviderName); + AppLogTag(OSP_INSTALLER, " - ProviderName=%s", pProviderName); + } + + char *pUpdatePeriod = pAttr->Find("UpdatePeriod"); + if (pUpdatePeriod) + { + long long updatePeriod = atoll(pUpdatePeriod); + __pLiveboxData->SetUpdatePeriod(updatePeriod); + AppLogTag(OSP_INSTALLER, " - UpdatePeriod=%lld", updatePeriod); + } + + char *pLiveboxPopupEnabled = pAttr->Find("LiveboxPopupEnabled"); + if (pLiveboxPopupEnabled) + { + __pLiveboxData->SetPopupEnabled(pLiveboxPopupEnabled); + AppLogTag(OSP_INSTALLER, " - LiveboxPopupEnabled=%s", pLiveboxPopupEnabled); + } + + char *pMain = pAttr->Find("Main"); + if (pMain) + { + __pLiveboxData->__main = pMain; + AppLogTag(OSP_INSTALLER, " - Main=%s", pMain); + } + + return true; +} + +bool +ManifestLiveboxesParser::OnLiveboxesEndElement(void) +{ + __pContext->SetLiveboxDataList(__pLiveboxDataList); + __pLiveboxDataList = null; + AppLogTag(OSP_INSTALLER, " </Liveboxes>"); + + return true; +} + +bool +ManifestLiveboxesParser::OnLiveboxEndElement(void) +{ + __pLiveboxDataList->Add(*__pLiveboxData); + __pLiveboxData = null; + AppLogTag(OSP_INSTALLER, " </Livebox>"); + + return true; +} + +bool +ManifestLiveboxesParser::OnSizeValue(const char *pCharacters) +{ + __pLiveboxData->AddSize(*(new (std::nothrow) String(pCharacters))); + + AppLogTag(OSP_INSTALLER, " <Size>%s</Size>", pCharacters); + return true; +} + +bool +ManifestLiveboxesParser::OnDisplayNameValue(const char *pCharacters) +{ + XmlAttribute* pAttr = 0; + char* pAttrValue = 0; + + ManifestHandler* pHandler = GetHandler(); + TryReturn(pHandler, false, "[osp-installer] pHandler is null"); + + pAttr = pHandler->GetAttribute(); + TryReturn(pAttr, true, "[osp-installer] pAttr is null"); + + pAttrValue = pAttr->Find("Locale"); + TryReturn(pAttrValue, true, "[osp-installer] pAttrValue is null"); + + String* pValue = new (std::nothrow) String; + StringUtil::Utf8ToString(pCharacters, *pValue); + __pLiveboxData->AddName(*(new (std::nothrow) String(pAttrValue)), *pValue); + + AppLogTag(OSP_INSTALLER, " <DisplayName>%s</DisplayName>", pCharacters); + + return true; +} + +bool +ManifestLiveboxesParser::OnConfigurationAppControlAppIdValue(const char* pCharacters) +{ + __pLiveboxData->__configurationAppControlAppId = pCharacters; + AppLogTag(OSP_INSTALLER, " <ConfigurationAppControlAppId>%s</ConfigurationAppControlAppId>", pCharacters); + + return true; +} diff --git a/src/XmlHandler/Parser/ManifestLiveboxesParser.h b/src/XmlHandler/Parser/ManifestLiveboxesParser.h new file mode 100755 index 0000000..ad61c64 --- /dev/null +++ b/src/XmlHandler/Parser/ManifestLiveboxesParser.h @@ -0,0 +1,70 @@ +// +// Open Service Platform +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +/** + * @file ManifestLiveboxesParser.h + * @brief This is the header file for the %ManifestLiveboxesParser class. + * + * This header file contains the declarations of the %ManifestLiveboxesParser class. + */ +#ifndef _MANIFEST_LIVEBOXES_PARSER_H_ +#define _MANIFEST_LIVEBOXES_PARSER_H_ + +#include <FBaseString.h> + +#include <FAppPkg_PackageInfoImpl.h> + +#include "ManifestParser.h" +#include "InstallationContext.h" + +/** + * @class ManifestLiveboxesParser + * @brief This class represents the class of ManifestLiveboxesParser. + * @since 1.0 + * + * This class represents the class of ManifestLiveboxesParser. + * + */ +class ManifestLiveboxesParser + : public ManifestParser +{ +public: + ManifestLiveboxesParser(void); + virtual ~ManifestLiveboxesParser(void); + + virtual bool OnStartElement(const char *pName); + virtual bool OnEndElement(const char *pName); + virtual bool OnCharacters(const char *pCharacters); + +private: + bool OnLiveboxesStartElement(void); + bool OnLiveboxStartElement(void); + + bool OnLiveboxesEndElement(void); + bool OnLiveboxEndElement(void); + + bool OnSizeValue(const char *pCharacters); + bool OnDisplayNameValue(const char *pCharacters); + bool OnConfigurationAppControlAppIdValue(const char* pCharacters); + +private: + InstallationContext* __pContext; + Tizen::Base::Collection::ArrayList* __pLiveboxDataList; + LiveboxData* __pLiveboxData; + +}; // ManifestLiveboxesParser + +#endif // _MANIFEST_LIVEBOXES_PARSER_H_ diff --git a/src/XmlHandler/Parser/ManifestParser.cpp b/src/XmlHandler/Parser/ManifestParser.cpp new file mode 100755 index 0000000..f5be175 --- /dev/null +++ b/src/XmlHandler/Parser/ManifestParser.cpp @@ -0,0 +1,77 @@ +// +// Open Service Platform +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +/** + * @file ManifestParser.cpp + * @brief This is the implementation file for %ManifestParser class. + */ + +#include <FIoFile.h> +#include <FSys_SystemInfoImpl.h> +#include <FAppPkg_PackageInfoImpl.h> +#include <FBase_StringConverter.h> + +#include "ManifestParser.h" +#include "InstallerUtil.h" + +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Base::Utility; +using namespace Tizen::App::Package; +using namespace Tizen::Io; +using namespace Tizen::System; + +ManifestParser::ManifestParser(void) +:__pManifestHandler(null) +{ +} + +ManifestParser::~ManifestParser(void) +{ +} + +bool +ManifestParser::Construct(ManifestHandler* pManifestHandler) +{ + __pManifestHandler = pManifestHandler; + + return true; +} + +ManifestHandler* +ManifestParser::GetHandler(void) +{ + return __pManifestHandler; +} + +bool +ManifestParser::OnStartElement(const char *pName) +{ + return true; +} + +bool +ManifestParser::OnEndElement(const char *pName) +{ + return true; +} + +bool +ManifestParser::OnCharacters(const char *pCharacters) +{ + return true; +} + diff --git a/src/XmlHandler/Parser/ManifestParser.h b/src/XmlHandler/Parser/ManifestParser.h new file mode 100755 index 0000000..2033d6f --- /dev/null +++ b/src/XmlHandler/Parser/ManifestParser.h @@ -0,0 +1,60 @@ +// +// Open Service Platform +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +/** + * @file ManifestParser.h + * @brief This is the header file for the %ManifestParser class. + * + * This header file contains the declarations of the %ManifestParser class. + */ +#ifndef _MANIFEST_PARSER_H_ +#define _MANIFEST_PARSER_H_ + +#include <FBaseString.h> + +#include <FAppPkg_PackageInfoImpl.h> + +#include "InstallationContext.h" + +class ManifestHandler; + +/** + * @class ManifestParser + * @brief This class represents the class of ManifestParser. + * @since 1.0 + * + * This class represents the class of ManifestParser. + * + */ +class ManifestParser +{ +public: + ManifestParser(void); + virtual ~ManifestParser(void); + + bool Construct(ManifestHandler* pManifestHandler); + ManifestHandler* GetHandler(void); + + virtual bool OnStartElement(const char *pName); + virtual bool OnEndElement(const char *pName); + virtual bool OnCharacters(const char *pCharacters); + +private: + ManifestHandler* __pManifestHandler; + +}; // ManifestParser + +#endif // _MANIFEST_PARSER_H_ diff --git a/src/XmlHandler/XmlHandler.h b/src/XmlHandler/XmlHandler.h index 57ddba5..1a4ed3b 100644..100755 --- a/src/XmlHandler/XmlHandler.h +++ b/src/XmlHandler/XmlHandler.h @@ -63,6 +63,11 @@ public: void SetError(void); bool GetError(void); + char* GetElementName(void); + XmlAttribute* GetAttribute(void); + Tizen::Base::Collection::IEnumerator* GetElementEnumeratorN(void); + int GetElementCount(void); + protected: bool ParseDocument(const char *pFilepath); bool ParseNormalizedDocument(const char* pFilepath); @@ -70,16 +75,11 @@ protected: int Normalize(const char* pBuf, int size, char* pNormalizedBuf); bool SetElementName(const char *pElementName); - char* GetElementName(void); void DeleteElement(void); void SetAttribute(XmlAttribute *pAttr); - XmlAttribute* GetAttribute(void); void DeleteAttribute(void); - Tizen::Base::Collection::IEnumerator* GetElementEnumeratorN(void); - int GetElementCount(void); - private: XmlHandler(const XmlHandler& value); XmlHandler& operator =(const XmlHandler& source); diff --git a/src/XmlHandler/XmlWriter.cpp b/src/XmlHandler/XmlWriter.cpp index 4fe216f..db0db70 100755 --- a/src/XmlHandler/XmlWriter.cpp +++ b/src/XmlHandler/XmlWriter.cpp @@ -51,7 +51,7 @@ XmlWriter::~XmlWriter(void) err = xmlTextWriterEndDocument(__pXmlWriter); if (err != 0) { - AppLogTag(OSP_INSTALLER, "xmlTextWriterEndDocument() is failed"); + AppLogTag(OSP_INSTALLER, "xmlTextWriterEndDocument() is failed(%d)", err); } File file; |