Seastar
High performance C++ framework for concurrent servers
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
seastar::basic_sstring< char_type, Size, max_size, NulTerminate > Class Template Reference

Classes

struct  initialized_later
 

Public Types

using value_type = char_type
 
using traits_type = std::char_traits< char_type >
 
using allocator_type = std::allocator< char_type >
 
using reference = char_type &
 
using const_reference = const char_type &
 
using pointer = char_type *
 
using const_pointer = const char_type *
 
using iterator = char_type *
 
using const_iterator = const char_type *
 
using difference_type = ssize_t
 
using size_type = Size
 

Public Member Functions

 basic_sstring (const basic_sstring &x)
 
 basic_sstring (basic_sstring &&x) noexcept
 
 basic_sstring (initialized_later, size_t size)
 
 basic_sstring (const char_type *x, size_t size)
 
 basic_sstring (size_t size, char_type x)
 
 basic_sstring (const char *x)
 
 basic_sstring (std::basic_string< char_type > &x)
 
 basic_sstring (std::initializer_list< char_type > x)
 
 basic_sstring (const char_type *b, const char_type *e)
 
 basic_sstring (const std::basic_string< char_type > &s)
 
template<typename InputIterator >
 basic_sstring (InputIterator first, InputIterator last)
 
 basic_sstring (std::basic_string_view< char_type, traits_type > v)
 
basic_sstringoperator= (const basic_sstring &x)
 
basic_sstringoperator= (basic_sstring &&x) noexcept
 
 operator std::basic_string< char_type > () const
 
size_t size () const noexcept
 
size_t length () const noexcept
 
size_t find (char_type t, size_t pos=0) const noexcept
 
size_t find (const char_type *c_str, size_t pos, size_t len2) const noexcept
 
constexpr size_t find (const char_type *s, size_t pos=0) const noexcept
 
size_t find (const basic_sstring &s, size_t pos=0) const noexcept
 
template<class StringViewLike , std::enable_if_t< std::is_convertible_v< StringViewLike, std::basic_string_view< char_type, traits_type >>, int > = 0>
size_t find (const StringViewLike &sv_like, size_type pos=0) const noexcept
 
size_t find_last_of (char_type c, size_t pos=npos) const noexcept
 
basic_sstringappend (const char_type *s, size_t n)
 
template<class Operation >
void resize_and_overwrite (size_t n, Operation op)
 
void resize (size_t n, const char_type c='\0')
 
basic_sstringreplace (size_type pos, size_type n1, const char_type *s, size_type n2)
 
template<class InputIterator >
basic_sstringreplace (const_iterator i1, const_iterator i2, InputIterator first, InputIterator last)
 
iterator erase (iterator first, iterator last)
 
template<class InputIterator >
void insert (const_iterator p, InputIterator beg, InputIterator end)
 
reference front () noexcept
 
const_reference front () const noexcept
 
reference back () noexcept
 
const_reference back () const noexcept
 
basic_sstring substr (size_t from, size_t len=npos) const
 
const char_type & at (size_t pos) const
 
char_type & at (size_t pos)
 
bool empty () const noexcept
 
void reset () noexcept
 
temporary_buffer< char_type > release () &&
 
int compare (std::basic_string_view< char_type, traits_type > x) const noexcept
 
int compare (size_t pos, size_t sz, std::basic_string_view< char_type, traits_type > x) const
 
constexpr bool starts_with (std::basic_string_view< char_type, traits_type > sv) const noexcept
 
constexpr bool starts_with (char_type c) const noexcept
 
constexpr bool starts_with (const char_type *s) const noexcept
 
constexpr bool ends_with (std::basic_string_view< char_type, traits_type > sv) const noexcept
 
constexpr bool ends_with (char_type c) const noexcept
 
constexpr bool ends_with (const char_type *s) const noexcept
 
constexpr bool contains (std::basic_string_view< char_type, traits_type > sv) const noexcept
 
constexpr bool contains (char_type c) const noexcept
 
constexpr bool contains (const char_type *s) const noexcept
 
void swap (basic_sstring &x) noexcept
 
char_type * data () noexcept
 
const char_type * data () const noexcept
 
const char_type * c_str () const noexcept
 
const char_type * begin () const noexcept
 
const char_type * end () const noexcept
 
const char_type * cbegin () const noexcept
 
const char_type * cend () const noexcept
 
