Hot Door CORE  0.7.0
Adobe® Illustrator® Plug-in Library
Classes | Public Types | Public Member Functions | Friends | List of all members
hdi::core::ai::Dictionary Class Reference

Embodies Illustrator's dictionary storage containers; can be placed inside an array, or another dictionary. More...

#include <hdicoreaiDictionary.h>

Classes

class  Iterator
 Allows for iteration through the members of a dictionary, a la std::vector iteration. More...
 

Public Types

typedef std::auto_ptr< IteratorIteratorAP
 

Public Member Functions

 Dictionary ()
 Constructs a Dictionary object as a new data container. More...
 
 Dictionary (const Dictionary &d_)
 Dictionary copy constructor. More...
 
 Dictionary (const AIDictionaryRef aiDict_)
 Constructs a new Dictionary object from an AIDictionaryRef. More...
 
virtual ~Dictionary ()
 Destructs a Dictionary object. More...
 
virtual Dictionaryoperator= (const Dictionary &rhs_)
 Overloaded assignment operator for Dictionary objects. More...
 
virtual bool operator== (const Dictionary &rhs_) const
 Tests whether a given Dictionary object is the same as another. More...
 
virtual bool operator!= (const Dictionary &rhs_) const
 Tests whether a given Dictionary object is not the same as another. More...
 
virtual AIDictionaryRef aiDictionaryRef () const
 Gets the dictionary ref around which the target object is wrapped. More...
 
virtual bool getEntry (const std::string &keyName_, Entry &entry__) const
 Gets an entry from the array by name. More...
 
virtual bool setEntry (const std::string &keyName_, const Entry &entry_)
 Sets an entry in the dictionary by key name. More...
 
virtual bool deleteEntry (const std::string &keyName_)
 Removes an entry in the dictionary by key name. More...
 
virtual bool getArrayEntry (const std::string &keyName_, Array &array__) const
 Gets an array entry from the dictionary by name. More...
 
virtual bool setArrayEntry (const std::string &keyName_, const Array &array_)
 Sets an array entry in the dictionary by name. More...
 
virtual bool getBoolEntry (const std::string &keyName_, bool &value__) const
 Gets a bool entry from the dictionary by name. More...
 
virtual bool setBoolEntry (const std::string &keyName_, const bool value_)
 Sets a bool entry in the dictionary by name. More...
 
virtual bool getDictEntry (const std::string &keyName_, Dictionary &dict__) const
 Gets a dictionary entry from the dictionary by name. More...
 
virtual bool setDictEntry (const std::string &keyName_, const Dictionary &dict_)
 Sets a dictionary entry in the dictionary by name. More...
 
virtual bool getIntEntry (const std::string &keyName_, int64_t &value__) const
 Gets an integer entry from the dictionary by name. More...
 
virtual bool setIntEntry (const std::string &keyName_, const int64_t value_)
 Sets an integer entry in the dictionary by name. More...
 
virtual bool getFloatEntry (const std::string &keyName_, double &value__) const
 Gets a floating point entry from the dictionary by name. More...
 
virtual bool setFloatEntry (const std::string &keyName_, const double value_)
 Sets a floating point entry in the dictionary by name. More...
 
virtual bool getStringEntry (const std::string &keyName_, std::string &value__) const
 Gets a string entry from the dictionary by name. More...
 
virtual bool setStringEntry (const std::string &keyName_, const std::string &value_)
 Sets a string entry in the dictionary by name. More...
 
virtual bool getUIDEntry (const std::string &keyName_, UID &uid__) const
 Gets a UID entry from the dictionary by name. More...
 
virtual bool setUIDEntry (const std::string &keyName_, const UID &value_)
 Sets a UID entry in the dictionary by key. More...
 
virtual bool getArtEntry (const std::string &keyName_, Art &art__) const
 Gets an Art entry from the dictionary by name. More...
 
virtual bool setArtEntry (const std::string &keyName_, const Art &value_)
 Sets an Art entry in the dictionary by key. More...
 
virtual bool hasKey (const std::string &keyName_) const
 Tests whether the dictionary has an entry with a particular key. More...
 
virtual bool clear ()
 Removes all entries from the dictionary. More...
 
Iterator begin () const
 Gets an iterator for the entries in the dictionary, starting with the first. More...
 

Friends

plugin::IllustratorDictionary * __accessImpl (const Dictionary &)
 
Dictionary __accessCtor (const plugin::IllustratorDictionary &)
 

Detailed Description

Embodies Illustrator's dictionary storage containers; can be placed inside an array, or another dictionary.

Constructor & Destructor Documentation

hdi::core::ai::Dictionary::Dictionary ( )

Constructs a Dictionary object as a new data container.

Author
GW
Date
08/2013
hdi::core::ai::Dictionary::Dictionary ( const Dictionary d_)

Dictionary copy constructor.

Author
GW
Date
08/2013
Parameters
d_Dictionary object to clone
hdi::core::ai::Dictionary::Dictionary ( const AIDictionaryRef  aiDict_)

Constructs a new Dictionary object from an AIDictionaryRef.

