SdfListEditorProxy< _TypePolicy > Class Template Reference

Represents a set of list editing operations. More...

Public Types

typedef _TypePolicy TypePolicy
 
typedef SdfListEditorProxy< TypePolicy > This
 
typedef SdfListProxy< TypePolicy > ListProxy
 
typedef TypePolicy::value_type value_type
 
typedef std::vector< value_type > value_vector_type
 
typedef std::function< boost::optional< value_type >SdfListOpType, const value_type &)> ApplyCallback
 
typedef std::function< boost::optional< value_type >const value_type &)> ModifyCallback
 

Public Member Functions

 SdfListEditorProxy ()
 Creates a default proxy object. More...
 
 SdfListEditorProxy (const boost::shared_ptr< Sdf_ListEditor< TypePolicy > > &listEditor)
 Creates a new proxy object backed by the supplied list editor. More...
 
bool IsExpired () const
 Returns true if the list editor is expired. More...
 
bool IsExplicit () const
 Returns true if the editor has an explicit list, false if it has list operations. More...
 
bool IsOrderedOnly () const
 Returns true if the editor is not explicit and allows ordering only. More...
 
bool HasKeys () const
 Returns true if the editor has an explicit list (even if it's empty) or it has any added, prepended, appended, deleted, or ordered keys. More...
 
void ApplyEditsToList (value_vector_type *vec) const
 Apply the edits to vec. More...
 
template<class CB >
void ApplyEditsToList (value_vector_type *vec, CB callback) const
 Apply the edits to vec. More...
 
bool CopyItems (const This &other)
 Copies the keys from other. More...
 
bool ClearEdits ()
 Removes all keys and changes the editor to have list operations. More...
 
bool ClearEditsAndMakeExplicit ()
 Removes all keys and changes the editor to be explicit. More...
 
template<class CB >
void ModifyItemEdits (CB callback)
 callback is called for every key. More...
 
bool ContainsItemEdit (const value_type &item, bool onlyAddOrExplicit=false) const
 Check if the given item is explicit, added, prepended, appended, deleted, or ordered by this editor. More...
 
void RemoveItemEdits (const value_type &item)
 Remove all occurrences of the given item, regardless of whether the item is explicit, added, prepended, appended, deleted, or ordered. More...
 
void ReplaceItemEdits (const value_type &oldItem, const value_type &newItem)
 Replace all occurrences of the given item, regardless of whether the item is explicit, added, prepended, appended, deleted or ordered. More...
 
ListProxy GetExplicitItems () const
 Returns the explicitly set items. More...
 
ListProxy GetAddedItems () const
 Returns the items added by this list editor. More...
 
ListProxy GetPrependedItems () const
 Returns the items prepended by this list editor. More...
 
ListProxy GetAppendedItems () const
 Returns the items appended by this list editor. More...
 
ListProxy GetDeletedItems () const
 Returns the items deleted by this list editor. More...
 
ListProxy GetOrderedItems () const
 Returns the items reordered by this list editor. More...
 
value_vector_type GetAddedOrExplicitItems () const
 Returns the added or explicitly set items. More...
 
void Add (const value_type &value)
 
void Prepend (const value_type &value)
 
void Append (const value_type &value)
 
void Remove (const value_type &value)
 
void Erase (const value_type &value)
 
 operator bool () const
 Explicit bool conversion operator. More...
 

Friends

template<class T >
class SdfPyWrapListEditorProxy
 

Detailed Description

template<class _TypePolicy>
class SdfListEditorProxy< _TypePolicy >

Represents a set of list editing operations.

An SdfListEditorProxy allows consumers to specify a transformation to be applied to a list via a set of list editing operations. Given a starting ordered list, it can either replace the result with another ordered list or apply a sequence of three operations: deleting keys, then adding keys to the end (if they aren't already in the starting list), then reordering keys.

The type policy defines the value type that a particular proxy can operate on.

Definition at line 57 of file listEditorProxy.h.

Constructor & Destructor Documentation

◆ SdfListEditorProxy() [1/2]

SdfListEditorProxy ( )
inline

Creates a default proxy object.

The object evaluates to false in a boolean context and all operations on this object have no effect.

Definition at line 75 of file listEditorProxy.h.

◆ SdfListEditorProxy() [2/2]

SdfListEditorProxy ( const boost::shared_ptr< Sdf_ListEditor< TypePolicy > > &  listEditor)
inlineexplicit

Creates a new proxy object backed by the supplied list editor.

Definition at line 80 of file listEditorProxy.h.

Member Function Documentation

◆ ApplyEditsToList() [1/2]

void ApplyEditsToList ( value_vector_type *  vec) const
inline

Apply the edits to vec.

Definition at line 119 of file listEditorProxy.h.

◆ ApplyEditsToList() [2/2]

void ApplyEditsToList ( value_vector_type *  vec,
CB  callback 
) const
inline

Apply the edits to vec.

If callback is valid then it's called for every key in the editor before applying it to vec. If the returned key is invalid then the key will not be applied. Otherwise the returned key is applied, allowing callbacks to perform key translation.

Definition at line 132 of file listEditorProxy.h.

◆ ClearEdits()

bool ClearEdits ( )
inline

Removes all keys and changes the editor to have list operations.

Not all list editors support changing their mode. If the mode can't be changed to the mode of other then this does nothing and returns false, otherwise it returns true.

Definition at line 157 of file listEditorProxy.h.

◆ ClearEditsAndMakeExplicit()

bool ClearEditsAndMakeExplicit ( )
inline

Removes all keys and changes the editor to be explicit.

Not all list editors support changing their mode. If the mode can't be changed to the mode of other then this does nothing and returns false, otherwise it returns true.

Definition at line 167 of file listEditorProxy.h.

◆ ContainsItemEdit()

bool ContainsItemEdit ( const value_type &  item,
bool  onlyAddOrExplicit = false 
) const
inline

Check if the given item is explicit, added, prepended, appended, deleted, or ordered by this editor.

If onlyAddOrExplicit is true we only check the added or explicit items.

Definition at line 186 of file listEditorProxy.h.

◆ CopyItems()

bool CopyItems ( const This other)
inline

Copies the keys from other.

This differs from assignment because assignment just makes two list editors refer to the same lists.

Not all list editors support changing their mode. If the mode can't be changed to the mode of other then this does nothing and returns false, otherwise it returns true.

Definition at line 146 of file listEditorProxy.h.

◆ GetAddedItems()

ListProxy GetAddedItems ( ) const
inline

Returns the items added by this list editor.

Definition at line 268 of file listEditorProxy.h.

◆ GetAddedOrExplicitItems()

value_vector_type GetAddedOrExplicitItems ( ) const
inline

Returns the added or explicitly set items.

Definition at line 298 of file listEditorProxy.h.

◆ GetAppendedItems()

ListProxy GetAppendedItems ( ) const
inline

Returns the items appended by this list editor.

Definition at line 280 of file listEditorProxy.h.

◆ GetDeletedItems()

ListProxy GetDeletedItems ( ) const
inline

Returns the items deleted by this list editor.

Definition at line 286 of file listEditorProxy.h.

◆ GetExplicitItems()

ListProxy GetExplicitItems ( ) const
inline

Returns the explicitly set items.

Definition at line 262 of file listEditorProxy.h.

◆ GetOrderedItems()

ListProxy GetOrderedItems ( ) const
inline

Returns the items reordered by this list editor.

Definition at line 292 of file listEditorProxy.h.

◆ GetPrependedItems()

ListProxy GetPrependedItems ( ) const
inline

Returns the items prepended by this list editor.

Definition at line 274 of file listEditorProxy.h.

◆ HasKeys()

bool HasKeys ( ) const
inline

Returns true if the editor has an explicit list (even if it's empty) or it has any added, prepended, appended, deleted, or ordered keys.

Definition at line 113 of file listEditorProxy.h.

◆ IsExpired()

bool IsExpired ( ) const
inline

Returns true if the list editor is expired.

Definition at line 87 of file listEditorProxy.h.

◆ IsExplicit()

bool IsExplicit ( ) const
inline

Returns true if the editor has an explicit list, false if it has list operations.

Definition at line 98 of file listEditorProxy.h.

◆ IsOrderedOnly()

bool IsOrderedOnly ( ) const
inline

Returns true if the editor is not explicit and allows ordering only.

Definition at line 105 of file listEditorProxy.h.

◆ ModifyItemEdits()

void ModifyItemEdits ( CB  callback)
inline

callback is called for every key.

If the returned key is invalid then the key is removed, otherwise it's replaced with the returned key.

Definition at line 176 of file listEditorProxy.h.

◆ operator bool()

operator bool ( ) const
inlineexplicit

Explicit bool conversion operator.

A ListEditorProxy object converts to true iff the list editor is valid, converts to false otherwise.

Definition at line 386 of file listEditorProxy.h.

◆ RemoveItemEdits()

void RemoveItemEdits ( const value_type &  item)
inline

Remove all occurrences of the given item, regardless of whether the item is explicit, added, prepended, appended, deleted, or ordered.

Definition at line 230 of file listEditorProxy.h.

◆ ReplaceItemEdits()

void ReplaceItemEdits ( const value_type &  oldItem,
const value_type &  newItem 
)
inline

Replace all occurrences of the given item, regardless of whether the item is explicit, added, prepended, appended, deleted or ordered.

Definition at line 247 of file listEditorProxy.h.


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