Kea  1.9.9-git
isc::data::Element::Position Struct Reference

Represents the position of the data element within a configuration string. More...

#include <data.h>

Public Member Functions

 Position ()
 Default constructor. More...
 
 Position (const std::string &file, const uint32_t line, const uint32_t pos)
 Constructor. More...
 
std::string str () const
 Returns the position in the textual format. More...
 

Public Attributes

std::string file_
 File name. More...
 
uint32_t line_
 Line number. More...
 
uint32_t pos_
 Position within the line. More...
 

Detailed Description

Represents the position of the data element within a configuration string.

Position comprises a file name, line number and an offset within this line where the element value starts. For example, if the JSON string is

{ "foo": "some string",
"bar": 123 }

the position of the element "bar" is: line_ = 2; pos_ = 9, because beginning of the value "123" is at offset 9 from the beginning of the second line, including whitespaces.

Note that the Position structure is used as an argument to Element constructors and factory functions to avoid ambiguity and so that the uint32_t arguments holding line number and position within the line are not confused with the Element values passed to these functions.

Definition at line 88 of file data.h.

Constructor & Destructor Documentation

isc::data::Element::Position::Position ( )
inline

Default constructor.

Definition at line 94 of file data.h.

isc::data::Element::Position::Position ( const std::string &  file,
const uint32_t  line,
const uint32_t  pos 
)
inline

Constructor.

Parameters
fileFile name.
lineLine number.
posPosition within the line.

Definition at line 102 of file data.h.

Member Function Documentation

std::string isc::data::Element::Position::str ( ) const

Returns the position in the textual format.

The returned position has the following format: file:line:pos.

Definition at line 38 of file data.cc.

References pos_.

Referenced by isc::data::operator<<().

Member Data Documentation

std::string isc::data::Element::Position::file_

File name.

Definition at line 89 of file data.h.

uint32_t isc::data::Element::Position::line_

Line number.

Definition at line 90 of file data.h.

uint32_t isc::data::Element::Position::pos_

Position within the line.

Definition at line 91 of file data.h.


The documentation for this struct was generated from the following files: