source code open
[framework/security/cert-svc.git] / vcore / src / vcore / Config.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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 #ifndef _SRC_VALIDATION_CORE_VALIDATION_CORE_CONFIG_H_
18 #define _SRC_VALIDATION_CORE_VALIDATION_CORE_CONFIG_H_
19
20 #include <string>
21
22 #include <dpl/singleton.h>
23
24 namespace ValidationCore {
25 class Config {
26 public:
27     /*
28      * Set path to config file with certificate description.
29      */
30     bool setXMLConfigPath(const std::string& path) {
31         if (!m_certificateXMLConfigPath.empty()) {
32             return false;
33         }
34         m_certificateXMLConfigPath = path;
35         return true;
36     }
37
38     /*
39      * Set path to schema of config file.
40      */
41     bool setXMLSchemaPath(const std::string& path) {
42         if (!m_certificateXMLSchemaPath.empty()) {
43             return false;
44         }
45         m_certificateXMLSchemaPath = path;
46         return true;
47     }
48
49     /*
50      * Get path to config file with certificate description.
51      */
52     std::string getXMLConfigPath() {
53         return m_certificateXMLConfigPath;
54     }
55
56     /*
57      * Get path to schema of config file.
58      */
59     std::string getXMLSchemaPath() {
60         return m_certificateXMLSchemaPath;
61     }
62
63 private:
64     std::string m_certificateXMLConfigPath;
65     std::string m_certificateXMLSchemaPath;
66 };
67
68 typedef DPL::Singleton<Config> ConfigSingleton;
69
70 } // namespace ValidationCore
71
72 #endif // _SRC_VALIDATION_CORE_VALIDATION_CORE_CONFIG_H_
73