Flow123d  master-f44eb46
Public Member Functions | Private Attributes | Friends | List of all members
fmt::BasicStringRef< Char > Class Template Reference

#include <format.h>

Public Member Functions

 BasicStringRef (const Char *s, std::size_t size)
 
 BasicStringRef (const Char *s)
 
 BasicStringRef (const std::basic_string< Char > &s)
 
std::basic_string< Char > to_string () const
 
const Char * data () const
 
std::size_t size () const
 
int compare (BasicStringRef other) const
 

Private Attributes

const Char * data_
 
std::size_t size_
 

Friends

bool operator== (BasicStringRef lhs, BasicStringRef rhs)
 
bool operator!= (BasicStringRef lhs, BasicStringRef rhs)
 
bool operator< (BasicStringRef lhs, BasicStringRef rhs)
 
bool operator<= (BasicStringRef lhs, BasicStringRef rhs)
 
bool operator> (BasicStringRef lhs, BasicStringRef rhs)
 
bool operator>= (BasicStringRef lhs, BasicStringRef rhs)
 

Detailed Description

template<typename Char>
class fmt::BasicStringRef< Char >

\rst A string reference. It can be constructed from a C string or std::string.

You can use one of the following typedefs for common character types:

+---------—+----------------------—+ | Type | Definition | +============+=========================+ | StringRef | BasicStringRef<char> | +---------—+----------------------—+ | WStringRef | BasicStringRef<wchar_t> | +---------—+----------------------—+

This class is most useful as a parameter type to allow passing different types of strings to a function, for example::

template <typename... Args> std::string format(StringRef format_str, const Args & ... args);

format("{}", 42); format(std::string("{}"), 42); \endrst

Definition at line 413 of file format.h.

Constructor & Destructor Documentation

◆ BasicStringRef() [1/3]

template<typename Char >
fmt::BasicStringRef< Char >::BasicStringRef ( const Char *  s,
std::size_t  size 
)
inline

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

Definition at line 420 of file format.h.

◆ BasicStringRef() [2/3]

template<typename Char >
fmt::BasicStringRef< Char >::BasicStringRef ( 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 428 of file format.h.

◆ BasicStringRef() [3/3]

template<typename Char >
fmt::BasicStringRef< Char >::BasicStringRef ( const std::basic_string< Char > &  s)
inline

\rst Constructs a string reference from an std::string object. \endrst

Definition at line 436 of file format.h.

Member Function Documentation

◆ compare()

template<typename Char >
int fmt::BasicStringRef< Char >::compare ( BasicStringRef< Char >  other) const
inline

Definition at line 455 of file format.h.

◆ data()

template<typename Char >
const Char* fmt::BasicStringRef< Char >::data ( ) const
inline

Returns a pointer to the string data.

Definition at line 449 of file format.h.

Here is the caller graph for this function:

◆ size()

template<typename Char >
std::size_t fmt::BasicStringRef< Char >::size ( ) const
inline

Returns the string size.

Definition at line 452 of file format.h.

Here is the caller graph for this function:

◆ to_string()

template<typename Char >
std::basic_string<Char> fmt::BasicStringRef< Char >::to_string ( ) const
inline

\rst Converts a string reference to an std::string object. \endrst

Definition at line 444 of file format.h.

Friends And Related Function Documentation

◆ operator!=

template<typename Char >
bool operator!= ( BasicStringRef< Char >  lhs,
BasicStringRef< Char >  rhs 
)
friend

Definition at line 466 of file format.h.

◆ operator<

template<typename Char >
bool operator< ( BasicStringRef< Char >  lhs,
BasicStringRef< Char >  rhs 
)
friend

Definition at line 469 of file format.h.

◆ operator<=

template<typename Char >
bool operator<= ( BasicStringRef< Char >  lhs,
BasicStringRef< Char >  rhs 
)
friend

Definition at line 472 of file format.h.

◆ operator==

template<typename Char >
bool operator== ( BasicStringRef< Char >  lhs,
BasicStringRef< Char >  rhs 
)
friend

Definition at line 463 of file format.h.

◆ operator>

template<typename Char >
bool operator> ( BasicStringRef< Char >  lhs,
BasicStringRef< Char >  rhs 
)
friend

Definition at line 475 of file format.h.

◆ operator>=

template<typename Char >
bool operator>= ( BasicStringRef< Char >  lhs,
BasicStringRef< Char >  rhs 
)
friend

Definition at line 478 of file format.h.

Member Data Documentation

◆ data_

template<typename Char >
const Char* fmt::BasicStringRef< Char >::data_
private

Definition at line 415 of file format.h.

◆ size_

template<typename Char >
std::size_t fmt::BasicStringRef< Char >::size_
private

Definition at line 416 of file format.h.


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