Hot Door CORE  0.7.0
Adobe® Illustrator® Plug-in Library
hdicoreDictionaryPref.h
Go to the documentation of this file.
1 
7 #ifndef __HDI_CORE_DICTIONARY_PREF__
8 #define __HDI_CORE_DICTIONARY_PREF__
9 
10 #include <vector>
11 
12 #include "hdicorePathStyle.h"
13 #include "hdicorePrefData.h"
14 
15 namespace hdi
16 {
17  namespace core
18  {
19  class ArtboardPoint;
20  class ArtboardRect;
21  class ArtColor;
22  class Color;
23  class Font;
24  class Point;
25  class Rect;
26  class Size;
27  class TransformMatrix;
28 
29  class ArrayPref;
30  class ArtboardPointPref;
31  class ArtboardRectPref;
32  class ArtColorPref;
33  class BoolPref;
34  class ColorPref;
35  class DashStylePref;
36  class DashStyleMapPref;
37  class FillStylePref;
38  class FillStyleMapPref;
39  class FontPref;
40  class NumberPref;
41  class PathStylePref;
42  class PathStyleMapPref;
43  class PointPref;
44  class RectPref;
45  class SizePref;
46  class StringPref;
47  class StrokeStylePref;
48  class StrokeStyleMapPref;
49  class TransformMatrixPref;
50 
55  class DictionaryPref : public PrefData
56  {
57  public:
58  typedef std::vector< PrefData* > PrefDataVector;
59 
71  class Iterator
72  {
73  public:
81  Iterator(const Iterator& iter_);
82 
88  ~Iterator();
89 
99  Iterator& operator=(const Iterator& rhs_);
100 
109  bool operator==(const Iterator& rhs_) const;
110 
119  bool operator!=(const Iterator& rhs_) const;
120 
128  Iterator& operator++();
129 
137  Iterator operator++(int);
138 
146  Iterator& operator--();
147 
155  Iterator operator--(int);
156 
165  bool atEnd() const;
166 
174  std::string key() const;
175 
183  std::auto_ptr<PrefData> value() const;
184 
185 
186  private:
187  // Only DictionaryPref can construct a new Iterator object
188  friend class DictionaryPref;
189 
193  void* __data;
194 
200  Iterator();
201 
209  explicit Iterator(const DictionaryPref& set_);
210  };
211 
212  typedef std::auto_ptr<Iterator> IteratorAP;
213 
222  DictionaryPref(const DictionaryPref& dict_);
223 
239  DictionaryPref(const PrefDataVector* members_ = NULL, const std::string& name_ = "");
240 
246  virtual ~DictionaryPref();
247 
256  virtual DictionaryPref& operator=(const DictionaryPref& rhs_);
257 
271  virtual DictionaryPref* clone() const;
272 
284  virtual bool addMember(const PrefData& data_);
285 
299  virtual bool member(const std::string& name_, std::auto_ptr<PrefData>& data__) const;
300 
314  virtual bool removeMember(const std::string& name_, std::auto_ptr<PrefData>& data__);
315 
331  virtual Iterator begin() const;
332 
343  virtual bool getArrayMember(const std::string& key_, ArrayPref& array__) const;
344 
364  virtual bool getOrCreateArrayMember(
365  const std::string& name_,
366  const PrefDataVector* elements_,
367  ArrayPref& array__
368  );
369 
380  virtual bool getArtboardPointMember(const std::string& key_, ArtboardPointPref& abp__) const;
381 
395  virtual bool getOrCreateArtboardPointMember(
396  const std::string& key_,
397  const ArtboardPoint& default_,
398  ArtboardPointPref& abp__
399  );
400 
411  virtual bool getArtboardRectMember(const std::string& key_, ArtboardRectPref& abr__) const;
412 
426  virtual bool getOrCreateArtboardRectMember(
427  const std::string& key_,
428  const ArtboardRect& default_,
429  ArtboardRectPref& abr__
430  );
431 
442  virtual bool getArtColorMember(const std::string& key_, ArtColorPref& ac__) const;
443 
457  virtual bool getOrCreateArtColorMember(
458  const std::string& key_,
459  const ArtColor& default_,
460  ArtColorPref& ac__
461  );
462 
473  virtual bool getBoolMember(const std::string& key_, BoolPref& b__) const;
474 
487  virtual bool getOrCreateBoolMember(
488  const std::string& key_,
489  const bool default_,
490  BoolPref& b__
491  );
492 
503  virtual bool getColorMember(const std::string& key_, ColorPref& c__) const;
504 
517  virtual bool getOrCreateColorMember(
518  const std::string& key_,
519  const Color& default_,
520  ColorPref& c__
521  );
522 
533  virtual bool getDashStyleMember(const std::string& key_, DashStylePref& ds__);
534 
548  virtual bool getOrCreateDashStyleMember(
549  const std::string& key_,
550  const DashStyle& default_,
551  DashStylePref& ds__
552  );
553 
564  virtual bool getDashStyleMapMember(const std::string& key_, DashStyleMapPref& ds__);
565 
579  virtual bool getOrCreateDashStyleMapMember(
580  const std::string& key_,
581  const DashStyle::Map& default_,
582  DashStyleMapPref& ds__
583  );
584 
595  virtual bool getDictMember(const std::string& key_, DictionaryPref& dict__) const;
596 
617  virtual bool getOrCreateDictMember(
618  const std::string& name_,
619  const PrefDataVector* members_,
620  DictionaryPref& dict__
621  );
622 
633  virtual bool getFillStyleMember(const std::string& key_, FillStylePref& fs__);
634 
648  virtual bool getOrCreateFillStyleMember(
649  const std::string& key_,
650  const FillStyle& default_,
651  FillStylePref& fs__
652  );
653 
664  virtual bool getFillStyleMapMember(const std::string& key_, FillStyleMapPref& fs__);
665 
679  virtual bool getOrCreateFillStyleMapMember(
680  const std::string& key_,
681  const FillStyle::Map& default_,
682  FillStyleMapPref& fs__
683  );
684 
695  virtual bool getFontMember(const std::string& key_, FontPref& f__) const;
696 
710  virtual bool getOrCreateFontMember(
711  const std::string& key_,
712  const Font& defaultFont_,
713  const double defaultSize_,
714  FontPref& f__
715  );
716 
727  virtual bool getTransformMatrixMember(const std::string& key_, TransformMatrixPref& tm__) const;
728 
743  const std::string& key_,
744  const TransformMatrix& default_,
745  TransformMatrixPref& tm__
746  );
747 
758  virtual bool getNumberMember(const std::string& key_, NumberPref& n__) const;
759 
773  virtual bool getOrCreateIntMember(const std::string& key_, const int64_t default_, NumberPref& n__);
774 
788  virtual bool getOrCreateFloatMember(const std::string& key_, const double default_, NumberPref& n__);
789 
800  virtual bool getPathStyleMember(const std::string& key_, PathStylePref& ps__);
801 
815  virtual bool getOrCreatePathStyleMember(
816  const std::string& key_,
817  const PathStyle& default_,
818  PathStylePref& ps__
819  );
820 
831  virtual bool getPathStyleMapMember(const std::string& key_, PathStyleMapPref& ps__);
832 
846  virtual bool getOrCreatePathStyleMapMember(
847  const std::string& key_,
848  const PathStyle::Map& default_,
849  PathStyleMapPref& ps__
850  );
851 
862  virtual bool getPointMember(const std::string& key_, PointPref& p__) const;
863 
876  virtual bool getOrCreatePointMember(const std::string& key_, const Point& default_, PointPref& p__);
877 
888  virtual bool getRectMember(const std::string& key_, RectPref& r__) const;
889 
902  virtual bool getOrCreateRectMember(const std::string& key_, const Rect& default_, RectPref& r__);
903 
914  virtual bool getSizeMember(const std::string& key_, SizePref& s__) const;
915 
928  virtual bool getOrCreateSizeMember(const std::string& key_, const Size& default_, SizePref& s__);
929 
940  virtual bool getStringMember(const std::string& key_, StringPref& str__) const;
941 
955  virtual bool getOrCreateStringMember(
956  const std::string& key_,
957  const std::string& default_,
958  StringPref& str__
959  );
960 
971  virtual bool getStrokeStyleMember(const std::string& key_, StrokeStylePref& ss__);
972 
986  virtual bool getOrCreateStrokeStyleMember(
987  const std::string& key_,
988  const StrokeStyle& default_,
989  StrokeStylePref& ss__
990  );
991 
1002  virtual bool getStrokeStyleMapMember(const std::string& key_, StrokeStyleMapPref& ss__);
1003 
1017  virtual bool getOrCreateStrokeStyleMapMember(
1018  const std::string& key_,
1019  const StrokeStyle::Map& default_,
1020  StrokeStyleMapPref& ss__
1021  );
1022  };
1023 
1024  typedef std::auto_ptr<DictionaryPref> DictionaryPrefAP;
1025  }
1026 }
1027 
1028 #endif
1029 // __HDI_CORE_DICTIONARY_PREF__
Allows for storage of path style maps.
Definition: hdicorePathStyleMapPref.h:20
virtual bool getStrokeStyleMapMember(const std::string &key_, StrokeStyleMapPref &ss__)
Gets a persistent stroke style map object from the dictionary.
~Iterator()
Destructs an Iterator object.
virtual bool getFontMember(const std::string &key_, FontPref &f__) const
Gets a persistent font object from the dictionary.
virtual bool getOrCreateArtboardRectMember(const std::string &key_, const ArtboardRect &default_, ArtboardRectPref &abr__)
Similar to getArtboardRectMember(), except that, if the member does not already exist, it will be created anew with a default value.
Acts as a DashStyle value map, indicating which values are "known".
Definition: hdicorePathStyle.h:30
virtual bool getOrCreateFloatMember(const std::string &key_, const double default_, NumberPref &n__)
Similar to getNumberMember(), except that, if the member does not already exist, it will be created a...
virtual bool getOrCreateArtColorMember(const std::string &key_, const ArtColor &default_, ArtColorPref &ac__)
Similar to getArtColorMember(), except that, if the member does not already exist, it will be created anew with a default value.
Describes a point in the 2-dimensional (x,y) coordinate system, typically in an Illustrator document ...
Definition: hdicorePoint.h:26
Describes an RGB color, with opacity, typically for UI purposes.
Definition: hdicoreColor.h:24
Allows for storage of 2D points.
Definition: hdicorePointPref.h:20
Allows for storage of artboard rects/bounds.
Definition: hdicoreArtboardRectPref.h:20
Iterator & operator=(const Iterator &rhs_)
Assigns one Iterator object to another.
Allows for storage of colors.
Definition: hdicoreColorPref.h:20
Allows for storage of font faces and sizes.
Definition: hdicoreFontPref.h:21
virtual bool getOrCreateFontMember(const std::string &key_, const Font &defaultFont_, const double defaultSize_, FontPref &f__)
Similar to getFontMember(), except that, if the member does not already exist, it will be created ane...
virtual bool getOrCreateDashStyleMember(const std::string &key_, const DashStyle &default_, DashStylePref &ds__)
Similar to getDashStyleMember(), except that, if the member does not already exist, it will be created anew with a default value.
virtual bool getRectMember(const std::string &key_, RectPref &r__) const
Gets a persistent rect object from the dictionary.
Describes all styling attributes of a path.
Definition: hdicorePathStyle.h:427
std::auto_ptr< PrefData > value() const
Gets the current member's value as pointed to by the iterator.
virtual bool getDictMember(const std::string &key_, DictionaryPref &dict__) const
Gets a persistent dictionary object from the dictionary.
Acts as a FillStyle value map, indicating which values are "known".
Definition: hdicorePathStyle.h:146
bool atEnd() const
Determines whether iteration should stop; works well as the conditional in a for() loop...
bool operator==(const Iterator &rhs_) const
Tests whether a given Iterator object is the same as another.
Describes the stroke styling of a path.
Definition: hdicorePathStyle.h:249
Allows for iteration through the members of a dictionary pref, a la std::vector iteration.
Definition: hdicoreDictionaryPref.h:71
Allows for storage of rects/bounds.
Definition: hdicoreRectPref.h:20
Describes a rectangular area on the Illustrator artboard.
Definition: hdicoreArtboardRect.h:25
virtual bool getOrCreateTransformMatrixMember(const std::string &key_, const TransformMatrix &default_, TransformMatrixPref &tm__)
Similar to getTransformMatrixMember(), except that, if the member does not already exist...
virtual bool getOrCreatePointMember(const std::string &key_, const Point &default_, PointPref &p__)
Similar to getPointMember(), except that, if the member does not already exist, it will be created an...
virtual bool getFillStyleMember(const std::string &key_, FillStylePref &fs__)
Gets a persistent fill style object from the dictionary.
Allows for storage of dash style maps.
Definition: hdicoreDashStyleMapPref.h:25
virtual bool removeMember(const std::string &name_, std::auto_ptr< PrefData > &data__)
Removes a PrefData member from the dictionary.
Acts as a dictionary-style container to store any other persistent data types, including arrays and d...
Definition: hdicoreDictionaryPref.h:55
Contains Point and Size objects to describe a rectangle that exists at a specific point of given dime...
Definition: hdicoreRect.h:26
virtual bool getStringMember(const std::string &key_, StringPref &str__) const
Gets a persistent string object from the dictionary.
virtual bool getOrCreateIntMember(const std::string &key_, const int64_t default_, NumberPref &n__)
Similar to getNumberMember(), except that, if the member does not already exist, it will be created a...
virtual bool getArtboardPointMember(const std::string &key_, ArtboardPointPref &abp__) const
Gets a persistent artboard point object from the dictionary.
virtual bool getOrCreateStrokeStyleMapMember(const std::string &key_, const StrokeStyle::Map &default_, StrokeStyleMapPref &ss__)
Similar to getStrokeStyleMapMember(), except that, if the member does not already exist...
virtual bool getOrCreatePathStyleMapMember(const std::string &key_, const PathStyle::Map &default_, PathStyleMapPref &ps__)
Similar to getPathStyleMapMember(), except that, if the member does not already exist, it will be created anew with a default value.
Allows for 2-dimensional transformations in a single application via matrix math. ...
Definition: hdicoreTransformMatrix.h:26
virtual bool getColorMember(const std::string &key_, ColorPref &c__) const
Gets a persistent color object from the dictionary.
virtual bool getOrCreateSizeMember(const std::string &key_, const Size &default_, SizePref &s__)
Similar to getSizeMember(), except that, if the member does not already exist, it will be created ane...
virtual bool getDashStyleMapMember(const std::string &key_, DashStyleMapPref &ds__)
Gets a persistent dash style map object from the dictionary.
Allows for storage of fill style maps.
Definition: hdicoreFillStyleMapPref.h:25
Iterator & operator--()
Prefix decrement operator for reverse iteration.
virtual bool getOrCreateArtboardPointMember(const std::string &key_, const ArtboardPoint &default_, ArtboardPointPref &abp__)
Similar to getArtboardPointMember(), except that, if the member does not already exist, it will be created anew with a default value.
Allows for storage of stroke style maps.
Definition: hdicoreStrokeStyleMapPref.h:25
bool operator!=(const Iterator &rhs_) const
Tests whether a given Iterator object is not the same as another.
Allows for storage of fill styles.
Definition: hdicoreFillStylePref.h:25
virtual bool getOrCreateBoolMember(const std::string &key_, const bool default_, BoolPref &b__)
Similar to getBoolMember(), except that, if the member does not already exist, it will be created ane...
Acts as a StrokeStyle value map, indicating which values are "known".
Definition: hdicorePathStyle.h:433
Font class to allow for easy font manipulation.
Definition: hdicoreFont.h:170
Allows for storage of transformation matrices.
Definition: hdicoreTransformMatrixPref.h:20
Header file for path style-related classes.
Allows for storage of 2D sizes.
Definition: hdicoreSizePref.h:20
virtual bool getOrCreateDashStyleMapMember(const std::string &key_, const DashStyle::Map &default_, DashStyleMapPref &ds__)
Similar to getDashStyleMapMember(), except that, if the member does not already exist, it will be created anew with a default value.
Allows for storage of stroke styles.
Definition: hdicoreStrokeStylePref.h:25
Allows for storage of bools.
Definition: hdicoreBoolPref.h:19
virtual bool getOrCreateArrayMember(const std::string &name_, const PrefDataVector *elements_, ArrayPref &array__)
Similar to getArrayMember(), except that, if the member does not already exist, it will be created an...
virtual bool getOrCreateFillStyleMember(const std::string &key_, const FillStyle &default_, FillStylePref &fs__)
Similar to getFillStyleMember(), except that, if the member does not already exist, it will be created anew with a default value.
virtual bool getOrCreateRectMember(const std::string &key_, const Rect &default_, RectPref &r__)
Similar to getRectMember(), except that, if the member does not already exist, it will be created ane...
virtual bool getPathStyleMapMember(const std::string &key_, PathStyleMapPref &ps__)
Gets a persistent path style map object from the dictionary.
virtual bool getOrCreateDictMember(const std::string &name_, const PrefDataVector *members_, DictionaryPref &dict__)
Similar to getDictMember(), except that, if the member does not already exist, it will be created ane...
virtual bool getArtColorMember(const std::string &key_, ArtColorPref &ac__) const
Gets a persistent art color object from the dictionary.
Contains a width and height for a rectangular shape.
Definition: hdicoreSize.h:24
Base class for persistent data objects, stored via JSON.
Definition: hdicorePrefData.h:24
Acts as an array-style container to store any other persistent data types, including arrays and dicti...
Definition: hdicoreArrayPref.h:55
Allows for storage of dash styles.
Definition: hdicoreDashStylePref.h:25
Definition: hdicoreaiArray.h:12
virtual bool getOrCreateColorMember(const std::string &key_, const Color &default_, ColorPref &c__)
Similar to getColorMember(), except that, if the member does not already exist, it will be created an...
virtual bool getFillStyleMapMember(const std::string &key_, FillStyleMapPref &fs__)
Gets a persistent fill style map object from the dictionary.
std::string key() const
Gets the current member's key as pointed to by the iterator.
Allows for storage of art colors.
Definition: hdicoreArtColorPref.h:20
virtual Iterator begin() const
Gets an iterator for the dictionary.
virtual bool getNumberMember(const std::string &key_, NumberPref &n__) const
Gets a persistent number object from the dictionary.
Allows for the storage of strings.
Definition: hdicoreStringPref.h:19
Iterator & operator++()
Prefix increment operator for forward iteration.
Acts as a StrokeStyle value map, indicating which values are "known".
Definition: hdicorePathStyle.h:276
virtual bool getOrCreateStrokeStyleMember(const std::string &key_, const StrokeStyle &default_, StrokeStylePref &ss__)
Similar to getStrokeStyleMember(), except that, if the member does not already exist, it will be created anew with a default value.
virtual bool getStrokeStyleMember(const std::string &key_, StrokeStylePref &ss__)
Gets a persistent stroke style object from the dictionary.
virtual bool getDashStyleMember(const std::string &key_, DashStylePref &ds__)
Gets a persistent dash style object from the dictionary.
virtual bool getPointMember(const std::string &key_, PointPref &p__) const
Gets a persistent point object from the dictionary.
virtual bool getArrayMember(const std::string &key_, ArrayPref &array__) const
Gets a persistent array object from the containing dictionary.
virtual bool addMember(const PrefData &data_)
Adds a PrefData object into the dictionary member tree at the top-level.
virtual bool getArtboardRectMember(const std::string &key_, ArtboardRectPref &abr__) const
Gets a persistent artboard rect object from the dictionary.
virtual bool getSizeMember(const std::string &key_, SizePref &s__) const
Gets a persistent size object from the dictionary.
Allows for storage of 2D artboard points.
Definition: hdicoreArtboardPointPref.h:20
Describes the dash styling of a path.
Definition: hdicorePathStyle.h:19
virtual ~DictionaryPref()
Destructs a DictionaryPref object.
virtual DictionaryPref * clone() const
Convenience method to clone an DictionaryPref object on the heap.
virtual bool getTransformMatrixMember(const std::string &key_, TransformMatrixPref &tm__) const
Gets a persistent matrix object from the dictionary.
virtual bool getOrCreatePathStyleMember(const std::string &key_, const PathStyle &default_, PathStylePref &ps__)
Similar to getPathStyleMember(), except that, if the member does not already exist, it will be created anew with a default value.
Allows for the storage of numbers.
Definition: hdicoreNumberPref.h:19
virtual bool getOrCreateFillStyleMapMember(const std::string &key_, const FillStyle::Map &default_, FillStyleMapPref &fs__)
Similar to getFillStyleMapMember(), except that, if the member does not already exist, it will be created anew with a default value.
Header file for general preference data storage.
Describes a point on the Illustrator artboard.
Definition: hdicoreArtboardPoint.h:28
virtual bool member(const std::string &name_, std::auto_ptr< PrefData > &data__) const
Gets a single member object from the dictionary data tree.
Describes the fill styling of a path.
Definition: hdicorePathStyle.h:140
Describes the color of art on the artboard.
Definition: hdicoreArtColor.h:32
virtual bool getOrCreateStringMember(const std::string &key_, const std::string &default_, StringPref &str__)
Similar to getStringMember(), except that, if the member does not already exist, it will be created a...
Allows for storage of path styles.
Definition: hdicorePathStylePref.h:20
DictionaryPref(const DictionaryPref &dict_)
Constructs a new DictionaryPref object from an existing DictionaryPref object (copy constructor) ...
virtual bool getBoolMember(const std::string &key_, BoolPref &b__) const
Gets a persistent bool object from the dictionary.
virtual bool getPathStyleMember(const std::string &key_, PathStylePref &ps__)
Gets a persistent path style object from the dictionary.
virtual DictionaryPref & operator=(const DictionaryPref &rhs_)
Allows one DictionaryPref object to be assigned from another.