Sese Framework  2.3.0
A cross-platform framework
Loading...
Searching...
No Matches
sese::text::StringBuffer Class Referencefinal

Thread-safe string buffer class. More...

#include <StringBuffer.h>

Inheritance diagram for sese::text::StringBuffer:
sese::text::AbstractStringBuffer

Public Types

using Ptr = std::unique_ptr<StringBuffer>
 

Public Member Functions

 StringBuffer (size_t cap=STRING_BUFFER_SIZE_FACTOR) noexcept
 
 StringBuffer (const char *str) noexcept
 
void append (char ch) noexcept override
 
void append (const char *str) noexcept override
 
void append (const std::string &str) noexcept override
 
void append (const std::string_view &str) noexcept override
 
void append (const String &str) noexcept override
 
void append (const StringView &str) noexcept override
 
void append (const char *data, size_t length) noexcept override
 
size_t length () noexcept
 
size_t size () noexcept
 
bool empty () noexcept
 
void clear () noexcept override
 
void reverse () noexcept override
 
char getCharAt (int index)
 
bool setChatAt (int index, char ch) override
 
bool delCharAt (int index) override
 
bool del (int start, int len) override
 
bool insertAt (int index, const char *str) override
 
bool insertAt (int index, const std::string &str) override
 
bool insertAt (int index, const std::string_view &str) override
 
bool insertAt (int index, const String &str) override
 
bool insertAt (int index, const StringView &str) override
 
void trim () noexcept override
 Remove whitespace at both ends.
 
std::vector< std::string > split (const std::string &str) noexcept
 
bool startsWith (const std::string_view &prefix) noexcept
 
bool endsWith (const std::string_view &suffix) noexcept
 
std::string toString () override
 
String toSString () override
 

Private Member Functions

virtual bool empty () const noexcept
 
virtual char getCharAt (int index) const
 
virtual size_t length () const noexcept
 
virtual size_t size () const noexcept
 
virtual std::vector< std::string > split (const std::string_view &str) const noexcept
 
- Private Member Functions inherited from sese::text::AbstractStringBuffer
 AbstractStringBuffer (size_t cap=STRING_BUFFER_SIZE_FACTOR) noexcept
 
 AbstractStringBuffer (const char *str) noexcept
 Initialize with a string.
 
virtual ~AbstractStringBuffer () noexcept
 
 AbstractStringBuffer (const AbstractStringBuffer &abstract_string_buffer) noexcept
 
 AbstractStringBuffer (AbstractStringBuffer &&abstract_string_buffer) noexcept
 
virtual bool startsWith (const std::string_view &prefix) const noexcept
 
virtual bool endsWith (const std::string_view &suffix) const noexcept
 
virtual void * buf ()
 
void expansion (size_t new_size) noexcept
 String caching.
 
bool insertAt (int index, const char *data, size_t len)
 

Static Private Member Functions

static std::vector< std::string > split (const std::string_view &text, const std::string_view &sub) noexcept
 
- Static Private Member Functions inherited from sese::text::AbstractStringBuffer
static std::vector< std::string > split (const std::string_view &text, const std::string_view &sub) noexcept
 
static bool startsWith (const std::string_view &text, const std::string_view &prefix) noexcept
 
static bool endsWith (const std::string_view &text, const std::string_view &suffix) noexcept
 

Private Attributes

std::mutex mutex
 
- Private Attributes inherited from sese::text::AbstractStringBuffer
size_t cap {}
 
size_t len = 0
 Actual capacity.
 
char * buffer = nullptr
 String length.
 

Detailed Description

Thread-safe string buffer class.

Member Typedef Documentation

◆ Ptr

using sese::text::StringBuffer::Ptr = std::unique_ptr<StringBuffer>

Constructor & Destructor Documentation

◆ StringBuffer() [1/2]

sese::text::StringBuffer::StringBuffer ( size_t cap = STRING_BUFFER_SIZE_FACTOR)
explicitnoexcept

◆ StringBuffer() [2/2]

sese::text::StringBuffer::StringBuffer ( const char * str)
explicitnoexcept

Member Function Documentation

◆ append() [1/7]

void sese::text::StringBuffer::append ( char ch)
overridevirtualnoexcept

◆ append() [2/7]

void sese::text::StringBuffer::append ( const char * data,
size_t length )
overridevirtualnoexcept

Reimplemented from sese::text::AbstractStringBuffer.

◆ append() [3/7]

void sese::text::StringBuffer::append ( const char * str)
overridevirtualnoexcept

Reimplemented from sese::text::AbstractStringBuffer.

