Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CP_PropertyList::Dictionary Class Reference

Inheritance diagram for CP_PropertyList::Dictionary:

CP_PropertyList::Node CP_CFMutableObject< CFDictionaryRef, CFMutableDictionaryRef > CP_M_RefCounted CP_CFObject< CFDictionaryRef > List of all members.

Public Types

typedef CP_String key_type
typedef Node * mapped_type
typedef std::pair< const CP_String,
CP_SmartRef< const Node > > 
value_type
typedef std::pair< const CP_String,
_value_reference > 
reference
typedef std::pair< const CP_String,
const _value_reference > 
const_reference
typedef UInt32 size_type
typedef UInt32 difference_type
typedef value_type * pointer
typedef const value_type * const_pointer
typedef _iterator iterator
typedef _const_iterator const_iterator
typedef std::reverse_iterator<
iterator > 
reverse_iterator
typedef std::reverse_iterator<
const_iterator > 
const_reverse_iterator

Public Member Functions

 Dictionary ()
 Dictionary (const Dictionary &inSrc)
 Dictionary (const CP_String &inKey, const Node &inValue)
 Dictionary (CFDictionaryRef inDictionaryRef, bool inRetain=true)
virtual ~Dictionary () throw ()
Dictionary * MakeMutable () const
 Make a mutable dictionary with the same contents.
virtual NodeType_t NodeType () const throw ()
virtual void PrintToLog (CP_LogFile &inLogFile, SInt32 inLevel=0, SInt32 inIndentLevel=0) const
virtual CFTypeRef GetNodeCFRef () const
virtual void WriteXMLData (CP_OutStream &inXMLDataStream) const
Getting / Setting values
const Node * GetValue (const CP_String &inKey) const
void SetValue (const CP_String &inKey, const Node &inValue)
bool HasKey (const CP_String &inKey) const throw ()
const Array * GetAllKeys () const
const Array * GetAllValues () const
Convenience Getters/Setters
bool GetStringValue (const CP_String &inKey, CP_String &outValue) const
 Get an optional value.
bool GetUInt32Value (const CP_String &inKey, UInt32 &outValue) const
bool GetSInt32Value (const CP_String &inKey, SInt32 &outValue) const
bool GetFloatValue (const CP_String &inKey, double &outValue) const
bool GetBooleanValue (const CP_String &inKey, bool &outValue) const
bool GetDateTimeValue (const CP_String &inKey, CP_DateTime &outDateTime) const
bool GetDateTimeValue (const CP_String &inKey, CP_Date *outDate, CP_Time *outTime) const
bool GetUUIDValue (const CP_String &inKey, CP_UUID &outUUID) const
const Array * GetArrayValue (const CP_String &inKey) const
 Get an optional value.
const Dictionary * GetDictionaryValue (const CP_String &inKey) const
 Get an optional value.
CP_String GetStringValue (const CP_String &inKey) const
 Get a required value.
UInt32 GetUInt32Value (const CP_String &inKey) const
SInt32 GetSInt32Value (const CP_String &inKey) const
double GetFloatValue (const CP_String &inKey) const
bool GetBooleanValue (const CP_String &inKey) const
CP_DateTime GetDateTimeValue (const CP_String &inKey) const
CP_Date GetDateValue (const CP_String &inKey) const
CP_Time GetTimeValue (const CP_String &inKey) const
CP_UUID GetUUIDValue (const CP_String &inKey) const
void SetStringValue (const CP_String &inKey, const CP_String &inValue)
 Set the value for a key.
