xentara-utils v1.2.1
Xentara utilities library
Loading...
Searching...
No Matches
xentara::utils::json::decoder::Location Class Reference

A class that can be used to log messages related to a specific line in a specific JSON document. More...

#include <json/decoder/Location.hpp>

Public Member Functions

 Location ()=default
 Default constructor.
 
 operator bool () const noexcept
 Checks whether the object contains a location.
 
auto document () const -> const Document &
 Gets the JSON document that the location refers to.
 
auto lineNumber () const -> std::uint_least32_t
 Gets the line number in the JSON document that the location refers to.
 
auto description () const -> std::string
 return a description of the location
 

Detailed Description

A class that can be used to log messages related to a specific line in a specific JSON document.

Constructor & Destructor Documentation

◆ Location()

xentara::utils::json::decoder::Location::Location ( )
default

Default constructor.

Constructs an unusable object that must be assigned a valid object before being used

Member Function Documentation

◆ description()

auto xentara::utils::json::decoder::Location::description ( ) const -> std::string

return a description of the location

Returns
A description of the location, or an empty string if the object does not contain a location

◆ document()

auto xentara::utils::json::decoder::Location::document ( ) const -> const Document &

Gets the JSON document that the location refers to.

This function must not be called on default constructed objects.

Returns
The document

◆ lineNumber()

auto xentara::utils::json::decoder::Location::lineNumber ( ) const -> std::uint_least32_t

Gets the line number in the JSON document that the location refers to.

This function must not be called on default constructed objects.

Returns
The line number within the JSON document

◆ operator bool()

xentara::utils::json::decoder::Location::operator bool ( ) const
explicitnoexcept

Checks whether the object contains a location.

Returns
true if the object contains a location