AnCH Framework 0.1
Another C++ Hack Framework
Loading...
Searching...
No Matches
section.hpp
1/*
2 ANCH Framework: ANother C++ Hack is a C++ framework based on C++11 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 <http://www.gnu.org/licenses/>.
19*/
20#pragma once
21
22#include <map>
23#include <string>
24#include <optional>
25#include <filesystem>
26
27
28namespace anch::ini {
29
39 class Section {
40
41 // Attributes +
42 private:
44 std::map<std::string, Section> _sections;
45
47 std::map<std::string, std::string> _values;
48 // Attributes -
49
50 // Constructors +
51 public:
56
63
70 // Constructors -
71
72 // Destructor +
73 public:
77 virtual ~Section();
78 // Destructor -
79
80 // Methods +
81 public:
82 // Getters +
88 const std::map<std::string, Section>& getSections() const;
89
95 const std::map<std::string, std::string>& getValues() const;
96
106 static std::optional<std::string> getValue(const std::string& path, const Section& section);
107
117 template<typename T>
118 std::optional<T> getValue(const std::string& key) const;
119
130 template<typename T>
131 T getValue(const std::string& key, const T& defaultValue) const;
132 // Getters -
133
134 // Modifiers +
142 Section& section(const std::string& key);
143
153 Section& putValue(const std::string& key, const std::string& value);
154 // Modifiers -
155
156 public:
162 std::string debug() const;
163
164 // Operators +
165 public:
174 // Operators -
175 // Methods -
176
177 };
178
179}
180
181#include "ini/impl/section.hpp"
Section & operator=(const Section &other)
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