void SetNumberValue (const CP_String &inKey, UInt32 inValue)
void SetNumberValue (const CP_String &inKey, SInt32 inValue)
void SetNumberValue (const CP_String &inKey, double inValue)
void SetBooleanValue (const CP_String &inKey, bool inValue)
void SetDateTimeValue (const CP_String &inKey, const CP_DateTime &inDateTime)
void SetDateValue (const CP_String &inKey, const CP_Date &inDate)
void SetTimeValue (const CP_String &inKey, const CP_Time &inTime)
void SetUUIDValue (const CP_String &inKey, const CP_UUID &inUUID)
STL associative container like interface
size_type size () const
bool empty () const
iterator find (const key_type &inKey)
const_iterator find (const key_type &inKey) const
std::pair< iterator, bool > insert (const value_type &inValue)
iterator begin ()
iterator end ()
const_iterator begin () const
const_iterator end () const
reverse_iterator rbegin ()
reverse_iterator rend ()
const_reverse_iterator rbegin () const
const_reverse_iterator rend () const
reference operator[] (const key_type &inKey)

Static Public Member Functions

static Dictionary * FromXMLData (CP_InStream &inXMLDataStream)
static Node * FromXMLData (CP_InStream &inXMLDataStream, NodeType_t inExpectedNodeType=NodeType_Any)
static Node * CreateNodeForCFObject (CFTypeRef inObject)

Protected Member Functions

CFMutableDictionaryRef GetMutableCFRef ()
 operator TMutableCFRef ()
void AttachRefMutable (CFMutableDictionaryRefinMutableRef, bool inRetain)
void AttachRef (CFDictionaryRefinRef, bool inRetain)
CFMutableDictionaryRef DetachRefMutable ()
void MakeMutable ()
CFMutableDictionaryRef MutableCopy (CFDictionaryRefinCFRef)
CFDictionaryRef DetachRef ()
CFDictionaryRef GetCFRef () const
bool IsValid () const

Protected Attributes

CFDictionaryRef fCFObject

Classes

class  _const_iterator
class  _iterator
class  _value_reference

Member Typedef Documentation

typedef CP_String CP_PropertyList::Dictionary::key_type
 

typedef Node* CP_PropertyList::Dictionary::mapped_type
 

typedef std::pair<const CP_String, CP_SmartRef<const Node> > CP_PropertyList::Dictionary::value_type
 

typedef std::pair<const CP_String, _value_reference > CP_PropertyList::Dictionary::reference
 

typedef std::pair<const CP_String, const _value_reference > CP_PropertyList::Dictionary::const_reference
 

typedef UInt32 CP_PropertyList::Dictionary::size_type
 

typedef UInt32 CP_PropertyList::Dictionary::difference_type
 

typedef value_type* CP_PropertyList::Dictionary::pointer
 

typedef const value_type* CP_PropertyList::Dictionary::const_pointer
 

typedef _iterator CP_PropertyList::Dictionary::iterator
 

typedef _const_iterator CP_PropertyList::Dictionary::const_iterator
 

typedef std::reverse_iterator<iterator> CP_PropertyList::Dictionary::reverse_iterator
 

typedef std::reverse_iterator<const_iterator> CP_PropertyList::Dictionary::const_reverse_iterator
 


Constructor & Destructor Documentation

CP_PropertyList::Dictionary::Dictionary (   ) 
 

CP_PropertyList::Dictionary::Dictionary (  const Dictionary &  inSrc  ) 
 

CP_PropertyList::Dictionary::Dictionary (  const CP_String &  inKey,
const Node &  inValue
) 
 

CP_PropertyList::Dictionary::Dictionary (  CFDictionaryRef  inDictionaryRef,
bool  inRetain = true
)  [explicit]
 

CP_PropertyList::Dictionary::~Dictionary (   )  throw () [virtual]
 


Member Function Documentation

const Node * CP_PropertyList::Dictionary::GetValue (  const CP_String &  inKey  )  const
 

void CP_PropertyList::Dictionary::SetValue (  const CP_String &  inKey,
const Node &  inValue
) 
 

bool CP_PropertyList::Dictionary::HasKey (  const CP_String &  inKey  )  const throw ()
 

const Array * CP_PropertyList::Dictionary::GetAllKeys (   )  const
 

const Array * CP_PropertyList::Dictionary::GetAllValues (   )  const
 

bool CP_PropertyList::Dictionary::GetStringValue (  const CP_String &  inKey,
CP_String &  outValue
)  const
 

Will retrieve the value associated with the specified key from the dictionary. If dictionary does not contain a value for the key, the function will return false, otherwise it will store the value in the outValue parameter and return true.

Exceptions:
std::bad_cast raised if value exists, but is not of the expected type.
Parameters:
[in] inKey The key that specifies which value to retrieve.
[out] outValue If value was found, it will be returned in this output parameter
Returns:
Whether or not the value was found.

bool CP_PropertyList::Dictionary::GetUInt32Value (  const CP_String &  inKey,
UInt32 &  outValue
)  const
 

bool CP_PropertyList::Dictionary::GetSInt32Value (  const CP_String &  inKey,
SInt32 &  outValue
)  const
 

bool CP_PropertyList::Dictionary::GetFloatValue (  const CP_String &  inKey,
double &  outValue
)  const
 

bool CP_PropertyList::Dictionary::GetBooleanValue (  const CP_String &  inKey,
bool &  outValue
)  const
 

bool CP_PropertyList::Dictionary::GetDateTimeValue (  const CP_String &  inKey,
CP_DateTime &  outDateTime
)  const
 

bool CP_PropertyList::Dictionary::GetDateTimeValue (  const CP_String &  inKey,
CP_Date *  outDate,
CP_Time *  outTime
)  const
 

bool CP_PropertyList::Dictionary::GetUUIDValue (  const CP_String &  inKey,
CP_UUID &  outUUID
)  const
 

const Array * CP_PropertyList::Dictionary::GetArrayValue (  const CP_String &  inKey  )  const
 

Will retrieve the value associated with the specified key from the dictionary. If dictionary does not contain a value for the key, the function will return NULL, otherwise it will return a pointer to the value object found.

Exceptions:
std::bad_cast raised if value exists, but is not of the expected type.
Parameters:
inKey The key that specifies which value to retrieve.
Returns:
The array value found, or NULL if value doesn't exist.

const Dictionary * CP_PropertyList::Dictionary::GetDictionaryValue (  const CP_String &  inKey  )  const
 

Will retrieve the value associated with the specified key from the dictionary. If dictionary does not contain a value for the key, the function will return NULL, otherwise it will return a pointer to the value object found.

Exceptions:
std::bad_cast raised if value exists, but is not of the expected type.
Parameters:
inKey The key that specifies which value to retrieve.
Returns:
The dictionary value found, or NULL if value doesn't exist.

CP_String CP_PropertyList::Dictionary::GetStringValue (  const CP_String &  inKey  )  const
 

Will retrieve the value associated with the specified key from the dictionary. If dictionary does not contain a value for the key, an exception will be raised.

Exceptions:
std::bad_cast raised if value exists, but is not of the expected type.
CP_OSErrorException(CP_resNotFound) raised if value does not exist.
Parameters:
inKey The key that specifies which value to retrieve.
Returns:
The value associated with inKey.

UInt32 CP_PropertyList::Dictionary::GetUInt32Value (  const CP_String &  inKey  )  const
 

SInt32 CP_PropertyList::Dictionary::GetSInt32Value (  const CP_String &  inKey  )  const
 

double CP_PropertyList::Dictionary::GetFloatValue (  const CP_String &  inKey  )  const
 

bool CP_PropertyList::Dictionary::GetBooleanValue (  const CP_String &  inKey  )  const
 

CP_DateTime CP_PropertyList::Dictionary::GetDateTimeValue (  const CP_String &  inKey  )  const
 

CP_Date CP_PropertyList::Dictionary::GetDateValue (  const CP_String &  inKey  )  const
 

CP_Time CP_PropertyList::Dictionary::GetTimeValue (  const CP_String &  inKey  )  const
 

CP_UUID CP_PropertyList::Dictionary::GetUUIDValue (  const CP_String &  inKey  )  const
 

void CP_PropertyList::Dictionary::SetStringValue (  const CP_String &  inKey,
const CP_String &  inValue
) 
 

Will set/change the value associated with the specified key in the dictionary. If dictionary does not contain a value for the key, a new value will be inserted, if the dictionary already contains a value for the key, it will be overwritten with the new value.

