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

The name of a member of a JSON object. More...

#include <json/decoder/Name.hpp>

Public Types

Standard library compliant type aliases
using traits_type = std::string::traits_type
 The char traits.
 
using value_type = std::string::value_type
 The character type.
 
using pointer = std::string::pointer
 A pointer to a character.
 
using const_pointer = std::string::const_pointer
 A const pointer to a character.
 
using reference = std::string::reference
 A reference to a character.
 
using const_reference = std::string::const_reference
 A const reference to a character.
 
using const_iterator = std::string::const_iterator
 A const iterator.
 
using iterator = const_iterator
 Same as a const iterator.
 
using const_reverse_iterator = std::string::const_reverse_iterator
 A const reverse iterator.
 
using reverse_iterator = const_reverse_iterator
 Same as a const reverse iterator.
 
using size_type = std::string::size_type
 The size type.
 
using difference_type = std::string::difference_type
 The difference type.
 

Public Member Functions

Construction
 Name ()=default
 Default constructor.
 
conversion operators
 operator std::string_view () const
 Conversion to an std::string_view.
 
 operator const std::string & () const &
 Conversion to an std::string reference.
 
 operator std::string && () &&
 Conversion to an std::string rvalue reference.
 
Iterators
auto begin () const -> const_iterator
 Gets the begin iterator.
 
auto cbegin () const -> const_iterator
 Gets the begin iterator.
 
auto end () const -> const_iterator
 Gets the end iterator.
 
auto cend () const -> const_iterator
 Gets the end iterator.
 
auto rbegin () const -> const_reverse_iterator
 Gets the reverse begin iterator.
 
auto crbegin () const -> const_reverse_iterator
 Gets the reverse begin iterator.
 
auto rend () const -> const_reverse_iterator
 Gets the reverse end iterator.
 
auto crend () const -> const_reverse_iterator
 Gets the reverse end iterator.
 
Element Access
auto at (size_type position) const -> const_reference
 Gets the element at a certain position.
 
auto operator[] (size_type position) const -> const_reference
 Gets the element at a certain position without bounds checking.
 
auto front () const noexcept -> const_reference
 Gets the first element.
 
auto back () const noexcept -> const_reference
 Gets the last element.
 
auto data () const noexcept -> const_pointer
 Gets the data.
 
auto c_str () const noexcept -> const char *
 Gets the name as a null terminated string.
 
Size
auto size () const noexcept -> size_type
 Gets the size of the name.
 
auto length () const noexcept -> size_type
 Gets the length of the name, which is the same as the size.
 
auto empty () const noexcept -> bool
 Determines if the name is empty.
 
Operations
auto copy (char *destination, size_type count, size_type position=0) const -> size_type
 Equivalent to std::string_view::copy()
 
auto substr (size_type position=0, size_type count=std::string::npos) const -> std::string_view
 Returns a substring.
 
auto compare (std::string_view string) const noexcept -> int
 Compares the name to a string view.
 
auto compare (size_type thisPosition, size_type thisCount, std::string_view string) const -> int
 Compares part of the name to a string view.
 
auto compare (size_type thisPosition, size_type thisCount, std::string_view string, size_type thatPosition, size_type thatCount) const -> int
 Compares part of the name to part of a string view.
 
auto compare (const char *string) const -> int
 Compares the name to a null terminated string.
 
auto compare (size_type thisPosition, size_type thisCount, const char *string) const -> int
 Compares part of the name to a null terminated string.
 
auto compare (size_type thisPosition, size_type thisCount, const char *string, size_type stringSize) const -> int
 Compares part of the name to a string.
 
auto starts_with (std::string_view prefix) const noexcept -> bool
 Determines whether the name starts with a certain prefix.
 
auto starts_with (char character) const noexcept -> bool
 Determines whether the name starts with a certain character.
 
auto starts_with (const char *prefix) const -> bool
 Determines whether the name starts with a certain prefix.
 
auto ends_with (std::string_view suffix) const noexcept -> bool
 Determines whether the name ends with a certain suffix.
 
