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

A set of options related to parsing. More...

Public Member Functions

 config_parse_options ()
 Gets an instance of config_parse_options with all fields set to the default values. More...
 
config_parse_options set_syntax (config_syntax syntax) const
 Set the file format. More...
 
config_syntax const & get_syntax () const
 Gets the current syntax option. More...
 
config_parse_options set_origin_description (shared_string origin_description) const
 Set a description for the thing being parsed. More...
 
shared_string const & get_origin_description () const
 Gets the current origin description, which may be null for "automatic". More...
 
config_parse_options set_allow_missing (bool allow_missing) const
 Set to false to throw an exception if the item being parsed (for example a file) is missing. More...
 
bool get_allow_missing () const
 Gets the current "allow missing" flag. More...
 
config_parse_options set_includer (shared_includer includer) const
 Set a config_includer which customizes how includes are handled. More...
 
config_parse_options prepend_includer (shared_includer includer) const
 Prepends a config_includer which customizes how includes are handled. More...
 
config_parse_options append_includer (shared_includer includer) const
 Appends a config_includer which customizes how includes are handled. More...
 
shared_includer const & get_includer () const
 Gets the current includer (will be null for the default includer). More...
 

Static Public Member Functions

static config_parse_options defaults ()
 Gets an instance of config_parse_options with all fields set to the default values. More...
 

Detailed Description

A set of options related to parsing.

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

Here is an example of creating a custom

:

    config_parse_options options = config_parse_options()
        .set_syntax(config_syntax.JSON)
        .set_allow_missing(false)

ClassLoader is Java-specific, so it was not ported to C++.

Definition at line 25 of file config_parse_options.hpp.

Constructor & Destructor Documentation

◆ config_parse_options()

hocon::config_parse_options::config_parse_options ( )

Gets an instance of config_parse_options with all fields set to the default values.

Start with this instance and make any changes you need.

Returns
the default parse options

Member Function Documentation

◆ append_includer()

config_parse_options hocon::config_parse_options::append_includer ( shared_includer  includer) const

◆ defaults()

static config_parse_options hocon::config_parse_options::defaults ( )
static

Gets an instance of config_parse_options with all fields set to the default values.

Start with this instance and make any changes you need.

Returns
the default parse options

◆ get_allow_missing()

bool hocon::config_parse_options::get_allow_missing ( ) const

Gets the current "allow missing" flag.

Returns
whether we allow missing files

◆ get_includer()

shared_includer const& hocon::config_parse_options::get_includer ( ) const

Gets the current includer (will be null for the default includer).

Returns
current includer or null

◆ get_origin_description()

shared_string const& hocon::config_parse_options::get_origin_description ( ) const

Gets the current origin description, which may be null for "automatic".

Returns
the current origin description or null

◆ get_syntax()

config_syntax const& hocon::config_parse_options::get_syntax ( ) const

Gets the current syntax option.

◆ prepend_includer()

config_parse_options hocon::config_parse_options::prepend_includer ( shared_includer  includer) const

Prepends a config_includer which customizes how includes are handled.

To prepend your includer, the library calls config_includer#with_fallback on your includer to append the existing includer to it.

Parameters
includerthe includer to prepend (may not be null)
Returns
new version of the parse options with different includer

◆ set_allow_missing()

config_parse_options hocon::config_parse_options::set_allow_missing ( bool  allow_missing) const

Set to false to throw an exception if the item being parsed (for example a file) is missing.

Set to true to just return an empty document in that case.

Parameters
allow_missingtrue to silently ignore missing item
Returns
options with the "allow missing" flag set

◆ set_includer()

config_parse_options hocon::config_parse_options::set_includer ( shared_includer  includer) const

Set a config_includer which customizes how includes are handled.

null means to use the default includer.

Parameters
includerthe includer to use or null for default
Returns
new version of the parse options with different includer

◆ set_origin_description()

config_parse_options hocon::config_parse_options::set_origin_description ( shared_string  origin_description) const

Set a description for the thing being parsed.

In most cases this will be set up for you to something like the filename, but if you provide just an input stream you might want to improve on it. Set to null to allow the library to come up with something automatically. This description is the basis for the config_origin of the parsed values.

Parameters
origin_descriptiondescription to put in the config_origin
Returns
options with the origin description set

◆ set_syntax()

config_parse_options hocon::config_parse_options::set_syntax ( config_syntax  syntax) const

Set the file format.

If set to null, try to guess from any available filename extension; if guessing fails, assume config_syntax#CONF.

Parameters
syntaxa syntax or
nullptr
for best guess
Returns
options with the syntax set

The documentation for this class was generated from the following file:
hocon::config_parse_options::config_parse_options
config_parse_options()
Gets an instance of config_parse_options with all fields set to the default values.