BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bslstl::StringRefImp< CHAR_TYPE > Class Template Reference

#include <bslstl_stringref.h>

Inheritance diagram for bslstl::StringRefImp< CHAR_TYPE >:
bslstl::StringRefData< CHAR_TYPE > bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >

Public Types

typedef const CHAR_TYPE value_type
 
typedef const CHAR_TYPE & reference
 
typedef const CHAR_TYPE & const_reference
 
typedef const CHAR_TYPE * iterator
 
typedef const CHAR_TYPE * const_iterator
 
typedef bsl::reverse_iterator< const_iteratorconst_reverse_iterator
 
typedef std::ptrdiff_t difference_type
 
typedef std::size_t size_type
 Standard Library general container requirements.
 
- Public Types inherited from bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >
typedef CHAR_TRAITS traits_type
 
typedef CHAR_TYPE value_type
 
typedef value_typepointer
 
typedef const value_typeconst_pointer
 
typedef value_typereference
 
typedef const value_typeconst_reference
 
typedef const value_typeconst_iterator
 
typedef const_iterator iterator
 
typedef bsl::reverse_iterator< iteratorreverse_iterator
 
typedef bsl::reverse_iterator< const_iteratorconst_reverse_iterator
 
typedef std::size_t size_type
 
typedef std::ptrdiff_t difference_type
 

Public Member Functions

 BSLMF_NESTED_TRAIT_DECLARATION (StringRefImp, bsl::is_trivially_copyable)
 
 StringRefImp ()
 
template<class INT_TYPE >
 StringRefImp (const CHAR_TYPE *data, INT_TYPE length, typename bsl::enable_if< bsl::is_integral< INT_TYPE >::value, bslmf::Nil >::type=bslmf::Nil())
 
 StringRefImp (const CHAR_TYPE *data, size_type length)
 
 StringRefImp (const_iterator begin, const_iterator end)
 
 StringRefImp (const CHAR_TYPE *data)
 
 StringRefImp (const bsl::basic_string_view< CHAR_TYPE > &str)
 
 StringRefImp (const std::basic_string< CHAR_TYPE > &str)
 
 StringRefImp (const bsl::basic_string< CHAR_TYPE > &str)
 
 StringRefImp (const StringRefImp &original)=default
 
 StringRefImp (const StringRefImp &original, size_type startIndex, size_type numCharacters)
 
 ~StringRefImp ()=default
 Destroy this object.
 
StringRefImpoperator= (const StringRefImp &rhs)=default
 
template<class INT_TYPE >
void assign (const CHAR_TYPE *data, INT_TYPE length, typename bsl::enable_if< bsl::is_integral< INT_TYPE >::value, bslmf::Nil >::type=bslmf::Nil())
 
void assign (const CHAR_TYPE *data, size_type length)
 
void assign (const_iterator begin, const_iterator end)
 
void assign (const CHAR_TYPE *data)
 
void assign (const bsl::basic_string< CHAR_TYPE > &str)
 
void assign (const StringRefImp< CHAR_TYPE > &stringRef)
 
void reset ()
 
const_reference operator[] (size_type index) const
 
 operator std::basic_string< CHAR_TYPE > () const
 
const_iterator begin () const
 
const_iterator end () const
 
const_reverse_iterator rbegin () const
 
const_reverse_iterator rend () const
 
const CHAR_TYPE * data () const
 
bool empty () const
 
bool isEmpty () const
 
size_type length () const
 
size_type size () const
 
int compare (const StringRefImp &other) const
 
- Public Member Functions inherited from bslstl::StringRefData< CHAR_TYPE >
 BSLMF_NESTED_TRAIT_DECLARATION (StringRefData, bsl::is_trivially_copyable)
 
 StringRefData ()
 
 StringRefData (const CHAR_TYPE *begin, const CHAR_TYPE *end)
 
 StringRefData (const bsl::basic_string_view< CHAR_TYPE > &view)
 Create a StringRefData object from the specified view.
 
 StringRefData (const StringRefData &)=default
 
 ~StringRefData ()=default
 
StringRefDataoperator= (const StringRefData &)=default
 
- Public Member Functions inherited from bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >
 BSLMF_NESTED_TRAIT_DECLARATION (basic_string_view, bsl::is_trivially_copyable)
 
