Diag-Client-Lib
json_parser.h
Go to the documentation of this file.
1 /* Diagnostic Client library
2  * Copyright (C) 2024 Avijit Dey
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7  */
8 #ifndef DIAGNOSTIC_CLIENT_LIB_LIB_BOOST_SUPPORT_PARSER_JSON_PARSER_H
9 #define DIAGNOSTIC_CLIENT_LIB_LIB_BOOST_SUPPORT_PARSER_JSON_PARSER_H
10 // includes
11 #include <boost/property_tree/json_parser.hpp>
12 #include <boost/property_tree/ptree.hpp>
13 #include <string_view>
14 
15 #include "core/include/result.h"
16 
17 namespace boost_support {
18 namespace parser {
19 
23 using boost_tree = boost::property_tree::ptree;
24 
28 enum class ParsingErrorCode : std::uint8_t { kError = 0U };
29 
38 core_type::Result<void, ParsingErrorCode> Read(std::string_view config_path, boost_tree &json_tree);
39 
40 } // namespace parser
41 } // namespace boost_support
42 
43 #endif // DIAGNOSTIC_CLIENT_LIB_LIB_BOOST_SUPPORT_PARSER_JSON_PARSER_H
Class type to contains a value (of type ValueType), or an error (of type ErrorType)
Definition: result.h:29
ParsingErrorCode
Definitions of Parsing failure error codes.
Definition: json_parser.h:28
core_type::Result< void, ParsingErrorCode > Read(std::string_view config_path, boost_tree &json_tree)
Parser to get the configuration from json file.
Definition: json_parser.cpp:16
boost::property_tree::ptree boost_tree
Type alias for boost property tree.
Definition: json_parser.h:23