A template to create a character array that can be manipulated as a string.
More...
#include <string.h>
|
| charbuf () |
| Create a new character buffer with an empty string.
|
|
| charbuf (const char *text) |
| Create a character buffer with assigned text.
|
|
| charbuf (const charbuf ©) |
| Copy constructor.
|
|
size_t | len (void) const |
| Get current length of string.
|
|
| operator bool () const |
| Test if data is contained in the object.
|
|
| operator char * () |
| Get text by casting reference.
|
|
bool | operator! () const |
| Test if the object is empty.
|
|
char * | operator() (size_t offset) |
| Get a pointer to an offset in the object by expression operator.
|
|
char * | operator* () |
| Get text by object pointer reference.
|
|
void | operator+= (const char *text) |
| Concatenate text into the object.
|
|
void | operator= (const char *text) |
| Assign null terminated text to the object.
|
|
char & | operator[] (size_t offset) const |
| Array operator to get a character from the object.
|
|
size_t | size (void) const |
| Get allocated size of the object.
|
|
template<size_t S>
class ucommon::charbuf< S >
A template to create a character array that can be manipulated as a string.
This is a mini string/stringbuf class that supports a subset of functionality but does not require a complex supporting object. Like stringbuf, this can be used to create local string variables.
- Author
- David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org
Definition at line 1459 of file string.h.
◆ charbuf() [1/3]
Create a new character buffer with an empty string.
Definition at line 1468 of file string.h.
◆ charbuf() [2/3]
Create a character buffer with assigned text.
If the text is larger than the size of the object, it is truncated.
- Parameters
-
Definition at line 1477 of file string.h.
◆ charbuf() [3/3]
◆ len()
Get current length of string.
- Returns
- length of string.
Definition at line 1571 of file string.h.
◆ operator bool()
Test if data is contained in the object.
- Returns
- true if there is text.
Definition at line 1509 of file string.h.
◆ operator char *()
Get text by casting reference.
- Returns
- pointer to text in object.
Definition at line 1525 of file string.h.
◆ operator!()
Test if the object is empty.
- Returns
- true if the object is empty.
Definition at line 1517 of file string.h.
◆ operator()()
Get a pointer to an offset in the object by expression operator.
- Parameters
-
offset | of character in string buffer. |
- Returns
- pointer to offset in object.
Definition at line 1553 of file string.h.
◆ operator*()
Get text by object pointer reference.
- Returns
- pointer to text in object.
Definition at line 1533 of file string.h.
◆ operator+=()
Concatenate text into the object.
If the text is larger than the size of the object, then it is truncated.
- Parameters
-
Definition at line 1501 of file string.h.
◆ operator=()
Assign null terminated text to the object.
- Parameters
-
Definition at line 1492 of file string.h.
◆ operator[]()
Array operator to get a character from the object.
- Parameters
-
offset | of character in string buffer. |
- Returns
- character at offset.
Definition at line 1542 of file string.h.
◆ size()
Get allocated size of the object.
- Returns
- allocated size.
Definition at line 1563 of file string.h.
The documentation for this class was generated from the following file:
- /builddir/build/BUILD/ucommon-7.0.0-build/ucommon-7.0.0/inc/ucommon/string.h