cpp-hocon  0.3.0
Public Member Functions | Static Public Member Functions | List of all members
hocon::simple_config_origin Class Reference
Inheritance diagram for hocon::simple_config_origin:
hocon::config_origin

Public Member Functions

 simple_config_origin (std::string description, int line_number, int end_line_number, origin_type org_type, std::string resource_or_null, std::vector< std::string > comments_or_null)
 
 simple_config_origin (std::string description, int line_number=-1, int end_line_number=-1, origin_type org_type=origin_type::GENERIC)
 This constructor replaces the new_simple method in the original library. More...
 
int line_number () const override
 Returns a line number where the value or exception originated. More...
 
std::string const & description () const override
 Returns a string describing the origin of a value or exception. More...
 
std::vector< std::string > const & comments () const override
 Returns any comments that appeared to "go with" this place in the file. More...
 
shared_origin with_line_number (int line_number) const override
 Returns a pointer to a copy of this origin with the specified line number as both starting and ending line. More...
 
shared_origin with_comments (std::vector< std::string > comments) const override
 Returns a. More...
 
std::shared_ptr< const simple_config_originappend_comments (std::vector< std::string > comments) const
 
std::shared_ptr< const simple_config_originprepend_comments (std::vector< std::string > comments) const
 
bool operator== (const simple_config_origin &other) const
 
bool operator!= (const simple_config_origin &other) const
 

Static Public Member Functions

static shared_origin merge_origins (shared_origin a, shared_origin b)
 
static shared_origin merge_origins (std::vector< shared_value > const &stack)
 
static shared_origin merge_origins (std::vector< shared_origin > const &stack)
 

Detailed Description

Definition at line 13 of file simple_config_origin.hpp.

Constructor & Destructor Documentation

◆ simple_config_origin()

hocon::simple_config_origin::simple_config_origin ( std::string  description,
int  line_number = -1,
int  end_line_number = -1,
origin_type  org_type = origin_type::GENERIC 
)

This constructor replaces the new_simple method in the original library.

Member Function Documentation

◆ comments()

std::vector<std::string> const& hocon::simple_config_origin::comments ( ) const
overridevirtual

Returns any comments that appeared to "go with" this place in the file.

Often an empty list, but never null. The details of this are subject to change, but at the moment comments that are immediately before an array element or object field, with no blank line after the comment, "go with" that element or field.

Returns
any comments that seemed to "go with" this origin, empty list if none

Implements hocon::config_origin.

◆ description()

std::string const& hocon::simple_config_origin::description ( ) const
overridevirtual

Returns a string describing the origin of a value or exception.

This will never return null.

Returns
string describing the origin

Implements hocon::config_origin.

◆ line_number()

int hocon::simple_config_origin::line_number ( ) const
overridevirtual

Returns a line number where the value or exception originated.

This will return -1 if there's no meaningful line number.

Returns
line number or -1 if none is available

Implements hocon::config_origin.

◆ with_comments()

shared_origin hocon::simple_config_origin::with_comments ( std::vector< std::string >  comments) const
overridevirtual

Returns a.

config_origin

based on this one, but with the given comments. Does not modify this instance or any

config_value

s with this origin (since they are immutable). To set the returned origin to a

config_value

, use config_value#with_origin.

Note that when the given comments are equal to the comments on this object, a new instance may not be created and

this

is returned directly.

Since
1.3.0
Parameters
commentsthe comments used on the returned origin
Returns
the config_origin with the given comments

Implements hocon::config_origin.

◆ with_line_number()

shared_origin hocon::simple_config_origin::with_line_number ( int  line_number) const
overridevirtual

Returns a pointer to a copy of this origin with the specified line number as both starting and ending line.

Implements hocon::config_origin.


The documentation for this class was generated from the following file: