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