X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=low-can-binding%2Futils%2Fconfig-parser.hpp;h=4553be2dd704fb35d6702e403ad01ab7b1ad7020;hb=7ea53d8a89912cd0ab00fa4c0957f40ee6c9db8a;hp=e6bd9d22f490ad6cf835b07fecf4b60b122e8705;hpb=a58d40b5ae336a54408201963b065ee049b43acd;p=apps%2Fagl-service-can-low-level.git diff --git a/low-can-binding/utils/config-parser.hpp b/low-can-binding/utils/config-parser.hpp index e6bd9d22..4553be2d 100644 --- a/low-can-binding/utils/config-parser.hpp +++ b/low-can-binding/utils/config-parser.hpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015, 2016 ,2017 "IoT.bzh" + * Copyright (C) 2015, 2016 , 2017, 2018, 2019 "IoT\.bzh" * Author "Romain Forlot" * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,27 +17,28 @@ #pragma once -#include -#include -#include -#include - #include +#include +#include +#include "ini-config.hpp" namespace utils { + /// @brief A configuration file parser that handle INI configuration + /// file format. class config_parser_t { private: - int conf_file_; /*!< conf_file_ - file that handle the binding configuration file */ - std::string config_content_; /*!< config_content_ - String that contains the content of config file */ - std::vector devices_name_; /*!< devices_name - Found devices name after reading configuration file */ + const std::string filepath_; /*!< filepath_ - Path to the config file*/ + ini_config config_content_; /*!< config_content_ - Parsed content of INI file.*/ - void parse_devices_name(); public: - config_parser_t(int conf_file); + config_parser_t(config_parser_t&&) = default; + config_parser_t(const config_parser_t&) = default; + explicit config_parser_t(std::string conf_file); - void read_conf(); - std::vector get_devices_name(); + const std::string& filepath() const; + bool check_conf(); + const std::vector > get_devices_name(); }; }