HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UN_StickyNoteData Class Reference

#include <UN_StickyNoteData.h>

+ Inheritance diagram for UN_StickyNoteData:

Classes

class  IDIterator
 Iterator for traversing valid sticky note IDs. More...
 
class  OrderedIDIterator
 Iterator for traversing valid sticky note IDs in an ascending order. More...
 

Public Types

using IDRange = UT_IteratorRange< IDIterator >
 Returns a range for iterating valid sticky note IDs. More...
 
using OrderedIDRange = UT_IteratorRange< OrderedIDIterator >
 Returns a range for iterating valid sticky note IDs. More...
 
- Public Types inherited from UN_Data
using IDRange = UN_DataIndexMap::IDRange
 Returns a range for iterating valid IDs. More...
 
using OrderedIDRange = UN_DataIndexMap::OrderedIDRange
 Returns a range for iterating valid IDs in an ascending order. More...
 

Public Member Functions

 UN_StickyNoteData (UN_CustomStickyNoteDataPtr custom_data=UN_CustomStickyNoteDataPtr())
 Constructors and destructors. More...
 
 ~UN_StickyNoteData ()=default
 
 UN_StickyNoteData (UN_StickyNoteData &&)
 
UN_StickyNoteDataoperator= (UN_StickyNoteData &&)
 
void setCapacityIfNeeded (UN_DataSize min_capacity)
 
UN_StickyNoteIDRemap merge (const UN_StickyNoteData &src_sticky_note_data)
 
UN_StickyNoteID addStickyNote ()
 
void clearStickyNote (UN_StickyNoteID sticky_note_id)
 Clears the data for the given sticky note to the default state. More...
 
bool removeStickyNote (UN_StickyNoteID sticky_note_id)
 
void removeAllStickyNotes (bool reset_next_id)
 
bool isValid (UN_StickyNoteID sticky_note_id) const
 
IDRange idRange () const
 
OrderedIDRange orderedIDRange () const
 
UN_StickyNoteIDList stickyNoteIDs () const
 Returns a list of all the valid sticky note IDs in the graph. More...
 
UN_StickyNoteIDList sortedStickyNoteIDs () const
 Returns a list of all the valid sticky note IDs in the graph. More...
 
const UT_StringHoldername (UN_StickyNoteID note_id) const
 Returns the name that identifies the sticky notes among its siblings. More...
 
void setText (UN_StickyNoteID note_id, const UT_StringRef &text)
 Sets the sticky note's contents text. More...
 
const UT_StringHoldertext (UN_StickyNoteID note_id) const
 Returns the sticky note's contents. More...
 
void setPosition (UN_StickyNoteID note_id, const UT_Vector2D &position)
 Sets the sticky note's location in the graph editor. More...
 
const UT_Vector2Dposition (UN_StickyNoteID note_id) const
 Returns the sticky note's position in the graph editor. More...
 
void setDimensions (UN_StickyNoteID note_id, const UT_Vector2D &dimensions)
 Sets the sticky note's width and height. More...
 
const UT_Vector2Ddimensions (UN_StickyNoteID note_id) const
 Returns the sticky note's dimensions (width & height). More...
 
void setColor (UN_StickyNoteID note_id, const UT_Color &color)
 Sets the sticky notes's background color in the graph editor. More...
 
const UT_Colorcolor (UN_StickyNoteID note_id) const
 Returns the sticky note's background color in the graph editor. More...
 
void setTextColor (UN_StickyNoteID note_id, const UT_Color &text_color)
 Sets the sticky notes's text (foreground) color in the graph editor. More...
 
const UT_ColortextColor (UN_StickyNoteID note_id) const
 Returns the sticky note's text (foreground) color in the graph editor. More...
 
void setTextSize (UN_StickyNoteID note_id, float text_size)
 Sets the sticky note's text size. More...
 
float textSize (UN_StickyNoteID note_id) const
 Returns the sticky note's text size. More...
 
void setCollapsed (UN_StickyNoteID note_id, bool is_collapsed)
 Sets the sticky note's collapsed (minimized) state. More...
 
bool isCollapsed (UN_StickyNoteID note_id) const
 Returns true if the sticky note is collapsed (minimized). More...
 
