cpp-hocon  0.3.0
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 
8 namespace 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 
hocon::config_value::at_key
shared_config at_key(std::string const &key) const
Places the value inside a config at the given key.
hocon::config_value::origin
virtual shared_origin const & origin() const
The origin of the value (file, line number, etc.), for debugging and error messages.
hocon::config_delayed_merge_object::attempt_peek_with_partial_resolve
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...
hocon::config_delayed_merge_object
Definition: config_delayed_merge_object.hpp:10
hocon::config_delayed_merge_object::replace_child
shared_value replace_child(shared_value const &child, shared_value replacement) const override
Replace a child of this value.
hocon::config_delayed_merge_object::key_set
std::vector< std::string > key_set() const override
Construct a list of keys in the _value map.
Definition: config_delayed_merge_object.hpp:23
hocon::not_resolved_exception
Exception indicating that you tried to use a function that requires substitutions to be resolved,...
Definition: config_exception.hpp:123
hocon::config_delayed_merge_object::has_descendant
bool has_descendant(shared_value const &descendant) const override
Super-expensive full traversal to see if descendant is anywhere underneath this container.
hocon::replaceable_merge_stack
Definition: replaceable_merge_stack.hpp:9
hocon
Factory for creating config_document instances.
Definition: config.hpp:18
hocon::resolve_context
Definition: resolve_context.hpp:16
hocon::config_value::render
virtual std::string render() const
Renders the config value as a HOCON string.
hocon::resolve_result< shared_value >
hocon::config_render_options
Definition: config_render_options.hpp:20
hocon::value
Definition: tokens.hpp:8
hocon::path
Definition: path.hpp:13
hocon::unmergeable
Interface that tags a config_value that is not mergeable until after substitutions are resolved.
Definition: unmergeable.hpp:14
hocon::resolve_source
Definition: resolve_source.hpp:15
hocon::config_object
Definition: config_object.hpp:11