Author
GW
Date
08/2015
Parameters
aiDict_Raw Illustrator AIDictionaryRef
virtual hdi::core::ai::Dictionary::~Dictionary ( )
virtual

Destructs a Dictionary object.

Author
GW
Date
08/2013

Member Function Documentation

virtual AIDictionaryRef hdi::core::ai::Dictionary::aiDictionaryRef ( ) const
virtual

Gets the dictionary ref around which the target object is wrapped.

Author
GW
Date
11/2013
Returns
AIDictionaryRef for the target object
Note
The caller should not release the returned AIDictionaryRef (its reference count is not increased before being returned).
Generally, you shouldn't need to call this method. Only use it if you know what you're doing. If a specific piece of functionality provided by Illustrator is not handled by this class (or related classes), then it should probably be added to the hdi_core library.
Iterator hdi::core::ai::Dictionary::begin ( ) const

Gets an iterator for the entries in the dictionary, starting with the first.

Author
GW
Date
08/2013
Returns
A new iterator for the target dictionary
// For example:
for(hdi::core::Dictionary::Iterator iter = someDict.begin(); !iter.atEnd(); ++iter)
{
// Do stuff with either iter.key() or iter.value()
}
virtual bool hdi::core::ai::Dictionary::clear ( )
virtual

Removes all entries from the dictionary.

Author
GW
Date
08/2013
Returns
true if the dictionary was cleared, false otherwise
virtual bool hdi::core::ai::Dictionary::deleteEntry ( const std::string &  keyName_)
virtual

Removes an entry in the dictionary by key name.

Author
GW
Date
08/2013
Parameters
keyName_Name of the entry to delete, as UTF-8
Returns
true if the entry was deleted, false otherwise
virtual bool hdi::core::ai::Dictionary::getArrayEntry ( const std::string &  keyName_,
Array array__ 
) const
virtual

Gets an array entry from the dictionary by name.

Author
GW
Date
08/2013
Parameters
keyName_Name of the array entry, as UTF-8
array__Return-by-reference for the indicated array entry
Returns
true if the array entry could be acquired, false otherwise
virtual bool hdi::core::ai::Dictionary::getArtEntry ( const std::string &  keyName_,
Art art__ 
) const
virtual

Gets an Art entry from the dictionary by name.

Author
GW
Date
08/2013
Parameters
keyName_Name of the Art entry, as UTF-8
art__Return-by-reference for the indicated Art entry
Returns
true if the Art entry could be acquired, false otherwise
virtual bool hdi::core::ai::Dictionary::getBoolEntry ( const std::string &  keyName_,
bool &  value__ 
) const
virtual

Gets a bool entry from the dictionary by name.

Author
GW
Date
08/2013
Parameters
keyName_Name of the bool entry, as UTF-8
value__Return-by-reference for the indicated bool entry
Returns
true if the bool entry could be acquired, false otherwise
virtual bool hdi::core::ai::Dictionary::getDictEntry ( const std::string &  keyName_,
Dictionary dict__ 
) const
virtual

Gets a dictionary entry from the dictionary by name.

Author
GW
Date
08/2013
Parameters
keyName_Name of the dictionary entry, as UTF-8
dict__Return-by-reference for the indicated dictionary entry
Returns
true if the dictionary entry could be acquired, false otherwise
virtual bool hdi::core::ai::Dictionary::getEntry ( const std::string &  keyName_,
Entry entry__ 
) const
virtual

Gets an entry from the array by name.

Author
GW
Date
08/2013
Parameters
keyName_Name of the entry in question, as UTF-8
entry__Return-by-reference for an Entry object representing the dictionary entry with the provided key name
Returns
true if the entry could be acquired, false otherwise
virtual bool hdi::core::ai::Dictionary::getFloatEntry ( const std::string &  keyName_,
double &  value__ 
) const
virtual

Gets a floating point entry from the dictionary by name.

Author
GW
Date
08/2013
Parameters
keyName_Name of the floating point entry, as UTF-8
value__Return-by-reference for the indicated floating point entry
Returns
true if the floating point entry could be acquired, false otherwise
virtual bool hdi::core::ai::Dictionary::getIntEntry ( const std::string &  keyName_,
int64_t &  value__ 
) const
virtual

Gets an integer entry from the dictionary by name.

Author
GW
Date
08/2013
Parameters
keyName_Name of the integer entry, as UTF-8
value__Return-by-reference for the indicated integer entry
Returns
true if the integer entry could be acquired, false otherwise
virtual bool hdi::core::ai::Dictionary::getStringEntry ( const std::string &  keyName_,
std::string &  value__ 
) const
virtual

Gets a string entry from the dictionary by name.

Author
GW
Date
08/2013
Parameters
keyName_Name of the string entry, as UTF-8
value__Return-by-reference for the indicated string entry, as UTF-8
Returns
true if the string entry could be acquired, false otherwise
virtual bool hdi::core::ai::Dictionary::getUIDEntry ( const std::string &  keyName_,
UID uid__ 
) const
virtual

Gets a UID entry from the dictionary by name.