◆ append() [4/7]

void sese::text::StringBuffer::append ( const std::string & str)
overridevirtualnoexcept

Reimplemented from sese::text::AbstractStringBuffer.

◆ append() [5/7]

void sese::text::StringBuffer::append ( const std::string_view & str)
overridevirtualnoexcept

Reimplemented from sese::text::AbstractStringBuffer.

◆ append() [6/7]

void sese::text::StringBuffer::append ( const String & str)
overridevirtualnoexcept

Reimplemented from sese::text::AbstractStringBuffer.

◆ append() [7/7]

void sese::text::StringBuffer::append ( const StringView & str)
overridevirtualnoexcept

Reimplemented from sese::text::AbstractStringBuffer.

◆ clear()

void sese::text::StringBuffer::clear ( )
overridevirtualnoexcept

◆ del()

bool sese::text::StringBuffer::del ( int start,
int len )
overridevirtual

◆ delCharAt()

bool sese::text::StringBuffer::delCharAt ( int index)
overridevirtual

◆ empty() [1/2]

virtual bool sese::text::AbstractStringBuffer::empty ( ) const
inlinenodiscardprivatevirtualnoexcept

Reimplemented from sese::text::AbstractStringBuffer.

◆ empty() [2/2]

bool sese::text::StringBuffer::empty ( )
nodiscardnoexcept

◆ endsWith()

bool sese::text::StringBuffer::endsWith ( const std::string_view & suffix)
nodiscardnoexcept

◆ getCharAt() [1/2]

char sese::text::StringBuffer::getCharAt ( int index)
nodiscard

◆ getCharAt() [2/2]

char sese::text::AbstractStringBuffer::getCharAt ( int index) const
nodiscardprivatevirtual

Reimplemented from sese::text::AbstractStringBuffer.

◆ insertAt() [1/5]

bool sese::text::StringBuffer::insertAt ( int index,
const char * str )
overridevirtual

◆ insertAt() [2/5]

bool sese::text::StringBuffer::insertAt ( int index,
const std::string & str )
overridevirtual

◆ insertAt() [3/5]

bool sese::text::StringBuffer::insertAt ( int index,
const std::string_view & str )
overridevirtual

◆ insertAt() [4/5]

bool sese::text::StringBuffer::insertAt ( int index,
const String & str )
overridevirtual

◆ insertAt() [5/5]

bool sese::text::StringBuffer::insertAt ( int index,
const StringView & str )
overridevirtual

◆ length() [1/2]

virtual size_t sese::text::AbstractStringBuffer::length ( ) const
inlinenodiscardprivatevirtualnoexcept

Reimplemented from sese::text::AbstractStringBuffer.

◆ length() [2/2]

size_t sese::text::StringBuffer::length ( )
nodiscardnoexcept

◆ reverse()

void sese::text::StringBuffer::reverse ( )
overridevirtualnoexcept

◆ setChatAt()

bool sese::text::StringBuffer::setChatAt ( int index,
char ch )
overridevirtual

◆ size() [1/2]

virtual size_t sese::text::AbstractStringBuffer::size ( ) const
inlinenodiscardprivatevirtualnoexcept

Reimplemented from sese::text::AbstractStringBuffer.

◆ size() [2/2]

size_t sese::text::StringBuffer::size ( )
nodiscardnoexcept

◆ split() [1/3]

std::vector< std::string > sese::text::StringBuffer::split ( const std::string & str)
nodiscardnoexcept

◆ split() [2/3]

std::vector< std::string > sese::text::AbstractStringBuffer::split ( const std::string_view & str) const
nodiscardprivatevirtualnoexcept

Reimplemented from sese::text::AbstractStringBuffer.

◆ split() [3/3]

std::vector< std::string > sese::text::AbstractStringBuffer::split ( const std::string_view & text,
const std::string_view & sub )
staticprivatenoexcept

◆ startsWith()

bool sese::text::StringBuffer::startsWith ( const std::string_view & prefix)
nodiscardnoexcept

◆ toSString()

sese::text::String sese::text::StringBuffer::toSString ( )
overridevirtual

◆ toString()

std::string sese::text::StringBuffer::toString ( )
overridevirtual

◆ trim()

void sese::text::StringBuffer::trim ( )
overridevirtualnoexcept

Remove whitespace at both ends.

Reimplemented from sese::text::AbstractStringBuffer.

References sese::text::AbstractStringBuffer::trim().

Member Data Documentation

◆ mutex

std::mutex sese::text::StringBuffer::mutex
private

Referenced by clear().


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