HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SdfListEditorProxy< _TypePolicy > Class Template Reference

#include <listEditorProxy.h>

Public Types

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

Public Member Functions

 SdfListEditorProxy ()
 
 SdfListEditorProxy (const std::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
 
bool IsOrderedOnly () const
 
bool HasKeys () const
 
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
 
bool CopyItems (const This &other)
 
bool ClearEdits ()
 
bool ClearEditsAndMakeExplicit ()
 
template<class CB >
void ModifyItemEdits (CB callback)
 
bool ContainsItemEdit (const value_type &item, bool onlyAddOrExplicit=false) const
 
void RemoveItemEdits (const value_type &item)
 
void ReplaceItemEdits (const value_type &oldItem, const value_type &newItem)
 
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
 Deprecated. Please use GetAppliedItems. More...
 
value_vector_type GetAppliedItems () const
 
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
 

Friends

class Sdf_ListEditorProxyAccess
 
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 56 of file listEditorProxy.h.

Member Typedef Documentation

template<class _TypePolicy >
typedef std::function<std::optional<value_type>SdfListOpType, const value_type&)> SdfListEditorProxy< _TypePolicy >::ApplyCallback

Definition at line 66 of file listEditorProxy.h.

template<class _TypePolicy >
typedef SdfListProxy<TypePolicy> SdfListEditorProxy< _TypePolicy >::ListProxy

Definition at line 60 of file listEditorProxy.h.

template<class _TypePolicy >
typedef std::function<std::optional<value_type>const value_type&)> SdfListEditorProxy< _TypePolicy >::ModifyCallback

Definition at line 70 of file listEditorProxy.h.

template<class _TypePolicy >
typedef SdfListEditorProxy<TypePolicy> SdfListEditorProxy< _TypePolicy >::This

Definition at line 59 of file listEditorProxy.h.

template<class _TypePolicy >
typedef _TypePolicy SdfListEditorProxy< _TypePolicy >::TypePolicy

Definition at line 58 of file listEditorProxy.h.

template<class _TypePolicy >
typedef TypePolicy::value_type SdfListEditorProxy< _TypePolicy >::value_type

Definition at line 61 of file listEditorProxy.h.

template<class _TypePolicy >
typedef std::vector<value_type> SdfListEditorProxy< _TypePolicy >::value_vector_type

Definition at line 62 of file listEditorProxy.h.

Constructor & Destructor Documentation

template<class _TypePolicy >
SdfListEditorProxy< _TypePolicy >::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 74 of file listEditorProxy.h.

template<class _TypePolicy >
SdfListEditorProxy< _TypePolicy >::SdfListEditorProxy ( const std::shared_ptr< Sdf_ListEditor< TypePolicy > > &  listEditor)
inlineexplicit

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

Definition at line 79 of file listEditorProxy.h.

Member Function Documentation

template<class _TypePolicy >
void SdfListEditorProxy< _TypePolicy >::Add ( const value_type value)
inline

Definition at line 318 of file listEditorProxy.h.

template<class _TypePolicy >
void SdfListEditorProxy< _TypePolicy >::Append ( const value_type value)
inline

Definition at line 348 of file listEditorProxy.h.

template<class _TypePolicy >
void SdfListEditorProxy< _TypePolicy >::ApplyEditsToList ( value_vector_type vec) const
inline

Apply the edits to vec.

Definition at line 118 of file listEditorProxy.h.

template<class _TypePolicy >
template<class CB >
void SdfListEditorProxy< _TypePolicy >::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 131 of file listEditorProxy.h.

template<class _TypePolicy >
bool SdfListEditorProxy< _TypePolicy >::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 156 of file listEditorProxy.h.

template<class _TypePolicy >
bool SdfListEditorProxy< _TypePolicy >::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 166 of file listEditorProxy.h.

template<class _TypePolicy >
bool SdfListEditorProxy< _TypePolicy >::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 185 of file listEditorProxy.h.

template<class _TypePolicy >
bool SdfListEditorProxy< _TypePolicy >::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 145 of file listEditorProxy.h.

