Fixed leak in MString when assigning from another MString.
This commit is contained in:
1 parent
423af4eb52
commit
b44a00862b
31 files changed
+268
-4807
No files matched your search
@@ -7,159 +7,193 @@
|
||||
|
||||
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);
|
||||
MString(void *alias);
|
||||
|
||||
///
|
||||
/// Consructor providing the initial setup of the MString object.
|
||||
///
|
||||
|
||||
MString(unsigned char *data, size_t length);
|
||||
|
||||
MString(const char *data, size_t length);
|
||||
|
||||
MString(const unsigned char *data, size_t length);
|
||||
|
||||
///
|
||||
/// Consructor providing a copy of a ZString.
|
||||
///
|
||||
|
||||
///
|
||||
/// Consructor providing a copy of a ZString.
|
||||
///
|
||||
|
||||
MString(MString &mstring);
|
||||
|
||||
// MString(MString mstring);
|
||||
|
||||
///
|
||||
/// Consructor providing a copy of a MString.
|
||||
///
|
||||
|
||||
MString(const MString &mstring);
|
||||
|
||||
///
|
||||
/// Consructor from a string.
|
||||
///
|
||||
|
||||
MString(std::string data);
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
|
||||
MString(char *data, size_t length);
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
|
||||
MString(std::FILE *file);
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
|
||||
virtual ~MString();
|
||||
|
||||
// ~MString();
|
||||
|
||||
///
|
||||
/// Assignment operator will copy data to backing store.
|
||||
///
|
||||
|
||||
// MString& operator=(coreutils::ZString& data);
|
||||
|
||||
///
|
||||
/// Assignment operator will copy data to backing store.
|
||||
///
|
||||
|
||||
// MString& operator=(coreutils::ZString& data);
|
||||
|
||||
MString &operator=(coreutils::MString &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);
|
||||
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
///
|
||||
|
||||
MString &operator<<(const int value);
|
||||
|
||||
// MString& operator<<(coreutils::ZString &zstring);
|
||||
|
||||
MString &operator<<(coreutils::ZString zstring);
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
|
||||
MString &operator<<(std::string value);
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
|
||||
void insert(char ch, int offset);
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
|
||||
void insert(ZString &value, int offset);
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
|
||||
void insert(std::string value, int offset);
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
|
||||
void replace(char ch, int offset);
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
|
||||
void replace(ZString &value, int offset);
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
|
||||
class MString : public ZString
|
||||
{
|
||||
|
||||
public:
|
||||
///
|
||||
///
|
||||
///
|
||||
|
||||
MString();
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
|
||||
MString(const char *data);
|
||||
MString(void *alias);
|
||||
///
|
||||
/// Consructor providing the initial setup of the MString object.
|
||||
///
|
||||
|
||||
MString(unsigned char *data, size_t length);
|
||||
|
||||
MString(const char *data, size_t length);
|
||||
|
||||
MString(const unsigned char *data, size_t length);
|
||||
|
||||
///
|
||||
/// Consructor providing a copy of a ZString.
|
||||
///
|
||||
|
||||
///
|
||||
/// Consructor providing a copy of a ZString.
|
||||
///
|
||||
|
||||
MString(ZString &zstring);
|
||||
|
||||
MString(ZString zstring);
|
||||
|
||||
///
|
||||
/// Consructor providing a copy of a ZString.
|
||||
///
|
||||
|
||||
MString(const MString &mstring);
|
||||
|
||||
///
|
||||
/// Consructor from a string.
|
||||
///
|
||||
MString(std::string data);
|
||||
///
|
||||
///
|
||||
///
|
||||
|
||||
MString(char *data, size_t length);
|
||||
|
||||
MString(std::FILE *file);
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
|
||||
virtual ~MString();
|
||||
|
||||
~MString();
|
||||
|
||||
///
|
||||
/// Assignment operator will copy data to backing store.
|
||||
///
|
||||
|
||||
// MString& operator=(coreutils::ZString& data);
|
||||
|
||||
///
|
||||
/// Assignment operator will copy data to backing store.
|
||||
///
|
||||
|
||||
// MString& operator=(coreutils::ZString& data);
|
||||
|
||||
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);
|
||||
|
||||
MString &operator<<(const int value);
|
||||
|
||||
// MString& operator<<(coreutils::ZString &zstring);
|
||||
|
||||
MString &operator<<(coreutils::ZString zstring);
|
||||
|
||||
MString &operator<<(std::string value);
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
|
||||
void insert(char ch, int offset);
|
||||
void insert(ZString &value, int offset);
|
||||
void insert(std::string value, int offset);
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
|
||||
void replace(char ch, int offset);
|
||||
void replace(ZString &value, int offset);
|
||||
void replace(std::string value, int offset);
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
|
||||
void remove(int offset, int length);
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
|
||||
MString &write(char ch);
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
|
||||
MString &write(ZString &value);
|
||||
|
||||
int offset();
|
||||
|
||||
private:
|
||||
int bufferSize = 0;
|
||||
void setSize(int size);
|
||||
};
|
||||
|
||||
void replace(std::string value, int offset);
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
|
||||
void remove(int offset, int length);
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
|
||||
MString &write(char ch);
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
|
||||
MString &write(ZString &value);
|
||||
|
||||
int offset();
|
||||
|
||||
private:
|
||||
int bufferSize = 0;
|
||||
void setSize(int size);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user