Bifrost SDK
Bifrost SDK documentation
Amino::String Class Referenceabstract

The string class used by Amino. More...

#include <String.h>

Public Types

using value_type = char
 
using iterator = value_type *
 
using const_iterator = const value_type *
 
using size_type = std::size_t
 
using difference_type = std::ptrdiff_t
 

Public Member Functions

 String ()
 Construct an empty string. More...
 
 String (std::nullptr_t)=delete
 Constructing a String from a nullptr_t is not allowed. More...
 
 String (const String &str)
 Copy constructor. More...
 
 String (String &&str) noexcept
 Move constructor. More...
 
 String (const String &str, size_type pos, size_type len=npos)
 Construct a string from another. More...
 
 String (const char *s)
 Construct a string from char char*. More...
 
 String (const char *s, size_type n)
 Construct a string from a char*. More...
 
 String (StringView sv)
 Construct a String from a StringView. More...
 
 String (size_type n, char c)
 Construct a string by filling it. More...
 
 ~String ()
 Destructor. More...
 
Stringappend (const char *s, size_type n)
 Appends a char* to the string. More...
 
Stringappend (const String &str, size_type subpos, size_type sublen)
 Appends a part of a string. More...
 
Stringappend (size_type n, char c)
 Append the same character multiple times. More...
 
Stringassign (const char *s, size_type n)
 Assign a char* to the string. More...
 
Stringassign (const String &str, size_type subpos, size_type sublen)
 
Stringassign (size_type n, char c)
 Assign a character multiple times to the string. More...
 
char & at (size_type pos)
 Return a character at a position. More...
 
const char & at (size_type pos) const
 Return a character at a position. More...
 
char & back ()
 Return the last character. More...
 
const char & back () const
 Return the last character. More...
 
size_type capacity () const
 Return the allocated storage size of the string. More...
 
void clear ()
 Clear the string. More...
 
int compare (size_type pos, size_type len, const String &str) const
 Compare a string. More...
 
int compare (size_type pos, size_type len, const String &str, size_type subpos, size_type sublen) const
 Compare a string. More...
 
int compare (size_type pos, size_type len, const char *s) const
 Compare a string. More...
 
int compare (size_type pos, size_type len, const char *s, size_type n) const
 Compare a string. More...
 
size_type copy (char *s, size_type len, size_type pos=0) const
 Copy part of the string into a char*. More...
 
const char * c_str () const
 Return the string as a char*. More...
 
const char * data () const
 Return the string as a char*. More...
 
bool empty () const
 Return true if this string is empty. More...
 
Stringerase (size_type pos=0, size_type len=npos)
 Erase a part of a string. More...
 
size_type length () const
 Return the length of the string. More...
 
size_type max_size () const
 Return the maximum size this string can reach. More...
 
char & operator[] (size_type pos)
 Return a character at a position. More...
 
const char & operator[] (size_type pos) const
 Return a character at a position. More...
 
void pop_back ()
 Remove the last character of the string. More...
 
void push_back (char c)
 Push a new character onto the back of the string. More...
 
void reserve (size_type n=0)
 Change the capacity of the string. More...
 
void resize (size_type n)
 Change the size of the string. More...
 
void resize (size_type n, char c)
 Change the size of the string. More...
 
void shrink_to_fit ()
 Try to reduce the memory footprint of the string. More...
 
size_type size () const
 Return the size of the string. More...
 
String substr (size_type pos=0, size_type len=npos) const
 Return a part of this string. More...
 
void swap (String &str)
 Swap this string with another. More...
 
const char * asChar () const
 Return the string as a char*. More...
 
Stringoperator= (const String &s)
 Assign to a string. More...
 
Stringoperator= (String &&s) noexcept
 Assign to a string. More...
 
Stringoperator= (const char *s)
 Assign to a string. More...
 
Stringoperator= (char s)
 Assign to a string. More...
 
template<typename StringViewLike , typename = enable_if_string_view_like<StringViewLike>>
AMINO_INTERNAL_FORCEINLINE Stringoperator= (StringViewLike const &s)
 Assign to a string. More...
 
AMINO_INTERNAL_FORCEINLINE operator std::string_view () const
 std::string_view conversions More...
 
Stringappend (const String &s)
 Append a copy of a string. More...
 
Stringappend (String &&s)
 Append a copy of a string. More...
 
Stringappend (const char *s)
 Append a copy of a string. More...
 
template<typename StringViewLike >
AMINO_INTERNAL_FORCEINLINE enable_if_string_view_like< StringViewLike, String & > append (StringViewLike const &s)
 Append a copy of a string. More...
 
Stringassign (const String &s)
 Assign a string. More...
 
Stringassign (String &&s) noexcept
 Assign a string. More...
 
Stringassign (const char *s)
 Assign a string. More...
 
template<typename StringViewLike >
AMINO_INTERNAL_FORCEINLINE enable_if_string_view_like< StringViewLike, String & > assign (StringViewLike const &s)
 Assign a string. More...
 
int compare (const String &s) const
 Compare a string. More...
 
int compare (const char *s) const
 Compare a string. More...
 
template<typename StringViewLike >
AMINO_INTERNAL_FORCEINLINE enable_if_string_view_like< StringViewLike, int > compare (StringViewLike const &s) const
 Compare a string. More...
 
size_type find (const String &str, size_type pos=0) const
 Multiple methods for finding strings. More...
 