BSLS_KEYWORD_CONSTEXPR basic_string_view () BSLS_KEYWORD_NOEXCEPT
 Create an empty view.
 
 basic_string_view (const basic_string_view &original)=default
 
BSLS_KEYWORD_CONSTEXPR_CPP17 basic_string_view (const CHAR_TYPE *characterString)
 
BSLS_KEYWORD_CONSTEXPR_CPP14 basic_string_view (const CHAR_TYPE *characterString, size_type numChars)
 
template<class CONTG_ITER , class SENTINEL >
BSLS_KEYWORD_CONSTEXPR_CPP14 basic_string_view (CONTG_ITER first, SENTINEL last, typename bsl::enable_if< BasicStringView_IsCompatibleIterator< CHAR_TYPE, CONTG_ITER >::value &&BasicStringView_IsCompatibleSentinel< SENTINEL >::value >::type *=0)
 
template<class ALLOCATOR >
 basic_string_view (const std::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > &str)
 Create a view of the specified string.
 
 ~basic_string_view ()=default
 Destroy this object.
 
basic_string_viewoperator= (const basic_string_view &rhs)=default
 
template<class ALLOCATOR >
BSLS_KEYWORD_CONSTEXPR_CPP14 basic_string_viewoperator= (const std::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > &rhs) BSLS_KEYWORD_NOEXCEPT
 
BSLS_KEYWORD_CONSTEXPR_CPP14 void remove_prefix (size_type numChars)
 
BSLS_KEYWORD_CONSTEXPR_CPP14 void remove_suffix (size_type numChars)
 
void swap (basic_string_view &other) BSLS_KEYWORD_NOEXCEPT
 
BSLS_KEYWORD_CONSTEXPR const_iterator begin () const BSLS_KEYWORD_NOEXCEPT
 
BSLS_KEYWORD_CONSTEXPR const_iterator cbegin () const BSLS_KEYWORD_NOEXCEPT
 
BSLS_KEYWORD_CONSTEXPR const_iterator end () const BSLS_KEYWORD_NOEXCEPT
 Return the past-the-end iterator for this view.
 
BSLS_KEYWORD_CONSTEXPR const_iterator cend () const BSLS_KEYWORD_NOEXCEPT
 
BSLS_KEYWORD_CONSTEXPR_CPP17 const_reverse_iterator rbegin () const BSLS_KEYWORD_NOEXCEPT
 
BSLS_KEYWORD_CONSTEXPR_CPP17 const_reverse_iterator crbegin () const BSLS_KEYWORD_NOEXCEPT
 
BSLS_KEYWORD_CONSTEXPR_CPP17 const_reverse_iterator rend () const BSLS_KEYWORD_NOEXCEPT
 Return the past-the-end reverse iterator for this view.
 
BSLS_KEYWORD_CONSTEXPR_CPP17 const_reverse_iterator crend () const BSLS_KEYWORD_NOEXCEPT
 
BSLS_KEYWORD_CONSTEXPR size_type size () const BSLS_KEYWORD_NOEXCEPT
 Return the length of this view.
 
BSLS_KEYWORD_CONSTEXPR size_type length () const BSLS_KEYWORD_NOEXCEPT
 Return the length of this view.
 
BSLS_KEYWORD_CONSTEXPR size_type max_size () const BSLS_KEYWORD_NOEXCEPT
 
BSLS_KEYWORD_CONSTEXPR bool empty () const BSLS_KEYWORD_NOEXCEPT
 Return true if this view has length 0, and false otherwise.
 
BSLS_KEYWORD_CONSTEXPR_CPP14 const_reference operator[] (size_type position) const
 
BSLS_KEYWORD_CONSTEXPR_CPP14 const_reference at (size_type position) const
 
BSLS_KEYWORD_CONSTEXPR_CPP14 const_reference front () const
 
BSLS_KEYWORD_CONSTEXPR_CPP14 const_reference back () const
 
BSLS_KEYWORD_CONSTEXPR const_pointer data () const BSLS_KEYWORD_NOEXCEPT
 
size_type copy (CHAR_TYPE *characterString, size_type numChars, size_type position=0) const
 
BSLS_KEYWORD_CONSTEXPR_CPP14 basic_string_view substr (size_type position=0, size_type numChars=npos) const
 
