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

String buffer class. More...

#include <AbstractStringBuffer.h>

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

Public Member Functions

 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 void append (char ch) noexcept
 
virtual void append (const char *str) noexcept
 
virtual void append (const std::string &str) noexcept
 
virtual void append (const std::string_view &str) noexcept
 
virtual void append (const String &str) noexcept
 
virtual void append (const StringView &view) noexcept
 
virtual void append (const char *data, size_t len) noexcept
 
virtual size_t length () const noexcept
 
virtual size_t size () const noexcept
 
virtual bool empty () const noexcept
 
virtual void clear () noexcept
 
virtual void reverse () noexcept
 
virtual char getCharAt (int index) const
 
virtual bool setChatAt (int index, char ch)
 
virtual bool delCharAt (int index)
 
virtual bool del (int start, int l)
 
virtual bool insertAt (int index, const char *str)
 
virtual bool insertAt (int index, const std::string &str)
 
virtual bool insertAt (int index, const std::string_view &str)
 
virtual bool insertAt (int index, const String &str)
 
virtual bool insertAt (int index, const StringView &view)
 
virtual void trim () noexcept
 Remove whitespace at both ends.
 
virtual std::vector< std::string > split (const std::string_view &str) const noexcept
 
virtual bool startsWith (const std::string_view &prefix) const noexcept
 
virtual bool endsWith (const std::string_view &suffix) const noexcept
 
virtual std::string toString ()
 
virtual String toSString ()
 
virtual void * buf ()
 

Static Public Member Functions

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
 

Protected Member Functions

void expansion (size_t new_size) noexcept
 String caching.
 
bool insertAt (int index, const char *data, size_t len)
 

Protected Attributes

size_t cap {}
 
size_t len = 0
 Actual capacity.
 
char * buffer = nullptr
 String length.
 

Detailed Description

String buffer class.

Constructor & Destructor Documentation

◆ AbstractStringBuffer() [1/4]

sese::text::AbstractStringBuffer::AbstractStringBuffer ( size_t cap = STRING_BUFFER_SIZE_FACTOR)
explicitnoexcept
Parameters
capInitial capacity

◆ AbstractStringBuffer() [2/4]

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

Initialize with a string.

Parameters
strString

References STRING_BUFFER_SIZE_FACTOR.

◆ ~AbstractStringBuffer()

sese::text::AbstractStringBuffer::~AbstractStringBuffer ( )
virtualnoexcept

References buffer.

◆ AbstractStringBuffer() [3/4]

sese::text::AbstractStringBuffer::AbstractStringBuffer ( const AbstractStringBuffer & abstract_string_buffer)
noexcept

◆ AbstractStringBuffer() [4/4]

sese::text::AbstractStringBuffer::AbstractStringBuffer ( AbstractStringBuffer && abstract_string_buffer)
noexcept

Member Function Documentation

◆ append() [1/7]

◆ append() [2/7]

void sese::text::AbstractStringBuffer::append ( const char * data,
size_t len )
virtualnoexcept

Reimplemented in sese::text::StringBuffer.

References STRING_BUFFER_SIZE_FACTOR.

◆ append() [3/7]

void sese::text::AbstractStringBuffer::append ( const char * str)
virtualnoexcept

Reimplemented in sese::text::StringBuffer.

References append().

◆ append() [4/7]

void sese::text::AbstractStringBuffer::append ( const std::string & str)
virtualnoexcept

Reimplemented in sese::text::StringBuffer.

References append().

◆ append() [5/7]

void sese::text::AbstractStringBuffer::append ( const std::string_view & str)
virtualnoexcept

Reimplemented in sese::text::StringBuffer.

References append().

◆ append() [6/7]

void sese::text::AbstractStringBuffer::append ( const String & str)
virtualnoexcept

Reimplemented in sese::text::StringBuffer.

References append(), and sstr::SStringView::len().

◆ append() [7/7]

void sese::text::AbstractStringBuffer::append ( const StringView & view)
virtualnoexcept

Reimplemented in sese::text::StringBuffer.

References append().

◆ buf()

void * sese::text::AbstractStringBuffer::buf ( )
virtual

◆ clear()

◆ del()