size_type find (const char *s, size_type pos=0) const
 Multiple methods for finding strings. More...
 
size_type find (const char *s, size_type pos, size_type n) const
 Multiple methods for finding strings. More...
 
size_type find (char c, size_type pos=0) const
 Multiple methods for finding strings. More...
 
size_type find_first_not_of (const String &str, size_type pos=0) const
 Multiple methods for finding the first character that does not match. More...
 
size_type find_first_not_of (const char *s, size_type pos=0) const
 Multiple methods for finding the first character that does not match. More...
 
size_type find_first_not_of (const char *s, size_type pos, size_type n) const
 Multiple methods for finding the first character that does not match. More...
 
size_type find_first_not_of (char c, size_type pos=0) const
 Multiple methods for finding the first character that does not match. More...
 
size_type find_first_of (const String &str, size_type pos=0) const
 Multiple methods for finding the first character that matches. More...
 
size_type find_first_of (const char *s, size_type pos=0) const
 Multiple methods for finding the first character that matches. More...
 
size_type find_first_of (const char *s, size_type pos, size_type n) const
 Multiple methods for finding the first character that matches. More...
 
size_type find_first_of (char c, size_type pos=0) const
 Multiple methods for finding the first character that matches. More...
 
size_type find_last_not_of (const String &str, size_type pos=npos) const
 Multiple methods for finding the first character that does not match from the end. More...
 
size_type find_last_not_of (const char *s, size_type pos=npos) const
 Multiple methods for finding the first character that does not match from the end. More...
 
size_type find_last_not_of (const char *s, size_type pos, size_type n) const
 Multiple methods for finding the first character that does not match from the end. More...
 
size_type find_last_not_of (char c, size_type pos=npos) const
 Multiple methods for finding the first character that does not match from the end. More...
 
size_type find_last_of (const String &str, size_type pos=npos) const
 Multiple methods for finding the first character that matches from the end. More...
 
size_type find_last_of (const char *s, size_type pos=npos) const
 Multiple methods for finding the first character that matches from the end. More...
 
size_type find_last_of (const char *s, size_type pos, size_type n) const
 Multiple methods for finding the first character that matches from the end. More...
 
size_type find_last_of (char c, size_type pos=npos) const
 Multiple methods for finding the first character that matches from the end. More...
 
iterator begin ()
 
const_iterator begin () const
 
const_iterator cbegin () const
 
iterator end ()
 
const_iterator end () const
 
const_iterator cend () const
 
char & front ()
 
const char & front () const
 
Stringinsert (size_type pos, const String &str)
 Multiple methods for string insertion. More...
 
Stringinsert (size_type pos, const String &str, size_type subpos, size_type sublen)
 Multiple methods for string insertion. More...
 
Stringinsert (size_type pos, const char *s)
 Multiple methods for string insertion. More...
 
Stringinsert (size_type pos, const char *s, size_type n)
 Multiple methods for string insertion. More...
 
Stringinsert (size_type pos, size_type n, char c)
 Multiple methods for string insertion. More...
 
Stringoperator+= (const String &s)
 The append operator. More...
 
Stringoperator+= (const char *s)
 The append operator. More...
 
Stringoperator+= (char s)
 The append operator. More...
 
template<typename StringViewLike >
AMINO_INTERNAL_FORCEINLINE enable_if_string_view_like< StringViewLike, String & > operator+= (StringViewLike const &s)
 The append operator. More...
 
Stringreplace (size_type pos, size_type len, const String &str)
 Multiple methods for string replacement. More...
 
Stringreplace (size_type pos, size_type len, const String &str, size_type subpos, size_type sublen)
 Multiple methods for string replacement. More...
 
Stringreplace (size_type pos, size_type len, const char *s)
 Multiple methods for string replacement. More...
 
Stringreplace (size_type pos, size_type len, const char *s, size_type n)
 Multiple methods for string replacement. More...
 
Stringreplace (size_type pos, size_type len, size_type n, char c)
 Multiple methods for string replacement. More...
 
size_type rfind (const String &str, size_type pos=npos) const
 Multiple methods for finding a string starting from the end. More...
 
size_type rfind (const char *s, size_type pos=npos) const
 Multiple methods for finding a string starting from the end. More...
 
size_type rfind (const char *s, size_type pos, size_type n) const
 Multiple methods for finding a string starting from the end. More...
 
size_type rfind (char c, size_type pos=npos) const
 Multiple methods for finding a string starting from the end. More...
 
bool operator== (const String &rhs) const
 Operator ==. More...
 
bool operator== (char const *rhs) const
 Operator ==. More...
 
template<typename StringViewLike >
AMINO_INTERNAL_FORCEINLINE enable_if_string_view_like< StringViewLike, bool > operator== (StringViewLike const &rhs) const
 Operator ==. More...
 
bool operator!= (const String &rhs) const
 Operator !=. More...
 
bool operator!= (char const *rhs) const
 Operator !=. More...
 
template<typename StringViewLike >
AMINO_INTERNAL_FORCEINLINE enable_if_string_view_like< StringViewLike, bool > operator!= (StringViewLike const &rhs) const
 Operator !=. More...
 
template<typename T >
AMINO_INTERNAL_FORCEINLINE auto operator< (T const &rhs) const -> decltype(compare(rhs)< 0)
 Operator <. More...
 
