A ConfigConcatenation represents a list of values to be concatenated (see the spec).
More...
|
|
| config_concatenation (shared_origin origin, std::vector< shared_value > pieces) |
| |
| config_value::type | value_type () const override |
| | The type of the value; matches the JSON type schema.
|
| |
| std::vector< shared_value > | unmerged_values () const override |
| |
| resolve_status | get_resolve_status () const override |
| |
| shared_value | replace_child (shared_value const &child, shared_value replacement) const override |
| | Replace a child of this value.
|
| |
| bool | has_descendant (shared_value const &descendant) const override |
| | Super-expensive full traversal to see if descendant is anywhere underneath this container.
|
| |
| resolve_result< shared_value > | resolve_substitutions (resolve_context const &context, resolve_source const &source) const override |
| |
| 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 included into in the parent file.
|
| |
| unwrapped_value | unwrapped () const override |
| |
| bool | operator== (config_value const &other) const override |
| |
| virtual shared_origin const & | origin () const |
| | The origin of the value (file, line number, etc.), for debugging and error messages.
|
| |
| char const * | value_type_name () const |
| | The printable name of the value type.
|
| |
| virtual std::string | render () const |
| | Renders the config value as a HOCON string.
|
| |
| virtual std::string | render (config_render_options options) const |
| | Renders the config value to a string, using the provided options.
|
| |
| shared_config | at_key (std::string const &key) const |
| | Places the value inside a config at the given key.
|
| |
| shared_config | at_path (std::string const &path_expression) const |
| | Places the value inside a config at the given path.
|
| |
| virtual shared_value | with_origin (shared_origin origin) const |
| | Returns a config_value based on this one, but with the given origin.
|
| |
| std::shared_ptr< const config_mergeable > | with_fallback (std::shared_ptr< const config_mergeable > other) const override |
| | Returns a new value computed by merging this value with another, with keys in this value "winning" over the other one.
|
| |
|
virtual std::string | transform_to_string () const |
| |
|
| shared_value | new_copy (shared_origin origin) const override |
| |
| bool | ignores_fallbacks () const override |
| |
| void | render (std::string &result, int indent, bool at_root, config_render_options options) const override |
| |
|
virtual void | render (std::string &result, int indent, bool at_root, std::string const &at_key, config_render_options options) const |
| |
|
shared_config | at_key (shared_origin origin, std::string const &key) const |
| |
|
shared_config | at_path (shared_origin origin, path raw_path) const |
| |
|
void | require_not_ignoring_fallbacks () const |
| |
|
virtual shared_value | with_fallbacks_ignored () const |
| |
|
shared_value | merged_with_the_unmergeable (std::vector< shared_value > stack, std::shared_ptr< const unmergeable > fallback) const |
| |
|
shared_value | merged_with_the_unmergeable (std::shared_ptr< const unmergeable > fallback) const |
| |
|
shared_value | merged_with_object (std::vector< shared_value > stack, shared_object fallback) const |
| |
|
virtual shared_value | merged_with_object (shared_object fallback) const |
| |
|
shared_value | merged_with_non_object (std::vector< shared_value > stack, shared_value fallback) const |
| |
|
shared_value | merged_with_non_object (shared_value fallback) const |
| |
|
virtual shared_value | construct_delayed_merge (shared_origin origin, std::vector< shared_value > stack) const |
| |
| shared_value | to_fallback_value () const override |
| | Converts a config to its root object and a config_value to itself.
|
| |
A ConfigConcatenation represents a list of values to be concatenated (see the spec).
It only has to exist if at least one value is an unresolved substitution, otherwise we could go ahead and collapse the list into a single value.
Right now this is always a list of strings and ${} references, but in the future should support a list of ConfigList. We may also support concatenations of objects, but ConfigDelayedMerge should be used for that since a concat of objects really will merge, not concatenate.
Definition at line 24 of file config_concatenation.hpp.
| shared_value hocon::config_concatenation::relativized |
( |
std::string |
prefix | ) |
const |
|
overridevirtual |
This is used when including one file in another; the included file is relativized to the path it's included into in the parent file.
The point is that if you include a file at foo.bar in the parent, and the included file as a substitution ${a.b.c}, the included substitution now needs to be ${foo.bar.a.b.c} because we resolve substitutions globally only after parsing everything.
- Parameters
-
- Returns
- value relativized to the given path or the same value if nothing to do
Reimplemented from hocon::config_value.
| virtual std::string hocon::config_value::render |
( |
| ) |
const |
|
virtualinherited |
Renders the config value as a HOCON string.
This method is primarily intended for debugging, so it tries to add helpful comments and whitespace.
If the config value has not been resolved (see config#resolve), it's possible that it can't be rendered as valid HOCON. In that case the rendering should still be useful for debugging but you might not be able to parse it. If the value has been resolved, it will always be parseable.
This method is equivalent to render(config_render_options()).
- Returns
- the rendered value
Renders the config value to a string, using the provided options.
If the config value has not been resolved (see config#resolve), it's possible that it can't be rendered as valid HOCON. In that case the rendering should still be useful for debugging but you might not be able to parse it. If the value has been resolved, it will always be parseable.
If the config value has been resolved and the options disable all HOCON-specific features (such as comments), the rendering will be valid JSON. If you enable HOCON-only features such as comments, the rendering will not be valid JSON.
- Parameters
-
| options | the rendering options |
- Returns
- the rendered value
Returns a new value computed by merging this value with another, with keys in this value "winning" over the other one.
This associative operation may be used to combine configurations from multiple sources (such as multiple configuration files).
The semantics of merging are described in the spec for HOCON. Merging typically occurs when either the same object is created twice in the same file, or two config files are both loaded. For example:
foo = { a: 42 }
foo = { b: 43 }
Here, the two objects are merged as if you had written:
foo = { a: 42, b: 43 }
Only ConfigObject and Config instances do anything in this method (they need to merge the fallback keys into themselves). All other values just return the original value, since they automatically override any fallback. This means that objects do not merge "across" non-objects; if you write object.withFallback(nonObject).withFallback(otherObject), then otherObject will simply be ignored. This is an intentional part of how merging works, because non-objects such as strings and integers replace (rather than merging with) any prior value:
foo = { a: 42 }
foo = 10
Here, the number 10 "wins" and the value of foo would be simply 10. Again, for details see the spec.
- Parameters
-
| other | an object whose keys should be used as fallbacks, if the keys are not present in this one |
- Returns
- a new object (or the original one, if the fallback doesn't get used)
Implements hocon::config_mergeable.