DataDirector API
Public Member Functions | List of all members
DDD_AttributeList Class Reference

The DDD_AttributeList class. Maintains a list of Data Director attributes. More...

#include <DDD_AttributeList.h>

Inheritance diagram for DDD_AttributeList:
DynamicPtrArray< DDD_AttributeBase * >

Public Member Functions

 DDD_AttributeList ()
 
 ~DDD_AttributeList ()
 
bool GetValueString (const std::string &name, std::string &returnedValue)
 
void Add (DDD_AttributeBase *attr, DDD_AttributeObserver *observer)
 
DDD_AttributeBaseFind (const std::string &name)
 
int IndexOf (const std::string &name)
 
void Remove (const std::string &name)
 
void Replace (DDD_AttributeBase *oldAttr, DDD_AttributeBase *newAttr)
 
void CopyValues (DDD_AttributeList &attrList, bool notifyObservers=false)
 
std::string ToString (const std::string &delim1=";", const std::string &delim2="=")
 
void FromString (const std::string &str, const std::string &delim1=";", const std::string &delim2="=")
 
void Merge (const DDD_AttributeList &otherList)
 
void DeleteDynamicAttributes ()
 
void RevertAttributes ()
 
- Public Member Functions inherited from DynamicPtrArray< DDD_AttributeBase * >
unsigned int Size () const
 
 DynamicPtrArray (int initialSize=0)
 
 ~DynamicPtrArray (void)
 
unsigned int Count () const
 
void InsertObject (const DDD_AttributeBase * &obj, unsigned int loc)
 
unsigned int InsertObject (const DDD_AttributeBase * &obj)
 
void PushObject (const DDD_AttributeBase * &obj)
 
void InsertObjectAfter (const DDD_AttributeBase * &obj, unsigned int loc)
 
bool DeleteObject (const DDD_AttributeBase * &obj)
 
bool DeleteObjectAtIndex (unsigned int index)
 
bool RemoveAndDeallocateObjectAtIndex (unsigned int index)
 
int Position (const DDD_AttributeBase * &obj)
 
bool RemoveAndDeallocate (DDD_AttributeBase * &obj)
 
void Swap (unsigned int a, unsigned int b)
 
void EmptyList (void)
 
void ClearList (void)
 
DDD_AttributeBase * & operator[] (int index)
 
const DDD_AttributeBase * & operator[] (int index) const
 
DDD_AttributeBase * * InternalArray (void)
 
DynamicPtrArray< DDD_AttributeBase * > & operator= (const DynamicPtrArray< DDD_AttributeBase * > &right)
 
bool IsEmpty (void) const
 

Additional Inherited Members

- Protected Member Functions inherited from DynamicPtrArray< DDD_AttributeBase * >
void GrowArray (void)
 
void Size (unsigned int newSize)
 
- Protected Attributes inherited from DynamicPtrArray< DDD_AttributeBase * >
unsigned int _count
 
DDD_AttributeBase * * _objects
 

Detailed Description

The DDD_AttributeList class. Maintains a list of Data Director attributes.

Constructor & Destructor Documentation

Constructor.

Destructor The DDD_AttributeList does NOT manage the storage of its attributes. Prior to calling this destructor, the calling code should free all of the attributes in this list.

Member Function Documentation

void Add ( DDD_AttributeBase attr,
DDD_AttributeObserver observer 
)

Add an attribute to the list and set its observer

Parameters
attrThe attribute to add
observerAn observer (or NULL) that will observe the attribute
void CopyValues ( DDD_AttributeList attrList,
bool  notifyObservers = false 
)

Copies the attribute values from the supplied list into this list. Only attributes that exist in both lists will be updated/

Parameters
attrListA list of attributes
notifyObserversIf true, the attributes whose values are overwritten will notify their observers
void DeleteDynamicAttributes ( )

Deletes and deallocates all of the attributes in this list that are not marked with the "Persistent" flag

DDD_AttributeBase* Find ( const std::string &  name)

Find the attribute with the given name within this attribute list

Parameters
nameThe name of the attribute to find
Returns
A pointer to the attribute or NULL if not found
void FromString ( const std::string &  str,
const std::string &  delim1 = ";",
const std::string &  delim2 = "=" 
)

Utility method that converts formatted string into an attribute list NOTE: No trailing delimeter will be expected in the string. NOTE!: This method DOES NOT CHECK FOR DUPLICATE NAMES. IT IS EXPECTED THAT THE CALLER FIRST EMPTY THIS LIST.

Parameters
strA string containing the attribute list, e.g. "name1=value1;name2=value2"
delim1The delimiter to separate name/value pairs.
delim2The delimiter to sepatate names from values.
bool GetValueString ( const std::string &  name,
std::string &  returnedValue 
)

Get the value of the named attribute and return it as a parameter

Parameters
nameThe name of the attribute to get
returnedValueWill contain the attribute value if found
Returns
True if the attribute was found, false otherwise
int IndexOf ( const std::string &  name)

Get the list index of the attribute with the given name within this attribute list

Parameters
nameThe name of the attribute to find
Returns
The (0 based) list index of the attribute or -1 if not found
void Merge ( const DDD_AttributeList otherList)

Merges another attribute list into this one

Parameters
otherListAnother attribute list
void Remove ( const std::string &  name)

Find the attribute with the given name within this attribute list and remove it

Parameters
nameThe name of the attribute to find
void Replace ( DDD_AttributeBase oldAttr,
DDD_AttributeBase newAttr 
)

Find the attribute with the given name within this attribute list and replace it

Parameters
nameThe name of the attribute to find
newAttrThe new attribute with which to replace it
void RevertAttributes ( )

Reverts all of the attributes in this list that are marked with the "Revertable" flag

std::string ToString ( const std::string &  delim1 = ";",
const std::string &  delim2 = "=" 
)

Utility method that converts an attribute list into a single formatted string using the specified delimiter. NOTE: No trailing delimeter will be added to the string.

Parameters
delim1The delimiter to separate name/value pairs.
delim2The delimiter to sepatate names from values.
Returns
A string containing the attribute list, e.g. "name1=value1;name2=value2"

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