Author
GW
Date
08/2013
Parameters
keyName_Name of the UID entry, as UTF-8
uid__Return-by-reference for the indicated UID entry
Returns
true if the UID entry could be acquired, false otherwise
virtual bool hdi::core::ai::Dictionary::hasKey ( const std::string &  keyName_) const
virtual

Tests whether the dictionary has an entry with a particular key.

Author
GW
Date
08/2013
Parameters
keyName_Name of the entry in question, as UTF-8
Returns
true if the dictionary contains the key, false otherwise
virtual bool hdi::core::ai::Dictionary::operator!= ( const Dictionary rhs_) const
virtual

Tests whether a given Dictionary object is not the same as another.

Author
GW
Date
08/2013
Parameters
rhs_Dictionary to compare against (righthand side of inequality operator)
Returns
true for the target and rhs_ being different dicts, false otherwise
virtual Dictionary& hdi::core::ai::Dictionary::operator= ( const Dictionary rhs_)
virtual

Overloaded assignment operator for Dictionary objects.

Author
GW
Date
08/2013
Parameters
rhs_Righthand side of the assignment operator; existing Dictionary object that the target should reference instead
Returns
The lefthand side of the assignment operator, but now referencing the same dictionary data as the righthand side
virtual bool hdi::core::ai::Dictionary::operator== ( const Dictionary rhs_) const
virtual

Tests whether a given Dictionary object is the same as another.

Author
GW
Date
08/2013
Parameters
rhs_Dictionary to compare against (righthand side of equality operator)
Returns
true for the target and rhs_ being the same dict, false otherwise
virtual bool hdi::core::ai::Dictionary::setArrayEntry ( const std::string &  keyName_,
const Array array_ 
)
virtual

Sets an array entry in the dictionary by name.

Author
GW
Date
08/2013
Parameters
keyName_Name of the array entry, as UTF-8
array_New value for the array entry
Returns
true if the entry was set, false otherwise
virtual bool hdi::core::ai::Dictionary::setArtEntry ( const std::string &  keyName_,
const Art value_ 
)
virtual

Sets an Art entry in the dictionary by key.

Author
GW
Date
08/2013
Parameters
keyName_Name of the art entry, as UTF-8
value_New value for the art entry
Returns
true if the entry was set, false otherwise
virtual bool hdi::core::ai::Dictionary::setBoolEntry ( const std::string &  keyName_,
const bool  value_ 
)
virtual

Sets a bool entry in the dictionary by name.

Author
GW
Date
08/2013
Parameters
keyName_Name of the bool entry, as UTF-8
value_New value for the bool entry
Returns
true if the entry was set, false otherwise
virtual bool hdi::core::ai::Dictionary::setDictEntry ( const std::string &  keyName_,
const Dictionary dict_ 
)
virtual

Sets a dictionary entry in the dictionary by name.

Author
GW
Date
08/2013
Parameters
keyName_Name of the dictionary entry, as UTF-8
dict_New value for the dictionary entry
Returns
true if the entry was set, false otherwise
virtual bool hdi::core::ai::Dictionary::setEntry ( const std::string &  keyName_,
const Entry entry_ 
)
virtual

Sets an entry in the dictionary by key name.

Author
GW
Date
08/2013
Parameters
keyName_Name of the entry in question, as UTF-8
entry_Entry to set on the dictionary
Returns
true if the entry was set, false otherwise
virtual bool hdi::core::ai::Dictionary::setFloatEntry ( const std::string &  keyName_,
const double  value_ 
)
virtual

Sets a floating point entry in the dictionary by name.

Author
GW
Date
08/2013
Parameters
keyName_Name of the floating point entry, as UTF-8
value_New value for the floating point entry
Returns
true if the entry was set, false otherwise
Note
This method compensates for values that are NaN by converting them to 0, and compensates for values that are -infinity or infinity by converting them to -FLT_MAX or FLT_MAX, respectively.
Illustrator 16 and below saves all floating point values as floats (not doubles), so anything larger than FLT_MAX or smaller than -FLT_MAX is adjusted accordingly.
virtual bool hdi::core::ai::Dictionary::setIntEntry ( const std::string &  keyName_,
const int64_t  value_ 
)
virtual

Sets an integer entry in the dictionary by name.

Author
GW
Date
08/2013
Parameters
keyName_Name of the integer entry, as UTF-8
value_New value for the integer entry
Returns
true if the entry was set, false otherwise
virtual bool hdi::core::ai::Dictionary::setStringEntry ( const std::string &  keyName_,
const std::string &  value_ 
)
virtual

Sets a string entry in the dictionary by name.

Author
GW
Date
08/2013
Parameters
keyName_Name of the string entry, as UTF-8
value_New value for the string entry, as UTF-8
Returns
true if the entry was set, false otherwise
virtual bool hdi::core::ai::Dictionary::setUIDEntry ( const std::string &  keyName_,
const UID value_ 
)
virtual

Sets a UID entry in the dictionary by key.

Author
GW
Date
08/2013
Parameters
keyName_Name of the UID entry, as UTF-8
value_New value for the UID entry
Returns
true if the entry was set, false otherwise