2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FAppPkg_PackageParser.h
20 * @brief This is the header file for the _PackageParser class.
23 #ifndef _FAPP_PKG_INTERNAL_PACKAGE_PARSER_H_
24 #define _FAPP_PKG_INTERNAL_PACKAGE_PARSER_H_
26 #include <libxml/xmlstring.h>
28 namespace Tizen { namespace App { namespace Package
31 class _PackageInfoImpl;
32 class _PackageAppInfoImpl;
34 class _PackageXmlAttribute
37 _PackageXmlAttribute(void);
38 virtual ~_PackageXmlAttribute(void);
40 bool Construct(const char* pName, const char* pValue);
42 char* Find(const char* pName);
43 bool Add(const char* pName, const char* pValue);
46 _PackageXmlAttribute(const _PackageXmlAttribute& value);
47 _PackageXmlAttribute& operator =(const _PackageXmlAttribute& source);
51 _PackageXmlAttribute* __pNext;
53 }; // _PackageXmlAttribute
56 class _PackageXmlHandler
59 _PackageXmlHandler(void);
60 virtual ~_PackageXmlHandler(void);
62 virtual bool OnStartDocument(void);
63 virtual bool OnEndDocument(void);
64 virtual bool OnStartElement(const char* pName);
65 virtual bool OnEndElement(const char* pName);
66 virtual bool OnCharacters(const char* pCharacters);
71 char* GetElementName(void);
72 _PackageXmlAttribute* GetAttribute(void);
73 Tizen::Base::Collection::IEnumerator* GetElementEnumeratorN(void);
74 int GetElementCount(void);
77 bool ParseNormalizedDocument(const char* pFilepath);
78 int Normalize(const char* pBuf, int size, char* pNormalizedBuf);
80 bool SetElementName(const char* pElementName);
81 void DeleteElement(void);
83 bool SetCharacters(const char* pCharacter);
84 char* GetCharacters(void);
85 void DeleteCharacters(void);
87 void SetAttribute(_PackageXmlAttribute* pAttr);
88 void DeleteAttribute(void);
91 _PackageXmlHandler(const _PackageXmlHandler& value);
92 _PackageXmlHandler& operator =(const _PackageXmlHandler& source);
94 static void StartDocument(void* pCtx);
95 static void EndDocument(void* pCtx);
97 static void StartElement(void* pCtx, const xmlChar* pName, const xmlChar** ppAtts);
98 static void EndElement(void* pCtx, const xmlChar* pName);
99 static void Characters(void* pCtx, const xmlChar* pCh, int len);
101 _PackageXmlAttribute* __pAttr;
102 char* __pElementName;
106 Tizen::Base::Collection::Stack __elementStack;
108 }; // _PackageXmlHandler
112 : public _PackageXmlHandler
115 _PackageParser(void);
116 virtual ~_PackageParser(void);
118 bool Construct(PackageInfo* pPackageInfo);
119 bool Parse(const Tizen::Base::String& packagepath);
122 _PackageParser(const _PackageParser& value);
123 _PackageParser& operator =(const _PackageParser& source);
125 virtual bool OnStartElement(const char* pName);
126 virtual bool OnEndElement(const char* pName);
127 virtual bool OnCharacters(const char* pCharacters);
129 bool OnUiAppStartElement(void);
130 bool OnServiceAppStartElement(void);
131 bool OnIconsStartElement(void);
133 bool OnUiAppEndElement(void);
134 bool OnServiceAppEndElement(void);
135 bool OnDisplayNamesEndElement(void);
137 bool OnIdValue(const char* pCharacters);
138 bool OnVersionValue(const char* pCharacters);
139 bool OnAuthorValue(const char* pCharacters);
140 bool OnUrlValue(const char* pCharacters);
141 bool OnPrivilegeValue(const char* pCharacters);
142 bool OnIconValue(const char* pCharacters);
143 bool OnDisplayNameValue(const char* pCharacters);
144 bool OnDescriptionValue(const char* pCharacters);
145 bool OnCategoryValue(const char* pCharacters);
147 bool ParseAppAttribute(_PackageXmlAttribute* pAttr, bool isUiApp);
150 _PackageInfoImpl* __pPackageInfoImpl;
151 PackageAppInfo* __pAppInfo;
153 Tizen::Base::String __packagePath;
155 char* __pDefaultIconType;
156 bool __isDefaultName;
159 } } } // Tizen::App::Package
161 #endif // _FAPP_PKG_INTERNAL_PACKAGE_PARSER_H_