2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file FAppPkg_PackageParser.h
19 * @brief This is the header file for the _PackageParser class.
22 #ifndef _FAPP_PKG_INTERNAL_PACKAGE_PARSER_H_
23 #define _FAPP_PKG_INTERNAL_PACKAGE_PARSER_H_
25 #include <libxml/xmlstring.h>
27 namespace Tizen { namespace App { namespace Package
30 class _PackageInfoImpl;
31 class _PackageAppInfoImpl;
33 class _PackageXmlAttribute
36 _PackageXmlAttribute(void);
37 virtual ~_PackageXmlAttribute(void);
39 bool Construct(const char* pName, const char* pValue);
41 char* Find(const char* pName);
42 bool Add(const char* pName, const char* pValue);
45 _PackageXmlAttribute(const _PackageXmlAttribute& value);
46 _PackageXmlAttribute& operator =(const _PackageXmlAttribute& source);
50 _PackageXmlAttribute* __pNext;
52 }; // _PackageXmlAttribute
55 class _PackageXmlHandler
58 _PackageXmlHandler(void);
59 virtual ~_PackageXmlHandler(void);
61 virtual bool OnStartDocument(void);
62 virtual bool OnEndDocument(void);
63 virtual bool OnStartElement(const char* pName);
64 virtual bool OnEndElement(const char* pName);
65 virtual bool OnCharacters(const char* pCharacters);
70 char* GetElementName(void);
71 _PackageXmlAttribute* GetAttribute(void);
72 Tizen::Base::Collection::IEnumerator* GetElementEnumeratorN(void);
73 int GetElementCount(void);
76 bool ParseNormalizedDocument(const char* pFilepath);
77 int Normalize(const char* pBuf, int size, char* pNormalizedBuf);
79 bool SetElementName(const char* pElementName);
80 void DeleteElement(void);
82 bool SetCharacters(const char* pCharacter);
83 char* GetCharacters(void);
84 void DeleteCharacters(void);
86 void SetAttribute(_PackageXmlAttribute* pAttr);
87 void DeleteAttribute(void);
90 _PackageXmlHandler(const _PackageXmlHandler& value);
91 _PackageXmlHandler& operator =(const _PackageXmlHandler& source);
93 static void StartDocument(void* pCtx);
94 static void EndDocument(void* pCtx);
96 static void StartElement(void* pCtx, const xmlChar* pName, const xmlChar** ppAtts);
97 static void EndElement(void* pCtx, const xmlChar* pName);
98 static void Characters(void* pCtx, const xmlChar* pCh, int len);
100 _PackageXmlAttribute* __pAttr;
101 char* __pElementName;
105 Tizen::Base::Collection::Stack __elementStack;
107 }; // _PackageXmlHandler
111 : public _PackageXmlHandler
114 _PackageParser(void);
115 virtual ~_PackageParser(void);
117 bool Construct(PackageInfo* pPackageInfo);
118 bool Parse(const Tizen::Base::String& packagepath);
121 _PackageParser(const _PackageParser& value);
122 _PackageParser& operator =(const _PackageParser& source);
124 virtual bool OnStartElement(const char* pName);
125 virtual bool OnEndElement(const char* pName);
126 virtual bool OnCharacters(const char* pCharacters);
128 bool OnUiAppStartElement(void);
129 bool OnServiceAppStartElement(void);
130 bool OnIconsStartElement(void);
132 bool OnUiAppEndElement(void);
133 bool OnServiceAppEndElement(void);
134 bool OnDisplayNamesEndElement(void);
136 bool OnIdValue(const char* pCharacters);
137 bool OnVersionValue(const char* pCharacters);
138 bool OnAuthorValue(const char* pCharacters);
139 bool OnUrlValue(const char* pCharacters);
140 bool OnPrivilegeValue(const char* pCharacters);
141 bool OnIconValue(const char* pCharacters);
142 bool OnDisplayNameValue(const char* pCharacters);
143 bool OnDescriptionValue(const char* pCharacters);
144 bool OnCategoryValue(const char* pCharacters);
146 bool ParseAppAttribute(_PackageXmlAttribute* pAttr, bool isUiApp);
149 _PackageInfoImpl* __pPackageInfoImpl;
150 PackageAppInfo* __pAppInfo;
152 Tizen::Base::String __packagePath;
154 char* __pDefaultIconType;
155 bool __isDefaultName;
158 } } } // Tizen::App::Package
160 #endif // _FAPP_PKG_INTERNAL_PACKAGE_PARSER_H_