auto ends_with (char character) const noexcept -> bool
 Determines whether the name ends with a certain character.
 
auto ends_with (const char *suffix) const -> bool
 Determines whether the name ends with a certain suffix.
 
auto find (std::string_view string, size_type position=0) const noexcept -> size_type
 Searches for a sub string.
 
auto find (char character, size_type position=0) const noexcept -> size_type
 Searches for a character.
 
auto find (const char *string, size_type position, size_type stringSize) const -> size_type
 Searches for a sub string.
 
auto find (const char *string, size_type position=0) const -> size_type
 Searches for a sub string.
 
auto rfind (std::string_view string, size_type position=npos) const noexcept -> size_type
 Searches for the last occurrence of a sub string.
 
auto rfind (char character, size_type position=npos) const noexcept -> size_type
 Searches for the last occurrence of a character.
 
auto rfind (const char *string, size_type position, size_type stringSize) const -> size_type
 Searches for the last occurrence of a sub string.
 
auto rfind (const char *string, size_type position=npos) const -> size_type
 Searches for the last occurrence of a sub string.
 
auto find_first_of (std::string_view string, size_type position=0) const noexcept -> size_type
 Searches for the first character matching any character in a string view.
 
auto find_first_of (char character, size_type position=0) const noexcept -> size_type
 Searches for the first occurrence of a character.
 
auto find_first_of (const char *characters, size_type position, size_type characterCount) const -> size_type
 Searches for the first character matching any character in a character array.
 
auto find_first_of (const char *string, size_type position=0) const -> size_type
 Searches for the first character matching any character in a null terminated string.
 
auto find_last_of (std::string_view string, size_type position=npos) const noexcept -> size_type
 Searches for the last character matching any character in a string view.
 
auto find_last_of (char character, size_type position=npos) const noexcept -> size_type
 Searches for the last occurrence of a character.
 
auto find_last_of (const char *characters, size_type position, size_type characterCount) const -> size_type
 Searches for the last character matching any character in a character array.
 
auto find_last_of (const char *string, size_type position=npos) const -> size_type
 Searches for the last character matching any character in a null terminated string.
 
auto find_first_not_of (std::string_view string, size_type position=0) const noexcept -> size_type
 Searches for the first character not matching any character in a string view.
 
auto find_first_not_of (char character, size_type position=0) const noexcept -> size_type
 Searches for the first character not matching a character.
 
auto find_first_not_of (const char *characters, size_type position, size_type characterCount) const -> size_type
 Searches for the last character not matching any character in a character array.
 
auto find_first_not_of (const char *string, size_type position=0) const -> size_type
 Searches for the last character not matching any character in a null terminated string.
 
auto find_last_not_of (std::string_view string, size_type position=npos) const noexcept -> size_type
 Searches for the last character not matching any character in a string view.
 
auto find_last_not_of (char character, size_type position=npos) const noexcept -> size_type
 Searches for the last character not matching a character.
 
auto find_last_not_of (const char *characters, size_type position, size_type characterCount) const -> size_type
 Searches for the last character not matching any character in a character array.
 
auto find_last_not_of (const char *string, size_type position=npos) const -> size_type
 Searches for the last character not matching any character in a null terminated string.
 
Access to the Location
auto document () const -> const Document *
 Gets the JSON document that the member belongs to.
 
auto lineNumber () const -> std::uint_least32_t
 Gets the line number in the JSON document that the member name is on.
 
auto location () const -> Location
 Gets the location of the member name within its JSON document.
 

Static Public Attributes

static const size_type npos
 Non-existent string position.
 

Detailed Description

The name of a member of a JSON object.

Member Typedef Documentation

◆ const_iterator

using xentara::utils::json::decoder::Name::const_iterator = std::string::const_iterator

A const iterator.

◆ const_pointer

using xentara::utils::json::decoder::Name::const_pointer = std::string::const_pointer

A const pointer to a character.

◆ const_reference

using xentara::utils::json::decoder::Name::const_reference = std::string::const_reference

A const reference to a character.

◆ const_reverse_iterator

