Phasor 3.3.0
Stack VM based Programming Language
Loading...
Searching...
No Matches
Phasor::PhsString Class Reference

#include <PhasorString.hpp>

Classes

struct  SmallBuf

Public Types

using value_type = char
using size_type = std::size_t
using difference_type = std::ptrdiff_t
using reference = char&
using const_reference = const char&
using pointer = char*
using const_pointer = const char*
using iterator = char*
using const_iterator = const char*
using reverse_iterator = std::reverse_iterator<iterator>
using const_reverse_iterator = std::reverse_iterator<const_iterator>

Public Member Functions

 PhsString () noexcept
 PhsString (const char *s)
 PhsString (const char *s, std::size_t n)
 PhsString (std::string_view sv)
 PhsString (const std::string &s)
 PhsString (std::size_t n, char c)
 PhsString (const PhsString &)=default
 PhsString (PhsString &&) noexcept=default
PhsStringoperator= (const PhsString &)=default
PhsStringoperator= (PhsString &&) noexcept=default
 ~PhsString ()=default
PhsStringoperator= (const char *s)
PhsStringoperator= (std::string_view sv)
std::size_t size () const noexcept
std::size_t length () const noexcept
bool empty () const noexcept
std::size_t capacity () const noexcept
std::size_t max_size () const noexcept
bool is_small () const noexcept
bool is_heap_allocated () const noexcept
const char * data () const noexcept
char * data () noexcept
const char * c_str () const noexcept
std::string_view view () const noexcept
char & operator[] (std::size_t i) noexcept
const char & operator[] (std::size_t i) const noexcept
char & at (std::size_t i)
const char & at (std::size_t i) const
char & front () noexcept
const char & front () const noexcept
char & back () noexcept
const char & back () const noexcept
iterator begin () noexcept
iterator end () noexcept
const_iterator begin () const noexcept
const_iterator end () const noexcept
const_iterator cbegin () const noexcept
const_iterator cend () const noexcept
reverse_iterator rbegin () noexcept
reverse_iterator rend () noexcept
const_reverse_iterator rbegin () const noexcept
const_reverse_iterator rend () const noexcept
const_reverse_iterator crbegin () const noexcept
const_reverse_iterator crend () const noexcept
void clear () noexcept
PhsStringappend (const char *s, std::size_t n)
PhsStringappend (std::string_view sv)
PhsStringappend (const char *s)
PhsStringappend (std::size_t n, char c)
PhsStringoperator+= (std::string_view sv)
PhsStringoperator+= (const char *s)
PhsStringoperator+= (char c)
void push_back (char c)
void pop_back () noexcept
void resize (std::size_t n, char c='\0')
std::size_t find (std::string_view sv, std::size_t pos=0) const noexcept
std::size_t find (char c, std::size_t pos=0) const noexcept
std::size_t rfind (std::string_view sv, std::size_t pos=npos) const noexcept
std::size_t rfind (char c, std::size_t pos=npos) const noexcept
std::size_t find_first_of (std::string_view sv, std::size_t pos=0) const noexcept
std::size_t find_last_of (std::string_view sv, std::size_t pos=npos) const noexcept
std::size_t find_first_not_of (std::string_view sv, std::size_t pos=0) const noexcept
std::size_t find_last_not_of (std::string_view sv, std::size_t pos=npos) const noexcept
int compare (std::string_view sv) const noexcept
bool starts_with (std::string_view sv) const noexcept
bool ends_with (std::string_view sv) const noexcept
bool contains (std::string_view sv) const noexcept
PhsString substr (std::size_t pos=0, std::size_t len=npos) const
std::string str () const
 operator std::string () const
 operator std::string_view () const noexcept
std::strong_ordering operator<=> (const PhsString &o) const noexcept
bool operator== (const PhsString &o) const noexcept
std::strong_ordering operator<=> (std::string_view sv) const noexcept
bool operator== (std::string_view sv) const noexcept

Static Public Attributes

static constexpr std::size_t SSO_CAPACITY = kSSOCapacity
static constexpr std::size_t npos = std::string::npos

Private Member Functions

SmallBufsm () noexcept
const SmallBufsm () const noexcept
std::string & lg () noexcept
const std::string & lg () const noexcept

