Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / resource / FUi_ResourceConfigParser.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.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
8 //
9 //     http://floralicense.org/license/
10 //
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.
16 //
17 /**
18  * @file                FUi_ResourceConfigParser.h
19  * @brief               This is the header file for ConfigParser class.
20  * @version             3.0
21  *
22  * This header file contains declaration of ConfigParser class.
23  *
24  */
25 #ifndef _FUI_INTERNAL_RESOURCE_CONFIG_PARSER_H_
26 #define _FUI_INTERNAL_RESOURCE_CONFIG_PARSER_H_
27
28 #include <libxml/tree.h>
29
30 namespace Tizen { namespace Base
31 {
32         class String;
33 }}
34
35 namespace Tizen { namespace Base { namespace Collection
36 {
37         template<class KeyType, class ValueType> class HashMapT;
38 }}}
39
40 namespace Tizen { namespace Graphics
41 {
42         class Color;
43 }}
44
45 namespace Tizen { namespace Ui { namespace _Resource
46 {
47 class MapContainer;
48
49 class ConfigParser
50 {
51 public:
52         ConfigParser(void);
53         ~ConfigParser(void);
54         bool Parse(const Tizen::Base::String& filename, MapContainer & table);
55         static void StartSaxFunc(void* pXmlParserCtxt, const xmlChar* pName, const xmlChar** pAttributes);
56         static Tizen::Base::Collection::HashMapT<Tizen::Base::String, Tizen::Base::String*>* GetMatchingTable(void);
57
58         class ColorMatchingMap
59                 : public Tizen::Base::Collection::HashMapT<Tizen::Base::String, Tizen::Base::String*>
60         {
61         public:
62                 ColorMatchingMap(void);
63                 virtual ~ColorMatchingMap(void);
64                 bool Initialize(const Tizen::Base::String& version, const Tizen::Base::String& dVersion = L"");
65         private:
66                 Tizen::Base::Collection::IHashCodeProviderT<Tizen::Base::String>* __pProvider;
67                 Tizen::Base::Collection::IComparerT<Tizen::Base::String>* __pComparer;
68         };
69
70 private:
71         void SetInformation(const xmlChar** pAttributes);
72         void StartAttribute(const xmlChar** pAttributes);
73         void AddColor(const xmlChar** pAttributes);
74         void AddImage(const xmlChar** pAttributes);
75         void SetColorMatchingMap(const Tizen::Base::String& version);
76         void ConvertStringToColor32(const char* pString, Tizen::Graphics::Color& color);
77         void GetValue(const Tizen::Base::String& value, Tizen::Base::String& out);
78         void GetValue(const Tizen::Base::String& value, Tizen::Graphics::Color& out);
79
80         MapContainer* __pMapContainer;
81         Tizen::Base::String __currentAttribute;
82 }; //class ConfigParser
83
84 }}}//Tizen::Ui
85
86 #endif //_FUI_INTERNAL_RESOURCE_CONFIG_PARSER_H_