using xentara::utils::json::decoder::Name::const_reverse_iterator = std::string::const_reverse_iterator

A const reverse iterator.

◆ difference_type

using xentara::utils::json::decoder::Name::difference_type = std::string::difference_type

The difference type.

◆ iterator

◆ pointer

using xentara::utils::json::decoder::Name::pointer = std::string::pointer

A pointer to a character.

◆ reference

using xentara::utils::json::decoder::Name::reference = std::string::reference

A reference to a character.

◆ reverse_iterator

◆ size_type

using xentara::utils::json::decoder::Name::size_type = std::string::size_type

The size type.

◆ traits_type

using xentara::utils::json::decoder::Name::traits_type = std::string::traits_type

The char traits.

◆ value_type

using xentara::utils::json::decoder::Name::value_type = std::string::value_type

The character type.

Constructor & Destructor Documentation

◆ Name()

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

Default constructor.

This constructor creates an empty name without a location

Member Function Documentation

◆ at()

auto xentara::utils::json::decoder::Name::at ( size_type  position) const -> const_reference

Gets the element at a certain position.

◆ back()

auto xentara::utils::json::decoder::Name::back ( ) const -> const_reference
noexcept

Gets the last element.

◆ begin()

auto xentara::utils::json::decoder::Name::begin ( ) const -> const_iterator

Gets the begin iterator.

◆ c_str()

auto xentara::utils::json::decoder::Name::c_str ( ) const -> const char *
noexcept

Gets the name as a null terminated string.

◆ cbegin()

auto xentara::utils::json::decoder::Name::cbegin ( ) const -> const_iterator

Gets the begin iterator.

◆ cend()

auto xentara::utils::json::decoder::Name::cend ( ) const -> const_iterator

Gets the end iterator.

◆ compare() [1/6]

auto xentara::utils::json::decoder::Name::compare ( const char *  string) const -> int

Compares the name to a null terminated string.

◆ compare() [2/6]

auto xentara::utils::json::decoder::Name::compare ( size_type  thisPosition,
size_type  thisCount,
const char *  string 
) const -> int

Compares part of the name to a null terminated string.

◆ compare() [3/6]

auto xentara::utils::json::decoder::Name::compare ( size_type  thisPosition,
size_type  thisCount,
const char *  string,
size_type  stringSize 
) const -> int

Compares part of the name to a string.

◆ compare() [4/6]

auto xentara::utils::json::decoder::Name::compare ( size_type  thisPosition,
size_type  thisCount,
std::string_view  string 
) const -> int

Compares part of the name to a string view.

◆ compare() [5/6]

auto xentara::utils::json::decoder::Name::compare ( size_type  thisPosition,
size_type  thisCount,
std::string_view  string,
size_type  thatPosition,
size_type  thatCount 
) const -> int

Compares part of the name to part of a string view.

◆ compare() [6/6]

auto xentara::utils::json::decoder::Name::compare ( std::string_view  string) const -> int
noexcept

Compares the name to a string view.

◆ copy()

auto xentara::utils::json::decoder::Name::copy ( char *  destination,
size_type  count,
size_type  position = 0 
) const -> size_type

Equivalent to std::string_view::copy()

◆ crbegin()

auto xentara::utils::json::decoder::Name::crbegin ( ) const -> const_reverse_iterator

Gets the reverse begin iterator.

◆ crend()

auto xentara::utils::json::decoder::Name::crend ( ) const -> const_reverse_iterator

Gets the reverse end iterator.

◆ data()

auto xentara::utils::json::decoder::Name::data ( ) const -> const_pointer
noexcept

Gets the data.

◆ document()

auto xentara::utils::json::decoder::Name::document ( ) const -> const Document *

Gets the JSON document that the member belongs to.

Returns
The document, or nullptr for a default constructed object

◆ empty()

auto xentara::utils::json::decoder::Name::empty ( ) const -> bool
noexcept

Determines if the name is empty.

◆ end()

auto xentara::utils::json::decoder::Name::end ( ) const -> const_iterator

Gets the end iterator.

◆ ends_with() [1/3]