Exceptions:
none (except for fatal things like e.g. memory allocation failure, etc.)
Parameters:
inKey The key that specifies which value to set.
inValue The new value to set.

void CP_PropertyList::Dictionary::SetNumberValue (  const CP_String &  inKey,
UInt32  inValue
) 
 

void CP_PropertyList::Dictionary::SetNumberValue (  const CP_String &  inKey,
SInt32  inValue
) 
 

void CP_PropertyList::Dictionary::SetNumberValue (  const CP_String &  inKey,
double  inValue
) 
 

void CP_PropertyList::Dictionary::SetBooleanValue (  const CP_String &  inKey,
bool  inValue
) 
 

void CP_PropertyList::Dictionary::SetDateTimeValue (  const CP_String &  inKey,
const CP_DateTime &  inDateTime
) 
 

void CP_PropertyList::Dictionary::SetDateValue (  const CP_String &  inKey,
const CP_Date &  inDate
) 
 

void CP_PropertyList::Dictionary::SetTimeValue (  const CP_String &  inKey,
const CP_Time &  inTime
) 
 

void CP_PropertyList::Dictionary::SetUUIDValue (  const CP_String &  inKey,
const CP_UUID &  inUUID
) 
 

Dictionary * CP_PropertyList::Dictionary::MakeMutable (   )  const
 

Returns a mutable dictionary with the same contents as this dictionary. It's up to the implementation to implement some copy-on-write mechanism, so in general, you shouldn neiter assume to get back the same object, nor assume it's a new object...
In any event, you don't need to release the object you get. If you want to hold on to the object for longer, you'll have to retain it (see CP_M_RefCounted::AddReference), otherwise it may go away at autorelease pool release time.

Exceptions:
none 
Returns:
A mutable dictionary with the same contents as this dictionary.

Dictionary::size_type CP_PropertyList::Dictionary::size (   )  const
 

bool CP_PropertyList::Dictionary::empty (   )  const
 

Dictionary::iterator CP_PropertyList::Dictionary::find (  const key_type &  inKey  ) 
 

Dictionary::const_iterator CP_PropertyList::Dictionary::find (  const key_type &  inKey  )  const
 

std::pair< Dictionary::iterator, bool > CP_PropertyList::Dictionary::insert (  const value_type &  inValue  ) 
 

Dictionary::iterator CP_PropertyList::Dictionary::begin (   ) 
 

Dictionary::iterator CP_PropertyList::Dictionary::end (   ) 
 

Dictionary::const_iterator CP_PropertyList::Dictionary::begin (   )  const
 

Dictionary::const_iterator CP_PropertyList::Dictionary::end (   )  const
 

Dictionary::reverse_iterator CP_PropertyList::Dictionary::rbegin (   ) 
 

Dictionary::reverse_iterator CP_PropertyList::Dictionary::rend (   ) 
 

Dictionary::const_reverse_iterator CP_PropertyList::Dictionary::rbegin (   )  const
 

Dictionary::const_reverse_iterator CP_PropertyList::Dictionary::rend (   )  const
 

Dictionary::mapped_type & CP_PropertyList::Dictionary::operator[] (  const key_type &  inKey  ) 
 

NodeType_t CP_PropertyList::Dictionary::NodeType (   )  const throw () [virtual]
 

Implements CP_PropertyList::Node.

Dictionary * CP_PropertyList::Dictionary::FromXMLData (  CP_InStream &  inXMLDataStream  )  [static]
 

void CP_PropertyList::Dictionary::PrintToLog (  CP_LogFile &  inLogFile,
SInt32  inLevel = 0,
SInt32  inIndentLevel = 0
)  const [virtual]
 

Implements CP_PropertyList::Node.

virtual CFTypeRef CP_PropertyList::Dictionary::GetNodeCFRef (   )  const [virtual]
 

Implements CP_PropertyList::Node.

void CP_PropertyList::Node::WriteXMLData (  CP_OutStream &  inXMLDataStream  )  const [virtual, inherited]
 

