Class gf::Str

template<size_t LEN>
class gf::Str

String implementation that keeps the data on the stack to avoid memory fragmentation.

Public Functions

Str()

Construct an empty string

Str(const char *str)

Construct string

Parameters
  • str: preset text

Str(const char chr)

Construct string from character

Parameters
  • chr: preset character

~Str()

Desctructor

template<size_t SLEN>
bool set(Str<SLEN> str)

Return

if it worked

Parameters
  • str: new content string

bool set(const char *str)

Return

if it worked

Parameters
  • str: new content string

bool set(const char chr)

Return

if it worked

Parameters
  • chr: new content character

bool clear()

Return

if clearing worked

const char *operator*()
const char *c_str()

Return

pointer to character array

size_t size()

Return

designated size of character array

size_t length()

Return

length of content

size_t left()

Return

how many space is left

bool operator!()
bool empty()

Return

true if length() == 0

template<size_t SLEN>
bool operator==(Str<SLEN> str)
template<size_t SLEN>
bool operator!=(Str<SLEN> str)
template<size_t SLEN>
bool equals(Str<SLEN> str)

Return

if same content

Parameters
  • str: other string

bool operator==(const char *str)
bool operator!=(const char *str)
bool equals(const char *str)

Return

if same content

Parameters
  • str: other string

bool operator==(const char chr)
bool operator!=(const char chr)
bool equals(const char chr)

Return

if same content

Parameters
  • chr: some character

template<size_t SLEN>
bool starts_with(Str<SLEN> str)

Return

if it starts with other string

Parameters
  • str: other string

bool starts_with(const char *str)

Return

if it starts with other string

Parameters
  • str: other string

bool starts_with(const char chr)

Return

if it starts with some character

Parameters
  • chr: some character

template<size_t SLEN>
bool ends_with(Str<SLEN> str)

Return

if it ends with other string

Parameters
  • str: other string

bool ends_with(const char *str)

Return

if it ends with other string

Parameters
  • str: other string

bool ends_with(const char chr)

Return

if it ends with some character

Parameters
  • chr: some character

template<size_t SLEN>
bool append(Str<SLEN> str)

Return

if it worked

Parameters
  • str: other string

bool append(const char *str)

Return

if it worked

Parameters
  • str: other string

bool append(const char chr)

Return

if it worked

Parameters
  • chr: some character

template<size_t SLEN>
bool prepend(Str<SLEN> str)

Return

if it worked

Parameters
  • str: other string

bool prepend(const char *str)

Return

if it worked

Parameters
  • str: other string

bool prepend(const char chr)

Return

if it worked

Parameters
  • chr: some character

void upper()
void lower()

Private Members

char _str[1 + LEN] = {_NIL}

internal buffer