Hot Door CORE 0.8.2
Adobe® Illustrator® Plug-in Library
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Friends | List of all members
hdi::core::TreeEntry Class Reference

Allows hierarchical views to store more data than simply strings and indices. More...

#include <hdicoreTreeEntry.h>

Public Member Functions

 TreeEntry ()
 Constructs an empty TreeEntry object.
 
 TreeEntry (const TreeEntry &e_)
 Constructs a new TreeEntry object from an existing TreeEntry object (copy constructor)
 
 TreeEntry (const std::string &id_, const EntryValue &value_, void *userData_, const bool enabled_, const bool expanded_, const bool editable_)
 Constructs a TreeEntry object with some custom data.
 
virtual ~TreeEntry ()
 Destructs a TreeEntry object.
 
virtual TreeEntryoperator= (const TreeEntry &rhs_)
 Assigns one TreeEntry object to another.
 
virtual bool isEmpty () const
 Gets whether the target TreeEntry object is empty (constructed with the default ctor)
 
virtual std::vector< std::string > idPath () const
 Gets the full ID path of the target entry.
 
virtual std::string entryID () const
 Gets the ID string of an entry.
 
virtual void setEntryID (const std::string &id_)
 Sets the ID string of an entry.
 
virtual EntryValue value () const
 Gets the value object of an entry.
 
virtual void setValue (const EntryValue &value_)
 Sets the value object of an entry.
 
virtual bool enabled () const
 Gets whether the entry should be enabled (selectable by the user in the list)
 
virtual void setEnabled (const bool enabled_)
 Sets whether the entry should be enabled (selectable by the user in the list)
 
virtual bool expanded () const
 Gets whether the entry is expanded (i.e. its children are visible)
 
virtual void setExpanded (const bool exp_)
 Sets whether the entry is expanded (i.e. its children are visible)
 
virtual bool editable () const
 Gets the editability of the entry (whether the user can edit it inline)
 
virtual void setEditable (const bool editable_)
 Sets the editability of the entry (whether the user can edit it inline)
 
virtual void *const userData () const
 Gets the custom data of an entry.
 
virtual void setUserData (void *data_)
 Sets the custom data of an entry.
 
virtual bool hasChild (const std::string &id_) const
 Gets whether the entry has a child with the given ID string.
 
virtual std::unique_ptr< TreeEntrychildWithID (const std::string &id_) const
 Get the child entry with the given ID string, if it exists within the target.
 
virtual uint32_t childCount () const
 Gets the count of child entries in the target entry.
 
virtual std::unique_ptr< TreeEntrychildAtIndex (const uint32_t index_) const
 Gets a specific child of the target entry.
 
virtual bool pushChild (const TreeEntry &child_)
 Pushes a new entry onto the end of the list of children of the target entry.
 
virtual bool popChild (TreeEntry &child__)
 Pops an existing entry off the end of the list of children of the target entry.
 
virtual bool insertChild (const std::string &id_, const TreeEntry &child_)
 Inserts an entry into the list of child entries at a given position.
 
virtual bool removeChild (const std::string &id_, TreeEntry &child__)
 Removes a specific entry from the list of child entries.
 
virtual bool operator== (const TreeEntry &rhs_) const
 Tests whether a given TreeEntry object is the same as another.
 
virtual bool operator!= (const TreeEntry &rhs_) const
 Tests whether a given TreeEntry object is not the same as another.
 

Static Public Attributes

static const char * separatorValue
 When you want a separator in a container widget, create a TreeEntry object with this as its string value.
 

Friends

pui::BaseTreeEntryData * __accessImpl (const TreeEntry &)
 

Detailed Description

Allows hierarchical views to store more data than simply strings and indices.

Constructor & Destructor Documentation

◆ TreeEntry() [1/3]

hdi::core::TreeEntry::TreeEntry ( )

Constructs an empty TreeEntry object.

Author
GW
Date
09/2014
Note
To test if a TreeEntry object is empty, call isEmpty() on it
Empty TreeEntry objects do not relate to any entry in any widget; they are designed to be "receivers" of some other TreeEntry object via the overloaded assignment operator. Empty TreeEntry objects are useless until such time (though it is safe to call any of their methods).

◆ TreeEntry() [2/3]

hdi::core::TreeEntry::TreeEntry ( const TreeEntry e_)

Constructs a new TreeEntry object from an existing TreeEntry object (copy constructor)

