DUECA/DUSIME
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
dueca::Dstring< mxsize > Class Template Reference

This is yet another string class, this time for strings of a fixed maximum size, and therefore a fixed storage requirement. More...

#include <Dstring.hxx>

Inheritance diagram for dueca::Dstring< mxsize >:
Inheritance graph
[legend]
Collaboration diagram for dueca::Dstring< mxsize >:
Collaboration graph
[legend]

Public Member Functions

 Dstring ()
 Constructor, makes empty string.
 
 Dstring (const char *s)
 Constructor, copies the data from a string.
 
 Dstring (const std::string &s)
 Constructor from an std::string.
 
template<int osize>
 Dstring (const Dstring< osize > &o)
 Copy constructor.
 
 Dstring (AmorphReStore &s)
 Construct the string from amorphous storage.
 
Dstringoperator= (const char *s)
 Assignment operator.
 
Dstringoperator= (const string &o)
 Assignment operator with string.
 
template<int osize>
Dstringoperator= (const Dstring< osize > &o)
 Assignment operator with a Dstring of the same or some other size.
 
template<int osize>
Dstring operator+ (const Dstring< osize > &s)
 Append a string to this one.
 
Dstring operator+ (const char *s)
 Append a c-style string to this one.
 
bool operator== (const Dstring< mxsize > &o) const
 Returns true if two strings are equal.
 
bool operator!= (const Dstring< mxsize > &o) const
 Returns false if two strings are equal.
 
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 charc_str () const
 Get the c-string style data out.
 
void assign (const char *d, size_t size)
 grab from a buffer
 
size_t size () const
 Get the length of the string.
 
constexpr size_t max_size () const
 Maximum size.
 
void resize (size_t s)
 Resize.
 
const chargetData () const
 Get direct access to the underlying data.
 
const chardata () const
 Get direct access to the underlying data.
 
const charbegin () const
 Pointer to the start.
 
charbegin ()
 Pointer to the start.
 
const charend () const
 Pointer to the end.
 
charend ()
 Pointer to the end.
 
chardata ()
 Get direct access to the underlying data.
 
void packData (AmorphStore &s) const
 Pack the string into a net-transportable format.
 
void unPackData (AmorphReStore &s)
 Unpack the string from a net-transportable format.
 
std::ostream & print (std::ostream &os) const
 Print to a stream.
 
std::istream & read (std::istream &is)
 Read from a stream.
 

Public Attributes

char _data [mxsize]
 The actual data, as a c-type string.
 

Additional Inherited Members

- Static Public Attributes inherited from dueca::dstring
static const charclassname
 Object is packable, and therefore its name is needed.
 
- Protected Member Functions inherited from dueca::dstring
 dstring ()
 Constructor.
 

Detailed Description

template<unsigned mxsize>
class dueca::Dstring< mxsize >

This is yet another string class, this time for strings of a fixed maximum size, and therefore a fixed storage requirement.

Constructor & Destructor Documentation

◆ Dstring()

template<unsigned mxsize>
template<int osize>
dueca::Dstring< mxsize >::Dstring ( const Dstring< osize > & o)
inline

Copy constructor.

Should be used for a brother/sister dstring of different size.

Member Function Documentation

◆ operator+() [1/2]

template<unsigned mxsize>
template<int osize>
Dstring dueca::Dstring< mxsize >::operator+ ( const Dstring< osize > & s)
inline

Append a string to this one.

Note that truncation may result.

◆ operator+() [2/2]

template<unsigned mxsize>
Dstring dueca::Dstring< mxsize >::operator+ ( const char * s)

Append a c-style string to this one.

Note that truncation may result.

◆ read()

template<unsigned mxsize>
std::istream & dueca::Dstring< mxsize >::read ( std::istream & is)

Read from a stream.

Todo
implement and check.

The documentation for this class was generated from the following file: