Merge "[2.2.1][P130807-00904] Fail to get the host of the uri which has only ? charac...
[platform/framework/native/appfw.git] / src / app / FApp_AppResourceString.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
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
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
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.
15 //
16
17 /**
18  * @file        FApp_AppResourceString.h
19  * @brief       This is the header file of the _AppResourceString class.
20  */
21
22 #ifndef _FAPP_INTERNAL_APP_RESOURCE_STRING_H_
23 #define _FAPP_INTERNAL_APP_RESOURCE_STRING_H_
24
25 #include <FBaseObject.h>
26 #include <FBaseString.h>
27
28 namespace Tizen { namespace Base { namespace Collection { class HashMap; } } }
29
30 struct _xmlDoc;
31 typedef _xmlDoc* xmlDocPtr;
32
33 namespace Tizen { namespace App
34 {
35
36 class _AppResourceString
37         : public Tizen::Base::Object
38 {
39 public:
40         /**
41         * This is the destructor for this class.
42         *
43         * @since                1.0
44         */
45         virtual ~_AppResourceString(void);
46
47         /**
48         * Gets the string at the specified resource ID.
49         *
50         * @since                1.0
51         * @return               An error code
52         * @param[in]    resourceId              The resource ID describing the String resource
53         * @param[out]   loadedString    The string obtained from the loaded application resource
54         * @exception    E_SUCCESS                                 The method was successful.
55         * @exception    E_FAILURE                       The argument passed is not found.
56         * @exception    E_INVALID_STATE   The state of XML context is not in a valid state.
57         * @exception    E_INVALID_ARG                   The argument passed to a method contains an invalid resource ID.
58         */
59         result GetString(const Tizen::Base::String resourceId, Tizen::Base::String& loadedString);
60
61
62         result Initialize(Tizen::Base::String& resourceFolder);
63         result InitializeStringInfo(Tizen::Base::String& resourceFolder);
64
65         static _AppResourceString* Get_AppResourceStringN(int type, const Tizen::Base::String& value = L"");
66
67
68 private:
69         static bool HasSpecialString(const Tizen::Base::String& resourceStr);
70         static result ConvertToCstyleString(const Tizen::Base::String& resourceStr, Tizen::Base::String& convertedStr);
71         static xmlDocPtr ParseXmlFile(const Tizen::Base::String& path);
72
73 private:
74         /**
75         * This is the default constructor for this class.
76         *
77         * @since        1.0
78         */
79         _AppResourceString(void);
80
81         /**
82         * This is the copy constructor for this class.
83         *
84         * @since        1.0
85         */
86         _AppResourceString(const _AppResourceString& source);
87
88         /**
89          * This is the assignment operator for this class.
90          */
91         _AppResourceString& operator =(const _AppResourceString& source);
92
93 private:
94
95         xmlDocPtr __pDoc;
96         Tizen::Base::Runtime::Mutex* __pLockOfParser;
97         Tizen::Base::Collection::HashMap* __pXmlNodeMap;
98
99 }; // _AppResourceString
100
101 } } // Tizen::App
102
103 #endif // _FAPP_INTERNAL_APP_RESOURCE_STRING_H_