auto xentara::utils::json::decoder::Name::ends_with ( char  character) const -> bool
noexcept

Determines whether the name ends with a certain character.

◆ ends_with() [2/3]

auto xentara::utils::json::decoder::Name::ends_with ( const char *  suffix) const -> bool

Determines whether the name ends with a certain suffix.

◆ ends_with() [3/3]

auto xentara::utils::json::decoder::Name::ends_with ( std::string_view  suffix) const -> bool
noexcept

Determines whether the name ends with a certain suffix.

◆ find() [1/4]

auto xentara::utils::json::decoder::Name::find ( char  character,
size_type  position = 0 
) const -> size_type
noexcept

Searches for a character.

◆ find() [2/4]

auto xentara::utils::json::decoder::Name::find ( const char *  string,
size_type  position,
size_type  stringSize 
) const -> size_type

Searches for a sub string.

◆ find() [3/4]

auto xentara::utils::json::decoder::Name::find ( const char *  string,
size_type  position = 0 
) const -> size_type

Searches for a sub string.

◆ find() [4/4]

auto xentara::utils::json::decoder::Name::find ( std::string_view  string,
size_type  position = 0 
) const -> size_type
noexcept

Searches for a sub string.

◆ find_first_not_of() [1/4]

auto xentara::utils::json::decoder::Name::find_first_not_of ( char  character,
size_type  position = 0 
) const -> size_type
noexcept

Searches for the first character not matching a character.

◆ find_first_not_of() [2/4]

auto xentara::utils::json::decoder::Name::find_first_not_of ( const char *  characters,
size_type  position,
size_type  characterCount 
) const -> size_type

Searches for the last character not matching any character in a character array.

◆ find_first_not_of() [3/4]

auto xentara::utils::json::decoder::Name::find_first_not_of ( const char *  string,
size_type  position = 0 
) const -> size_type

Searches for the last character not matching any character in a null terminated string.

◆ find_first_not_of() [4/4]

auto xentara::utils::json::decoder::Name::find_first_not_of ( std::string_view  string,
size_type  position = 0 
) const -> size_type
noexcept

Searches for the first character not matching any character in a string view.

◆ find_first_of() [1/4]

auto xentara::utils::json::decoder::Name::find_first_of ( char  character,
size_type  position = 0 
) const -> size_type
noexcept

Searches for the first occurrence of a character.

◆ find_first_of() [2/4]

auto xentara::utils::json::decoder::Name::find_first_of ( const char *  characters,
size_type  position,
size_type  characterCount 
) const -> size_type

Searches for the first character matching any character in a character array.

◆ find_first_of() [3/4]

auto xentara::utils::json::decoder::Name::find_first_of ( const char *  string,
size_type  position = 0 
) const -> size_type

Searches for the first character matching any character in a null terminated string.

◆ find_first_of() [4/4]

auto xentara::utils::json::decoder::Name::find_first_of ( std::string_view  string,
size_type  position = 0 
) const -> size_type
noexcept

Searches for the first character matching any character in a string view.

◆ find_last_not_of() [1/4]

auto xentara::utils::json::decoder::Name::find_last_not_of ( char  character,
size_type  position = npos 
) const -> size_type
noexcept

Searches for the last character not matching a character.

◆ find_last_not_of() [2/4]

auto xentara::utils::json::decoder::Name::find_last_not_of ( const char *  characters,
size_type  position,
size_type  characterCount 
) const -> size_type

Searches for the last character not matching any character in a character array.

◆ find_last_not_of() [3/4]

auto xentara::utils::json::decoder::Name::find_last_not_of ( const char *  string,
size_type  position = npos 
) const -> size_type

Searches for the last character not matching any character in a null terminated string.

◆ find_last_not_of() [4/4]

auto xentara::utils::json::decoder::Name::find_last_not_of ( std::string_view  string,
size_type  position = npos 
) const -> size_type
noexcept

Searches for the last character not matching any character in a string view.

◆ find_last_of() [1/4]

auto xentara::utils::json::decoder::Name::find_last_of ( char  character,
size_type  position = npos 
) const -> size_type
noexcept

