AnCH Framework 0.2
Another C++ Hack: C++23 utility libraries
Loading...
Searching...
No Matches
section.hpp
1/*
2 ANCH Framework: ANother C++ Hack is a C++ framework based on C++23 standard
3 Copyright (C) 2012 Vincent Lachenal
4
5 This file is part of ANCH Framework.
6
7 ANCH Framework is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser 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.
11
12 ANCH Framework is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with ANCH Framework. If not, see <https://www.gnu.org/licenses/>.
19*/
20#pragma once
21
22#include "anch-ini-export.hpp"
23
24#include <map>
25#include <string>
26#include <optional>
27#include <filesystem>
28
29
30namespace anch::ini {
31
41 class ANCH_INI_EXPORT Section {
42
43 // Attributes +
44 private:
46 std::map<std::string, Section> _sections;
47
49 std::map<std::string, std::string> _values;
50 // Attributes -
51
52 // Constructors +
53 public:
58
65
72 // Constructors -
73
74 // Destructor +
75 public:
79 virtual ~Section();
80 // Destructor -
81
82 // Methods +
83 public:
84 // Getters +
90 const std::map<std::string, Section>& getSections() const;
91
97 const std::map<std::string, std::string>& getValues() const;
98
108 static std::optional<std::string> getValue(const std::string& path, const Section& section);
109
120 template<typename T>
121 std::optional<T> getValue(const std::string& key) const;
122
134 template<typename T>
135 T getValue(const std::string& key, const T& defaultValue) const;
136 // Getters -
137
138 // Modifiers +
146 Section& section(const std::string& key);
147
157 Section& putValue(const std::string& key, const std::string& value);
158 // Modifiers -
159
160 public:
166 std::string debug() const;
167
168 // Operators +
169 public:
177 Section& operator = (const Section& other);
178 // Operators -
179 // Methods -
180
181 };
182
183}
184
185#include "ini/impl/section.hpp"
std::string debug() const
Section & section(const std::string &key)
static std::optional< std::string > getValue(const std::string &path, const Section &section)
std::optional< T > getValue(const std::string &key) const
T getValue(const std::string &key, const T &defaultValue) const
Section & putValue(const std::string &key, const std::string &value)
const std::map< std::string, std::string > & getValues() const
Section(const Section &section)
Section(Section &&section)
const std::map< std::string, Section > & getSections() const
AnCH INI library namespace.