cpp-hocon  0.3.0
Public Member Functions | List of all members
hocon::config_resolve_options Class Reference

A set of options related to resolving substitutions. More...

Public Member Functions

 config_resolve_options (bool use_system_environment=true, bool allow_unresolved=false)
 Returns the default resolve options. More...
 
config_resolve_options set_use_system_environment (bool value) const
 Returns resolve options that disable any reference to "system" data (currently, this means environment variables). More...
 
bool get_use_system_environment () const
 Returns whether the options enable use of system environment variables. More...
 
config_resolve_options set_allow_unresolved (bool value) const
 Returns options with "allow unresolved" set to the given value. More...
 
bool get_allow_unresolved () const
 Returns whether the options allow unresolved substitutions. More...
 

Detailed Description

A set of options related to resolving substitutions.

Substitutions use the ${foo.bar} syntax and are documented in the HOCON spec.

Typically this class would be used with the method config#resolve(config_resolve_options).

This object is immutable, so the "setters" return a new object.

Here is an example of creating a custom

:

    config_resolve_options options = config_resolve_options()
        .set_use_system_environment(false)

<p<blockquote>

In addition to config_resolve_options, there's a prebuilt config_resolve_options#no_system which avoids looking at any system environment variables or other external system information. (Right now, environment variables are the only example.)

Definition at line 30 of file config_resolve_options.hpp.

Constructor & Destructor Documentation

◆ config_resolve_options()

hocon::config_resolve_options::config_resolve_options ( bool  use_system_environment = true,
bool  allow_unresolved = false 
)

Returns the default resolve options.

By default the system environment will be used and unresolved substitutions are not allowed.

Returns
the default resolve options

Member Function Documentation

◆ get_allow_unresolved()

bool hocon::config_resolve_options::get_allow_unresolved ( ) const

Returns whether the options allow unresolved substitutions.

This method is mostly used by the config lib internally, not by applications.

Returns
true if unresolved substitutions are allowed

◆ get_use_system_environment()

bool hocon::config_resolve_options::get_use_system_environment ( ) const

Returns whether the options enable use of system environment variables.

This method is mostly used by the config lib internally, not by applications.

Returns
true if environment variables should be used

◆ set_allow_unresolved()

config_resolve_options hocon::config_resolve_options::set_allow_unresolved ( bool  value) const

Returns options with "allow unresolved" set to the given value.

By default, unresolved substitutions are an error. If unresolved substitutions are allowed, then a future attempt to use the unresolved value may fail, but config#resolve(config_resolve_options) itself will not throw.

Parameters
valuetrue to silently ignore unresolved substitutions.
Returns
options with requested setting for whether to allow substitutions

◆ set_use_system_environment()

config_resolve_options hocon::config_resolve_options::set_use_system_environment ( bool  value) const

Returns resolve options that disable any reference to "system" data (currently, this means environment variables).

Returns
the resolve options with env variables disabled

The documentation for this class was generated from the following file:
hocon::config_resolve_options::config_resolve_options
config_resolve_options(bool use_system_environment=true, bool allow_unresolved=false)
Returns the default resolve options.