Public Types | Public Member Functions | Private Attributes | Friends | List of all members
basic_string_view< Char > Class Template Reference

#include <core.h>

Public Types

using iterator = const Char *
 
using value_type = Char
 

Public Member Functions

constexpr basic_string_view () noexcept
 
FMT_CONSTEXPR_CHAR_TRAITS FMT_INLINE basic_string_view (const Char *s)
 
constexpr basic_string_view (const Char *s, size_t count) noexcept
 
template<typename Traits , typename Alloc >
FMT_CONSTEXPR basic_string_view (const std::basic_string< Char, Traits, Alloc > &s) noexcept
 
template<typename S , FMT_ENABLE_IF(std::is_same< S, detail::std_string_view< Char >>::value) >
FMT_CONSTEXPR basic_string_view (S s) noexcept
 
constexpr auto begin () const noexcept -> iterator
 
FMT_CONSTEXPR_CHAR_TRAITS auto compare (basic_string_view other) const -> int
 
constexpr auto data () const noexcept -> const Char *
 
constexpr auto end () const noexcept -> iterator
 
constexpr auto operator[] (size_t pos) const noexcept -> const Char &
 
FMT_CONSTEXPR void remove_prefix (size_t n) noexcept
 
constexpr auto size () const noexcept -> size_t
 
FMT_CONSTEXPR_CHAR_TRAITS auto starts_with (basic_string_view< Char > sv) const noexcept -> bool
 
FMT_CONSTEXPR_CHAR_TRAITS auto starts_with (Char c) const noexcept -> bool
 
FMT_CONSTEXPR_CHAR_TRAITS auto starts_with (const Char *s) const -> bool
 

Private Attributes

const Char * data_
 
size_t size_
 

Friends

auto operator!= (basic_string_view lhs, basic_string_view rhs) -> bool
 
auto operator< (basic_string_view lhs, basic_string_view rhs) -> bool
 
auto operator<= (basic_string_view lhs, basic_string_view rhs) -> bool
 
FMT_CONSTEXPR_CHAR_TRAITS friend auto operator== (basic_string_view lhs, basic_string_view rhs) -> bool
 
auto operator> (basic_string_view lhs, basic_string_view rhs) -> bool
 
auto operator>= (basic_string_view lhs, basic_string_view rhs) -> bool
 

Detailed Description

template<typename Char>
class basic_string_view< Char >

An implementation of std::basic_string_view for pre-C++17. It provides a subset of the API. fmt::basic_string_view is used for format strings even if std::string_view is available to prevent issues when a library is compiled with a different -std option than the client code (which is not recommended).

Definition at line 415 of file core.h.

Member Typedef Documentation

◆ iterator

template<typename Char >
using basic_string_view< Char >::iterator = const Char*

Definition at line 422 of file core.h.

◆ value_type

template<typename Char >
using basic_string_view< Char >::value_type = Char

Definition at line 421 of file core.h.

Constructor & Destructor Documentation

◆ basic_string_view() [1/5]

template<typename Char >
constexpr basic_string_view< Char >::basic_string_view ( )
inlineconstexprnoexcept

Definition at line 424 of file core.h.

◆ basic_string_view() [2/5]

template<typename Char >
constexpr basic_string_view< Char >::basic_string_view ( const Char *  s,
size_t  count 
)
inlineconstexprnoexcept

Constructs a string reference object from a C string and a size.

Definition at line 427 of file core.h.

◆ basic_string_view() [3/5]

template<typename Char >
FMT_CONSTEXPR_CHAR_TRAITS FMT_INLINE basic_string_view< Char >::basic_string_view ( const Char *  s)
inline

\rst Constructs a string reference object from a C string computing the size with std::char_traits<Char>::length. \endrst

Definition at line 438 of file core.h.

◆ basic_string_view() [4/5]

template<typename Char >
template<typename Traits , typename Alloc >
FMT_CONSTEXPR basic_string_view< Char >::basic_string_view ( const std::basic_string< Char, Traits, Alloc > &  s)
inlinenoexcept

Constructs a string reference from a std::basic_string object.

Definition at line 447 of file core.h.