template<typename T >
AMINO_INTERNAL_FORCEINLINE auto operator> (T const &rhs) const -> decltype(compare(rhs) > 0)
 Operator <. More...
 
template<typename T >
AMINO_INTERNAL_FORCEINLINE auto operator<= (T const &rhs) const -> decltype(compare(rhs)<=0)
 Operator <. More...
 
template<typename T >
AMINO_INTERNAL_FORCEINLINE auto operator>= (T const &rhs) const -> decltype(compare(rhs) >=0)
 Operator <. More...
 

Static Public Member Functions

static AMINO_INTERNAL_FORCEINLINE String concat ()
 Concatenate multiple strings. More...
 
template<typename S >
static AMINO_INTERNAL_FORCEINLINE std::enable_if_t< std::is_constructible_v< String, S >, Stringconcat (S &&s)
 Concatenate multiple strings. More...
 
template<typename S1 , typename S2 , typename... S>
static AMINO_INTERNAL_FORCEINLINE String concat (S1 const &s1, S2 const &s2, S &&... s)
 Concatenate multiple strings. More...
 
static String concat (SpanParam< StringView const > const &strs)
 Concatenate multiple strings. More...
 

Static Public Attributes

static constexpr size_type npos = ~size_type(0)
 Maximum value for a size_type. More...
 

Detailed Description

The string class used by Amino.

Warning
Amino::String is NOT a replacement for standard strings (like std::string). It is only meant to be used with Amino graphs. Therefore if a value never needs to flow directly into a graph, a standard string (like std::string) should be used instead.

Definition at line 46 of file String.h.

Member Typedef Documentation

◆ const_iterator

Definition at line 62 of file String.h.

◆ difference_type

using Amino::String::difference_type = std::ptrdiff_t

Definition at line 64 of file String.h.

◆ iterator

Definition at line 61 of file String.h.

◆ size_type

using Amino::String::size_type = std::size_t

Definition at line 63 of file String.h.

◆ value_type

Definition at line 60 of file String.h.

Constructor & Destructor Documentation

◆ String() [1/9]

Amino::String::String ( )

Construct an empty string.

◆ String() [2/9]

Amino::String::String ( std::nullptr_t  )
delete

Constructing a String from a nullptr_t is not allowed.

◆ String() [3/9]

Amino::String::String ( const String str)

Copy constructor.

Parameters
strThe string to copy

◆ String() [4/9]

Amino::String::String ( String &&  str)
noexcept

Move constructor.

Parameters
strThe string to move

◆ String() [5/9]

Amino::String::String ( const String str,
size_type  pos,
size_type  len = npos 
)

Construct a string from another.

The portion of the string to copy is specified by the starting position and length. If the string is too short or len is npos then the entire string will be copied

Parameters
strThe other string
posThe position to start from
lenThe number of characters to take

◆ String() [6/9]

Amino::String::String ( const char *  s)

Construct a string from char char*.

Parameters
sThe char * to use

◆ String() [7/9]

Amino::String::String ( const char *  s,
size_type  n 
)

Construct a string from a char*.

Parameters
sThe char* to use
nThe number of characters to take from the char* buffer

◆ String() [8/9]

Amino::String::String ( StringView  sv)
inlineexplicit

Construct a String from a StringView.

Parameters
svThe StringView from which to copy the data when constructing the String.

Definition at line 114 of file String.h.

◆ String() [9/9]

Amino::String::String ( size_type  n,
char  c 
)

Construct a string by filling it.

Parameters
nThe number or characters to fill
cThe character to use in the fill

◆ ~String()

Amino::String::~String ( )

Destructor.

Member Function Documentation

◆ append() [1/7]

String & Amino::String::append ( const char *  s)

Append a copy of a string.

Parameters
sThe string to append
Returns
The appended string

◆ append() [2/7]

String & Amino::String::append ( const char *  s,
size_type  n 
)

Appends a char* to the string.

Parameters
sThe char* to append
nThe number of characters from the char* buffer to append
Returns
The appended string

◆ append() [3/7]

String & Amino::String::append ( const String s)

Append a copy of a string.

Parameters
sThe string to append
Returns
The appended string

◆ append() [4/7]

String & Amino::String::append ( const String str,
size_type  subpos,
size_type  sublen 
)

Appends a part of a string.

The portion of the string to append is specified by the sub position and sub length. If the string is too short or len is npos then the entire string will be copied

Parameters
strThe string to append
subposThe subposition of the string to use
sublenThe sub length to use
Returns
The appended string

◆ append() [5/7]

String & Amino::String::append ( size_type  n,
char  c 
)

Append the same character multiple times.

Parameters
nThe number of times to append the character
cThe character to append
Returns
The appended string

◆ append() [6/7]

String & Amino::String::append ( String &&  s)

Append a copy of a string.

Parameters
sThe string to append
Returns
The appended string

◆ append() [7/7]

template<typename StringViewLike >
AMINO_INTERNAL_FORCEINLINE enable_if_string_view_like< StringViewLike, String & > Amino::String::append ( StringViewLike const &  s)
inline

Append a copy of a string.

Parameters
sThe string to append
Returns
The appended string

Definition at line 167 of file String.h.

◆ asChar()

const char * Amino::String::asChar ( ) const

Return the string as a char*.

◆ assign() [1/7]

