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

holds a source or yaml file position, for example when an error is detected; See also location_format() and location_format_with_context(). More...

#include <common.hpp>

Public Member Functions

 operator bool () const noexcept
 
 Location () noexcept
 
 Location (size_t l) noexcept
 
 Location (size_t l, size_t c) noexcept
 
 Location (size_t b, size_t l, size_t c) noexcept
 
 Location (csubstr n, size_t l) noexcept
 
 Location (csubstr n, size_t l, size_t c) noexcept
 
 Location (csubstr n, size_t b, size_t l, size_t c) noexcept
 
 Location (const char *n, size_t l) noexcept
 
 Location (const char *n, size_t l, size_t c) noexcept
 
 Location (const char *n, size_t b, size_t l, size_t c) noexcept
 

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
 name of the file More...
 

Detailed Description

holds a source or yaml file position, for example when an error is detected; See also location_format() and location_format_with_context().

Definition at line 282 of file common.hpp.

Constructor & Destructor Documentation

◆ Location() [1/10]

c4::yml::Location::Location ( )
inlinenoexcept

Definition at line 291 of file common.hpp.

291 : offset(npos), line(npos), col(npos), name() {};
@ npos
a null string position
Definition: common.hpp:258
size_t col
column
Definition: common.hpp:286
size_t line
line
Definition: common.hpp:285
size_t offset
number of bytes from the beginning of the source buffer
Definition: common.hpp:284
csubstr name
name of the file
Definition: common.hpp:287

◆ Location() [2/10]

c4::yml::Location::Location ( size_t  l)
inlinenoexcept

Definition at line 292 of file common.hpp.

292 : offset(npos), line(l), col(npos), name() {}

◆ Location() [3/10]

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

Definition at line 293 of file common.hpp.

293 : offset(npos), line(l), col(c ), name() {}

◆ Location() [4/10]

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

Definition at line 294 of file common.hpp.

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

◆ Location() [5/10]

c4::yml::Location::Location ( csubstr  n,
size_t  l 
)
inlinenoexcept

Definition at line 295 of file common.hpp.

295 : offset(npos), line(l), col(npos), name(n) {}

◆ Location() [6/10]

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

Definition at line 296 of file common.hpp.

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

◆ Location() [7/10]

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

Definition at line 297 of file common.hpp.

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

◆ Location() [8/10]

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

Definition at line 298 of file common.hpp.

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

◆ Location() [9/10]

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

Definition at line 299 of file common.hpp.

299 : offset(npos), line(l), col(c ), name(to_csubstr(n)) {}

◆ Location() [10/10]

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

Definition at line 300 of file common.hpp.

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

Member Function Documentation

◆ operator bool()

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

Definition at line 289 of file common.hpp.

289 { return !name.empty() || line != npos || offset != npos || col != npos; }

References c4::yml::npos.

Member Data Documentation

◆ offset

size_t c4::yml::Location::offset

number of bytes from the beginning of the source buffer

Definition at line 284 of file common.hpp.

◆ line

size_t c4::yml::Location::line

line

Definition at line 285 of file common.hpp.

◆ col

size_t c4::yml::Location::col

column

Definition at line 286 of file common.hpp.

◆ name

csubstr c4::yml::Location::name

name of the file

Definition at line 287 of file common.hpp.


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