AnCH Framework 0.1
Another C++ Hack Framework
Loading...
Searching...
No Matches
placeholders.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 <string>
23#include <map>
24
25#include "conf/section.hpp"
26#include "conf/confError.hpp"
27#include "conf/subplaceholder.hpp"
28
29#include "events/observable.hpp"
30
31namespace anch::conf {
32
33 struct ConfPlaceholders;
34
44 class Placeholders: anch::events::Observable<anch::conf::ResConfEvt> {
45
46 // Attributes +
47 private:
49 anch::conf::Section& _section;
50
52 std::map<std::string, anch::conf::ConfPlaceholders> _values;
53 // Attributes -
54
55 // Constructors +
56 public:
60 Placeholders() = delete;
61
67 Placeholders(const Placeholders& other) = delete;
68
74 Placeholders(Placeholders&& other) = delete;
75
81 Placeholders(anch::conf::Section& section) noexcept;
82 // Constructors -
83
84 // Destructor +
88 virtual ~Placeholders() noexcept;
89 // Destructor -
90
91 // Methods +
92 public:
100 bool collect();
101
107 void resolve();
108
109 private:
118 void collect(anch::conf::Section& section, const std::string& path = "");
119
128 void parsePlaceholder(anch::conf::ConfPlaceholders& cph, const std::string& placeholder);
129 // Methods -
130
131 };
132
133}
134
135#include "impl/placeholders.hpp"
virtual ~Placeholders() noexcept
Placeholders(const Placeholders &other)=delete
Placeholders(Placeholders &&other)=delete
Placeholders(anch::conf::Section &section) noexcept
An observable implementation of the observers/observable design pattern.
Definition observable.hpp:44
AnCH framework base namespace.
Definition app.hpp:28