100 lines
1.7 KiB
C++
100 lines
1.7 KiB
C++
#ifndef __MString_h__
|
|
#define __MString_h__
|
|
|
|
#include "ZString.h"
|
|
#include <iostream>
|
|
#include <sstream>
|
|
|
|
namespace coreutils {
|
|
|
|
///
|
|
/// Use the MString object when you need a permanent backing store on the heap
|
|
/// for a ZString style functionality. Because MString has a backing store we
|
|
/// added functionalities to build strings as well as the parsing power of the
|
|
/// ZString.
|
|
///
|
|
|
|
class MString : public ZString {
|
|
|
|
public:
|
|
|
|
///
|
|
///
|
|
///
|
|
|
|
MString();
|
|
|
|
///
|
|
///
|
|
///
|
|
|
|
MString(const char *data);
|
|
|
|
///
|
|
/// Consructor providing the initial setup of the ZString object.
|
|
///
|
|
|
|
MString(char *data, size_t length);
|
|
|
|
MString(const char *data, size_t length);
|
|
|
|
///
|
|
/// Consructor providing a copy of a ZString.
|
|
///
|
|
|
|
MString(const MString &zstring);
|
|
|
|
///
|
|
/// Consructor from a string.
|
|
///
|
|
|
|
MString(std::string string);
|
|
|
|
~MString();
|
|
|
|
///
|
|
/// Assignment operator will copy data to backing store.
|
|
///
|
|
|
|
MString& operator=(coreutils::ZString& data);
|
|
|
|
///
|
|
/// Assignment operator will copy data to backing store.
|
|
///
|
|
|
|
MString& operator=(const char *data);
|
|
|
|
///
|
|
/// Assignment operator will copy data to backing store.
|
|
///
|
|
|
|
MString& operator=(char data);
|
|
|
|
///
|
|
///
|
|
///
|
|
|
|
MString& operator<<(const char *value);
|
|
|
|
///
|
|
///
|
|
///
|
|
|
|
int write(char ch);
|
|
|
|
///
|
|
///
|
|
///
|
|
|
|
int write(ZString &value);
|
|
|
|
private:
|
|
int bufferSize = 0;
|
|
void setSize(int size);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|