Private Attributes

std::variant< SmallBuf, std::string > m_store

Friends

std::ostream & operator<< (std::ostream &os, const PhsString &s)

Detailed Description

Definition at line 23 of file PhasorString.hpp.

Member Typedef Documentation

◆ const_iterator

using Phasor::PhsString::const_iterator = const char*

Definition at line 36 of file PhasorString.hpp.

◆ const_pointer

using Phasor::PhsString::const_pointer = const char*

Definition at line 34 of file PhasorString.hpp.

◆ const_reference

Definition at line 32 of file PhasorString.hpp.

◆ const_reverse_iterator

Definition at line 38 of file PhasorString.hpp.

◆ difference_type

using Phasor::PhsString::difference_type = std::ptrdiff_t

Definition at line 30 of file PhasorString.hpp.

◆ iterator

Definition at line 35 of file PhasorString.hpp.

◆ pointer

Definition at line 33 of file PhasorString.hpp.

◆ reference

Definition at line 31 of file PhasorString.hpp.

◆ reverse_iterator

using Phasor::PhsString::reverse_iterator = std::reverse_iterator<iterator>

Definition at line 37 of file PhasorString.hpp.

◆ size_type

using Phasor::PhsString::size_type = std::size_t

Definition at line 29 of file PhasorString.hpp.

◆ value_type

Definition at line 28 of file PhasorString.hpp.

Constructor & Destructor Documentation

◆ PhsString() [1/8]

Phasor::PhsString::PhsString ( )
inlinenoexcept

Definition at line 40 of file PhasorString.hpp.

Here is the caller graph for this function:

◆ PhsString() [2/8]

Phasor::PhsString::PhsString ( const char * s)
inline

Definition at line 42 of file PhasorString.hpp.

Here is the call graph for this function:

◆ PhsString() [3/8]

Phasor::PhsString::PhsString ( const char * s,
std::size_t n )
inline

Definition at line 44 of file PhasorString.hpp.

◆ PhsString() [4/8]

Phasor::PhsString::PhsString ( std::string_view sv)
inline

Definition at line 49 of file PhasorString.hpp.

Here is the call graph for this function:

◆ PhsString() [5/8]

Phasor::PhsString::PhsString ( const std::string & s)
inline

Definition at line 52 of file PhasorString.hpp.

Here is the call graph for this function:

◆ PhsString() [6/8]

Phasor::PhsString::PhsString ( std::size_t n,
char c )
inline

Definition at line 55 of file PhasorString.hpp.

◆ PhsString() [7/8]

Phasor::PhsString::PhsString ( const PhsString & )
default
Here is the call graph for this function:

◆ PhsString() [8/8]

Phasor::PhsString::PhsString ( PhsString && )
defaultnoexcept
Here is the call graph for this function:

◆ ~PhsString()

Phasor::PhsString::~PhsString ( )
default
Here is the call graph for this function:

Member Function Documentation

◆ append() [1/4]

PhsString & Phasor::PhsString::append ( const char * s)
inline

Definition at line 154 of file PhasorString.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ append() [2/4]

PhsString & Phasor::PhsString::append ( const char * s,
std::size_t n )
inline

Definition at line 133 of file PhasorString.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ append() [3/4]

PhsString & Phasor::PhsString::append ( std::size_t n,
char c )
inline

Definition at line 155 of file PhasorString.hpp.

Here is the call graph for this function:

◆ append() [4/4]

PhsString & Phasor::PhsString::append ( std::string_view sv)
inline

Definition at line 153 of file PhasorString.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ at() [1/2]

char & Phasor::PhsString::at ( std::size_t i)
inline

Definition at line 98 of file PhasorString.hpp.

Here is the call graph for this function:

◆ at() [2/2]

const char & Phasor::PhsString::at ( std::size_t i) const
inline

Definition at line 102 of file PhasorString.hpp.

Here is the call graph for this function:

◆ back() [1/2]

const char & Phasor::PhsString::back ( ) const
inlinenoexcept

Definition at line 110 of file PhasorString.hpp.

Here is the call graph for this function:

◆ back() [2/2]

