cpp-hocon 0.3.0
Loading...
Searching...
No Matches
config_concatenation.hpp
1#pragma once
2
3#include <hocon/config_value.hpp>
4#include <internal/unmergeable.hpp>
5#include <internal/container.hpp>
6#include <string>
7#include <vector>
8
9namespace hocon {
10
11 struct config_exception;
12
24 class config_concatenation : public config_value, public unmergeable, public container {
25 public:
26 config_concatenation(shared_origin origin, std::vector<shared_value> pieces);
27
29 std::vector<shared_value> unmerged_values() const override;
30
31 resolve_status get_resolve_status() const override;
32
33 shared_value replace_child(shared_value const& child, shared_value replacement) const override;
34 bool has_descendant(shared_value const& descendant) const override;
35 resolve_result<shared_value> resolve_substitutions(resolve_context const& context, resolve_source const& source) const override;
36
37 static std::vector<shared_value> consolidate(std::vector<shared_value> pieces);
38 static shared_value concatenate(std::vector<shared_value> pieces);
39 shared_value relativized(std::string prefix) const override;
40
41 unwrapped_value unwrapped() const override;
42
43 bool operator==(config_value const& other) const override;
44
45 protected:
46 shared_value new_copy(shared_origin origin) const override;
47 bool ignores_fallbacks() const override;
48 void render(std::string& result, int indent, bool at_root, config_render_options options) const override;
49
50 private:
51 std::vector<shared_value> _pieces;
52
53 config_exception not_resolved() const;
54 static bool is_ignored_whitespace(shared_value value);
55 static void join(std::vector<shared_value> & builder, shared_value right);
56 };
57
58} // namespace hocon
59
A ConfigConcatenation represents a list of values to be concatenated (see the spec).
shared_value relativized(std::string prefix) const override
This is used when including one file in another; the included file is relativized to the path it's in...
shared_value replace_child(shared_value const &child, shared_value replacement) const override
Replace a child of this value.
config_value::type value_type() const override
The type of the value; matches the JSON type schema.
bool has_descendant(shared_value const &descendant) const override
Super-expensive full traversal to see if descendant is anywhere underneath this container.
An immutable value, following the JSON type schema.
virtual shared_origin const & origin() const
The origin of the value (file, line number, etc.), for debugging and error messages.
type
The type of a configuration value (following the JSON type schema).
virtual std::string render() const
Renders the config value as a HOCON string.
An AbstractConfigValue which contains other values.
Definition: container.hpp:12
Interface that tags a ConfigValue that is not mergeable until after substitutions are resolved.
Definition: unmergeable.hpp:14
Factory for creating config_document instances.
Definition: config.hpp:18
All exceptions thrown by the library are subclasses of config_exception.