2 * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 ////////////////////////////////////////////////////////////////////////////////////////////////////
18 /// \ingroup tag_NS_ConfigParser
19 /// \brief This file contains declaration of class CCFGReader.
21 ////////////////////////////////////////////////////////////////////////////////////////////////////
23 #ifndef FRAMEWORK_UNIFIED_CLIENT_NS_CONFIGPARSER_INCLUDE_NS_CFG_READER_H_
24 #define FRAMEWORK_UNIFIED_CLIENT_NS_CONFIGPARSER_INCLUDE_NS_CFG_READER_H_
26 ////////////////////////////////////////////////////////////////////////////////////////////////////
28 ////////////////////////////////////////////////////////////////////////////////////////////////////
29 #include <native_service/ns_reader.h>
35 * This class provides functionalities to read from CFG config file
37 class CCFGReader: public IConfigReader {
39 ////////////////////////////////////////////////////////////////////////////////////////////////
41 /// Constructor of CCFGReader class
47 ////////////////////////////////////////////////////////////////////////////////////////////////
50 ////////////////////////////////////////////////////////////////////////////////////////////////
52 /// Constructor of CCFGReader class
54 /// \param [IN] f_c_filepath
55 /// std::string - Full path of the configuration file
59 ////////////////////////////////////////////////////////////////////////////////////////////////
60 explicit CCFGReader(const std::string &f_c_filepath);
62 ////////////////////////////////////////////////////////////////////////////////////////////////
64 /// Destructor of CCFGReader class
70 ////////////////////////////////////////////////////////////////////////////////////////////////
73 ////////////////////////////////////////////////////////////////////////////////////////////////
75 /// This function is used to parse the file
77 /// \param [IN] f_c_filepath
78 /// std::string - path of file to parse
80 /// \return EFrameworkunifiedStatus - success or failure
82 ////////////////////////////////////////////////////////////////////////////////////////////////
83 EFrameworkunifiedStatus ParseFile(const std::string &f_c_filepath);
85 ////////////////////////////////////////////////////////////////////////////////////////////////
87 /// This function is used to get the value associated with the key
89 /// \param [IN] f_c_key
90 /// std::string - key to search
92 /// \return std::string - value for key
94 ////////////////////////////////////////////////////////////////////////////////////////////////
95 std::string GetValue(const std::string &f_c_key);
97 ////////////////////////////////////////////////////////////////////////////////////////////////
99 /// This function is used to get the value associated with the key
101 /// \param [IN] f_c_key
102 /// std::string - key to search
103 /// \param [REF] f_c_value
104 /// std::string - Value of key
106 /// \return EFrameworkunifiedStatus
107 /// EFrameworkunifiedStatus - error if key not found else eFrameworkunifiedStatusOK
109 ////////////////////////////////////////////////////////////////////////////////////////////////
110 EFrameworkunifiedStatus GetValue(const std::string &f_c_key, std::string &f_c_value); // NOLINT (readability/nolint)
112 ////////////////////////////////////////////////////////////////////////////////////////////////
114 /// This function is used to get the data pointer. This pointer is then set in config writer.
115 /// This is needed to avoid recreation of same data structure object in both reader and writer
116 /// when we create object of NSConfigParser.
120 /// \return PVOID - pointer of data structure
122 ////////////////////////////////////////////////////////////////////////////////////////////////
126 // path of config file
127 std::string m_cFilePath;
129 // CFG file parser object
130 CCFGParser *m_pCFGParser;
133 #endif // FRAMEWORK_UNIFIED_CLIENT_NS_CONFIGPARSER_INCLUDE_NS_CFG_READER_H_