String & Amino::String::assign ( const char *  s)
inline

Assign a string.

Parameters
sThe string to assign
Returns
The string that was assigned

Definition at line 214 of file String.h.

◆ assign() [2/7]

String & Amino::String::assign ( const char *  s,
size_type  n 
)

Assign a char* to the string.

Parameters
sThe char* to assign
nThe number of characters from the char* buffer to assign
Returns
The string that was assigned

◆ assign() [3/7]

String & Amino::String::assign ( const String s)
inline

Assign a string.

Parameters
sThe string to assign
Returns
The string that was assigned

Definition at line 212 of file String.h.

◆ assign() [4/7]

String & Amino::String::assign ( const String str,
size_type  subpos,
size_type  sublen 
)

Assign a part of a string

The portion of the string to assign is specified by the sub position and sub length. If the string is too short or len is npos then the entire string will be copied

Parameters
strThe string to assign a part of
subposThe sub position to use
sublenThe sub length to use
Returns
The string that was assigned

◆ assign() [5/7]

String & Amino::String::assign ( size_type  n,
char  c 
)

Assign a character multiple times to the string.

Parameters
nThe number of times to assign the character
cThe character to assign
Returns
The string that was assigned

◆ assign() [6/7]

String & Amino::String::assign ( String &&  s)
inlinenoexcept

Assign a string.

Parameters
sThe string to assign
Returns
The string that was assigned

Definition at line 213 of file String.h.

◆ assign() [7/7]

template<typename StringViewLike >
AMINO_INTERNAL_FORCEINLINE enable_if_string_view_like< StringViewLike, String & > Amino::String::assign ( StringViewLike const &  s)
inline

Assign a string.

Parameters
sThe string to assign
Returns
The string that was assigned

Definition at line 219 of file String.h.

◆ at() [1/2]

char & Amino::String::at ( size_type  pos)

Return a character at a position.

Parameters
posThe position of the character

◆ at() [2/2]

const char & Amino::String::at ( size_type  pos) const

Return a character at a position.

Parameters
posThe position of the character

◆ back() [1/2]

char & Amino::String::back ( )

Return the last character.

◆ back() [2/2]

const char & Amino::String::back ( ) const

Return the last character.

◆ begin() [1/2]

iterator Amino::String::begin ( )

Return an iterator to the beginning of the string

◆ begin() [2/2]

const_iterator Amino::String::begin ( ) const
inline

Return an iterator to the beginning of the string

Definition at line 469 of file String.h.

◆ c_str()

const char * Amino::String::c_str ( ) const

Return the string as a char*.

Referenced by std::hash< Amino::String >::operator()(), and Amino::operator<<().

◆ capacity()

size_type Amino::String::capacity ( ) const

Return the allocated storage size of the string.

This is not necessarily the same as the string length

Returns
The capacity

◆ cbegin()

const_iterator Amino::String::cbegin ( ) const

Return an iterator to the beginning of the string

◆ cend()

const_iterator Amino::String::cend ( ) const

Return an iterator to the end of the string

◆ clear()

void Amino::String::clear ( )

Clear the string.

Postcondition
empty() == true

◆ compare() [1/7]

int Amino::String::compare ( const char *  s) const

Compare a string.

Parameters
sThe string to compare to
Returns
0 if they are equal, < 0 is less than or >0 if greater than

◆ compare() [2/7]

int Amino::String::compare ( const String s) const

Compare a string.

Parameters
sThe string to compare to
Returns
0 if they are equal, < 0 is less than or >0 if greater than

◆ compare() [3/7]

int Amino::String::compare ( size_type  pos,
size_type  len,
const char *  s 
) const

Compare a string.

Parameters
sThe char* to compare to
posThe position to start at
lenThe number of characters to compare
Returns
0 if they are equal, < 0 is less than or >0 if greater than

◆ compare() [4/7]

int Amino::String::compare ( size_type  pos,
size_type  len,
const char *  s,
size_type  n 
) const

Compare a string.

Parameters
sThe char* to compare to
posThe position to start at
lenThe number of characters to compare
nThe number of characters in the char* buffer to compare to
Returns
0 if they are equal, < 0 is less than or >0 if greater than

◆ compare() [5/7]

int Amino::String::compare ( size_type  pos,
size_type  len,
const String str 
) const

Compare a string.

Parameters
strThe string to compare to
posThe position to start at
lenThe number of characters to compare
Returns
0 if they are equal, < 0 is less than or >0 if greater than

◆ compare() [6/7]

int Amino::String::compare ( size_type  pos,
size_type  len,
const String str,
size_type  subpos,
size_type  sublen 
) const

Compare a string.

Parameters
strThe string to compare to
posThe position to start at
lenThe number of characters to compare
subposThe position in str to use
sublenThe number of characters in str to use
Returns
0 if they are equal, < 0 is less than or >0 if greater than

◆ compare() [7/7]

template<typename StringViewLike >
AMINO_INTERNAL_FORCEINLINE enable_if_string_view_like< StringViewLike, int > Amino::String::compare ( StringViewLike const &  s) const
inline

Compare a string.

Parameters
sThe string to compare to
Returns
0 if they are equal, < 0 is less than or >0 if greater than

Definition at line 298 of file String.h.

◆ concat() [1/4]

static AMINO_INTERNAL_FORCEINLINE String Amino::String::concat ( )
inlinestatic

