cpp-hocon  0.3.0
resolve_source.hpp
1 #pragma once
2 
3 #include <memory>
4 #include <list>
5 #include <hocon/types.hpp>
6 #include <internal/resolve_result.hpp>
7 #include <hocon/config_exception.hpp>
8 
9 namespace hocon {
10 
11  class container;
12  class resolve_context;
13  class substitution_expression;
14 
16  public:
17  typedef std::list<std::shared_ptr<const container>> node;
18 
21  node path_from_root;
22 
23  result_with_path(resolve_result<shared_value> result_value, node path_from_root_value);
24  };
25 
26  resolve_source(shared_object root);
27  resolve_source(shared_object root, node path_from_root);
28  resolve_source push_parent(std::shared_ptr<const container> parent) const;
29  result_with_path lookup_subst(resolve_context context, std::shared_ptr<substitution_expression> subst, int prefix_length) const;
30 
31  resolve_source replace_current_parent(std::shared_ptr<const container> old, std::shared_ptr<const container> replacement) const;
32  resolve_source replace_within_current_parent(shared_value old, shared_value replacement) const;
33  resolve_source reset_parents() const;
34 
35  private:
36  struct value_with_path {
37  shared_value value;
38  node path_from_root;
39 
40  value_with_path(shared_value v, node path_from_root_value);
41  };
42 
43  shared_object _root;
44  node _path_from_root;
45 
46  static value_with_path find_in_object(shared_object obj, path the_path);
47  static result_with_path find_in_object(shared_object obj, resolve_context context, path the_path);
48  static value_with_path find_in_object(shared_object obj, path the_path, node parents);
49  static not_resolved_exception improve_not_resolved(path what, not_resolved_exception const& original);
50 
51  shared_object root_must_be_obj(std::shared_ptr<const container> value) const;
52 
53  static node replace(const node& list, std::shared_ptr<const container> old, shared_value replacement);
54  };
55 } // namespace hocon
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
Factory for creating config_document instances.
Definition: config.hpp:18
hocon::resolve_context
Definition: resolve_context.hpp:16
hocon::resolve_result< shared_value >
hocon::value
Definition: tokens.hpp:8
hocon::path
Definition: path.hpp:13
hocon::resolve_source::result_with_path
Definition: resolve_source.hpp:19
hocon::resolve_source
Definition: resolve_source.hpp:15