Searches for the last occurrence of a character.

◆ find_last_of() [2/4]

auto xentara::utils::json::decoder::Name::find_last_of ( const char *  characters,
size_type  position,
size_type  characterCount 
) const -> size_type

Searches for the last character matching any character in a character array.

◆ find_last_of() [3/4]

auto xentara::utils::json::decoder::Name::find_last_of ( const char *  string,
size_type  position = npos 
) const -> size_type

Searches for the last character matching any character in a null terminated string.

◆ find_last_of() [4/4]

auto xentara::utils::json::decoder::Name::find_last_of ( std::string_view  string,
size_type  position = npos 
) const -> size_type
noexcept

Searches for the last character matching any character in a string view.

◆ front()

auto xentara::utils::json::decoder::Name::front ( ) const -> const_reference
noexcept

Gets the first element.

◆ length()

auto xentara::utils::json::decoder::Name::length ( ) const -> size_type
noexcept

Gets the length of the name, which is the same as the size.

◆ lineNumber()

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

Gets the line number in the JSON document that the member name is on.

Returns
The line number, or 0 for a default constructed object

◆ location()

auto xentara::utils::json::decoder::Name::location ( ) const -> Location

Gets the location of the member name within its JSON document.

Returns
The location of the name within the JSON document, or a default constructed location for a default constructed object

◆ operator const std::string &()

xentara::utils::json::decoder::Name::operator const std::string & ( ) const &

Conversion to an std::string reference.

◆ operator std::string &&()

xentara::utils::json::decoder::Name::operator std::string && ( ) &&

Conversion to an std::string rvalue reference.

◆ operator std::string_view()

xentara::utils::json::decoder::Name::operator std::string_view ( ) const

Conversion to an std::string_view.

◆ operator[]()

auto xentara::utils::json::decoder::Name::operator[] ( size_type  position) const -> const_reference

Gets the element at a certain position without bounds checking.

◆ rbegin()

auto xentara::utils::json::decoder::Name::rbegin ( ) const -> const_reverse_iterator

Gets the reverse begin iterator.

◆ rend()

auto xentara::utils::json::decoder::Name::rend ( ) const -> const_reverse_iterator

Gets the reverse end iterator.

◆ rfind() [1/4]

auto xentara::utils::json::decoder::Name::rfind ( char  character,
size_type  position = npos 
) const -> size_type
noexcept

Searches for the last occurrence of a character.

◆ rfind() [2/4]

auto xentara::utils::json::decoder::Name::rfind ( const char *  string,
size_type  position,
size_type  stringSize 
) const -> size_type

Searches for the last occurrence of a sub string.

◆ rfind() [3/4]

auto xentara::utils::json::decoder::Name::rfind ( const char *  string,
size_type  position = npos 
) const -> size_type

Searches for the last occurrence of a sub string.

◆ rfind() [4/4]

auto xentara::utils::json::decoder::Name::rfind ( std::string_view  string,
size_type  position = npos 
) const -> size_type
noexcept

Searches for the last occurrence of a sub string.

◆ size()

auto xentara::utils::json::decoder::Name::size ( ) const -> size_type
noexcept

Gets the size of the name.

◆ starts_with() [1/3]

auto xentara::utils::json::decoder::Name::starts_with ( char  character) const -> bool
noexcept

Determines whether the name starts with a certain character.

◆ starts_with() [2/3]

auto xentara::utils::json::decoder::Name::starts_with ( const char *  prefix) const -> bool

Determines whether the name starts with a certain prefix.

◆ starts_with() [3/3]

auto xentara::utils::json::decoder::Name::starts_with ( std::string_view  prefix) const -> bool
noexcept

Determines whether the name starts with a certain prefix.

◆ substr()

auto xentara::utils::json::decoder::Name::substr ( size_type  position = 0,
size_type  count = std::string::npos 
) const -> std::string_view

Returns a substring.

Member Data Documentation

◆ npos

const size_type xentara::utils::json::decoder::Name::npos
static

Non-existent string position.