template<class _TypePolicy >
void SdfListEditorProxy< _TypePolicy >::Erase ( const value_type value)
inline

Definition at line 378 of file listEditorProxy.h.

template<class _TypePolicy >
ListProxy SdfListEditorProxy< _TypePolicy >::GetAddedItems ( ) const
inline

Returns the items added by this list editor.

Definition at line 267 of file listEditorProxy.h.

template<class _TypePolicy >
value_vector_type SdfListEditorProxy< _TypePolicy >::GetAddedOrExplicitItems ( ) const
inline

Deprecated. Please use GetAppliedItems.

Definition at line 297 of file listEditorProxy.h.

template<class _TypePolicy >
ListProxy SdfListEditorProxy< _TypePolicy >::GetAppendedItems ( ) const
inline

Returns the items appended by this list editor.

Definition at line 279 of file listEditorProxy.h.

template<class _TypePolicy >
value_vector_type SdfListEditorProxy< _TypePolicy >::GetAppliedItems ( ) const
inline

Returns the effective list of items represented by the operations in this list op. This function should be used to determine the final list of items added instead of looking at the individual explicit, prepended, and appended item lists.

This is equivalent to calling ApplyOperations on an empty item vector.

Definition at line 309 of file listEditorProxy.h.

template<class _TypePolicy >
ListProxy SdfListEditorProxy< _TypePolicy >::GetDeletedItems ( ) const
inline

Returns the items deleted by this list editor.

Definition at line 285 of file listEditorProxy.h.

template<class _TypePolicy >
ListProxy SdfListEditorProxy< _TypePolicy >::GetExplicitItems ( ) const
inline

Returns the explicitly set items.

Definition at line 261 of file listEditorProxy.h.

template<class _TypePolicy >
ListProxy SdfListEditorProxy< _TypePolicy >::GetOrderedItems ( ) const
inline

Returns the items reordered by this list editor.

Definition at line 291 of file listEditorProxy.h.

template<class _TypePolicy >
ListProxy SdfListEditorProxy< _TypePolicy >::GetPrependedItems ( ) const
inline

Returns the items prepended by this list editor.

Definition at line 273 of file listEditorProxy.h.

template<class _TypePolicy >
bool SdfListEditorProxy< _TypePolicy >::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 112 of file listEditorProxy.h.

template<class _TypePolicy >
bool SdfListEditorProxy< _TypePolicy >::IsExpired ( ) const
inline

Returns true if the list editor is expired.

Definition at line 86 of file listEditorProxy.h.

template<class _TypePolicy >
bool SdfListEditorProxy< _TypePolicy >::IsExplicit ( ) const
inline

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

Definition at line 97 of file listEditorProxy.h.

template<class _TypePolicy >
bool SdfListEditorProxy< _TypePolicy >::IsOrderedOnly ( ) const
inline

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

Definition at line 104 of file listEditorProxy.h.

template<class _TypePolicy >
template<class CB >
void SdfListEditorProxy< _TypePolicy >::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 175 of file listEditorProxy.h.

template<class _TypePolicy >
SdfListEditorProxy< _TypePolicy >::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 397 of file listEditorProxy.h.

template<class _TypePolicy >
void SdfListEditorProxy< _TypePolicy >::Prepend ( const value_type value)
inline

Definition at line 333 of file listEditorProxy.h.

template<class _TypePolicy >
void SdfListEditorProxy< _TypePolicy >::Remove ( const value_type value)
inline

Definition at line 363 of file listEditorProxy.h.

template<class _TypePolicy >
void SdfListEditorProxy< _TypePolicy >::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 229 of file listEditorProxy.h.

template<class _TypePolicy >
void SdfListEditorProxy< _TypePolicy >::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 246 of file listEditorProxy.h.

Friends And Related Function Documentation

template<class _TypePolicy >
friend class Sdf_ListEditorProxyAccess
friend

Definition at line 477 of file listEditorProxy.h.

template<class _TypePolicy >
template<class T >
friend class SdfPyWrapListEditorProxy
friend

Definition at line 478 of file listEditorProxy.h.


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