18#ifndef __LIBSTD_STRING_H
19#define __LIBSTD_STRING_H
36#define STRING_DEFAULT_SIZE 64
76 String(
const char *s,
const bool copy =
false);
157 virtual const char *
get(
const Size position)
const;
168 virtual const char &
at(
const Size position)
const;
180 virtual const char value(
const Size position)
const;
189 virtual bool contains(
const char character)
const;
225 bool endsWith(
const char * suffix)
const;
247 const bool caseSensitive =
true)
const;
260 const bool caseSensitive =
true,
277 bool match(
const char *mask)
const;
362 char *
string =
ZERO);
375 const bool sign =
false);
Simple linked list template class.
Sequences are containers that provide indexed based storage of items.
const char * operator*() const
Dereference operator (read-only).
Number::Base m_base
Number format to use for convertions.
bool startsWith(const String &prefix) const
Tests if this String starts with the specified prefix.
virtual Size count() const
Number of characters in the string.
String & trim()
Remove leading and trailing whitespace from the String.
Size m_size
Size of the string buffer, including any NULL byte(s) at the end.
long toLong(const Number::Base base=Number::Dec) const
Convert the String to a signed long integer.
virtual bool equals(const String &str) const
Alias for compareTo().
String substring(const Size index, const Size size=0) const
Returns a part of the String as a copy.
String & operator<<(const char *str)
Append character string to the String.
Size length() const
Same as count().
Size setUnsigned(const ulong number, const Number::Base base=Number::Dec, char *string=ZERO, const bool sign=false)
Set text-representation of an unsigned number.
virtual bool reserve(const Size count)
Make sure at least given number of bytes available.
Size set(const long number, const Number::Base base=Number::Dec, char *string=ZERO)
Set text-representation of a signed number.
virtual bool contains(const char character) const
Check if the given character occurs in the String.
virtual const char * get(const Size position) const
Returns the item at the given position.
bool endsWith(const String &suffix) const
Tests if this String ends with the specified suffix.
char * m_string
Current value of the String.
String()
Default constructor.
virtual Size size() const
Calculates the length of the String.
String & lower()
Convert all Characters to lower case.
void operator=(const char *str)
Assignment operator.
String & pad(const Size length)
Pad line with trailing whitespace.
bool operator==(const String &str) const
Comparision operator.
Size m_count
Length of the string text, excluding NULL byte(s) at the end.
virtual int compareTo(const String &str) const
Compares this String to the given String.
virtual ~String()
Destructor.
bool operator!=(const String &str) const
Inequal operator.
List< String > split(const char delimiter) const
Split the String into parts separated by a delimiter.
String & upper()
Convert all Characters to upper case.
virtual const char & at(const Size position) const
Returns a reference to the item at the given position.
bool match(const char *mask) const
Matches the String against a mask.
bool m_allocated
True if the string buffer is a deep copy, false otherwise.
virtual const char value(const Size position) const
Return value at the given position.
virtual bool resize(const Size size)
Change the size of the String buffer.
unsigned long ulong
Unsigned long number.
unsigned int Size
Any sane size indicator cannot go negative.
void copy(Terminal *term, const teken_rect_t *rect, const teken_pos_t *pos)
Copy bytes to the terminal.
Base
Numeral system base type.