Kea  2.5.3
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 94 of file data.h.

Constructor & Destructor Documentation

◆ Position() [1/2]

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

Default constructor.

Definition at line 100 of file data.h.

◆ Position() [2/2]

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


fileFile name.
lineLine number.
posPosition within the line.

Definition at line 108 of file data.h.

Member Function Documentation

◆ str()

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

References pos_.

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

Member Data Documentation

◆ file_

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

File name.

Definition at line 95 of file data.h.

◆ line_

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

Line number.

Definition at line 96 of file data.h.

◆ pos_

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

Position within the line.

Definition at line 97 of file data.h.

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