void setBackgroundHidden (UN_StickyNoteID note_id, bool is_hidden)
 
bool isBackgroundHidden (UN_StickyNoteID note_id) const
 
void setCheckValidStickyNoteNames (bool flag)
 Asserts that the sticky note names are alphanumeric. More...
 
void setStickyNoteNameSafeChars (const UT_StringRef &safe_chars)
 A set of additional characters that are legal in sticky note names. More...
 
UN_CustomStickyNoteDatacustomStickyNoteData ()
 
const UN_CustomStickyNoteDatacustomStickyNoteData () const
 
- Public Member Functions inherited from UN_Data
 UN_Data (UN_CustomDataPtr custom_data=UN_CustomDataPtr())
 Constructors and destructors. More...
 
 ~UN_Data ()=default
 
 UN_Data (UN_Data &&)
 Move operators. More...
 
UN_Dataoperator= (UN_Data &&)
 
IDRange idRange () const
 
OrderedIDRange orderedIDRange () const
 
UN_DataIDList dataIDs () const
 Returns a list of all the valid IDs in this container. More...
 
UN_DataIDList sortedDataIDs () const
 Returns a sorted list of all the valid IDs in this container. More...
 
UN_DataSize size () const
 Returns the number of valid data items in the buffer. More...
 
UN_DataSize indexSize () const
 
UN_DataSize idSize () const
 
template<typename D >
UN_GenericBufferID addGenericBuffer (const UT_StringRef &name, UN_GenericBufferType type, const D &default_value)
 
UN_GenericBufferType genericBufferType (UN_GenericBufferID id) const
 Returns the type of the generic buffer identified by the given ID. More...
 
UN_GenericBufferID findGenericBuffer (const UT_StringRef &name) const
 
const UT_StringHoldergenericBufferName (UN_GenericBufferID id) const
 Returns the name of the generic buffer identified by the given ID. More...
 
UN_CustomDatacustomData ()
 Returns the custom data container, if one was provided. More...
 
const UN_CustomDatacustomData () const
 Returns the custom data container, if one was provided. More...
 

Static Public Attributes

static const UT_StringHolder theDefText
 
static const auto theDefPos = UT_Vector2D(0.0)
 
static const auto theDefDim = UT_Vector2D(2.5)
 
static const auto theDefColor
 
static const auto theDefTextColor = UT_BLACK
 
static const auto theDefTextSize = 0.0F
 
static const auto theDefCollapsed = false
 
static const auto theDefBackgroundHidden = false
 

Protected Member Functions

 UN_StickyNoteData (const UN_StickyNoteData &)=default
 
UN_StickyNoteDataoperator= (const UN_StickyNoteData &)=default
 
void setName (UN_StickyNoteID note_id, const UT_StringRef &name)
 Sets the sticky note name that differentiates it among its siblings. More...
 
UN_StickyNoteIndex stickyNoteIndex (UN_StickyNoteID id) const
 Returns the sticky note's data index into the data buffer arrays. More...
 
- Protected Member Functions inherited from UN_Data
 UN_Data (const UN_Data &)
 
UN_Dataoperator= (const UN_Data &)
 
UN_DataMergeInfo mergeData (const UN_Data &src_data, bool combine_id_zero=false)
 
std::pair< UN_DataID,
UN_DataIndex
addData ()
 
std::pair< UN_DataID,
UN_DataIndex
findOrAddData (UN_DataID data_id)
 
bool removeData (UN_DataID data_id)
 
void removeAllData (bool reset_next_id)
 
bool isValid (UN_DataID data_id) const
 
UN_DataIndex dataIndex (UN_DataID id) const
 
UN_DataSize dataBufferSize () const
 
UN_DataSize freeDataBufferSize () const
 
UN_DataSize usedDataBufferSize () const
 
template<typename V , typename B >
void setData (B &buffer, UN_DataID id, const V &value)
 Helper method to copy-assign the value to an entry in the data buffer. More...
 
template<typename V , typename B >
void setData (B &buffer, UN_DataID id, V &&value)
 Helper method to move-assign the value to an entry in the data buffer. More...
 
template<typename V , typename B >
const V & getDataRef (const B &buffer, UN_DataID id, const V &default_value) const
 Helper method to return a const ref to an entry in the data buffer. More...
 