Author
GW
Date
09/2014
Parameters
e_Existing TreeEntry object

◆ TreeEntry() [3/3]

hdi::core::TreeEntry::TreeEntry ( const std::string &  id_,
const EntryValue value_,
void *  userData_,
const bool  enabled_,
const bool  expanded_,
const bool  editable_ 
)

Constructs a TreeEntry object with some custom data.

Author
GW
Date
09/2014
Parameters
id_Entry ID string, as UTF-8 (must form a unique ID path in the target container)
value_Entry value object
userData_Data to store in the entry
enabled_Whether the entry should be enabled
expanded_true to expand the entry, false to collapse
editable_Whether the entry should be inline editable
Note
A given entry ID can occur in multiple children vectors, so long as the ID path of at least one parent is not identical (e.g. "A"/"C" and "B"/"C" are allowed to exist in one widget, but "X"/"Y" and "X"/"Y" are not).

◆ ~TreeEntry()

virtual hdi::core::TreeEntry::~TreeEntry ( )
virtual

Destructs a TreeEntry object.

Author
GW
Date
09/2014

Member Function Documentation

◆ childAtIndex()

virtual std::unique_ptr< TreeEntry > hdi::core::TreeEntry::childAtIndex ( const uint32_t  index_) const
virtual

Gets a specific child of the target entry.

Author
GW
Date
09/2014
Parameters
index_Index of the desired child entry
Returns
The direct child at the given index, or NULL for error

◆ childCount()

virtual uint32_t hdi::core::TreeEntry::childCount ( ) const
virtual

Gets the count of child entries in the target entry.

Author
GW
Date
09/2014
Returns
The count of direct child entries

◆ childWithID()

virtual std::unique_ptr< TreeEntry > hdi::core::TreeEntry::childWithID ( const std::string &  id_) const
virtual

Get the child entry with the given ID string, if it exists within the target.

Author
GW
Date
12/2022
Parameters
id_ID of the child to search for
Returns
The found child entry, or NULL if not found
Note
This method performs an O(n) operation, and only searches direct children (i.e. not a full-subtree search).

◆ editable()

virtual bool hdi::core::TreeEntry::editable ( ) const
virtual

Gets the editability of the entry (whether the user can edit it inline)

Author
GW
Date
07/2022
Returns
true for enabled, false otherwise

◆ enabled()

virtual bool hdi::core::TreeEntry::enabled ( ) const
virtual

Gets whether the entry should be enabled (selectable by the user in the list)

Author
GW
Date
09/2014
Returns
true for enabled, false otherwise

◆ entryID()

virtual std::string hdi::core::TreeEntry::entryID ( ) const
virtual

Gets the ID string of an entry.

Author
GW
Date
09/2014
Returns
The unique ID of the entry, as UTF-8

◆ expanded()

virtual bool hdi::core::TreeEntry::expanded ( ) const
virtual

Gets whether the entry is expanded (i.e. its children are visible)

Author
GW
Date
02/2015
Returns
true for expanded, false for collapsed

◆ hasChild()

virtual bool hdi::core::TreeEntry::hasChild ( const std::string &  id_) const
virtual

Gets whether the entry has a child with the given ID string.

Author
GW
Date
12/2022
Parameters
id_ID of the child to search for
Returns
true if found, false otherwise
Note
This method performs an O(n) operation, and only searches direct children (i.e. not a full-subtree search).

◆ idPath()

virtual std::vector< std::string > hdi::core::TreeEntry::idPath ( ) const
virtual

Gets the full ID path of the target entry.

Author
GW
Date
12/2022
Returns
The the ID path for the target, from top-most to the target
Warning
Only valid after the entry and its ancestors have been added to a HierarchicalWidget, and can change if the entries are e.g. reorganized and the widget is updated.

◆ insertChild()

virtual bool hdi::core::TreeEntry::insertChild ( const std::string &  id_,
const TreeEntry child_ 
)
virtual

Inserts an entry into the list of child entries at a given position.

Author
GW
Date
12/2022
Parameters
id_Existing entry immediately before the position at which the new entry will be inserted, as UTF-8; pass "" to insert at the beginning
child_New entry object to insert into the list of children
Returns
true if the entry is inserted successfully, false otherwise
Note
If the entry for id_ doesn't exist in the list, the new child will not be inserted.
If the passed child is already present in the list (based on its ID), it will not be inserted.