BSLS_KEYWORD_CONSTEXPR_CPP17 int compare (basic_string_view other) const BSLS_KEYWORD_NOEXCEPT
 
BSLS_KEYWORD_CONSTEXPR_CPP14 int compare (size_type position, size_type numChars, basic_string_view other) const
 
BSLS_KEYWORD_CONSTEXPR_CPP14 int compare (size_type lhsPosition, size_type lhsNumChars, basic_string_view other, size_type otherPosition, size_type otherNumChars) const
 
BSLS_KEYWORD_CONSTEXPR_CPP14 int compare (const CHAR_TYPE *other) const
 
BSLS_KEYWORD_CONSTEXPR_CPP14 int compare (size_type lhsPosition, size_type lhsNumChars, const CHAR_TYPE *other) const
 
BSLS_KEYWORD_CONSTEXPR_CPP14 int compare (size_type lhsPosition, size_type lhsNumChars, const CHAR_TYPE *other, size_type otherNumChars) const
 
BSLS_KEYWORD_CONSTEXPR_CPP17 bool starts_with (basic_string_view subview) const BSLS_KEYWORD_NOEXCEPT
 
BSLS_KEYWORD_CONSTEXPR bool starts_with (CHAR_TYPE character) const BSLS_KEYWORD_NOEXCEPT
 
BSLS_KEYWORD_CONSTEXPR_CPP17 bool starts_with (const CHAR_TYPE *characterString) const
 
BSLS_KEYWORD_CONSTEXPR_CPP17 bool ends_with (basic_string_view subview) const BSLS_KEYWORD_NOEXCEPT
 
BSLS_KEYWORD_CONSTEXPR bool ends_with (CHAR_TYPE character) const BSLS_KEYWORD_NOEXCEPT
 
BSLS_KEYWORD_CONSTEXPR_CPP17 bool ends_with (const CHAR_TYPE *characterString) const
 
BSLS_KEYWORD_CONSTEXPR_CPP14 size_type find (basic_string_view subview, size_type position=0) const BSLS_KEYWORD_NOEXCEPT
 
BSLS_KEYWORD_CONSTEXPR_CPP14 size_type find (const CHAR_TYPE *characterString, size_type position, size_type numChars) const
 
BSLS_KEYWORD_CONSTEXPR_CPP17 size_type find (const CHAR_TYPE *characterString, size_type position=0) const
 
BSLS_KEYWORD_CONSTEXPR_CPP14 size_type find (CHAR_TYPE character, size_type position=0) const BSLS_KEYWORD_NOEXCEPT
 
BSLS_KEYWORD_CONSTEXPR_CPP14 size_type rfind (basic_string_view subview, size_type position=npos) const BSLS_KEYWORD_NOEXCEPT
 
BSLS_KEYWORD_CONSTEXPR_CPP14 size_type rfind (const CHAR_TYPE *characterString, size_type position, size_type numChars) const
 
BSLS_KEYWORD_CONSTEXPR_CPP14 size_type rfind (const CHAR_TYPE *characterString, size_type position=npos) const
 
BSLS_KEYWORD_CONSTEXPR_CPP14 size_type rfind (CHAR_TYPE character, size_type position=npos) const BSLS_KEYWORD_NOEXCEPT
 
BSLS_KEYWORD_CONSTEXPR_CPP14 size_type find_first_of (basic_string_view subview, size_type position=0) const BSLS_KEYWORD_NOEXCEPT
 
BSLS_KEYWORD_CONSTEXPR_CPP14 size_type find_first_of (const CHAR_TYPE *characterString, size_type position, size_type numChars) const
 
BSLS_KEYWORD_CONSTEXPR_CPP17 size_type find_first_of (const CHAR_TYPE *characterString, size_type position=0) const
 
BSLS_KEYWORD_CONSTEXPR_CPP14 size_type find_first_of (CHAR_TYPE character, size_type position=0) const BSLS_KEYWORD_NOEXCEPT
 
BSLS_KEYWORD_CONSTEXPR_CPP14 size_type find_last_of (basic_string_view subview, size_type position=npos) const BSLS_KEYWORD_NOEXCEPT
 
BSLS_KEYWORD_CONSTEXPR_CPP14 size_type find_last_of (const CHAR_TYPE *characterString, size_type position, size_type numChars) const
 
BSLS_KEYWORD_CONSTEXPR_CPP17 size_type find_last_of (const CHAR_TYPE *characterString, size_type position=npos) const
 
