|
arduino-audio-tools
|
Str which keeps the data on the heap. We grow the allocated memory only if the copy source is not fitting. More...
#include <Str.h>
Public Member Functions | |
| Str ()=default | |
| Str (const char *str) | |
| Str (int initialAllocatedLength) | |
| Str (Str &&obj) | |
| Move constructor. | |
| Str (Str &source) | |
| Copy constructor. | |
| Str (StrView &source) | |
| Convert StrView to Str. | |
| ~Str () | |
| Destructor. | |
| virtual void | add (const char *append) |
| adds a string | |
| virtual void | add (const char c) |
| adds a character | |
| virtual void | add (double value, int precision=2, int withd=0) |
| adds a double value | |
| virtual void | add (int value) |
| adds a int value | |
| void | allocate (int len=-1) |
| virtual const char * | c_str () |
| provides the string value as const char* | |
| size_t | capacity () |
| void | clear () override |
| clears and resizes to 0 | |
| void | clear (bool resize) |
| virtual bool | contains (const char *str) |
| checks if the string contains a substring | |
| bool | containsNumber () |
| void | copyFrom (const char *source, int len, int maxlen=0) |
| assigns a memory buffer | |
| virtual int | count (char c, int startPos) |
| count number of indicated characters as position | |
| virtual bool | endsWith (const char *str) |
| checks if the string ends with the indicated substring | |
| virtual bool | endsWithIgnoreCase (const char *str) |
| checks if the string ends with the indicated substring | |
| virtual bool | equals (const char *str) |
| checks if the string equals indicated parameter string | |
| virtual bool | equalsIgnoreCase (const char *alt) |
| Compares the string ignoring the case. | |
| virtual int | indexOf (const char *cont, int start=0) |
| virtual int | indexOf (const char c, int start=0) |
| virtual void | insert (int pos, const char *str) |
| inserts a substring into the string | |
| bool | isConst () override |
| checks if the string is a constant that must not be changed | |
| virtual bool | isEmpty () |
| checks if the string is empty | |
| bool | isInteger () |
| Returns true if the string is an integer. | |
| bool | isNumber () |
| bool | isOnHeap () override |
| checks if the string is on the heap | |
| virtual int | lastIndexOf (const char *cont) |
| provides the position of the last occurrence of the indicated substring | |
| virtual int | length () |
| virtual void | ltrim () |
| remove leading spaces | |
| virtual bool | matches (const char *pattern) |
| virtual int | maxLength () |
| provides the maximum length of the string | |
| virtual int | nIndexOf (const char *cont, int n) |
| searches for the nth occurence of the indicated character | |
| virtual int | nIndexOf (const char c, int n) |
| searches for the nth occurence of the indicated character | |
| int | numberOfDecimals () |
| Determines the number of decimals in the number string. | |
| virtual bool | operator!= (const char *alt) const |
| checks if the indicated string is different from the current string | |
| virtual bool | operator!= (const StrView &alt) const |
| checks if the indicated string is different from the current string | |
| virtual void | operator+= (const char *str) |
| adds a substring at the end of the string | |
| virtual void | operator+= (const char value) |
| adds a character | |
| virtual void | operator+= (double value) |
| adds a double at the end of the string | |
| virtual void | operator+= (int value) |
| adds a int at the end of the string | |
| virtual void | operator<< (int n) |
| shift characters to the right -> we just move the pointer | |
| void | operator= (char *str) override |
| we can assign a char* | |
| void | operator= (const char *str) override |
| we can assign a const char* | |
| void | operator= (double v) override |
| we can assign a double | |
| void | operator= (int v) override |
| we can assign an int | |
| Str & | operator= (Str &&obj) |
| Move assignment. | |
| Str & | operator= (Str &obj) |
| Copy assingment. | |
| virtual bool | operator== (const char *alt) const |
| checks if the indicated string is equal to the current string | |
| virtual bool | operator== (const StrView &alt) const |
| checks if the indicated string is equal to the current string | |
| virtual char | operator[] (int index) |
| virtual void | remove (const char *toRemove) |
| removes the indicated substring from the string | |
| virtual void | removeAll (const char *toRemove) |
| removes the indicated substring from the string | |
| virtual bool | replace (const char *toReplace, const char *replaced) |
| Replaces the first instance of toReplace with replaced. | |
| virtual bool | replaceAll (const char *toReplace, const char *replaced) |
| Replaces all instances of toReplace with replaced. | |
| virtual void | rtrim () |
| remove trailing spaces | |
| virtual void | set (char chars[], int maxlen, int len=0, bool isConst=false) |
| assigns a memory buffer | |
| virtual void | set (const char *alt) |
| assigs a value | |
| virtual void | set (const char c) |
| virtual void | set (const StrView &alt) |
| assigs from another Str value | |
| virtual void | set (double value, int precision=2, int withd=0) |
| virtual void | set (int value) |
| void | setCapacity (size_t newLen) |
| void | setChars (char c, int len) |
| Fills the string with len chars. | |
| virtual void | setLength (int len, bool addZero=true) |
| limits the length of the string (by adding a delimiting 0) | |
| virtual void | setLengthUndo () |
| undo the last setLength call | |
| virtual bool | startsWith (const char *str) |
| checks if the string starts with the indicated substring | |
| virtual void | substring (const char *from, int start, int end) |
| copies a substring into the current string | |
| virtual void | substring (StrView &from, int start, int end) |
| copies a substring into the current string | |
| void | swap (Str &other) |
| virtual void | swap (StrView &str) |
| double | toDouble () |
| Converts the string to a double. | |
| float | toFloat () |
| Converts the string to a float. | |
| int | toInt () |
| Converts the string to an int. | |
| long | toLong () |
| Converts the string to an long. | |
| void | toLowerCase () |
| Converts the string to lowercase letters. | |
| void | toUpperCase () |
| Converts the string to uppercase letters. | |
| virtual void | trim () |
| remove leading and traling spaces | |
| void | urlDecode () |
| decodes a url encoded string | |
| void | urlEncode () |
| url encode the string | |
Static Public Member Functions | |
| static const char * | toBinary (void const *const ptr, size_t const size) |
| provides a binary string represntation | |
Protected Member Functions | |
| char | charToInt (char ch) |
| bool | grow (int newMaxLen) override |
| only supported in subclasses | |
| Str & | move (Str &other) |
| char | strToBin (char *pString) |
| void | urlEncodeChar (char c, char *result, int maxLen) |
Static Protected Member Functions | |
| static char * | floatToString (char *outstr, double val, int precision, int widthp) |
| static char * | itoa (int n, char s[]) |
| static void | reverse (char s[]) |
| static int | strncmp_i (const char *s1, const char *s2, int n) |
Protected Attributes | |
| char * | chars = nullptr |
| bool | is_const = false |
| int | len = 0 |
| int | maxlen = 0 |
| char | savedChar |
| int | savedLen = -1 |
| Vector< char > | vector |
Str which keeps the data on the heap. We grow the allocated memory only if the copy source is not fitting.
While it should be avoided to use a lot of heap allocatioins in embedded devices it is sometimes more convinent to allocate a string once on the heap and have the insurance that it might grow if we need to process an unexpected size.
We also need to use this if we want to manage a vecor of strings.
|
default |
|
inline |
Destructor.
adds a double value
|
inline |
checks if the string contains a substring
|
inlineinherited |
count number of indicated characters as position
checks if the string ends with the indicated substring
checks if the string ends with the indicated substring
checks if the string equals indicated parameter string
Compares the string ignoring the case.
|
inlinestaticprotectedinherited |
compute the rounding factor and fractional multiplier
print the decimal point
generate space padding
only supported in subclasses
Reimplemented from StrView.
provides the position of the the indicated substring after the indicated start position
provides the position of the the indicated character after the indicated start position
inserts a substring into the string
|
inlineoverridevirtual |
checks if the string is a constant that must not be changed
Reimplemented from StrView.
|
inlineinherited |
Returns true if the string is an integer.
|
inlineinherited |
|
inlineoverridevirtual |
checks if the string is on the heap
Reimplemented from StrView.
provides the position of the last occurrence of the indicated substring
provides the current length (filled with characters) of the string - excluding the terminating 0
file matching supporting * and ? - replacing regex which is not supported in all environments
returns 1 (true) if there is a match returns 0 if the pattern is not whitin the line
the line is ended but char was expected
end of mask
if the line also ends here then the pattern match
try to restart the mask on the rest
searches for the nth occurence of the indicated character
searches for the nth occurence of the indicated character
|
inlineinherited |
Determines the number of decimals in the number string.
checks if the indicated string is different from the current string
checks if the indicated string is different from the current string
adds a substring at the end of the string
adds a double at the end of the string
shift characters to the right -> we just move the pointer
we can assign a char*
Reimplemented from StrView.
we can assign a const char*
Reimplemented from StrView.
we can assign a double
Reimplemented from StrView.
checks if the indicated string is equal to the current string
checks if the indicated string is equal to the current string
removes the indicated substring from the string
removes the indicated substring from the string
Replaces the first instance of toReplace with replaced.
Replaces all instances of toReplace with replaced.
|
inlinevirtualinherited |
assigns a memory buffer
limits the length of the string (by adding a delimiting 0)
checks if the string starts with the indicated substring
copies a substring into the current string
copies a substring into the current string
provides a binary string represntation
|
inlineinherited |
Converts the string to a double.
|
inlineinherited |
Converts the string to a float.
|
inlineinherited |
Converts the string to an int.
|
inlineinherited |
Converts the string to an long.
|
inlineinherited |
Converts the string to lowercase letters.
|
inlineinherited |
Converts the string to uppercase letters.
|
inline |
decodes a url encoded string
|
inline |
url encode the string
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |