NeBuild dev
Loading...
Searching...
No Matches
path_component Class Reference

Represents a single component of a complete 'TOML-path': either a key or an array index. More...

#include <path.hpp>

Public Member Functions

TOML_NODISCARD_CTOR TOML_EXPORTED_MEMBER_FUNCTION path_component ()
 Default constructor (creates an empty key).
 
TOML_NODISCARD_CTOR TOML_EXPORTED_MEMBER_FUNCTION path_component (size_t index) noexcept
 Constructor for a path component that is an array index.
 
TOML_NODISCARD_CTOR TOML_EXPORTED_MEMBER_FUNCTION path_component (std::string_view key)
 Constructor for a path component that is a key string.
 
TOML_NODISCARD_CTOR TOML_EXPORTED_MEMBER_FUNCTION path_component (std::wstring_view key)
 Constructor for a path component that is a key string.
 
TOML_NODISCARD_CTOR TOML_EXPORTED_MEMBER_FUNCTION path_component (const path_component &pc)
 Copy constructor.
 
TOML_NODISCARD_CTOR TOML_EXPORTED_MEMBER_FUNCTION path_component (path_component &&pc) noexcept
 Move constructor.
 
TOML_EXPORTED_MEMBER_FUNCTION path_componentoperator= (const path_component &rhs)
 Copy-assignment operator.
 
TOML_EXPORTED_MEMBER_FUNCTION path_componentoperator= (path_component &&rhs) noexcept
 Move-assignment operator.
 
TOML_EXPORTED_MEMBER_FUNCTION path_componentoperator= (size_t new_index) noexcept
 Assigns an array index to this path component.
 
TOML_EXPORTED_MEMBER_FUNCTION path_componentoperator= (std::string_view new_key)
 Assigns a path key to this path component.
 
TOML_EXPORTED_MEMBER_FUNCTION path_componentoperator= (std::wstring_view new_key)
 Assigns a path key to this path component.
 
 ~path_component () noexcept
 Destructor.
 
TOML_PURE_INLINE_GETTER path_component_type type () const noexcept
 Retrieve the type of this path component, either path_component::key or path_component::array_index.
 
Array index accessors
Warning
It is undefined behaviour to call these functions when the path component does not represent an array index. Check type() to determine the component's value type.
TOML_PURE_GETTER size_t index () const noexcept
 Returns the array index (const lvalue overload).
 
TOML_PURE_INLINE_GETTER operator size_t () const noexcept
 Returns the array index (const lvalue).
 
Key accessors
Warning
It is undefined behaviour to call these functions when the path component does not represent a key. Check type() to determine the component's value type.
TOML_PURE_GETTER const std::string & key () const noexcept
 Returns the key string.
 
TOML_PURE_INLINE_GETTER operator const std::string & () const noexcept
 Returns the key string.
 

Friends

Equality
TOML_PURE_INLINE_GETTER friend bool operator== (const path_component &lhs, const path_component &rhs) noexcept
 Returns true if two path components represent the same key or array index.
 
TOML_PURE_INLINE_GETTER friend bool operator!= (const path_component &lhs, const path_component &rhs) noexcept
 Returns true if two path components do not represent the same key or array index.
 

Detailed Description

Represents a single component of a complete 'TOML-path': either a key or an array index.

Constructor & Destructor Documentation

◆ path_component() [1/6]

TOML_NODISCARD_CTOR TOML_EXPORTED_MEMBER_FUNCTION path_component::path_component ( )

Default constructor (creates an empty key).

◆ path_component() [2/6]

TOML_NODISCARD_CTOR TOML_EXPORTED_MEMBER_FUNCTION path_component::path_component ( size_t  index)
noexcept

Constructor for a path component that is an array index.

◆ path_component() [3/6]

TOML_NODISCARD_CTOR TOML_EXPORTED_MEMBER_FUNCTION path_component::path_component ( std::string_view  key)

Constructor for a path component that is a key string.

◆ path_component() [4/6]

TOML_NODISCARD_CTOR TOML_EXPORTED_MEMBER_FUNCTION path_component::path_component ( std::wstring_view  key)

Constructor for a path component that is a key string.

\availability This constructor is only available when TOML_ENABLE_WINDOWS_COMPAT is enabled.

◆ path_component() [5/6]

TOML_NODISCARD_CTOR TOML_EXPORTED_MEMBER_FUNCTION path_component::path_component ( const path_component pc)

Copy constructor.

◆ path_component() [6/6]

TOML_NODISCARD_CTOR TOML_EXPORTED_MEMBER_FUNCTION path_component::path_component ( path_component &&  pc)
noexcept

Move constructor.

◆ ~path_component()

path_component::~path_component ( )
inlinenoexcept

Destructor.

Member Function Documentation

◆ index()

TOML_PURE_GETTER size_t path_component::index ( ) const
inlinenoexcept

Returns the array index (const lvalue overload).

◆ key()

TOML_PURE_GETTER const std::string & path_component::key ( ) const
inlinenoexcept

Returns the key string.

◆ operator const std::string &()

TOML_PURE_INLINE_GETTER path_component::operator const std::string & ( ) const
inlineexplicitnoexcept

Returns the key string.

◆ operator size_t()

TOML_PURE_INLINE_GETTER path_component::operator size_t ( ) const
inlineexplicitnoexcept

Returns the array index (const lvalue).

◆ operator=() [1/5]

TOML_EXPORTED_MEMBER_FUNCTION path_component & path_component::operator= ( const path_component rhs)

Copy-assignment operator.

◆ operator=() [2/5]

TOML_EXPORTED_MEMBER_FUNCTION path_component & path_component::operator= ( path_component &&  rhs)
noexcept

Move-assignment operator.

◆ operator=() [3/5]

TOML_EXPORTED_MEMBER_FUNCTION path_component & path_component::operator= ( size_t  new_index)
noexcept

Assigns an array index to this path component.

◆ operator=() [4/5]

TOML_EXPORTED_MEMBER_FUNCTION path_component & path_component::operator= ( std::string_view  new_key)

Assigns a path key to this path component.

◆ operator=() [5/5]

TOML_EXPORTED_MEMBER_FUNCTION path_component & path_component::operator= ( std::wstring_view  new_key)

Assigns a path key to this path component.

\availability This overload is only available when TOML_ENABLE_WINDOWS_COMPAT is enabled.

◆ type()

TOML_PURE_INLINE_GETTER path_component_type path_component::type ( ) const
inlinenoexcept

Retrieve the type of this path component, either path_component::key or path_component::array_index.

Friends And Related Symbol Documentation

◆ operator!=

TOML_PURE_INLINE_GETTER friend bool operator!= ( const path_component lhs,
const path_component rhs 
)
friend

Returns true if two path components do not represent the same key or array index.

◆ operator==

TOML_PURE_INLINE_GETTER friend bool operator== ( const path_component lhs,
const path_component rhs 
)
friend

Returns true if two path components represent the same key or array index.


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