DUECA/DUSIME
|
This is yet another string class, this time for strings of a fixed maximum size, and therefore a fixed storage requirement. More...
Public Member Functions | |
Dstring () | |
Constructor, makes empty string. More... | |
Dstring (const char *s) | |
Constructor, copies the data from a string. More... | |
Dstring (const std::string &s) | |
Constructor from an std::string. | |
template<int osize> | |
Dstring (const Dstring< osize > &o) | |
Copy constructor. More... | |
Dstring (AmorphReStore &s) | |
Construct the string from amorphous storage. More... | |
Dstring & | operator= (const char *s) |
Assignment operator. More... | |
Dstring & | operator= (const string &o) |
Assignment operator with string. More... | |
template<int osize> | |
Dstring & | operator= (const Dstring< osize > &o) |
Assignment operator with a Dstring of the same or some other size. More... | |
template<int osize> | |
Dstring | operator+ (const Dstring< osize > &s) |
Append a string to this one. More... | |
Dstring | operator+ (const char *s) |
Append a c-style string to this one. More... | |
bool | operator== (const Dstring< mxsize > &o) const |
Returns true if two strings are equal. More... | |
bool | operator!= (const Dstring< mxsize > &o) const |
Returns false if two strings are equal. More... | |
bool | operator< (const Dstring< mxsize > &o) const |
Returns true if lexically smaller than second string. | |
bool | operator> (const Dstring< mxsize > &o) const |
Returns true if lexically greater than second string. | |
const char * | c_str () const |
Get the c-string style data out. More... | |
void | assign (const char *d, size_t size) |
grab from a buffer | |
size_t | size () const |
Get the length of the string. More... | |
constexpr size_t | max_size () const |
Maximum size. | |
void | resize (size_t s) |
Resize. | |
const char * | getData () const |
Get direct access to the underlying data. More... | |
const char * | data () const |
Get direct access to the underlying data. More... | |
const char * | begin () const |
Pointer to the start. | |
char * | begin () |
Pointer to the start. | |
const char * | end () const |
Pointer to the end. | |
char * | end () |
Pointer to the end. | |
char * | data () |
Get direct access to the underlying data. More... | |
void | packData (AmorphStore &s) const |
Pack the string into a net-transportable format. More... | |
void | unPackData (AmorphReStore &s) |
Unpack the string from a net-transportable format. More... | |
std::ostream & | print (std::ostream &os) const |
Print to a stream. More... | |
std::istream & | read (std::istream &is) |
Read from a stream. More... | |
Public Attributes | |
char | _data [mxsize] |
The actual data, as a c-type string. More... | |
Additional Inherited Members | |
![]() | |
static const char * | classname |
Object is packable, and therefore its name is needed. | |
![]() | |
dstring () | |
Constructor. More... | |
This is yet another string class, this time for strings of a fixed maximum size, and therefore a fixed storage requirement.
dueca::Dstring< mxsize >::Dstring | ( | ) |
Constructor, makes empty string.
dueca::Dstring< mxsize >::Dstring | ( | const char * | s | ) |
Constructor, copies the data from a string.
|
inline |
Copy constructor.
Should be used for a brother/sister dstring of different size.
dueca::Dstring< mxsize >::Dstring | ( | AmorphReStore & | s | ) |
Construct the string from amorphous storage.
Dstring& dueca::Dstring< mxsize >::operator= | ( | const char * | s | ) |
Assignment operator.
|
inline |
Assignment operator with string.
|
inline |
Assignment operator with a Dstring of the same or some other size.
|
inline |
Append a string to this one.
Note that truncation may result.
Dstring dueca::Dstring< mxsize >::operator+ | ( | const char * | s | ) |
Append a c-style string to this one.
Note that truncation may result.
bool dueca::Dstring< mxsize >::operator== | ( | const Dstring< mxsize > & | o | ) | const |
Returns true if two strings are equal.
bool dueca::Dstring< mxsize >::operator!= | ( | const Dstring< mxsize > & | o | ) | const |
Returns false if two strings are equal.
|
inline |
Get the c-string style data out.
size_t dueca::Dstring< mxsize >::size | ( | ) | const |
Get the length of the string.
|
inline |
Get direct access to the underlying data.
|
inline |
Get direct access to the underlying data.
|
inline |
Get direct access to the underlying data.
void dueca::Dstring< mxsize >::packData | ( | AmorphStore & | s | ) | const |
Pack the string into a net-transportable format.
void dueca::Dstring< mxsize >::unPackData | ( | AmorphReStore & | s | ) |
Unpack the string from a net-transportable format.
std::ostream& dueca::Dstring< mxsize >::print | ( | std::ostream & | os | ) | const |
Print to a stream.
std::istream& dueca::Dstring< mxsize >::read | ( | std::istream & | is | ) |
Read from a stream.
char dueca::Dstring< mxsize >::_data[mxsize] |
The actual data, as a c-type string.