◆ isEmpty()

virtual bool hdi::core::TreeEntry::isEmpty ( ) const
virtual

Gets whether the target TreeEntry object is empty (constructed with the default ctor)

Author
GW
Date
09/2014
Returns
true if the target TreeEntry object is empty, false otherwise

◆ operator!=()

virtual bool hdi::core::TreeEntry::operator!= ( const TreeEntry rhs_) const
virtual

Tests whether a given TreeEntry object is not the same as another.

Author
GW
Date
09/2014
Parameters
rhs_TreeEntry to compare against (righthand side of inequality operator)
Returns
true for the target and rhs_ being different entries, false otherwise

◆ operator=()

virtual TreeEntry & hdi::core::TreeEntry::operator= ( const TreeEntry rhs_)
virtual

Assigns one TreeEntry object to another.

Author
GW
Date
09/2014
Parameters
rhs_Existing TreeEntry object to copy values from
Returns
The target TreeEntry object, but with its values updated to match that of the rhs_ argument

◆ operator==()

virtual bool hdi::core::TreeEntry::operator== ( const TreeEntry rhs_) const
virtual

Tests whether a given TreeEntry object is the same as another.

Author
GW
Date
09/2014
Parameters
rhs_TreeEntry to compare against (righthand side of equality operator)
Returns
true for the target and rhs_ being the same entry, false otherwise

◆ popChild()

virtual bool hdi::core::TreeEntry::popChild ( TreeEntry child__)
virtual

Pops an existing entry off the end of the list of children of the target entry.

Author
GW
Date
09/2014
Parameters
child__Return-by-reference for the child entry that was removed
Returns
true if the child could be acquired and popped, false otherwise

◆ pushChild()

virtual bool hdi::core::TreeEntry::pushChild ( const TreeEntry child_)
virtual

Pushes a new entry onto the end of the list of children of the target entry.

Author
GW
Date
09/2014
Parameters
child_New child to add to the end of the list of children
Returns
true if the child could be pushed, false otherwise

◆ removeChild()

virtual bool hdi::core::TreeEntry::removeChild ( const std::string &  id_,
TreeEntry child__ 
)
virtual

Removes a specific entry from the list of child entries.

Author
GW
Date
12/2022
Parameters
id_ID of the entry to be removed, as UTF-8
entry__Return-by-reference for the removed child, so the caller can inspect which one was removed
Returns
true if the child was removed and acquired, false otherwise

◆ setEditable()

virtual void hdi::core::TreeEntry::setEditable ( const bool  editable_)
virtual

Sets the editability of the entry (whether the user can edit it inline)

Author
GW
Date
07/2022
Parameters
enabled_true for enabled, false otherwise

◆ setEnabled()

virtual void hdi::core::TreeEntry::setEnabled ( const bool  enabled_)
virtual

Sets whether the entry should be enabled (selectable by the user in the list)

Author
GW
Date
09/2014
Parameters
enabled_true for enabled, false otherwise

◆ setEntryID()

virtual void hdi::core::TreeEntry::setEntryID ( const std::string &  id_)
virtual

Sets the ID string of an entry.

Author
GW
Date
09/2014
Parameters
id_New entry ID string, as UTF-8
Note
It is up to the caller to ensure that the ID path is not in use with other entries within the same container widget.

◆ setExpanded()

virtual void hdi::core::TreeEntry::setExpanded ( const bool  exp_)
virtual

Sets whether the entry is expanded (i.e. its children are visible)

Author
GW
Date
02/2015
Parameters
exp_true for expanded, false for collapsed

◆ setUserData()

virtual void hdi::core::TreeEntry::setUserData ( void *  data_)
virtual

Sets the custom data of an entry.

Author
GW
Date
09/2014
Parameters
data_New custom data to store

◆ setValue()

virtual void hdi::core::TreeEntry::setValue ( const EntryValue value_)
virtual

Sets the value object of an entry.

Author
GW
Date
09/2014
Parameters
value_New entry value object

◆ userData()

virtual void *const hdi::core::TreeEntry::userData ( ) const
virtual

Gets the custom data of an entry.

Author
GW
Date
09/2014
Returns
The data stored inside the target entry object

◆ value()

virtual EntryValue hdi::core::TreeEntry::value ( ) const
virtual

Gets the value object of an entry.

Author
GW
Date
09/2014
Returns
The entry's value object