template<typename V , typename B >
getDataVal (const B &buffer, UN_DataID id, const V &default_value) const
 
template<typename V , typename B >
stealData (B &buffer, UN_DataID id, const V &default_value)
 Helper method to return a value moved from an entry in the data buffer. More...
 
template<typename OP , typename B >
void updateData (B &buffer, UN_DataID id, const OP &op)
 
template<typename T >
void setGenericData (UN_GenericBufferID buf_id, UN_DataID id, const T &value)
 Sets the data value in a generic buffer for a given data ID. More...
 
template<typename T >
void setGenericData (UN_GenericBufferID buf_id, UN_DataID id, T &&value)
 Sets the data value in a generic buffer via move. More...
 
template<typename T >
const TgenericDataRef (UN_GenericBufferID buf_id, UN_DataID id) const
 Returns a const ref to the data value in a generic buffer. More...
 
template<typename T >
T genericDataVal (UN_GenericBufferID buf_id, UN_DataID id) const
 
template<typename T >
T stealGenericData (UN_GenericBufferID buf_id, UN_DataID id)
 Moves the data value out of a generic buffer. More...
 
template<typename T , typename OP >
void updateGenericData (UN_GenericBufferID buf_id, UN_DataID id, const OP &op)
 Updates the data value in a generic buffer in-place via a callable. More...
 
void addGenericData (UN_DataIndex index)
 Adds a data slot at the given index to all generic buffers. More...
 
void clearGenericData (UN_DataIndex index)
 Clears the generic data at the given index to defaults. More...
 
void removeAllGenericData ()
 Removes all data from all generic buffers. More...
 
void setGenericDataCapacityIfNeeded (UN_DataSize min_capacity)
 Grows all generic buffers to the given minimum capacity. More...
 
void mergeGenericData (const UN_Data &src, const UN_DataMergeInfo &merge_info)
 Merges generic data from another UN_Data container. More...
 
bool isGenericDataSizeConsistent (UN_DataSize expected_size) const
 Returns true if all generic buffers have the expected size. More...
 

Protected Attributes

friend UN_GraphData
 

Detailed Description

Container of data for all the sticky notes in the graph.

NOTE: This class is generally not trivially relocatable, because its base class (UN_Data) is not trivially relocatable (see comment there).

Definition at line 32 of file UN_StickyNoteData.h.

Member Typedef Documentation

Returns a range for iterating valid sticky note IDs.

Definition at line 130 of file UN_StickyNoteData.h.

Returns a range for iterating valid sticky note IDs.

Definition at line 138 of file UN_StickyNoteData.h.

Constructor & Destructor Documentation

UN_StickyNoteData::UN_StickyNoteData ( UN_CustomStickyNoteDataPtr  custom_data = UN_CustomStickyNoteDataPtr())

Constructors and destructors.

UN_StickyNoteData::~UN_StickyNoteData ( )
default
UN_StickyNoteData::UN_StickyNoteData ( UN_StickyNoteData &&  )
UN_StickyNoteData::UN_StickyNoteData ( const UN_StickyNoteData )
protecteddefault

Member Function Documentation

UN_StickyNoteID UN_StickyNoteData::addStickyNote ( )

Adds a slot for a new sticky note in this container. Returns an ID that should be used to refer to this new sticky note for accessing its data (eg, source port, destination port, etc).

void UN_StickyNoteData::clearStickyNote ( UN_StickyNoteID  sticky_note_id)

Clears the data for the given sticky note to the default state.

const UT_Color& UN_StickyNoteData::color ( UN_StickyNoteID  note_id) const
inline

Returns the sticky note's background color in the graph editor.

Definition at line 221 of file UN_StickyNoteData.h.

UN_CustomStickyNoteData* UN_StickyNoteData::customStickyNoteData ( )
inline

Returns sticky notes's custom data container, if one was provided to c-tor.

Definition at line 59 of file UN_StickyNoteData.h.

const UN_CustomStickyNoteData* UN_StickyNoteData::customStickyNoteData ( ) const
inline

Returns sticky notes's custom data container, if one was provided to c-tor.

Definition at line 64 of file UN_StickyNoteData.h.