char & Phasor::PhsString::back ( )
inlinenoexcept

Definition at line 109 of file PhasorString.hpp.

Here is the call graph for this function:

◆ begin() [1/2]

const_iterator Phasor::PhsString::begin ( ) const
inlinenoexcept

Definition at line 115 of file PhasorString.hpp.

Here is the call graph for this function:

◆ begin() [2/2]

iterator Phasor::PhsString::begin ( )
inlinenoexcept

Definition at line 113 of file PhasorString.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ c_str()

const char * Phasor::PhsString::c_str ( ) const
inlinenodiscardnoexcept

Definition at line 92 of file PhasorString.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ capacity()

std::size_t Phasor::PhsString::capacity ( ) const
inlinenodiscardnoexcept

Definition at line 80 of file PhasorString.hpp.

Here is the call graph for this function:

◆ cbegin()

const_iterator Phasor::PhsString::cbegin ( ) const
inlinenoexcept

Definition at line 117 of file PhasorString.hpp.

Here is the call graph for this function:

◆ cend()

const_iterator Phasor::PhsString::cend ( ) const
inlinenoexcept

Definition at line 118 of file PhasorString.hpp.

Here is the call graph for this function:

◆ clear()

void Phasor::PhsString::clear ( )
inlinenoexcept

Definition at line 128 of file PhasorString.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ compare()

int Phasor::PhsString::compare ( std::string_view sv) const
inlinenoexcept

Definition at line 206 of file PhasorString.hpp.

Here is the call graph for this function:

◆ contains()

bool Phasor::PhsString::contains ( std::string_view sv) const
inlinenodiscardnoexcept

Definition at line 210 of file PhasorString.hpp.

Here is the call graph for this function:

◆ crbegin()

const_reverse_iterator Phasor::PhsString::crbegin ( ) const
inlinenoexcept

Definition at line 124 of file PhasorString.hpp.

Here is the call graph for this function:

◆ crend()

const_reverse_iterator Phasor::PhsString::crend ( ) const
inlinenoexcept

Definition at line 125 of file PhasorString.hpp.

Here is the call graph for this function:

◆ data() [1/2]

const char * Phasor::PhsString::data ( ) const
inlinenodiscardnoexcept

Definition at line 90 of file PhasorString.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ data() [2/2]

char * Phasor::PhsString::data ( )
inlinenodiscardnoexcept

Definition at line 91 of file PhasorString.hpp.

Here is the call graph for this function:

◆ empty()

bool Phasor::PhsString::empty ( ) const
inlinenodiscardnoexcept

Definition at line 78 of file PhasorString.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ end() [1/2]

const_iterator Phasor::PhsString::end ( ) const
inlinenoexcept

Definition at line 116 of file PhasorString.hpp.

Here is the call graph for this function:

◆ end() [2/2]

iterator Phasor::PhsString::end ( )
inlinenoexcept

Definition at line 114 of file PhasorString.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ends_with()

bool Phasor::PhsString::ends_with ( std::string_view sv) const
inlinenodiscardnoexcept

Definition at line 209 of file PhasorString.hpp.

Here is the call graph for this function:

◆ find() [1/2]

std::size_t Phasor::PhsString::find ( char c,
std::size_t pos = 0 ) const
inlinenoexcept

Definition at line 197 of file PhasorString.hpp.

Here is the call graph for this function:

◆ find() [2/2]

std::size_t Phasor::PhsString::find ( std::string_view sv,
std::size_t pos = 0 ) const
inlinenoexcept

Definition at line 196 of file PhasorString.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ find_first_not_of()

std::size_t Phasor::PhsString::find_first_not_of ( std::string_view sv,
std::size_t pos = 0 ) const
inlinenoexcept

Definition at line 203 of file PhasorString.hpp.

Here is the call graph for this function:

◆ find_first_of()

std::size_t Phasor::PhsString::find_first_of ( std::string_view sv,
std::size_t pos = 0 ) const
inlinenoexcept

Definition at line 201 of file PhasorString.hpp.

Here is the call graph for this function:

◆ find_last_not_of()

std::size_t Phasor::PhsString::find_last_not_of ( std::string_view sv,
std::size_t pos = npos ) const
inlinenoexcept