BSLS_KEYWORD_CONSTEXPR_CPP14 size_type find_last_of (CHAR_TYPE character, size_type position=npos) const BSLS_KEYWORD_NOEXCEPT
 
BSLS_KEYWORD_CONSTEXPR_CPP14 size_type find_first_not_of (basic_string_view subview, size_type position=0) const BSLS_KEYWORD_NOEXCEPT
 
BSLS_KEYWORD_CONSTEXPR_CPP14 size_type find_first_not_of (const CHAR_TYPE *characterString, size_type position, size_type numChars) const
 
BSLS_KEYWORD_CONSTEXPR_CPP17 size_type find_first_not_of (const CHAR_TYPE *characterString, size_type position=0) const
 
BSLS_KEYWORD_CONSTEXPR_CPP14 size_type find_first_not_of (CHAR_TYPE character, size_type position=0) const BSLS_KEYWORD_NOEXCEPT
 
BSLS_KEYWORD_CONSTEXPR_CPP14 size_type find_last_not_of (basic_string_view subview, size_type position=npos) const BSLS_KEYWORD_NOEXCEPT
 
BSLS_KEYWORD_CONSTEXPR_CPP14 size_type find_last_not_of (const CHAR_TYPE *characterString, size_type position, size_type numChars) const
 
BSLS_KEYWORD_CONSTEXPR_CPP17 size_type find_last_not_of (const CHAR_TYPE *characterString, size_type position=npos) const
 
BSLS_KEYWORD_CONSTEXPR_CPP14 size_type find_last_not_of (CHAR_TYPE character, size_type position=npos) const BSLS_KEYWORD_NOEXCEPT
 
template<class ALLOCATOR >
BSLS_KEYWORD_EXPLICIT operator std::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > () const
 
template<class CONTG_ITER , class SENTINEL >
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP14 basic_string_view (CONTG_ITER first, SENTINEL last, typename bsl::enable_if< BasicStringView_IsCompatibleIterator< CHAR_TYPE, CONTG_ITER >::value &&BasicStringView_IsCompatibleSentinel< SENTINEL >::value >::type *)
 
template<class ALLOCATOR >
BSLS_PLATFORM_AGGRESSIVE_INLINE basic_string_view (const std::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > &str)
 
template<class ALLOCATOR >
BSLS_PLATFORM_AGGRESSIVE_INLINE BSLS_KEYWORD_CONSTEXPR_CPP14 basic_string_view< CHAR_TYPE, CHAR_TRAITS > & operator= (const std::basic_string< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > &rhs) BSLS_KEYWORD_NOEXCEPT
 

Additional Inherited Members

- Static Public Member Functions inherited from bslstl::StringRefData< CHAR_TYPE >
static std::size_t cStringLength (const CHAR_TYPE *data)
 
- Static Public Attributes inherited from bsl::basic_string_view< CHAR_TYPE, CHAR_TRAITS >
static const size_type npos = ~size_type(0)
 

Detailed Description

template<class CHAR_TYPE>
class bslstl::StringRefImp< CHAR_TYPE >

This class provides a reference-semantic-like (see below) mechanism that allows const std::string values, which are represented externally as either an std::string or null-terminated c-style string (or parts thereof), to be treated both uniformly and efficiently when passed as an argument to a function in which the string's length will be needed. The interface of this class provides a subset of accessor methods found on std::string (but none of the manipulators) – all of which apply to the referenced string. But, because only non-modifiable access is afforded to the referenced string value, each of the manipulators on this type – assignment in particular – apply to this string-reference object itself (as if it had pointer semantics). Hence, this class has a hybrid of reference- and pointer-semantics.

This class:

  • supports a complete set of value-semantic operations
    • except for bdex serialization
  • is exception-neutral (agnostic)
  • is alias-safe
  • is const thread-safe For terminology see bsldoc_glossary .

See bslstl_stringref

Member Typedef Documentation

◆ const_iterator

template<class CHAR_TYPE >
typedef const CHAR_TYPE* bslstl::StringRefImp< CHAR_TYPE >::const_iterator

◆ const_reference

template<class CHAR_TYPE >
typedef const CHAR_TYPE& bslstl::StringRefImp< CHAR_TYPE >::const_reference

