String literal wrapper. More...
#include <string_literal_fwd.hpp>
Public Types | |
typedef CharT | value_type |
typedef TraitsT | traits_type |
typedef std::size_t | size_type |
typedef std::ptrdiff_t | difference_type |
typedef const value_type * | const_pointer |
typedef value_type const & | const_reference |
typedef const value_type * | const_iterator |
typedef std::reverse_iterator < const_iterator > | const_reverse_iterator |
typedef std::basic_string < value_type, traits_type > | string_type |
Corresponding STL string type. More... | |
Public Member Functions | |
basic_string_literal () BOOST_NOEXCEPT | |
Constructor. More... | |
template<typename T , size_type LenV> | |
basic_string_literal (T(&p)[LenV]) BOOST_NOEXCEPT | |
Constructor from a string literal. More... | |
basic_string_literal (basic_string_literal const &that) BOOST_NOEXCEPT | |
Copy constructor. More... | |
this_type & | operator= (this_type const &that) BOOST_NOEXCEPT |
Assignment operator. More... | |
template<typename T , size_type LenV> | |
enable_if< is_same< T, const value_type >, this_type & > ::type | operator= (T(&p)[LenV]) BOOST_NOEXCEPT |
Assignment from a string literal. More... | |
bool | operator== (this_type const &that) const BOOST_NOEXCEPT |
Lexicographical comparison (equality) More... | |
bool | operator== (const_pointer str) const BOOST_NOEXCEPT |
Lexicographical comparison (equality) More... | |
bool | operator== (string_type const &that) const |
Lexicographical comparison (equality) More... | |
bool | operator< (this_type const &that) const BOOST_NOEXCEPT |
Lexicographical comparison (less ordering) More... | |
bool | operator< (const_pointer str) const BOOST_NOEXCEPT |
Lexicographical comparison (less ordering) More... | |
bool | operator< (string_type const &that) const |
Lexicographical comparison (less ordering) More... | |
bool | operator> (this_type const &that) const BOOST_NOEXCEPT |
Lexicographical comparison (greater ordering) More... | |
bool | operator> (const_pointer str) const BOOST_NOEXCEPT |
Lexicographical comparison (greater ordering) More... | |
bool | operator> (string_type const &that) const |
Lexicographical comparison (greater ordering) More... | |
const_reference | operator[] (size_type i) const BOOST_NOEXCEPT |
Subscript operator. More... | |
const_reference | at (size_type i) const |
Checked subscript. More... | |
const_pointer | c_str () const BOOST_NOEXCEPT |
const_pointer | data () const BOOST_NOEXCEPT |
size_type | size () const BOOST_NOEXCEPT |
size_type | length () const BOOST_NOEXCEPT |
bool | empty () const BOOST_NOEXCEPT |
const_iterator | begin () const BOOST_NOEXCEPT |
const_iterator | end () const BOOST_NOEXCEPT |
const_reverse_iterator | rbegin () const BOOST_NOEXCEPT |
const_reverse_iterator | rend () const BOOST_NOEXCEPT |
string_type | str () const |
void | clear () BOOST_NOEXCEPT |
The method clears the literal. More... | |
void | swap (this_type &that) BOOST_NOEXCEPT |
The method swaps two literals. More... | |
this_type & | assign (this_type const &that) BOOST_NOEXCEPT |
Assignment from another literal. More... | |
template<typename T , size_type LenV> | |
enable_if< is_same< T, const value_type >, this_type & > ::type | assign (T(&p)[LenV]) BOOST_NOEXCEPT |
Assignment from another literal. More... | |
size_type | copy (value_type *str, size_type n, size_type pos=0) const |
The method copies the literal or its portion to an external buffer. More... | |
int | compare (size_type pos, size_type n, const_pointer str, size_type len) const |
Lexicographically compares the argument string to a part of this string. More... | |
int | compare (size_type pos, size_type n, const_pointer str) const BOOST_NOEXCEPT |
Lexicographically compares the argument string to a part of this string. More... | |
int | compare (size_type pos, size_type n, this_type const &that) const BOOST_NOEXCEPT |
Lexicographically compares the argument string literal to a part of this string. More... | |
int | compare (const_pointer str, size_type len) const BOOST_NOEXCEPT |
Lexicographically compares the argument string to this string. More... | |
int | compare (const_pointer str) const BOOST_NOEXCEPT |
Lexicographically compares the argument string to this string. More... | |
int | compare (this_type const &that) const BOOST_NOEXCEPT |
Lexicographically compares the argument string to this string. More... | |
String literal wrapper.
The basic_string_literal
is a thin wrapper around a constant string literal. It provides interface similar to STL strings, but because of read-only nature of string literals, lacks ability to modify string contents. However, basic_string_literal
objects can be assigned to and cleared.
The main advantage of this class comparing to other string classes is that it doesn't dynamically allocate memory and therefore is fast, thin and exception safe.
typedef const value_type* boost::basic_string_literal< CharT, TraitsT >::const_iterator |
typedef const value_type* boost::basic_string_literal< CharT, TraitsT >::const_pointer |
typedef value_type const& boost::basic_string_literal< CharT, TraitsT >::const_reference |
typedef std::reverse_iterator< const_iterator > boost::basic_string_literal< CharT, TraitsT >::const_reverse_iterator |
typedef std::ptrdiff_t boost::basic_string_literal< CharT, TraitsT >::difference_type |
typedef std::size_t boost::basic_string_literal< CharT, TraitsT >::size_type |
typedef std::basic_string< value_type, traits_type > boost::basic_string_literal< CharT, TraitsT >::string_type |
Corresponding STL string type.
typedef TraitsT boost::basic_string_literal< CharT, TraitsT >::traits_type |
typedef CharT boost::basic_string_literal< CharT, TraitsT >::value_type |
|
inline |
Constructor.
empty() == true
References boost::basic_string_literal< CharT, TraitsT >::clear().
|
inline |
Constructor from a string literal.
*this == p
p | A zero-terminated constant sequence of characters |
|
inline |
Copy constructor.
*this == that
that | Source literal to copy string from |
|
inline |
Assignment from another literal.
*this == that
that | Source literal to copy string from |
Referenced by boost::basic_string_literal< CharT, TraitsT >::operator=().
|
inline |
Assignment from another literal.
*this == p
p | A zero-terminated constant sequence of characters |
References boost::multiprecision::backends::p.
|
inline |
Checked subscript.
i | Requested character index |
Throws: An std::exception
-based exception if index i is out of string boundaries
References BOOST_THROW_EXCEPTION, and boost::multiprecision::backends::i.
|
inline |
Referenced by boost::basic_string_literal< CharT, TraitsT >::rend().
|
inline |
Referenced by boost::operator<<(), and boost::expressions::aux::parse_named_scope_format().
|
inline |
The method clears the literal.
empty() == true
Referenced by boost::basic_string_literal< CharT, TraitsT >::basic_string_literal().
|
inline |
Lexicographically compares the argument string to a part of this string.
pos <= size()
pos | Starting position within this string to perform comparison to |
n | Length of the substring of this string to perform comparison to |
str | Comparand. Must point to a sequence of characters, must not be NULL. |
len | Number of characters in the sequence str. |
Throws: An std::exception
-based exception if pos is out of range.
References BOOST_THROW_EXCEPTION, boost::python::len(), and boost::n.
Referenced by boost::basic_string_literal< CharT, TraitsT >::compare().
|
inline |
Lexicographically compares the argument string to a part of this string.
pos <= size()
pos | Starting position within this string to perform comparison to |
n | Length of the substring of this string to perform comparison to |
str | Comparand. Must point to a zero-terminated sequence of characters, must not be NULL. |
Throws: An std::exception
-based exception if pos is out of range.
References boost::basic_string_literal< CharT, TraitsT >::compare(), boost::n, and boost::basic_string_literal< CharT, TraitsT >::str().
|
inline |
Lexicographically compares the argument string literal to a part of this string.
pos <= size()
pos | Starting position within this string to perform comparison to |
n | Length of the substring of this string to perform comparison to |
that | Comparand |
Throws: An std::exception
-based exception if pos is out of range.
References boost::basic_string_literal< CharT, TraitsT >::compare(), and boost::n.
|
inline |
Lexicographically compares the argument string to this string.
str | Comparand. Must point to a sequence of characters, must not be NULL. |
len | Number of characters in the sequence str. |
References boost::basic_string_literal< CharT, TraitsT >::compare(), boost::python::len(), and boost::basic_string_literal< CharT, TraitsT >::str().
|
inline |
Lexicographically compares the argument string to this string.
str | Comparand. Must point to a zero-terminated sequence of characters, must not be NULL. |
References boost::basic_string_literal< CharT, TraitsT >::compare(), and boost::basic_string_literal< CharT, TraitsT >::str().
|
inline |
Lexicographically compares the argument string to this string.
that | Comparand |
References boost::basic_string_literal< CharT, TraitsT >::compare().
|
inline |
The method copies the literal or its portion to an external buffer.
pos <= size()
str | Pointer to the external buffer beginning. Must not be NULL. The buffer must have enough capacity to accommodate the requested number of characters. |
n | Maximum number of characters to copy |
pos | Starting position to start copying from |
Throws: An std::exception
-based exception if pos is out of range.
References BOOST_THROW_EXCEPTION, boost::filesystem::detail::copy(), boost::python::len(), and boost::n.
|
inline |
|
inline |
true
if the literal is an empty string, false
otherwise
|
inline |
Referenced by boost::basic_string_literal< CharT, TraitsT >::rbegin().
|
inline |
|
inline |
Lexicographical comparison (less ordering)
that | Comparand |
true
if this string is less than the comparand, false
otherwise
|
inline |
Lexicographical comparison (less ordering)
str | Comparand. Must point to a zero-terminated sequence of characters, must not be NULL. |
true
if this string is less than the comparand, false
otherwise References boost::basic_string_literal< CharT, TraitsT >::str().
|
inline |
Lexicographical comparison (less ordering)
that | Comparand |
true
if this string is less than the comparand, false
otherwise
|
inline |
Assignment operator.
*this == that
that | Source literal to copy string from |
References boost::basic_string_literal< CharT, TraitsT >::assign().
|
inline |
Assignment from a string literal.
*this == p
p | A zero-terminated constant sequence of characters |
References boost::basic_string_literal< CharT, TraitsT >::assign(), and boost::multiprecision::backends::p.
|
inline |
Lexicographical comparison (equality)
that | Comparand |
true
if the comparand string equals to this string, false
otherwise
|
inline |
Lexicographical comparison (equality)
str | Comparand. Must point to a zero-terminated sequence of characters, must not be NULL. |
true
if the comparand string equals to this string, false
otherwise References boost::basic_string_literal< CharT, TraitsT >::str().
|
inline |
Lexicographical comparison (equality)
that | Comparand |
true
if the comparand string equals to this string, false
otherwise
|
inline |
Lexicographical comparison (greater ordering)
that | Comparand |
true
if this string is greater than the comparand, false
otherwise
|
inline |
Lexicographical comparison (greater ordering)
str | Comparand. Must point to a zero-terminated sequence of characters, must not be NULL. |
true
if this string is greater than the comparand, false
otherwise References boost::basic_string_literal< CharT, TraitsT >::str().
|
inline |
Lexicographical comparison (greater ordering)
that | Comparand |
true
if this string is greater than the comparand, false
otherwise
|
inline |
Subscript operator.
i < size()
i | Requested character index |
References boost::multiprecision::backends::i.
|
inline |
References boost::basic_string_literal< CharT, TraitsT >::end().
|
inline |
References boost::basic_string_literal< CharT, TraitsT >::begin().
|
inline |
Referenced by boost::operator<<(), and boost::expressions::aux::parse_named_scope_format().
|
inline |
Referenced by boost::basic_string_literal< CharT, TraitsT >::compare(), boost::basic_string_literal< CharT, TraitsT >::operator<(), boost::basic_string_literal< CharT, TraitsT >::operator==(), and boost::basic_string_literal< CharT, TraitsT >::operator>().
|
inline |
The method swaps two literals.
References boost::multiprecision::backends::p.