Definition at line 204 of file PhasorString.hpp.

Here is the call graph for this function:

◆ find_last_of()

std::size_t Phasor::PhsString::find_last_of ( std::string_view sv,
std::size_t pos = npos ) const
inlinenoexcept

Definition at line 202 of file PhasorString.hpp.

Here is the call graph for this function:

◆ front() [1/2]

const char & Phasor::PhsString::front ( ) const
inlinenoexcept

Definition at line 108 of file PhasorString.hpp.

Here is the call graph for this function:

◆ front() [2/2]

char & Phasor::PhsString::front ( )
inlinenoexcept

Definition at line 107 of file PhasorString.hpp.

Here is the call graph for this function:

◆ is_heap_allocated()

bool Phasor::PhsString::is_heap_allocated ( ) const
inlinenodiscardnoexcept

Definition at line 88 of file PhasorString.hpp.

Here is the call graph for this function:

◆ is_small()

bool Phasor::PhsString::is_small ( ) const
inlinenodiscardnoexcept

Definition at line 87 of file PhasorString.hpp.

Here is the caller graph for this function:

◆ length()

std::size_t Phasor::PhsString::length ( ) const
inlinenodiscardnoexcept

Definition at line 77 of file PhasorString.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lg() [1/2]

const std::string & Phasor::PhsString::lg ( ) const
inlineprivatenoexcept

Definition at line 262 of file PhasorString.hpp.

◆ lg() [2/2]

std::string & Phasor::PhsString::lg ( )
inlineprivatenoexcept

Definition at line 261 of file PhasorString.hpp.

Here is the caller graph for this function:

◆ max_size()

std::size_t Phasor::PhsString::max_size ( ) const
inlinenodiscardnoexcept

Definition at line 83 of file PhasorString.hpp.

◆ operator std::string()

Phasor::PhsString::operator std::string ( ) const
inline

Definition at line 221 of file PhasorString.hpp.

Here is the call graph for this function:

◆ operator std::string_view()

Phasor::PhsString::operator std::string_view ( ) const
inlinenoexcept

Definition at line 222 of file PhasorString.hpp.

Here is the call graph for this function:

◆ operator+=() [1/3]

PhsString & Phasor::PhsString::operator+= ( char c)
inline

Definition at line 176 of file PhasorString.hpp.

Here is the call graph for this function:

◆ operator+=() [2/3]

PhsString & Phasor::PhsString::operator+= ( const char * s)
inline

Definition at line 175 of file PhasorString.hpp.

Here is the call graph for this function:

◆ operator+=() [3/3]

PhsString & Phasor::PhsString::operator+= ( std::string_view sv)
inline

Definition at line 174 of file PhasorString.hpp.

Here is the call graph for this function:

◆ operator<=>() [1/2]

std::strong_ordering Phasor::PhsString::operator<=> ( const PhsString & o) const
inlinenodiscardnoexcept

Definition at line 224 of file PhasorString.hpp.

Here is the call graph for this function:

◆ operator<=>() [2/2]

std::strong_ordering Phasor::PhsString::operator<=> ( std::string_view sv) const
inlinenodiscardnoexcept

Definition at line 231 of file PhasorString.hpp.

Here is the call graph for this function:

◆ operator=() [1/4]

PhsString & Phasor::PhsString::operator= ( const char * s)
inline

Definition at line 73 of file PhasorString.hpp.

Here is the call graph for this function:

◆ operator=() [2/4]

PhsString & Phasor::PhsString::operator= ( const PhsString & )
default
Here is the call graph for this function:

◆ operator=() [3/4]

PhsString & Phasor::PhsString::operator= ( PhsString && )
defaultnoexcept
Here is the call graph for this function:

◆ operator=() [4/4]

PhsString & Phasor::PhsString::operator= ( std::string_view sv)
inline

Definition at line 74 of file PhasorString.hpp.

Here is the call graph for this function:

◆ operator==() [1/2]

bool Phasor::PhsString::operator== ( const PhsString & o) const
inlinenodiscardnoexcept

Definition at line 227 of file PhasorString.hpp.

Here is the call graph for this function:

◆ operator==() [2/2]

