Jameo Core Library
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
jm::LinkedList Class Reference

This class provides a linked list including undo management. More...

Inheritance diagram for jm::LinkedList:
jm::Object

Public Member Functions

 LinkedList (Object *owner)
 Constructor for the LinkedList. Initializes all variables.
 
 ~LinkedList () override
 Destructor for the linked list. This function deletes all variables.
 
bool hasNext () const
 This method returns true if there is a next element in the list.
 
Object * next ()
 Iterates to the next element in the list and returns the current one. The next element can be NULL, but then hasNext() will return false.
 
Object * first () const
 Returns the first element of the list.
 
Object * last () const
 Returns the last element of the list.
 
void rewind ()
 
void clear (UndoManager *um)
 
void add (Object *data, UndoManager *um)
 
void addBefore (const Object *addBeforeThis, Object *itemToAdd, UndoManager *um)
 
Status remove (const Object *data, UndoManager *um)
 removes the element from the list.
 
void swapData (Object *data1, Object *data2, UndoManager *um)
 
size_t size () const
 Returns the number of entries in this list.
 
LinkedListIterator iterator () const
 
jm::String displayName () const override
 Returns the display name of the object intended to present to a user.
 
- Public Member Functions inherited from jm::Object
 Object () noexcept
 Constructor.
 
virtual ~Object () noexcept
 Destructor.
 
void release () noexcept
 Decreases the reference counter and releases the object immediately when the reference counter becomes 0.
 
Object * retain () noexcept
 Increases the reference counter of this object by 1.
 
Object * autorelease () noexcept
 Same function as release(), but releases the object with a delay if the reference counter is 0. AutoreleasePool::drain() must be called in the to release the object.
 
int32 referenceCount () const noexcept
 Returns the value of the reference counter.
 
virtual bool equals (const Object *other) const
 Comparison of objects.
 
virtual void printDiffInfo (DiffOperation operation, Object *other) const
 Output method for outputting the diff results for the diff algorithm.
 
void setHighBit (bool status) noexcept
 
bool highBit () const noexcept
 

Friends

class LinkedListIterator
 

Detailed Description

This class provides a linked list including undo management.

Constructor & Destructor Documentation

◆ LinkedList()

jm::LinkedList::LinkedList ( Object *  owner)
explicit

Constructor for the LinkedList. Initializes all variables.

Parameters
ownerThe owner of the list. Ideally an Editable object. This object may receive regenerate events during undo steps.

◆ ~LinkedList()

jm::LinkedList::~LinkedList ( )
override

Destructor for the linked list. This function deletes all variables.

Warning
If you are using the LinkedList together with UndoManager, you must call LinkedList::clear() with the UndoManager object to gracefully erase the objects. Alternatively, you can call UndoManager::clearStacks() to achieve the same effect. Otherwise, memory errors may occur.

Member Function Documentation

◆ add()

void jm::LinkedList::add ( Object *  data,
UndoManager *  um 
)

◆ addBefore()

void jm::LinkedList::addBefore ( const Object *  addBeforeThis,
Object *  itemToAdd,
UndoManager *  um 
)

◆ clear()

void jm::LinkedList::clear ( UndoManager *  um)

◆ displayName()

jm::String jm::LinkedList::displayName ( ) const
overridevirtual

Returns the display name of the object intended to present to a user.

This method should be implemented by objects that want to present the name of the object to the user of an application. For example the diff-algorithm uses this or also the dwg objects.

Reimplemented from jm::Object.

◆ first()

Object * jm::LinkedList::first ( ) const

Returns the first element of the list.

◆ hasNext()

bool jm::LinkedList::hasNext ( ) const

This method returns true if there is a next element in the list.

◆ iterator()

LinkedListIterator jm::LinkedList::iterator ( ) const

◆ last()

Object * jm::LinkedList::last ( ) const

Returns the last element of the list.

◆ next()

Object * jm::LinkedList::next ( )

Iterates to the next element in the list and returns the current one. The next element can be NULL, but then hasNext() will return false.

◆ remove()

Status jm::LinkedList::remove ( const Object *  data,
UndoManager *  um 
)

removes the element from the list.

Returns
eOK on success. eNotFound, if entry is not in the list.

◆ rewind()

void jm::LinkedList::rewind ( )

◆ size()

size_t jm::LinkedList::size ( ) const

Returns the number of entries in this list.

◆ swapData()

void jm::LinkedList::swapData ( Object *  data1,
Object *  data2,
UndoManager *  um 
)

Friends And Related Symbol Documentation

◆ LinkedListIterator

friend class LinkedListIterator
friend