bool sese::text::AbstractStringBuffer::del ( int start,
int l )
virtual

Reimplemented in sese::text::StringBuffer.

References buffer, and len.

Referenced by sese::text::StringBuffer::del().

◆ delCharAt()

bool sese::text::AbstractStringBuffer::delCharAt ( int index)
virtual

Reimplemented in sese::text::StringBuffer.

References buffer, CheckRange, and len.

Referenced by sese::text::StringBuffer::delCharAt().

◆ empty()

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

◆ endsWith() [1/2]

bool sese::text::AbstractStringBuffer::endsWith ( const std::string_view & suffix) const
nodiscardvirtualnoexcept

◆ endsWith() [2/2]

bool sese::text::AbstractStringBuffer::endsWith ( const std::string_view & text,
const std::string_view & suffix )
staticnoexcept

◆ expansion()

void sese::text::AbstractStringBuffer::expansion ( size_t new_size)
protectednoexcept

String caching.

Expansion

Parameters
new_sizeSize after expansion

Referenced by insertAt().

◆ getCharAt()

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

Reimplemented in sese::text::StringBuffer.

References buffer, cap, and CheckRange.

Referenced by sese::text::StringBuffer::getCharAt().

◆ insertAt() [1/6]

◆ insertAt() [2/6]

bool sese::text::AbstractStringBuffer::insertAt ( int index,
const char * str )
virtual

Reimplemented in sese::text::StringBuffer.

References insertAt().

◆ insertAt() [3/6]

bool sese::text::AbstractStringBuffer::insertAt ( int index,
const std::string & str )
virtual

Reimplemented in sese::text::StringBuffer.

References insertAt().

◆ insertAt() [4/6]

bool sese::text::AbstractStringBuffer::insertAt ( int index,
const std::string_view & str )
virtual

Reimplemented in sese::text::StringBuffer.

References insertAt().

◆ insertAt() [5/6]

bool sese::text::AbstractStringBuffer::insertAt ( int index,
const String & str )
virtual

Reimplemented in sese::text::StringBuffer.

References insertAt(), and sstr::SStringView::len().

◆ insertAt() [6/6]

bool sese::text::AbstractStringBuffer::insertAt ( int index,
const StringView & view )
virtual

◆ length()

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

◆ reverse()

void sese::text::AbstractStringBuffer::reverse ( )
virtualnoexcept

Reimplemented in sese::text::StringBuffer.

References buffer, and len.

Referenced by sese::text::StringBuffer::reverse().

◆ setChatAt()

bool sese::text::AbstractStringBuffer::setChatAt ( int index,
char ch )
virtual

Reimplemented in sese::text::StringBuffer.

References buffer, cap, and CheckRange.

Referenced by sese::text::StringBuffer::setChatAt().

◆ size()

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

◆ split() [1/2]

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

Reimplemented in sese::text::StringBuffer.

◆ split() [2/2]

◆ startsWith() [1/2]

bool sese::text::AbstractStringBuffer::startsWith ( const std::string_view & prefix) const
nodiscardvirtualnoexcept

◆ startsWith() [2/2]

bool sese::text::AbstractStringBuffer::startsWith ( const std::string_view & text,
const std::string_view & prefix )
staticnoexcept

◆ toSString()

String sese::text::AbstractStringBuffer::toSString ( )
virtual

Reimplemented in sese::text::StringBuffer.

References buffer, and len.

Referenced by sese::text::StringBuffer::toSString().

◆ toString()

◆ trim()

void sese::text::AbstractStringBuffer::trim ( )
virtualnoexcept

Remove whitespace at both ends.

Reimplemented in sese::text::StringBuffer.

References buffer, sese::isSpace(), and len.

Referenced by sese::text::StringBuffer::trim().

Member Data Documentation

◆ buffer

char* sese::text::AbstractStringBuffer::buffer = nullptr
protected

◆ cap

size_t sese::text::AbstractStringBuffer::cap {}
protected

Referenced by getCharAt(), insertAt(), setChatAt(), and size().

◆ len

size_t sese::text::AbstractStringBuffer::len = 0
protected

Actual capacity.

Referenced by clear(), del(), delCharAt(), empty(), insertAt(), length(), reverse(), toSString(), toString(), and trim().


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