WPILibC++ 2027.0.0-alpha-3
Loading...
Searching...
No Matches
wpi::SmallString< InternalLen > Class Template Reference

SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better as a string (e.g. More...

#include <wpi/SmallString.h>

Inheritance diagram for wpi::SmallString< InternalLen >:

Public Member Functions

 SmallString ()=default
 Default ctor - Initialize to empty.
 
 SmallString (std::string_view S)
 Initialize from a std::string_view.
 
 SmallString (std::initializer_list< std::string_view > Refs)
 Initialize by concatenating a list of std::string_views.
 
template<typename ItTy >
 SmallString (ItTy S, ItTy E)
 Initialize with a range.
 
std::string_view str () const
 Explicit conversion to std::string_view.
 
const char * c_str ()
 
 operator std::string_view () const
 Implicit conversion to std::string_view.
 
 operator std::string () const
 
SmallStringoperator= (std::string_view RHS)
 
SmallStringoperator+= (std::string_view RHS)
 
SmallStringoperator+= (char C)
 
String Assignment
void assign (std::string_view RHS)
 Assign from a std::string_view.
 
void assign (std::initializer_list< std::string_view > Refs)
 Assign from a list of std::string_views.
 
String Concatenation
void append (std::string_view RHS)
 Append from a std::string_view.
 
void append (std::initializer_list< std::string_view > Refs)
 Append from a list of std::string_views.
 
String Comparison
int compare (std::string_view RHS) const
 compare - Compare two strings; the result is negative, zero, or positive if this string is lexicographically less than, equal to, or greater than the RHS.
 
String Searching
size_t find (char C, size_t From=0) const
 find - Search for the first character C in the string.
 
size_t find (std::string_view Str, size_t From=0) const
 Search for the first string Str in the string.
 
size_t rfind (char C, size_t From=std::string_view::npos) const
 Search for the last character C in the string.
 
size_t rfind (std::string_view Str) const
 Search for the last string Str in the string.
 
size_t find_first_of (char C, size_t From=0) const
 Find the first character in the string that is C, or npos if not found.
 
size_t find_first_of (std::string_view Chars, size_t From=0) const
 Find the first character in the string that is in Chars, or npos if not found.
 
size_t find_first_not_of (char C, size_t From=0) const
 Find the first character in the string that is not C or npos if not found.
 
size_t find_first_not_of (std::string_view Chars, size_t From=0) const
 Find the first character in the string that is not in the string Chars, or npos if not found.
 
size_t find_last_of (char C, size_t From=std::string_view::npos) const
 Find the last character in the string that is C, or npos if not found.
 
size_t find_last_of (std::string_view Chars, size_t From=std::string_view::npos) const
 Find the last character in the string that is in C, or npos if not found.
 

Detailed Description

template<unsigned InternalLen>
class wpi::SmallString< InternalLen >

SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better as a string (e.g.

operator+ etc).

Constructor & Destructor Documentation

◆ SmallString() [1/4]

template<unsigned InternalLen>
wpi::SmallString< InternalLen >::SmallString ( )
default

Default ctor - Initialize to empty.

◆ SmallString() [2/4]

template<unsigned InternalLen>
wpi::SmallString< InternalLen >::SmallString ( std::string_view S)
inline

Initialize from a std::string_view.

◆ SmallString() [3/4]

template<unsigned InternalLen>
wpi::SmallString< InternalLen >::SmallString ( std::initializer_list< std::string_view > Refs)
inline

Initialize by concatenating a list of std::string_views.

◆ SmallString() [4/4]

template<unsigned InternalLen>
template<typename ItTy >
wpi::SmallString< InternalLen >::SmallString ( ItTy S,
ItTy E )
inline

Initialize with a range.

Member Function Documentation

◆ append() [1/2]

template<unsigned InternalLen>
void wpi::SmallString< InternalLen >::append ( std::initializer_list< std::string_view > Refs)
inline

Append from a list of std::string_views.

◆ append() [2/2]

template<unsigned InternalLen>
void wpi::SmallString< InternalLen >::append ( std::string_view RHS)
inline

Append from a std::string_view.

◆ assign() [1/2]

template<unsigned InternalLen>
void wpi::SmallString< InternalLen >::assign ( std::initializer_list< std::string_view > Refs)
inline

Assign from a list of std::string_views.

◆ assign() [2/2]

template<unsigned InternalLen>
void wpi::SmallString< InternalLen >::assign ( std::string_view RHS)
inline

Assign from a std::string_view.

◆ c_str()

template<unsigned InternalLen>
const char * wpi::SmallString< InternalLen >::c_str ( )
inline

◆ compare()

template<unsigned InternalLen>
int wpi::SmallString< InternalLen >::compare ( std::string_view RHS) const
inlinenodiscard

compare - Compare two strings; the result is negative, zero, or positive if this string is lexicographically less than, equal to, or greater than the RHS.

◆ find() [1/2]

template<unsigned InternalLen>
size_t wpi::SmallString< InternalLen >::find ( char C,
size_t From = 0 ) const
inlinenodiscard

find - Search for the first character C in the string.

Returns
- The index of the first occurrence of C, or npos if not found.

◆ find() [2/2]

template<unsigned InternalLen>
size_t wpi::SmallString< InternalLen >::find ( std::string_view Str,
size_t From = 0 ) const
inlinenodiscard

Search for the first string Str in the string.

Returns:
The index of the first occurrence of Str, or npos if not found.

◆ find_first_not_of() [1/2]

template<unsigned InternalLen>
size_t wpi::SmallString< InternalLen >::find_first_not_of ( char C,
size_t From = 0 ) const
inlinenodiscard

Find the first character in the string that is not C or npos if not found.

◆ find_first_not_of() [2/2]

template<unsigned InternalLen>
size_t wpi::SmallString< InternalLen >::find_first_not_of ( std::string_view Chars,
size_t From = 0 ) const
inlinenodiscard

Find the first character in the string that is not in the string Chars, or npos if not found.

Complexity: O(size() + Chars.size())

◆ find_first_of() [1/2]

template<unsigned InternalLen>
size_t wpi::SmallString< InternalLen >::find_first_of ( char C,
size_t From = 0 ) const
inlinenodiscard

Find the first character in the string that is C, or npos if not found.

Same as find.

◆ find_first_of() [2/2]

template<unsigned InternalLen>
size_t wpi::SmallString< InternalLen >::find_first_of ( std::string_view Chars,
size_t From = 0 ) const
inlinenodiscard

Find the first character in the string that is in Chars, or npos if not found.

Complexity: O(size() + Chars.size())

◆ find_last_of() [1/2]

template<unsigned InternalLen>
size_t wpi::SmallString< InternalLen >::find_last_of ( char C,
size_t From = std::string_view::npos ) const
inlinenodiscard

Find the last character in the string that is C, or npos if not found.

◆ find_last_of() [2/2]

template<unsigned InternalLen>
size_t wpi::SmallString< InternalLen >::find_last_of ( std::string_view Chars,
size_t From = std::string_view::npos ) const
inlinenodiscard

Find the last character in the string that is in C, or npos if not found.

Complexity: O(size() + Chars.size())

◆ operator std::string()

template<unsigned InternalLen>
wpi::SmallString< InternalLen >::operator std::string ( ) const
inlineexplicit

◆ operator std::string_view()

template<unsigned InternalLen>
wpi::SmallString< InternalLen >::operator std::string_view ( ) const
inline

Implicit conversion to std::string_view.

◆ operator+=() [1/2]

template<unsigned InternalLen>
SmallString & wpi::SmallString< InternalLen >::operator+= ( char C)
inline

◆ operator+=() [2/2]

template<unsigned InternalLen>
SmallString & wpi::SmallString< InternalLen >::operator+= ( std::string_view RHS)
inline

◆ operator=()

template<unsigned InternalLen>
SmallString & wpi::SmallString< InternalLen >::operator= ( std::string_view RHS)
inline

◆ rfind() [1/2]

template<unsigned InternalLen>
size_t wpi::SmallString< InternalLen >::rfind ( char C,
size_t From = std::string_view::npos ) const
inlinenodiscard

Search for the last character C in the string.

Returns:
The index of the last occurrence of C, or npos if not found.

◆ rfind() [2/2]

template<unsigned InternalLen>
size_t wpi::SmallString< InternalLen >::rfind ( std::string_view Str) const
inlinenodiscard

Search for the last string Str in the string.

Returns:
The index of the last occurrence of Str, or npos if not found.

◆ str()

template<unsigned InternalLen>
std::string_view wpi::SmallString< InternalLen >::str ( ) const
inlinenodiscard

Explicit conversion to std::string_view.


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