Jameo Core Library
Loading...
Searching...
No Matches
Classes
Data Management

A collection of classes to provide data management (Undo, Redo, Transactions). More...

Classes

class  jm::AutoreleasePool
 This class provides the memory pool component to release objects at regular intervals that the programmer has designated for delayed release by Object::autorelease(). More...
 
class  jm::Document
 This class represents the "model" in the MVC context. This class is also the ideal parent class for all document-based applications, because basic functionalities that every user expects are already predefined here. In addition, development time is saved. These include: More...
 
struct  jm::Property
 This interface defines the possibility to edit properties of an object via a uniform interface. This is particularly useful for saving time when objects are to be edited in the GUI. More...
 
class  jm::EditableObject
 Objects of this class have additional functions for comfortable user interaction. For example the undo- management is more easy usable, also the connection to the user interface can be done more automatic. More...
 
class  jm::UndoChange
 This element of a linked list stores the changes made to the file in an Undo Step. More...
 
class  jm::UndoStep
 This object stores an editing step made to the file. The undo list is a doubly linked list. More...
 
class  jm::UndoManager
 This class represents the manager for undo operations. More...
 

Detailed Description

A collection of classes to provide data management (Undo, Redo, Transactions).

Jameo Core library provides rich features for data management. In any modern software, error-tolerant input by the user is expected. In particular, it is expected that incorrect input can be undone or that data is checked for inconsistency when it is entered.

All these possibilities are implemented here in a programmer-friendly way.

Example for implementing undo management in data structure:

#include "core/Core.h"
// Example Person shows principle procedure to implement undo management.
class Person: public jm::EditableObject
{
public:
// Constructor
Person(jm::Document* doc):jm::EditableObject(doc)
{
};
// Example setter
jm::Status setName(const jm::String& name)
{
return setMember(&mName,name);
};
// Example getter
const jm::String& name() const
{
return mName;
}
private:
// Name of the person
jm::String mName;
};
This class represents the "model" in the MVC context. This class is also the ideal parent class for a...
Definition Document.h:52
Objects of this class have additional functions for comfortable user interaction. For example the und...
Definition Property.h:375
virtual Status setMember(String *pointer, const String &value)
The method set the value to the member the pointer references.
String implements our generic string because std::string is inadequate and inconvenient....
Definition String.h:70
Definition Array.h:41
Status
This enumeration list all errors posted by this library.
Definition Types.h:184

Example of calling undo/redo:

...
jm::Document* doc = ...; // Already initialized
Person* p = ...;
p->setName("Uwe");
// Close the undo step if changes are done.
um->close();
// Undo, if necessary
um->undo();
// Redo, if necessary
um->redo();
...
UndoManager * undoManager()
Returns the undo manager if it exists.
This class represents the manager for undo operations.
Definition UndoManager.h:145
void close()
This method finalizes the current editing step. Programmers must explicitly mark the completion of an...
bool redo()
Repeats the last editing step, undoing previous "undos".
bool undo()
Undoes the last editing step on the file and pushes the change to the RedoStack.

When you want to ensure, that several changes will only be done at all, use transactions:

...
jm::Document* doc = ...; // Already initialized
Person* p = ...;
p->setName("Uwe");
p->setGender("male");
// Close the undo step if changes are done.
...
void openTransaction()
Begin a transaction.
Status closeTransaction()
Closes the transaction.