◆ const_reverse_iterator

template<class CHAR_TYPE >
typedef bsl::reverse_iterator<const_iterator> bslstl::StringRefImp< CHAR_TYPE >::const_reverse_iterator

◆ difference_type

template<class CHAR_TYPE >
typedef std::ptrdiff_t bslstl::StringRefImp< CHAR_TYPE >::difference_type

◆ iterator

template<class CHAR_TYPE >
typedef const CHAR_TYPE* bslstl::StringRefImp< CHAR_TYPE >::iterator

◆ reference

template<class CHAR_TYPE >
typedef const CHAR_TYPE& bslstl::StringRefImp< CHAR_TYPE >::reference

◆ size_type

template<class CHAR_TYPE >
typedef std::size_t bslstl::StringRefImp< CHAR_TYPE >::size_type

◆ value_type

template<class CHAR_TYPE >
typedef const CHAR_TYPE bslstl::StringRefImp< CHAR_TYPE >::value_type

Constructor & Destructor Documentation

◆ StringRefImp() [1/10]

template<class CHAR_TYPE >
bslstl::StringRefImp< CHAR_TYPE >::StringRefImp ( )
inline

Create an object representing an empty std::string value that is independent of any external representation and with the following attribute values:

begin() == end()
isEmpty() == true
const_iterator end() const
Definition bslstl_stringref.h:913
bool isEmpty() const
Definition bslstl_stringref.h:950
const_iterator begin() const
Definition bslstl_stringref.h:905

◆ StringRefImp() [2/10]

template<class CHAR_TYPE >
template<class INT_TYPE >
bslstl::StringRefImp< CHAR_TYPE >::StringRefImp ( const CHAR_TYPE *  data,
INT_TYPE  length,
typename bsl::enable_if< bsl::is_integral< INT_TYPE >::value, bslmf::Nil >::type  = bslmf::Nil() 
)
inline

Create a string-reference object having a valid std::string value, whose external representation begins at the specified data address and extends for the specified length. The external representation must remain valid as long as it is bound to this string reference. Passing 0 has the same effect as default construction. The behavior is undefined unless 0 <= length and, if 0 == data, then 0 == length. Note that, like an std::string, the data need not be null-terminated and may contain embedded null characters. Note that the template and non-template versions combine to allow various integral and enumeration types to be used for length while preventing (char *, 0) initializer arguments from matching the two-iterator constructor below.

◆ StringRefImp() [3/10]

template<class CHAR_TYPE >
bslstl::StringRefImp< CHAR_TYPE >::StringRefImp ( const CHAR_TYPE *  data,
size_type  length 
)
inline

◆ StringRefImp() [4/10]

template<class CHAR_TYPE >
bslstl::StringRefImp< CHAR_TYPE >::StringRefImp ( const_iterator  begin,
const_iterator  end 
)
inline

Create a string-reference object having a valid std::string value, whose external representation begins at the specified begin iterator and extends up to, but not including, the specified end iterator. The external representation must remain valid as long as it is bound to this string reference. The behavior is undefined unless begin <= end. Note that, like an std::string, the string need not be null-terminated and may contain embedded null characters.

◆ StringRefImp() [5/10]

template<class CHAR_TYPE >
bslstl::StringRefImp< CHAR_TYPE >::StringRefImp ( const CHAR_TYPE *  data)
inline

Create a string-reference object having a valid std::string value, whose external representation begins at the specified data address and extends for std::char_traits<CHAR_TYPE>::length(data) characters. The external representation must remain valid as long as it is bound to this string reference. The behavior is undefined unless data is null-terminated.

◆ StringRefImp() [6/10]

template<class CHAR_TYPE >
bslstl::StringRefImp< CHAR_TYPE >::StringRefImp ( const bsl::basic_string_view< CHAR_TYPE > &  str)
inline

Create a string-reference object having a valid std::string value, whose external representation is defined by the specified str object. The external representation must remain valid as long as it is bound to this string reference.

◆ StringRefImp() [7/10]

template<class CHAR_TYPE >
bslstl::StringRefImp< CHAR_TYPE >::StringRefImp ( const std::basic_string< CHAR_TYPE > &  str)
inline

◆ StringRefImp() [8/10]

template<class CHAR_TYPE >
bslstl::StringRefImp< CHAR_TYPE >::StringRefImp ( const bsl::basic_string< CHAR_TYPE > &  str)
inline

