|
| | 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.
|
| |
| StringRefImp & | operator= (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 |
| |
| | 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 |
| |
| StringRefData & | operator= (const StringRefData &)=default |
| |
| | 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_view & | operator= (const basic_string_view &rhs)=default |
| |
| template<class ALLOCATOR > |
| BSLS_KEYWORD_CONSTEXPR_CPP14 basic_string_view & | operator= (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 |
| |
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