Concatenate multiple strings.

Definition at line 692 of file String.h.

◆ concat() [2/4]

template<typename S >
static AMINO_INTERNAL_FORCEINLINE std:: enable_if_t< std::is_constructible_v< String, S >, String > Amino::String::concat ( S &&  s)
inlinestatic

Concatenate multiple strings.

Definition at line 697 of file String.h.

◆ concat() [3/4]

template<typename S1 , typename S2 , typename... S>
static AMINO_INTERNAL_FORCEINLINE String Amino::String::concat ( S1 const &  s1,
S2 const &  s2,
S &&...  s 
)
inlinestatic

Concatenate multiple strings.

Definition at line 701 of file String.h.

◆ concat() [4/4]

static String Amino::String::concat ( SpanParam< StringView const > const &  strs)
static

Concatenate multiple strings.

◆ copy()

size_type Amino::String::copy ( char *  s,
size_type  len,
size_type  pos = 0 
) const

Copy part of the string into a char*.

Method does not append a null character at the end of the string

Parameters
sThe char* array to copy into
lenThe number of characters to copy
posThe position of the first character to be copied
Returns
The number of characters copied

◆ data()

const char * Amino::String::data ( ) const

Return the string as a char*.

◆ empty()

bool Amino::String::empty ( ) const

Return true if this string is empty.

◆ end() [1/2]

iterator Amino::String::end ( )

Return an iterator to the end of the string

◆ end() [2/2]

const_iterator Amino::String::end ( ) const
inline

Return an iterator to the end of the string

Definition at line 477 of file String.h.

◆ erase()

String & Amino::String::erase ( size_type  pos = 0,
size_type  len = npos 
)

Erase a part of a string.

Parameters
posThe starting position
lenThe number of string positions to erase
Returns
The string result

◆ find() [1/4]

size_type Amino::String::find ( char  c,
size_type  pos = 0 
) const

Multiple methods for finding strings.

Searches can be done for Strings, char* or char. The pos parameter is where the search is started in this string. The n parameter gives how many characters out of the char* buffer to use in the search. The return value is the position of the first character that matches or npos if there is no match.

◆ find() [2/4]

size_type Amino::String::find ( const char *  s,
size_type  pos,
size_type  n 
) const

Multiple methods for finding strings.

Searches can be done for Strings, char* or char. The pos parameter is where the search is started in this string. The n parameter gives how many characters out of the char* buffer to use in the search. The return value is the position of the first character that matches or npos if there is no match.

◆ find() [3/4]

size_type Amino::String::find ( const char *  s,
size_type  pos = 0 
) const

Multiple methods for finding strings.

Searches can be done for Strings, char* or char. The pos parameter is where the search is started in this string. The n parameter gives how many characters out of the char* buffer to use in the search. The return value is the position of the first character that matches or npos if there is no match.

◆ find() [4/4]

size_type Amino::String::find ( const String str,
size_type  pos = 0 
) const

Multiple methods for finding strings.

Searches can be done for Strings, char* or char. The pos parameter is where the search is started in this string. The n parameter gives how many characters out of the char* buffer to use in the search. The return value is the position of the first character that matches or npos if there is no match.

◆ find_first_not_of() [1/4]

size_type Amino::String::find_first_not_of ( char  c,
size_type  pos = 0 
) const

Multiple methods for finding the first character that does not match.

Matches can be performed by string, char* or char. The pos parameter is the starting point in the string. The n parameter is the starting point in the char* buffer array. The return values is the position for the first character that does not match or npos otherwise

◆ find_first_not_of() [2/4]

size_type Amino::String::find_first_not_of ( const char *  s,
size_type  pos,
size_type  n 
) const

Multiple methods for finding the first character that does not match.

Matches can be performed by string, char* or char. The pos parameter is the starting point in the string. The n parameter is the starting point in the char* buffer array. The return values is the position for the first character that does not match or npos otherwise

◆ find_first_not_of() [3/4]

size_type Amino::String::find_first_not_of ( const char *  s,
size_type  pos = 0 
) const

Multiple methods for finding the first character that does not match.

Matches can be performed by string, char* or char. The pos parameter is the starting point in the string. The n parameter is the starting point in the char* buffer array. The return values is the position for the first character that does not match or npos otherwise

◆ find_first_not_of() [4/4]

size_type Amino::String::find_first_not_of ( const String str,
size_type  pos = 0 
) const

Multiple methods for finding the first character that does not match.

Matches can be performed by string, char* or char. The pos parameter is the starting point in the string. The n parameter is the starting point in the char* buffer array. The return values is the position for the first character that does not match or npos otherwise

◆ find_first_of() [1/4]

size_type Amino::String::find_first_of ( char  c,
size_type  pos = 0 
) const

Multiple methods for finding the first character that matches.

Matches can be performed by string, char* or char. The pos parameter is the starting point in the string. The n parameter is the starting point in the char* buffer array. The return values is the position for the first character that match or npos otherwise

◆ find_first_of() [2/4]

size_type Amino::String::find_first_of ( const char *  s,
size_type  pos,
size_type  n 
) const

Multiple methods for finding the first character that matches.

Matches can be performed by string, char* or char. The pos parameter is the starting point in the string. The n parameter is the starting point in the char* buffer array. The return values is the position for the first character that match or npos otherwise

◆ find_first_of() [3/4]