◆ basic_string_view() [5/5]

template<typename Char >
template<typename S , FMT_ENABLE_IF(std::is_same< S, detail::std_string_view< Char >>::value) >
FMT_CONSTEXPR basic_string_view< Char >::basic_string_view ( S  s)
inlinenoexcept

Definition at line 453 of file core.h.

Member Function Documentation

◆ begin()

template<typename Char >
constexpr auto basic_string_view< Char >::begin ( ) const -> iterator
inlineconstexprnoexcept

Definition at line 462 of file core.h.

◆ compare()

template<typename Char >
FMT_CONSTEXPR_CHAR_TRAITS auto basic_string_view< Char >::compare ( basic_string_view< Char >  other) const -> int
inline

Definition at line 487 of file core.h.

◆ data()

template<typename Char >
constexpr auto basic_string_view< Char >::data ( ) const -> const Char*
inlineconstexprnoexcept

Returns a pointer to the string data.

Definition at line 457 of file core.h.

◆ end()

template<typename Char >
constexpr auto basic_string_view< Char >::end ( ) const -> iterator
inlineconstexprnoexcept

Definition at line 463 of file core.h.

◆ operator[]()

template<typename Char >
constexpr auto basic_string_view< Char >::operator[] ( size_t  pos) const -> const Char&
inlineconstexprnoexcept

Definition at line 465 of file core.h.

◆ remove_prefix()

template<typename Char >
FMT_CONSTEXPR void basic_string_view< Char >::remove_prefix ( size_t  n)
inlinenoexcept

Definition at line 469 of file core.h.

◆ size()

template<typename Char >
constexpr auto basic_string_view< Char >::size ( ) const -> size_t
inlineconstexprnoexcept

Returns the string size.

Definition at line 460 of file core.h.

◆ starts_with() [1/3]

template<typename Char >
FMT_CONSTEXPR_CHAR_TRAITS auto basic_string_view< Char >::starts_with ( basic_string_view< Char >  sv) const -> bool
inlinenoexcept

Definition at line 474 of file core.h.

◆ starts_with() [2/3]

template<typename Char >
FMT_CONSTEXPR_CHAR_TRAITS auto basic_string_view< Char >::starts_with ( Char  c) const -> bool
inlinenoexcept

Definition at line 479 of file core.h.

◆ starts_with() [3/3]

template<typename Char >
FMT_CONSTEXPR_CHAR_TRAITS auto basic_string_view< Char >::starts_with ( const Char *  s) const -> bool
inline

Definition at line 482 of file core.h.

Friends And Related Function Documentation

◆ operator!=

template<typename Char >
auto operator!= ( basic_string_view< Char >  lhs,
basic_string_view< Char >  rhs 
) -> bool
friend

Definition at line 500 of file core.h.

◆ operator<

template<typename Char >
auto operator< ( basic_string_view< Char >  lhs,
basic_string_view< Char >  rhs 
) -> bool
friend

Definition at line 503 of file core.h.

◆ operator<=

template<typename Char >
auto operator<= ( basic_string_view< Char >  lhs,
basic_string_view< Char >  rhs 
) -> bool
friend

Definition at line 506 of file core.h.

◆ operator==

template<typename Char >
FMT_CONSTEXPR_CHAR_TRAITS friend auto operator== ( basic_string_view< Char >  lhs,
basic_string_view< Char >  rhs 
) -> bool
friend

Definition at line 495 of file core.h.

◆ operator>

template<typename Char >
auto operator> ( basic_string_view< Char >  lhs,
basic_string_view< Char >  rhs 
) -> bool
friend

Definition at line 509 of file core.h.

◆ operator>=

template<typename Char >
auto operator>= ( basic_string_view< Char >  lhs,
basic_string_view< Char >  rhs 
) -> bool
friend

Definition at line 512 of file core.h.

Member Data Documentation

◆ data_

template<typename Char >
const Char* basic_string_view< Char >::data_
private

Definition at line 417 of file core.h.

◆ size_

template<typename Char >
size_t basic_string_view< Char >::size_
private

Definition at line 418 of file core.h.


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


plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Aug 11 2024 02:24:28