crawlserv++  [under development]
Application for crawling and analyzing textual content of websites.
ConfigItem.hpp
Go to the documentation of this file.
1 /*
2  *
3  * ---
4  *
5  * Copyright (C) 2020 Anselm Schmidt (ans[ät]ohai.su)
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version in addition to the terms of any
11  * licences already herein identified.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <https://www.gnu.org/licenses/>.
20  *
21  * ---
22  *
23  * ConfigItem.hpp
24  *
25  * Configuration item (category, name and JSON value).
26  *
27  * Created on: Mar 9, 2019
28  * Author: ans
29  */
30 
31 #ifndef STRUCT_CONFIGITEM_HPP_
32 #define STRUCT_CONFIGITEM_HPP_
33 
34 #include "../_extern/rapidjson/include/rapidjson/document.h"
35 
36 #include <string> // std::string
37 
38 namespace crawlservpp::Struct {
39 
41  struct ConfigItem {
44 
46  std::string category;
47 
49  std::string name;
50 
52  const rapidjson::Value * value{nullptr};
53 
57 
59 
63  [[nodiscard]] std::string str() const {
64  return std::string(category + "." + name);
65  }
66 
70 
72  ConfigItem() = default;
73 
75  virtual ~ConfigItem() = default;
76 
78 
81 
84  ConfigItem(ConfigItem&) = delete;
85 
87  ConfigItem& operator=(ConfigItem&) = delete;
88 
90  ConfigItem(ConfigItem&&) = default;
91 
93  ConfigItem& operator=(ConfigItem&&) = default;
94 
96  };
97 
98 } /* namespace crawlservpp::Struct */
99 
100 #endif /* STRUCT_CONFIGITEM_HPP_ */
const rapidjson::Value * value
JSON value of the configuration item, or nullptr if not initialized.
Definition: ConfigItem.hpp:52
std::string category
Category of the configuration item.
Definition: ConfigItem.hpp:46
std::string name
Name of the configuration item.
Definition: ConfigItem.hpp:49
ConfigItem & operator=(ConfigItem &)=delete
Deleted copy assignment operator.
virtual ~ConfigItem()=default
Default destructor.
std::string str() const
Combines category and name into one string.
Definition: ConfigItem.hpp:63
ConfigItem()=default
Default constructor.
Namespace for data structures.
Definition: AlgoThreadProperties.hpp:43
Configuration item containing its category, name, and JSON value.
Definition: ConfigItem.hpp:41