const UT_Vector2D& UN_StickyNoteData::dimensions ( UN_StickyNoteID  note_id) const
inline

Returns the sticky note's dimensions (width & height).

Definition at line 209 of file UN_StickyNoteData.h.

IDRange UN_StickyNoteData::idRange ( ) const
inline

Definition at line 131 of file UN_StickyNoteData.h.

bool UN_StickyNoteData::isBackgroundHidden ( UN_StickyNoteID  note_id) const
inline

Returns true if the background of the sticky note is not drawn, effectively making it transparent.

Definition at line 271 of file UN_StickyNoteData.h.

bool UN_StickyNoteData::isCollapsed ( UN_StickyNoteID  note_id) const
inline

Returns true if the sticky note is collapsed (minimized).

Definition at line 257 of file UN_StickyNoteData.h.

bool UN_StickyNoteData::isValid ( UN_StickyNoteID  sticky_note_id) const
inline

Returns true if the given ID refers to a valid sticky note entry in the data buffers. Ie, such a sticky note exists and is valid.

Definition at line 95 of file UN_StickyNoteData.h.

UN_StickyNoteIDRemap UN_StickyNoteData::merge ( const UN_StickyNoteData src_sticky_note_data)

Merges another sticky data data container into this one. Returns a mapping between the sticky data IDs in the merge source and destination (this) data buffers.

const UT_StringHolder& UN_StickyNoteData::name ( UN_StickyNoteID  note_id) const
inline

Returns the name that identifies the sticky notes among its siblings.

Definition at line 173 of file UN_StickyNoteData.h.

UN_StickyNoteData& UN_StickyNoteData::operator= ( UN_StickyNoteData &&  )
UN_StickyNoteData& UN_StickyNoteData::operator= ( const UN_StickyNoteData )
protecteddefault
OrderedIDRange UN_StickyNoteData::orderedIDRange ( ) const
inline

Definition at line 139 of file UN_StickyNoteData.h.

const UT_Vector2D& UN_StickyNoteData::position ( UN_StickyNoteID  note_id) const
inline

Returns the sticky note's position in the graph editor.

Definition at line 197 of file UN_StickyNoteData.h.

void UN_StickyNoteData::removeAllStickyNotes ( bool  reset_next_id)

Frees the data slots occupied by all the sticky notes.

Parameters
'reset_next_id'If true, the sticky note ID generator is reset to zero.
bool UN_StickyNoteData::removeStickyNote ( UN_StickyNoteID  sticky_note_id)

Removes the sticky note from this container and frees the data slot it occupied. After calling this method, the container will have no knowledge of the sticky note by this ID. Returns true on successs; false if the sticky note was not found.

void UN_StickyNoteData::setBackgroundHidden ( UN_StickyNoteID  note_id,
bool  is_hidden 
)
inline

Sets the flag on the sticky note to avoid drawing its background, effectively making it transparent.

Definition at line 264 of file UN_StickyNoteData.h.

void UN_StickyNoteData::setCapacityIfNeeded ( UN_DataSize  min_capacity)

Increases the capacity of the data buffer arrays to the given minimum, unless the capacity is already greater or equal to that minimum, in which case the capacity remains unchanged.

void UN_StickyNoteData::setCheckValidStickyNoteNames ( bool  flag)
inline

Asserts that the sticky note names are alphanumeric.

Definition at line 279 of file UN_StickyNoteData.h.

void UN_StickyNoteData::setCollapsed ( UN_StickyNoteID  note_id,
bool  is_collapsed 
)
inline

Sets the sticky note's collapsed (minimized) state.

Definition at line 251 of file UN_StickyNoteData.h.

void UN_StickyNoteData::setColor ( UN_StickyNoteID  note_id,
const UT_Color color 
)
inline

Sets the sticky notes's background color in the graph editor.

Definition at line 215 of file UN_StickyNoteData.h.

void UN_StickyNoteData::setDimensions ( UN_StickyNoteID  note_id,
const UT_Vector2D dimensions 
)
inline

Sets the sticky note's width and height.

Definition at line 203 of file UN_StickyNoteData.h.

void UN_StickyNoteData::setName ( UN_StickyNoteID  note_id,
const UT_StringRef name 
)
inlineprotected