size_type Amino::String::find_first_of ( const char *  s,
size_type  pos = 0 
) const

Multiple methods for finding the first character that matches.

Matches can be performed by string, char* or char. The pos parameter is the starting point in the string. The n parameter is the starting point in the char* buffer array. The return values is the position for the first character that match or npos otherwise

◆ find_first_of() [4/4]

size_type Amino::String::find_first_of ( const String str,
size_type  pos = 0 
) const

Multiple methods for finding the first character that matches.

Matches can be performed by string, char* or char. The pos parameter is the starting point in the string. The n parameter is the starting point in the char* buffer array. The return values is the position for the first character that match or npos otherwise

◆ find_last_not_of() [1/4]

size_type Amino::String::find_last_not_of ( char  c,
size_type  pos = npos 
) const

Multiple methods for finding the first character that does not match from the end.

Matches can be performed by string, char* or char. The pos parameter is the starting point in the string. The n parameter is the starting point in the char* buffer array. The return values is the position for the first character that does not match or npos otherwise

◆ find_last_not_of() [2/4]

size_type Amino::String::find_last_not_of ( const char *  s,
size_type  pos,
size_type  n 
) const

Multiple methods for finding the first character that does not match from the end.

Matches can be performed by string, char* or char. The pos parameter is the starting point in the string. The n parameter is the starting point in the char* buffer array. The return values is the position for the first character that does not match or npos otherwise

◆ find_last_not_of() [3/4]

size_type Amino::String::find_last_not_of ( const char *  s,
size_type  pos = npos 
) const

Multiple methods for finding the first character that does not match from the end.

Matches can be performed by string, char* or char. The pos parameter is the starting point in the string. The n parameter is the starting point in the char* buffer array. The return values is the position for the first character that does not match or npos otherwise

◆ find_last_not_of() [4/4]

size_type Amino::String::find_last_not_of ( const String str,
size_type  pos = npos 
) const

Multiple methods for finding the first character that does not match from the end.

Matches can be performed by string, char* or char. The pos parameter is the starting point in the string. The n parameter is the starting point in the char* buffer array. The return values is the position for the first character that does not match or npos otherwise

◆ find_last_of() [1/4]

size_type Amino::String::find_last_of ( char  c,
size_type  pos = npos 
) const

Multiple methods for finding the first character that matches from the end.

Matches can be performed by string, char* or char. The pos parameter is the starting point in the string. The n parameter is the starting point in the char* buffer array. The return values is the position for the first character that match or npos otherwise

◆ find_last_of() [2/4]

size_type Amino::String::find_last_of ( const char *  s,
size_type  pos,
size_type  n 
) const

Multiple methods for finding the first character that matches from the end.

Matches can be performed by string, char* or char. The pos parameter is the starting point in the string. The n parameter is the starting point in the char* buffer array. The return values is the position for the first character that match or npos otherwise

◆ find_last_of() [3/4]

size_type Amino::String::find_last_of ( const char *  s,
size_type  pos = npos 
) const

Multiple methods for finding the first character that matches from the end.

Matches can be performed by string, char* or char. The pos parameter is the starting point in the string. The n parameter is the starting point in the char* buffer array. The return values is the position for the first character that match or npos otherwise

◆ find_last_of() [4/4]

size_type Amino::String::find_last_of ( const String str,
size_type  pos = npos 
) const

Multiple methods for finding the first character that matches from the end.

Matches can be performed by string, char* or char. The pos parameter is the starting point in the string. The n parameter is the starting point in the char* buffer array. The return values is the position for the first character that match or npos otherwise

◆ front() [1/2]

char & Amino::String::front ( )

Return the first character of the string

◆ front() [2/2]

const char & Amino::String::front ( ) const

Return the first character of the string

◆ insert() [1/5]

String & Amino::String::insert ( size_type  pos,
const char *  s 
)

Multiple methods for string insertion.

String insertion can be done by String, char* or char. The pos parameter is the starting position of the insertion. The subpos is the starting position of the string to be inserted while the sublen is how many characters of the string should be inserted. The n parameter is how many characters of the char* buffer should be copied. The result is the new string

◆ insert() [2/5]

String & Amino::String::insert ( size_type  pos,
const char *  s,
size_type  n 
)

Multiple methods for string insertion.

String insertion can be done by String, char* or char. The pos parameter is the starting position of the insertion. The subpos is the starting position of the string to be inserted while the sublen is how many characters of the string should be inserted. The n parameter is how many characters of the char* buffer should be copied. The result is the new string

◆ insert() [3/5]

String & Amino::String::insert ( size_type  pos,
const String str 
)

Multiple methods for string insertion.

String insertion can be done by String, char* or char. The pos parameter is the starting position of the insertion. The subpos is the starting position of the string to be inserted while the sublen is how many characters of the string should be inserted. The n parameter is how many characters of the char* buffer should be copied. The result is the new string

◆ insert() [4/5]

String & Amino::String::insert ( size_type  pos,
const String str,
size_type  subpos,
size_type  sublen 
)

Multiple methods for string insertion.

String insertion can be done by String, char* or char. The pos parameter is the starting position of the insertion. The subpos is the starting position of the string to be inserted while the sublen is how many characters of the string should be inserted. The n parameter is how many characters of the char* buffer should be copied. The result is the new string

◆ insert() [5/5]

String & Amino::String::insert ( size_type  pos,
size_type  n,
char  c 
)

Multiple methods for string insertion.

String insertion can be done by String, char* or char. The pos parameter is the starting position of the insertion. The subpos is the starting position of the string to be inserted while the sublen is how many characters of the string should be inserted. The n parameter is how many characters of the char* buffer should be copied. The result is the new string

◆ length()

size_type Amino::String::length ( ) const

Return the length of the string.

◆ max_size()

size_type Amino::String::max_size ( ) const

Return the maximum size this string can reach.

◆ operator std::string_view()

AMINO_INTERNAL_FORCEINLINE Amino::String::operator std::string_view ( ) const
inline

std::string_view conversions

Definition at line 149 of file String.h.

◆ operator!=() [1/3]

bool Amino::String::operator!= ( char const *  rhs) const
inline

Operator !=.

Parameters
rhsThe string to compare to
Returns
true if the strings are equal, false otherwise

Definition at line 649 of file String.h.

◆ operator!=() [2/3]

bool Amino::String::operator!= ( const String rhs) const
inline

Operator !=.

Parameters
rhsThe string to compare to
Returns
true if the strings are equal, false otherwise

Definition at line 648 of file String.h.

◆ operator!=() [3/3]

template<typename StringViewLike >
AMINO_INTERNAL_FORCEINLINE enable_if_string_view_like< StringViewLike, bool > Amino::String::operator!= ( StringViewLike const &  rhs) const
inline

Operator !=.

Parameters
rhsThe string to compare to
Returns
true if the strings are equal, false otherwise

Definition at line 654 of file String.h.

◆ operator+=() [1/4]

String & Amino::String::operator+= ( char  s)
inline

The append operator.

Parameters
sThe string/character(s) to append
Returns
The appended string

Definition at line 519 of file String.h.

◆ operator+=() [2/4]

String & Amino::String::operator+= ( const char *  s)
inline

The append operator.

Parameters
sThe string/character(s) to append
Returns
The appended string

Definition at line 518 of file String.h.

◆ operator+=() [3/4]

String & Amino::String::operator+= ( const String s)
inline

The append operator.

Parameters
sThe string/character(s) to append
Returns
The appended string

Definition at line 517 of file String.h.

◆ operator+=() [4/4]

template<typename StringViewLike >
AMINO_INTERNAL_FORCEINLINE enable_if_string_view_like< StringViewLike, String & > Amino::String::operator+= ( StringViewLike const &  s)
inline

The append operator.

Parameters
sThe string/character(s) to append
Returns
The appended string

Definition at line 526 of file String.h.

◆ operator<()

template<typename T >
AMINO_INTERNAL_FORCEINLINE auto Amino::String::operator< ( T const &  rhs) const -> decltype(compare(rhs) < 0)
inline

Operator <.

Parameters
rhsThe string to compare to
Returns
true if the strings are equal, false otherwise

Definition at line 666 of file String.h.

◆ operator<=()

template<typename T >
AMINO_INTERNAL_FORCEINLINE auto Amino::String::operator<= ( T const &  rhs) const -> decltype(compare(rhs) <
inlinepure virtual

Operator <.

Parameters
rhsThe string to compare to
Returns
true if the strings are equal, false otherwise

Definition at line 676 of file String.h.

◆ operator=() [1/5]

String & Amino::String::operator= ( char  s)

Assign to a string.

Parameters
sThe string/character(s) to assign
Returns
The new string

◆ operator=() [2/5]

String & Amino::String::operator= ( const char *  s)

Assign to a string.

Parameters
sThe string/character(s) to assign
Returns
The new string

◆ operator=() [3/5]

String & Amino::String::operator= ( const String s)

Assign to a string.

Parameters
sThe string/character(s) to assign
Returns
The new string

◆ operator=() [4/5]

String & Amino::String::operator= ( String &&  s)
noexcept

Assign to a string.

Parameters
sThe string/character(s) to assign
Returns
The new string

◆ operator=() [5/5]

template<typename StringViewLike , typename = enable_if_string_view_like<StringViewLike>>
AMINO_INTERNAL_FORCEINLINE String & Amino::String::operator= ( StringViewLike const &  s)
inline

Assign to a string.

Parameters
sThe string/character(s) to assign
Returns
The new string

Definition at line 140 of file String.h.

◆ operator==() [1/3]

bool Amino::String::operator== ( char const *  rhs) const

Operator ==.

Parameters
rhsThe string to compare to
Returns
true if the strings are equal, false otherwise

◆ operator==() [2/3]

bool Amino::String::operator== ( const String rhs) const

Operator ==.

Parameters
rhsThe string to compare to
Returns
true if the strings are equal, false otherwise

◆ operator==() [3/3]

template<typename StringViewLike >
AMINO_INTERNAL_FORCEINLINE enable_if_string_view_like< StringViewLike, bool > Amino::String::operator== ( StringViewLike const &  rhs) const
inline

Operator ==.

Parameters
rhsThe string to compare to
Returns
true if the strings are equal, false otherwise

Definition at line 637 of file String.h.

◆ operator>()

template<typename T >
AMINO_INTERNAL_FORCEINLINE auto Amino::String::operator> ( T const &  rhs) const -> decltype(compare(rhs) > 0)
inline

Operator <.

Parameters
rhsThe string to compare to
Returns
true if the strings are equal, false otherwise

Definition at line 671 of file String.h.

◆ operator>=()

template<typename T >
AMINO_INTERNAL_FORCEINLINE auto Amino::String::operator>= ( T const &  rhs) const -> decltype(compare(rhs) >
inlinepure virtual

Operator <.

Parameters
rhsThe string to compare to
Returns
true if the strings are equal, false otherwise

Definition at line 681 of file String.h.

◆ operator[]() [1/2]

char & Amino::String::operator[] ( size_type  pos)

Return a character at a position.

Parameters
posThe position of the character
Returns
Reference to the character at the specified position

◆ operator[]() [2/2]

const char & Amino::String::operator[] ( size_type  pos) const

Return a character at a position.

Parameters
posThe position of the character
Returns
Reference to the character at the specified position

◆ pop_back()

void Amino::String::pop_back ( )

Remove the last character of the string.

◆ push_back()

void Amino::String::push_back ( char  c)

Push a new character onto the back of the string.

Parameters
cThe new character to add to the back

◆ replace() [1/5]

String & Amino::String::replace ( size_type  pos,
size_type  len,
const char *  s 
)

Multiple methods for string replacement.

String replacement can be done with a String, char* or char. The pos parameter is the starting position of the replacement in this string. The len parameter is the length of the replacement in this string. The subpos and sublen are the equivalents in the String parameter for that specific method.

◆ replace() [2/5]

String & Amino::String::replace ( size_type  pos,
size_type  len,
const char *  s,
size_type  n 
)

Multiple methods for string replacement.

String replacement can be done with a String, char* or char. The pos parameter is the starting position of the replacement in this string. The len parameter is the length of the replacement in this string. The subpos and sublen are the equivalents in the String parameter for that specific method.

◆ replace() [3/5]

String & Amino::String::replace ( size_type  pos,
size_type  len,
const String str 
)

Multiple methods for string replacement.

String replacement can be done with a String, char* or char. The pos parameter is the starting position of the replacement in this string. The len parameter is the length of the replacement in this string. The subpos and sublen are the equivalents in the String parameter for that specific method.

◆ replace() [4/5]

String & Amino::String::replace ( size_type  pos,
size_type  len,
const String str,
size_type  subpos,
size_type  sublen 
)

Multiple methods for string replacement.

String replacement can be done with a String, char* or char. The pos parameter is the starting position of the replacement in this string. The len parameter is the length of the replacement in this string. The subpos and sublen are the equivalents in the String parameter for that specific method.

◆ replace() [5/5]

String & Amino::String::replace ( size_type  pos,
size_type  len,
size_type  n,
char  c 
)

Multiple methods for string replacement.

String replacement can be done with a String, char* or char. The pos parameter is the starting position of the replacement in this string. The len parameter is the length of the replacement in this string. The subpos and sublen are the equivalents in the String parameter for that specific method.

◆ reserve()

void Amino::String::reserve ( size_type  n = 0)

Change the capacity of the string.

Parameters
nThe new size

◆ resize() [1/2]

void Amino::String::resize ( size_type  n)

Change the size of the string.

Parameters
nThe new size of the string

◆ resize() [2/2]

void Amino::String::resize ( size_type  n,
char  c 
)

Change the size of the string.

Parameters
nThe new size of the string
cThe fill character to use if the string was expanded

◆ rfind() [1/4]

size_type Amino::String::rfind ( char  c,
size_type  pos = npos 
) const

Multiple methods for finding a string starting from the end.

We can search for a String, char* or char. The pos parameter gives the starting position while the n parameter is how much characters to search for. The return value is the first character of the match or npos if there is no match

◆ rfind() [2/4]

size_type Amino::String::rfind ( const char *  s,
size_type  pos,
size_type  n 
) const

Multiple methods for finding a string starting from the end.

We can search for a String, char* or char. The pos parameter gives the starting position while the n parameter is how much characters to search for. The return value is the first character of the match or npos if there is no match

◆ rfind() [3/4]

size_type Amino::String::rfind ( const char *  s,
size_type  pos = npos 
) const

Multiple methods for finding a string starting from the end.

We can search for a String, char* or char. The pos parameter gives the starting position while the n parameter is how much characters to search for. The return value is the first character of the match or npos if there is no match

◆ rfind() [4/4]

size_type Amino::String::rfind ( const String str,
size_type  pos = npos 
) const

Multiple methods for finding a string starting from the end.

We can search for a String, char* or char. The pos parameter gives the starting position while the n parameter is how much characters to search for. The return value is the first character of the match or npos if there is no match

◆ shrink_to_fit()

void Amino::String::shrink_to_fit ( )

Try to reduce the memory footprint of the string.

◆ size()

size_type Amino::String::size ( ) const

Return the size of the string.

◆ substr()

String Amino::String::substr ( size_type  pos = 0,
size_type  len = npos 
) const

Return a part of this string.

Parameters
posThe position to start at
lenThe number of characters to take
Returns
The substring

◆ swap()

void Amino::String::swap ( String str)

Swap this string with another.

Parameters
strThe other string to swap

Member Data Documentation

◆ npos

constexpr size_type Amino::String::npos = ~size_type(0)
staticconstexpr

Maximum value for a size_type.

Note
npos does not have a One Definition Rule (ODR). Do not reference it (do not use &npos).

Definition at line 716 of file String.h.