13 #ifndef ML_BASE_ITEM_H
14 #define ML_BASE_ITEM_H
70 const char *
name ()
const {
return _name; }
Class for writing object data to a stream.
General Base object class for list items that have an id and a name.
std::string persistentState() const override
Return a string representation of the item object.
char * newString(const std::string &str) const
Convenience method to create a copy of the string str allocated on the heap.
BaseItem(const BaseItem &item)
Copy constructor.
void addStateToTree(TreeNode *parent) const override
Attaches the object state as children of the given parent node.
void writeTo(AbstractPersistenceOutputStream *stream) const override
write state to stream
const char * name() const
Get name.
void setPersistentState(const std::string &state) override
Initialize the item object from the string state.
BaseItem()
Default constructor.
BaseItem(MLssize_t id, const char *nameStr=nullptr)
ID and name.
void readFrom(AbstractPersistenceInputStream *stream, int version) override
read state from stream
~BaseItem() override
Destructor.
void readStateFromTree(TreeNode *parent) override
Reads the object state from the children of the given parent node.
void setId(MLssize_t id)
Sets the id of the item.
BaseItem * deepCopy() const override
Create a deep copy of the BaseItem.
ML_SET_ADDSTATE_VERSION(0)
Set addState version number.
MLssize_t getId() const
Sets the id of the item.
void setName(const char *newName)
Set name, object stores a copy.
void deleteString(char *str) const
Dispose a string allocated with newString()
Class representing general ML objects that support import/export via strings (setPersistentState() an...
The class TreeNode is the abstract base class for the import/export of ML objects.
#define MLBASEEXPORT
defined Header file mlBaseInit.h
#define ML_CLASS_HEADER(className)
Same like ML_CLASS_HEADER_EXPORTED with a non-existing export symbol.
SSIZE_T MLssize_t
The signed ML size type that is a signed 32-bit size_t on 32-bit platforms and 64-bit one on 64-bit p...