bool Phasor::PhsString::operator== ( std::string_view sv) const
inlinenodiscardnoexcept

Definition at line 234 of file PhasorString.hpp.

Here is the call graph for this function:

◆ operator[]() [1/2]

const char & Phasor::PhsString::operator[] ( std::size_t i) const
inlinenoexcept

Definition at line 96 of file PhasorString.hpp.

Here is the call graph for this function:

◆ operator[]() [2/2]

char & Phasor::PhsString::operator[] ( std::size_t i)
inlinenoexcept

Definition at line 95 of file PhasorString.hpp.

Here is the call graph for this function:

◆ pop_back()

void Phasor::PhsString::pop_back ( )
inlinenoexcept

Definition at line 179 of file PhasorString.hpp.

Here is the call graph for this function:

◆ push_back()

void Phasor::PhsString::push_back ( char c)
inline

Definition at line 178 of file PhasorString.hpp.

Here is the call graph for this function:

◆ rbegin() [1/2]

const_reverse_iterator Phasor::PhsString::rbegin ( ) const
inlinenoexcept

Definition at line 122 of file PhasorString.hpp.

Here is the call graph for this function:

◆ rbegin() [2/2]

reverse_iterator Phasor::PhsString::rbegin ( )
inlinenoexcept

Definition at line 120 of file PhasorString.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rend() [1/2]

const_reverse_iterator Phasor::PhsString::rend ( ) const
inlinenoexcept

Definition at line 123 of file PhasorString.hpp.

Here is the call graph for this function:

◆ rend() [2/2]

reverse_iterator Phasor::PhsString::rend ( )
inlinenoexcept

Definition at line 121 of file PhasorString.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resize()

void Phasor::PhsString::resize ( std::size_t n,
char c = '\0' )
inline

Definition at line 185 of file PhasorString.hpp.

Here is the call graph for this function:

◆ rfind() [1/2]

std::size_t Phasor::PhsString::rfind ( char c,
std::size_t pos = npos ) const
inlinenoexcept

Definition at line 199 of file PhasorString.hpp.

Here is the call graph for this function:

◆ rfind() [2/2]

std::size_t Phasor::PhsString::rfind ( std::string_view sv,
std::size_t pos = npos ) const
inlinenoexcept

Definition at line 198 of file PhasorString.hpp.

Here is the call graph for this function:

◆ size()

std::size_t Phasor::PhsString::size ( ) const
inlinenodiscardnoexcept

Definition at line 76 of file PhasorString.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sm() [1/2]

const SmallBuf & Phasor::PhsString::sm ( ) const
inlineprivatenoexcept

Definition at line 260 of file PhasorString.hpp.

◆ sm() [2/2]

SmallBuf & Phasor::PhsString::sm ( )
inlineprivatenoexcept

Definition at line 259 of file PhasorString.hpp.

Here is the caller graph for this function:

◆ starts_with()

bool Phasor::PhsString::starts_with ( std::string_view sv) const
inlinenodiscardnoexcept

Definition at line 208 of file PhasorString.hpp.

Here is the call graph for this function:

◆ str()

std::string Phasor::PhsString::str ( ) const
inlinenodiscard

Definition at line 218 of file PhasorString.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ substr()

PhsString Phasor::PhsString::substr ( std::size_t pos = 0,
std::size_t len = npos ) const
inlinenodiscard

Definition at line 212 of file PhasorString.hpp.

Here is the call graph for this function:

◆ view()

std::string_view Phasor::PhsString::view ( ) const
inlinenodiscardnoexcept

Definition at line 93 of file PhasorString.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
const PhsString & s )
friend

Definition at line 238 of file PhasorString.hpp.

Member Data Documentation

◆ m_store

std::variant<SmallBuf, std::string> Phasor::PhsString::m_store
private

Definition at line 257 of file PhasorString.hpp.

◆ npos

std::size_t Phasor::PhsString::npos = std::string::npos
staticconstexpr

Definition at line 26 of file PhasorString.hpp.

◆ SSO_CAPACITY

std::size_t Phasor::PhsString::SSO_CAPACITY = kSSOCapacity
staticconstexpr

Definition at line 25 of file PhasorString.hpp.


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