◆ StringRefImp() [9/10]

template<class CHAR_TYPE >
bslstl::StringRefImp< CHAR_TYPE >::StringRefImp ( const StringRefImp< CHAR_TYPE > &  original)
default

Create a string-reference object having a valid std::string value, whose external representation is defined by the specified original object. The external representation must remain valid as long as it is bound to this string reference. Note that this trivial copy constructor's definition is compiler generated.

◆ StringRefImp() [10/10]

template<class CHAR_TYPE >
bslstl::StringRefImp< CHAR_TYPE >::StringRefImp ( const StringRefImp< CHAR_TYPE > &  original,
size_type  startIndex,
size_type  numCharacters 
)
inline

Create a string-reference object having a valid std::string value, whose external representation begins at the specified startIndex in the specified original string reference, and extends either the specified numCharacters or until the end of the original string reference, whichever comes first. The external representation must remain valid as long as it is bound to this string reference. The behavior is undefined unless startIndex <= original.length(). Note that if startIndex is original.length() an empty string reference is returned.

◆ ~StringRefImp()

template<class CHAR_TYPE >
bslstl::StringRefImp< CHAR_TYPE >::~StringRefImp ( )
default

Member Function Documentation

◆ assign() [1/6]

template<class CHAR_TYPE >
void bslstl::StringRefImp< CHAR_TYPE >::assign ( const bsl::basic_string< CHAR_TYPE > &  str)
inline

Bind this string reference to the specified str string. The string indicated by str must remain valid as long as it is bound to this object.

◆ assign() [2/6]

template<class CHAR_TYPE >
void bslstl::StringRefImp< CHAR_TYPE >::assign ( const CHAR_TYPE *  data)
inline

Bind this string reference to the string at the specified data address and extending for std::char_traits<CHAR_TYPE>::length(data) characters. The string at the data address must remain valid as long as it is bound to this string reference. The behavior is undefined unless data is null-terminated.

◆ assign() [3/6]

template<class CHAR_TYPE >
template<class INT_TYPE >
void bslstl::StringRefImp< CHAR_TYPE >::assign ( const CHAR_TYPE *  data,
INT_TYPE  length,
typename bsl::enable_if< bsl::is_integral< INT_TYPE >::value, bslmf::Nil >::type  = bslmf::Nil() 
)
inline

Bind this string reference to the string at the specified data address and extending for the specified length characters. The string indicated by data and length must remain valid as long as it is bound to this object. The behavior is undefined unless 0 <= length or 0 == data && 0 == length. Note that the string need not be null-terminated and may contain embedded null characters. Note that the template and non-template versions combine to allow various integral and enumeration types to be used for length while preventing (char *, 0) initializer arguments from matching the two-iterator overload of assign below.

◆ assign() [4/6]

template<class CHAR_TYPE >
void bslstl::StringRefImp< CHAR_TYPE >::assign ( const CHAR_TYPE *  data,
size_type  length 
)
inline

◆ assign() [5/6]

template<class CHAR_TYPE >
void bslstl::StringRefImp< CHAR_TYPE >::assign ( const StringRefImp< CHAR_TYPE > &  stringRef)
inline

Modify this string reference to refer to the same string as the specified stringRef. Note, that the string bound to stringRef must remain valid as long as it is bound to this object.

◆ assign() [6/6]

template<class CHAR_TYPE >
void bslstl::StringRefImp< CHAR_TYPE >::assign ( const_iterator  begin,
const_iterator  end 
)
inline

Bind this string reference to the string at the specified begin iterator, extending up to, but not including, the character at the specified end iterator. The string indicated by begin and end must remain valid as long as it is bound to this object. The behavior is undefined unless begin <= end. Note that the string need not be null-terminated and may contain embedded null characters.

◆ begin()

template<class CHAR_TYPE >
StringRefImp< CHAR_TYPE >::const_iterator bslstl::StringRefImp< CHAR_TYPE >::begin ( ) const
inline

Return an STL-compatible iterator to the first character of the string bound to this string reference or end() if the string reference is empty. The iterator remains valid as long as this object is valid and is bound to the same string.

◆ BSLMF_NESTED_TRAIT_DECLARATION()

template<class CHAR_TYPE >
bslstl::StringRefImp< CHAR_TYPE >::BSLMF_NESTED_TRAIT_DECLARATION ( StringRefImp< CHAR_TYPE >  ,
bsl::is_trivially_copyable   
)

◆ compare()

template<class CHAR_TYPE >
int bslstl::StringRefImp< CHAR_TYPE >::compare ( const StringRefImp< CHAR_TYPE > &  other) const
inline

Compare this and the specified other string objects using a lexicographical comparison and return a negative value if this string is less than other string, a positive value if this string is greater than other string, and 0 if this string is equal to other string.

◆ data()

template<class CHAR_TYPE >
const CHAR_TYPE * bslstl::StringRefImp< CHAR_TYPE >::data ( ) const
inline

Return the address of the first character of the string bound to this string reference such that [data() .. data()+length()) is a valid half-open range of characters. Note that the range of characters might not be null-terminated and may contain embedded null characters.

◆ empty()

template<class CHAR_TYPE >
bool bslstl::StringRefImp< CHAR_TYPE >::empty ( ) const
inline

Return true if this object represents an empty string value, and false otherwise. This object represents an empty string value if begin() == end(). Note that this method is functionally identical with the isEmpty method and allows developers to avoid distracting syntax differences when StringRef appears in juxtaposition with string, which defines empty but not isEmpty.

◆ end()

template<class CHAR_TYPE >
StringRefImp< CHAR_TYPE >::const_iterator bslstl::StringRefImp< CHAR_TYPE >::end ( ) const
inline

Return an STL-compatible iterator one-past-the-last character of the string bound to this string reference or begin() if the string reference is empty. The iterator remains valid as long as this object is valid and is bound to the same string.

◆ isEmpty()

template<class CHAR_TYPE >
bool bslstl::StringRefImp< CHAR_TYPE >::isEmpty ( ) const
inline

Return true if this object represents an empty string value, and false otherwise. This object represents an empty string value if begin() == end().

◆ length()

template<class CHAR_TYPE >
StringRefImp< CHAR_TYPE >::size_type bslstl::StringRefImp< CHAR_TYPE >::length ( ) const
inline

Return the length of the string referred to by this object. Note that this call is equivalent to end() - begin().

◆ operator=()

template<class CHAR_TYPE >
StringRefImp & bslstl::StringRefImp< CHAR_TYPE >::operator= ( const StringRefImp< CHAR_TYPE > &  rhs)
default

Modify this string reference to refer to the same string as the specified rhs string reference and return a reference providing modifiable access to this object. The assigned object is guaranteed to have values of attributes begin and end equal to the rhs object's attributes.

◆ operator[]()

template<class CHAR_TYPE >
StringRefImp< CHAR_TYPE >::const_reference bslstl::StringRefImp< CHAR_TYPE >::operator[] ( size_type  index) const
inline

Return a reference providing a non-modifiable access to the character at the specified index in the string bound to this reference. This reference remains valid as long as the string currently bound to this object remains valid. The behavior is undefined unless 0 <= index < length().

◆ rbegin()

template<class CHAR_TYPE >
StringRefImp< CHAR_TYPE >::const_reverse_iterator bslstl::StringRefImp< CHAR_TYPE >::rbegin ( ) const
inline

Return an STL-compatible reverse iterator to the last character of the string bound to this string reference or rend() if the string reference is empty. The iterator remains valid as long as this object is valid and is bound to the same string.

◆ rend()

template<class CHAR_TYPE >
StringRefImp< CHAR_TYPE >::const_reverse_iterator bslstl::StringRefImp< CHAR_TYPE >::rend ( ) const
inline

Return an STL-compatible reverse iterator to the prior-to-the-beginning character of the string bound to this string reference or rbegin() if the string reference is empty. The iterator remains valid as long as this object is valid and is bound to the same string.

◆ reset()

template<class CHAR_TYPE >
void bslstl::StringRefImp< CHAR_TYPE >::reset ( )
inline

Reset this string reference to the default-constructed state having an empty std::string value and the following attribute values:

begin() == end()
isEmpty() == true

◆ size()

template<class CHAR_TYPE >
StringRefImp< CHAR_TYPE >::size_type bslstl::StringRefImp< CHAR_TYPE >::size ( ) const
inline

Return the number of characters in the string referred to by this object. Note that this call is equivalent to end() - begin().


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