cpp-hocon 0.3.0
Loading...
Searching...
No Matches
config_delayed_merge_object.hpp
1#pragma once
2
3#include <hocon/config_object.hpp>
4#include <hocon/config_exception.hpp>
5#include <internal/replaceable_merge_stack.hpp>
6#include <internal/values/config_delayed_merge.hpp>
7
8namespace hocon {
9
11 public:
12 config_delayed_merge_object(shared_origin origin, std::vector<shared_value> const& stack);
13
14 resolve_result<shared_value> resolve_substitutions(resolve_context const& context, resolve_source const& source) const override;
15 std::vector<shared_value> unmerged_values() const override;
16 shared_value make_replacement(resolve_context const& context, int skipping) const override;
17
18 shared_object with_value(path raw_path, shared_value value) const override;
19 shared_object with_value(std::string key, shared_value value) const override;
20
21 resolve_status get_resolve_status() const override { return resolve_status::UNRESOLVED; }
22
23 std::vector<std::string> key_set() const override { throw not_resolved(); }
24
25 // map interface
26 bool is_empty() const override { throw not_resolved(); }
27 size_t size() const override { throw not_resolved(); }
28 shared_value operator[](std::string const& key) const override { throw not_resolved(); }
29 shared_value get(std::string const& key) const override { throw not_resolved(); }
30 iterator begin() const override { throw not_resolved(); }
31 iterator end() const override { throw not_resolved(); }
32 unwrapped_value unwrapped() const override;
33
34 bool operator==(config_value const& other) const override;
35
36 // container interface
37 shared_value replace_child(shared_value const& child, shared_value replacement) const override;
38 bool has_descendant(shared_value const& descendant) const override;
39
40
41 protected:
42 shared_value attempt_peek_with_partial_resolve(std::string const& key) const override;
43 std::unordered_map<std::string, shared_value> const& entry_set() const override;
44 shared_object without_path(path raw_path) const override;
45 shared_object with_only_path(path raw_path) const override;
46 shared_object with_only_path_or_null(path raw_path) const override;
47 shared_object new_copy(resolve_status const& status, shared_origin origin) const override;
48 bool ignores_fallbacks() const override;
49 virtual void render(std::string& result, int indent, bool at_root, std::string const& at_key, config_render_options options) const override;
50 virtual void render(std::string& result, int indent, bool at_root, config_render_options options) const override;
51
52 private:
53 not_resolved_exception not_resolved() const;
54
55 const std::vector<shared_value> _stack;
56 };
57
58} // namespace hocon::config_delayed_merge_object
59
bool has_descendant(shared_value const &descendant) const override
Super-expensive full traversal to see if descendant is anywhere underneath this container.
std::vector< std::string > key_set() const override
Construct a list of keys in the _value map.
shared_value attempt_peek_with_partial_resolve(std::string const &key) const override
Look up the key on an only-partially-resolved object, with no transformation or type conversion of an...
shared_value replace_child(shared_value const &child, shared_value replacement) const override
Replace a child of this value.
virtual shared_origin const & origin() const
The origin of the value (file, line number, etc.), for debugging and error messages.
shared_config at_key(std::string const &key) const
Places the value inside a config at the given key.
virtual std::string render() const
Renders the config value as a HOCON string.
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
Exception indicating that you tried to use a function that requires substitutions to be resolved,...