char_type * begin () noexcept
 
char_type * end () noexcept
 
bool operator== (const basic_sstring &x) const noexcept
 
bool operator!= (const basic_sstring &x) const noexcept
 
constexpr bool operator== (const std::basic_string< char_type > x) const noexcept
 
constexpr bool operator== (const char_type *x) const noexcept
 
bool operator< (const basic_sstring &x) const noexcept
 
basic_sstring operator+ (const basic_sstring &x) const
 
basic_sstringoperator+= (const basic_sstring &x)
 
char_type & operator[] (size_type pos) noexcept
 
const char_type & operator[] (size_type pos) const noexcept
 
 operator std::basic_string_view< char_type > () const noexcept
 

Static Public Member Functions

static constexpr unsigned padding ()
 

Static Public Attributes

static constexpr size_type npos = static_cast<size_type>(-1)
 

Class Documentation

◆ seastar::basic_sstring::initialized_later

struct seastar::basic_sstring::initialized_later

Member Function Documentation

◆ append()

template<typename char_type , typename Size , Size max_size, bool NulTerminate>
basic_sstring& seastar::basic_sstring< char_type, Size, max_size, NulTerminate >::append ( const char_type *  s,
size_t  n 
)
inline

Append a C substring.

Parameters
sThe C string to append.
nThe number of characters to append.
Returns
Reference to this string.

◆ back() [1/2]

template<typename char_type , typename Size , Size max_size, bool NulTerminate>
const_reference seastar::basic_sstring< char_type, Size, max_size, NulTerminate >::back ( ) const
inlinenoexcept

Returns a read-only (constant) reference to the data at the last element of the string. This function shall not be called on empty strings.

◆ back() [2/2]

template<typename char_type , typename Size , Size max_size, bool NulTerminate>
reference seastar::basic_sstring< char_type, Size, max_size, NulTerminate >::back ( )
inlinenoexcept

Returns a read/write reference to the data at the last element of the string. This function shall not be called on empty strings.

◆ find_last_of()

template<typename char_type , typename Size , Size max_size, bool NulTerminate>
size_t seastar::basic_sstring< char_type, Size, max_size, NulTerminate >::find_last_of ( char_type  c,
size_t  pos = npos 
) const
inlinenoexcept

find_last_of find the last occurrence of c in the string. When pos is specified, the search only includes characters at or before position pos.

◆ front() [1/2]

template<typename char_type , typename Size , Size max_size, bool NulTerminate>
const_reference seastar::basic_sstring< char_type, Size, max_size, NulTerminate >::front ( ) const
inlinenoexcept

Returns a read-only (constant) reference to the data at the first element of the string. This function shall not be called on empty strings.

◆ front() [2/2]

template<typename char_type , typename Size , Size max_size, bool NulTerminate>
reference seastar::basic_sstring< char_type, Size, max_size, NulTerminate >::front ( )
inlinenoexcept

Returns a read/write reference to the data at the first element of the string. This function shall not be called on empty strings.

◆ insert()

template<typename char_type , typename Size , Size max_size, bool NulTerminate>
template<class InputIterator >
void seastar::basic_sstring< char_type, Size, max_size, NulTerminate >::insert ( const_iterator  p,
InputIterator  beg,
InputIterator  end 
)
inline

Inserts additional characters into the string right before the character indicated by p.

◆ replace()

template<typename char_type , typename Size , Size max_size, bool NulTerminate>
basic_sstring& seastar::basic_sstring< char_type, Size, max_size, NulTerminate >::replace ( size_type  pos,
size_type  n1,
const char_type *  s,
size_type  n2 
)
inline

Replace characters with a value of a C style substring.

◆ resize()

template<typename char_type , typename Size , Size max_size, bool NulTerminate>
void seastar::basic_sstring< char_type, Size, max_size, NulTerminate >::resize ( size_t  n,
const char_type  c = '\0' 
)
inline

Resize string.

Parameters
nnew size.
cif n greater than current size character to fill newly allocated space with.

◆ resize_and_overwrite()

template<typename char_type , typename Size , Size max_size, bool NulTerminate>
template<class Operation >
void seastar::basic_sstring< char_type, Size, max_size, NulTerminate >::resize_and_overwrite ( size_t  n,
Operation  op 
)
inline

Resize string and use the specified op to modify the content and the length

Parameters
nnew size
opthe function object used for setting the new content of the string

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