Sets the sticky note name that differentiates it among its siblings.

Definition at line 164 of file UN_StickyNoteData.h.

void UN_StickyNoteData::setPosition ( UN_StickyNoteID  note_id,
const UT_Vector2D position 
)
inline

Sets the sticky note's location in the graph editor.

Definition at line 191 of file UN_StickyNoteData.h.

void UN_StickyNoteData::setStickyNoteNameSafeChars ( const UT_StringRef safe_chars)
inline

A set of additional characters that are legal in sticky note names.

Definition at line 285 of file UN_StickyNoteData.h.

void UN_StickyNoteData::setText ( UN_StickyNoteID  note_id,
const UT_StringRef text 
)
inline

Sets the sticky note's contents text.

Definition at line 179 of file UN_StickyNoteData.h.

void UN_StickyNoteData::setTextColor ( UN_StickyNoteID  note_id,
const UT_Color text_color 
)
inline

Sets the sticky notes's text (foreground) color in the graph editor.

Definition at line 227 of file UN_StickyNoteData.h.

void UN_StickyNoteData::setTextSize ( UN_StickyNoteID  note_id,
float  text_size 
)
inline

Sets the sticky note's text size.

Definition at line 239 of file UN_StickyNoteData.h.

UN_StickyNoteIDList UN_StickyNoteData::sortedStickyNoteIDs ( ) const
inline

Returns a list of all the valid sticky note IDs in the graph.

Definition at line 153 of file UN_StickyNoteData.h.

UN_StickyNoteIDList UN_StickyNoteData::stickyNoteIDs ( ) const
inline

Returns a list of all the valid sticky note IDs in the graph.

Definition at line 146 of file UN_StickyNoteData.h.

UN_StickyNoteIndex UN_StickyNoteData::stickyNoteIndex ( UN_StickyNoteID  id) const
inlineprotected

Returns the sticky note's data index into the data buffer arrays.

Definition at line 292 of file UN_StickyNoteData.h.

const UT_StringHolder& UN_StickyNoteData::text ( UN_StickyNoteID  note_id) const
inline

Returns the sticky note's contents.

Definition at line 185 of file UN_StickyNoteData.h.

const UT_Color& UN_StickyNoteData::textColor ( UN_StickyNoteID  note_id) const
inline

Returns the sticky note's text (foreground) color in the graph editor.

Definition at line 233 of file UN_StickyNoteData.h.

float UN_StickyNoteData::textSize ( UN_StickyNoteID  note_id) const
inline

Returns the sticky note's text size.

Definition at line 245 of file UN_StickyNoteData.h.

Member Data Documentation

const auto UN_StickyNoteData::theDefBackgroundHidden = false
inlinestatic

Definition at line 350 of file UN_StickyNoteData.h.

const auto UN_StickyNoteData::theDefCollapsed = false
inlinestatic

Definition at line 349 of file UN_StickyNoteData.h.

const auto UN_StickyNoteData::theDefColor
inlinestatic
Initial value:
=
UT_Color(UT_RGB, 1.000F, 0.969F, 0.522F)

Definition at line 345 of file UN_StickyNoteData.h.

const auto UN_StickyNoteData::theDefDim = UT_Vector2D(2.5)
inlinestatic

Definition at line 344 of file UN_StickyNoteData.h.

const auto UN_StickyNoteData::theDefPos = UT_Vector2D(0.0)
inlinestatic

Definition at line 343 of file UN_StickyNoteData.h.

const UT_StringHolder UN_StickyNoteData::theDefText
inlinestatic

Definition at line 342 of file UN_StickyNoteData.h.

const auto UN_StickyNoteData::theDefTextColor = UT_BLACK
inlinestatic

Definition at line 347 of file UN_StickyNoteData.h.

const auto UN_StickyNoteData::theDefTextSize = 0.0F
inlinestatic

Definition at line 348 of file UN_StickyNoteData.h.

friend UN_StickyNoteData::UN_GraphData
protected

This container can have large data, so generally, forbid the costly copy operations to the public. Knowledgable friends and derived classes can still use them.

Definition at line 47 of file UN_StickyNoteData.h.


The documentation for this class was generated from the following file: