Merge "[ACR][01/10/2013][Add|Deprecate]Adding ToInt8() method in Number, Int8, Intege...
[platform/framework/native/appfw.git] / src / security / inc / FSec_PrivilegeInfoImpl.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        FSec_PrivilegeInfoImpl.h
19  * @brief       This is the header file for the _PrivilegeInfoImpl class.
20  */
21
22 #ifndef _FSEC_INTERNAL_PRIVILEGE_INFO_IMPL_H_
23 #define _FSEC_INTERNAL_PRIVILEGE_INFO_IMPL_H_
24
25
26 #include <FBaseObject.h>
27 #include <FBaseString.h>
28 #include <FOspConfig.h>
29 #include <FBaseInternalTypes.h>
30
31 namespace Tizen { namespace Io
32 {
33 class Database;
34 class DbStatement;
35 class DbEnumerator;
36 }}
37
38 namespace Tizen { namespace Security
39 {
40
41 class PrivilegeInfo;
42
43 static const int MAX_DATABASE_RETRY_COUNT = 30;
44 static const wchar_t EXTERNAL_PRIVILEGE_DATABASE_FILE_NAME[] = L"/opt/dbspace/.privilegelist.db";
45
46 class _OSP_EXPORT_ _PrivilegeInfoImpl
47         : public Tizen::Base::Object
48 {
49 public:
50         Tizen::Base::String GetDescription(const Tizen::Base::String& privilege) const;
51         Tizen::Base::String GetName(const Tizen::Base::String& privilege) const;
52
53         _PrivilegeInfoImpl(void);
54         virtual ~_PrivilegeInfoImpl(void);
55         result Construct(const Tizen::Base::String& privilegeId);
56         Tizen::Base::String GetId(void) const;
57         Tizen::Base::String GetDisplayName(void) const;
58         Tizen::Base::String GetDescription(void) const;
59
60 private:
61
62         Tizen::Io::Database* __pDb;
63
64         static _PrivilegeInfoImpl* __pPrivilegeInfoImplInstance;
65
66         bool CheckExternalPrivilege(const Tizen::Base::String& privilegeId);
67         static Tizen::Io::DbStatement* CreateStatementN(Tizen::Io::Database& db, const Tizen::Base::String& query);
68         static Tizen::Io::DbEnumerator* ExecuteStatementN(Tizen::Io::Database& db, const Tizen::Io::DbStatement* pStmt);
69
70         friend class PrivilegeInfo;
71
72 private:
73         Tizen::Base::String __privilegeId;
74
75
76 }; // _PrivilegeInfoImpl
77
78 } } // Tizen::Security
79
80 #endif // _FSEC_INTERNAL_PRIVILEGE_INFO_IMPL_H_