rapidyaml  0.8.0
parse and emit YAML, and do it fast
c4::yml::Location Struct Reference

a source file position More...

#include <common.hpp>

Public Member Functions

 operator bool () const
 
 operator LineCol const & () const
 
 Location ()=default
 
 Location (size_t l, size_t c)
 
 Location (size_t b, size_t l, size_t c)
 
 Location (csubstr n, size_t l, size_t c)
 
 Location (csubstr n, size_t b, size_t l, size_t c)
 
 Location (const char *n, size_t l, size_t c)
 
 Location (const char *n, size_t b, size_t l, size_t c)
 

Public Attributes

size_t offset
 number of bytes from the beginning of the source buffer More...
 
size_t line
 line More...
 
size_t col
 column More...
 
csubstr name
 file name More...
 

Detailed Description

a source file position

Definition at line 296 of file common.hpp.

Constructor & Destructor Documentation

◆ Location() [1/7]

c4::yml::Location::Location ( )
default

◆ Location() [2/7]

c4::yml::Location::Location ( size_t  l,
size_t  c 
)
inline

Definition at line 311 of file common.hpp.

311 : offset( ), line(l), col(c), name( ) {}
size_t col
column
Definition: common.hpp:303
size_t line
line
Definition: common.hpp:301
size_t offset
number of bytes from the beginning of the source buffer
Definition: common.hpp:299
csubstr name
file name
Definition: common.hpp:305

◆ Location() [3/7]

c4::yml::Location::Location ( size_t  b,
size_t  l,
size_t  c 
)
inline

Definition at line 312 of file common.hpp.

312 : offset(b), line(l), col(c), name( ) {}

◆ Location() [4/7]

c4::yml::Location::Location ( csubstr  n,
size_t  l,
size_t  c 
)
inline

Definition at line 313 of file common.hpp.

313 : offset( ), line(l), col(c), name(n) {}

◆ Location() [5/7]

c4::yml::Location::Location ( csubstr  n,
size_t  b,
size_t  l,
size_t  c 
)
inline

Definition at line 314 of file common.hpp.

314 : offset(b), line(l), col(c), name(n) {}

◆ Location() [6/7]

c4::yml::Location::Location ( const char *  n,
size_t  l,
size_t  c 
)
inline

Definition at line 315 of file common.hpp.

315 : offset( ), line(l), col(c), name(to_csubstr(n)) {}
csubstr to_csubstr(substr s) noexcept
neutral version for use in generic code
Definition: substr.hpp:2186

◆ Location() [7/7]

c4::yml::Location::Location ( const char *  n,
size_t  b,
size_t  l,
size_t  c 
)
inline

Definition at line 316 of file common.hpp.

316 : offset(b), line(l), col(c), name(to_csubstr(n)) {}

Member Function Documentation

◆ operator bool()

c4::yml::Location::operator bool ( ) const
inline

Definition at line 307 of file common.hpp.

307 { return !name.empty() || line != 0 || offset != 0 || col != 0; }

◆ operator LineCol const &()

c4::yml::Location::operator LineCol const & ( ) const
inline

Definition at line 308 of file common.hpp.

308 { return reinterpret_cast<LineCol const&>(*this); } // NOLINT

Member Data Documentation

◆ offset

size_t c4::yml::Location::offset

number of bytes from the beginning of the source buffer

Definition at line 299 of file common.hpp.

Referenced by sample::ErrorHandlerExample::on_error(), c4::yml::report_error_impl(), sample::sample_location_tracking(), and c4::yml::ParserState::start_parse().

◆ line

◆ col

◆ name

csubstr c4::yml::Location::name

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