cpp-hocon  0.3.0
config_reference.hpp
1 #pragma once
2 
3 #include <hocon/config_value.hpp>
4 #include <internal/unmergeable.hpp>
5 
6 namespace hocon {
7 
8  class substitution_expression;
9 
10  class config_reference : public config_value, public unmergeable {
11  public:
12  config_reference(shared_origin origin, std::shared_ptr<substitution_expression> expr, int prefix_length = 0);
13 
19  type value_type() const override;
20  std::vector<shared_value> unmerged_values() const override;
21  resolve_status get_resolve_status() const override;
22  unwrapped_value unwrapped() const override;
23 
24  std::shared_ptr<substitution_expression> expression() const;
25 
26  bool operator==(config_value const& other) const override;
27 
28  protected:
29  shared_value new_copy(shared_origin origin) const override;
30  resolve_result<shared_value> resolve_substitutions(resolve_context const& context, resolve_source const& source) const override;
31  bool ignores_fallbacks() const override { return false; }
32  void render(std::string& s, int indent, bool at_root, config_render_options options) const override;
33 
34  private:
35  std::shared_ptr<substitution_expression> _expr;
36  int _prefix_length;
37  };
38 }
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_value::type
type
The type of a configuration value (following the JSON type schema).
Definition: config_value.hpp:56
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::config_reference::value_type
type value_type() const override
The type of the value; matches the JSON type schema.
hocon::config_value
An immutable value, following the JSON type schema.
Definition: config_value.hpp:39
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_reference
Definition: config_reference.hpp:10