Node * CP_PropertyList::Node::FromXMLData (  CP_InStream &  inXMLDataStream,
NodeType_t  inExpectedNodeType = NodeType_Any
)  [static, inherited]
 

static Node* CP_PropertyList::Node::CreateNodeForCFObject (  CFTypeRef  inObject  )  [static, inherited]
 

UInt32 CP_M_RefCounted::AddReference (   )  const [inherited]
 

Add a reference to our object, returning the new reference count.

Exceptions:
none 
Returns:
UInt32 const Returns the new reference count.

UInt32 CP_M_RefCounted::RemoveReference (   )  const [inherited]
 

Remove a reference to our object, returning the new reference count. If the count is 0, then this object is also deleted, and 0 is returned.

Exceptions:
none 
Returns:
UInt32 const Returns the new reference count.

void CP_M_RefCounted::Autorelease (   )  const [inherited]
 

Add the object to the topmost auto-release pool. This will ensure that the object is eventually released.

See also:
CP_AutoReleasePool
Exceptions:
none 
Returns:
void

UInt32 CP_M_RefCounted::GetRefCount (   )  const [inherited]
 

Returns the current ref count.

Exceptions:
none 
Returns:
UInt32 The current referencce count.

CFMutableDictionaryRef CP_CFMutableObject< CFDictionaryRef , CFMutableDictionaryRef >::GetMutableCFRef (   )  [inherited]
 

Returns a mutable CFRef for this object. If the object is not mutable already, then it is first made mutable before returning the CFRef.

Exceptions:
none 

CP_CFMutableObject< CFDictionaryRef , CFMutableDictionaryRef >::operator CFMutableDictionaryRef (   )  [inherited]
 

operator TMutableCFRef to return the mutable CFRef object for this class.

Exceptions:
none 
Returns:
CFMutableCFRef The mutable CFRef object for ths class.

void CP_CFMutableObject< CFDictionaryRef , CFMutableDictionaryRef >::AttachRefMutable (  CFMutableDictionaryRef   inMutableRef,
bool  inRetain
)  [inherited]
 

Attach a reference to the passed in CFRef.

Parameters:
inMutableRef The mutable ref object to attach the reference to.
inRetain Flag to indicate if we retain this object.
Exceptions:
none 

void CP_CFMutableObject< CFDictionaryRef , CFMutableDictionaryRef >::AttachRef (  CFDictionaryRef   inRef,
bool  inRetain
)  [inherited]
 

Attach a reference to the passed in CFRef.

Parameters:
refToAttach The object to attach the reference to.
inRetain Flag to indicate if we retain this object.
Exceptions:
none 

Reimplemented from CP_CFObject< CFDictionaryRef >.

CFMutableDictionaryRef CP_CFMutableObject< CFDictionaryRef , CFMutableDictionaryRef >::DetachRefMutable (   )  [inherited]
 

Detach a reference to the CFRef maintained by this object. If the object is not mutable, it is first made mutable.

Exceptions:
none 

void CP_CFMutableObject< CFDictionaryRef , CFMutableDictionaryRef >::MakeMutable (   )  [protected, inherited]
 

Turns this object we are storing into a mutable version.

Exceptions:
none 

CFMutableDictionaryRef CP_CFMutableObject< CFDictionaryRef , CFMutableDictionaryRef >::MutableCopy (  CFDictionaryRef   inCFRef  )  [protected, inherited]
 

CFDictionaryRef CP_CFObject< CFDictionaryRef >::DetachRef (   )  [inherited]
 

CFDictionaryRef CP_CFObject< CFDictionaryRef >::GetCFRef (   )  const [inherited]
 

bool CP_CFObject< CFDictionaryRef >::IsValid (   )  const [inherited]
 


Member Data Documentation

CFDictionaryRef CP_CFObject< CFDictionaryRef >::fCFObject [protected, inherited]
 


The documentation for this class was generated from the following files:
Generated on Sat Sep 17 20:02:38 2005 for CPLAT by  doxygen 1.4.0