FLTK 1.4.0
|
Fl_String is the basic string class for FLTK. More...
#include <Fl_String.H>
Public Member Functions | |
char * | buffer () |
int | capacity () const |
void | capacity (int num_bytes) |
Set the minumum capacity to num_bytes plus one for a terminating NUL. More... | |
void | debug (const char *info=0) const |
Write some details about the string to stdout. More... | |
Fl_String (const char *str) | |
Fl_String (const char *str, int size) | |
Fl_String (const Fl_String &in) | |
void | hexdump (const char *info=0) const |
Write some details about the string to stdout, followed by a hex dump of the string. More... | |
Fl_String & | operator= (const char *in) |
Fl_String & | operator= (const Fl_String &in) |
int | size () const |
int | slen () const |
const char * | value () const |
void | value (const char *str) |
void | value (const char *str, int slen) |
Fl_String is the basic string class for FLTK.
In this version Fl_String can be used to store strings, copy strings, and move strings. There are no string manipulation methods yet.
Fl_String can hold the value of an Fl_Input widget including nul bytes if the constructor Fl_String(const char *str, int size) is used.
Assignment and copy constructors copy the string value such that the source string can be freed immediately after the assignment.
The string value() can be an empty string ""
or NULL
.
If value() is not NULL
it is guaranteed that the string is terminated by a trailing nul
byte even if the string contains embedded nul
bytes.
The method size() returns the full string size, whether the string contains embedded nul
bytes or not. The special method slen() returns 0 if value() is NULL
, otherwise the same as strlen()
would do.
Examples:
void Fl_String::capacity | ( | int | num_bytes | ) |
Set the minumum capacity to num_bytes plus one for a terminating NUL.
The cintents of the string buffer will be copied if needed.
num_bytes | minimum size of buffer |
void Fl_String::debug | ( | const char * | info = 0 | ) | const |
Write some details about the string to stdout.
Nothing at all is written if info
is NULL, otherwise the short info string and details are written to stdout.
The info
string should not be longer than 20 characters to align the debug output of several strings.
[in] | info | short info string or NULL |
void Fl_String::hexdump | ( | const char * | info = 0 | ) | const |
Write some details about the string to stdout, followed by a hex dump of the string.
The first part is the same as written by Fl_String::debug(). The following part is a hexadecimal dump of all bytes of the string. Embedded nul
bytes are possible and will be dumped as well.
[in] | info | short info string or NULL |