Hot Door CORE  0.7.0
Adobe® Illustrator® Plug-in Library
hdicorePreferences.h
Go to the documentation of this file.
1 
7 #ifndef __HDI_CORE_PREFERENCES__
8 #define __HDI_CORE_PREFERENCES__
9 
10 #include <vector>
11 
12 #include "hdicorePathStyle.h"
13 
14 namespace hdi
15 {
16  namespace plugin
17  {
18  class Preferences;
19  }
20 
21  namespace core
22  {
23  class ArtboardPoint;
24  class ArtboardRect;
25  class ArtColor;
26  class Color;
27  class Font;
28  class Point;
29  class Rect;
30  class Size;
31  class TransformMatrix;
32 
33  class PrefData;
34  class ArrayPref;
35  class ArtboardPointPref;
36  class ArtboardRectPref;
37  class ArtColorPref;
38  class BoolPref;
39  class ColorPref;
40  class DashStylePref;
41  class DashStyleMapPref;
42  class DictionaryPref;
43  class FillStylePref;
44  class FillStyleMapPref;
45  class FontPref;
46  class NumberPref;
47  class PathStylePref;
48  class PathStyleMapPref;
49  class PointPref;
50  class RectPref;
51  class SizePref;
52  class StringPref;
53  class StrokeStylePref;
54  class StrokeStyleMapPref;
55  class TransformMatrixPref;
56 
61  {
62  public:
63  typedef std::vector< PrefData* > PrefDataVector;
64 
76  Preferences();
77 
85  Preferences(const Preferences& prefs_);
86 
92  virtual ~Preferences();
93 
103  virtual Preferences& operator=(const Preferences& rhs_);
104 
112  virtual bool isEmpty() const;
113 
126  static bool load(const std::string& path_, Preferences& prefs__);
127 
143  virtual bool reload(const std::string& path_);
144 
153  virtual bool save(const std::string& path_) const;
154 
162  virtual uint64_t saveCount() const;
163 
176  virtual bool addPref(const PrefData& pref_);
177 
190  virtual bool getPref(const std::string& key_, std::auto_ptr<PrefData>& pref__) const;
191 
200  virtual bool removePref(const PrefData& pref_);
201 
212  virtual bool getArrayPref(const std::string& key_, ArrayPref& array__) const;
213 
233  virtual bool getOrCreateArrayPref(
234  const std::string& key_,
235  const PrefDataVector* elements_,
236  ArrayPref& array__
237  );
238 
249  virtual bool getArtboardPointPref(const std::string& key_, ArtboardPointPref& abp__) const;
250 
263  virtual bool getOrCreateArtboardPointPref(
264  const std::string& key_,
265  const ArtboardPoint& default_,
266  ArtboardPointPref& abp__
267  );
268 
279  virtual bool getArtboardRectPref(const std::string& key_, ArtboardRectPref& abr__) const;
280 
293  virtual bool getOrCreateArtboardRectPref(
294  const std::string& key_,
295  const ArtboardRect& default_,
296  ArtboardRectPref& abr__
297  );
298 
309  virtual bool getArtColorPref(const std::string& key_, ArtColorPref& ac__) const;
310 
323  virtual bool getOrCreateArtColorPref(
324  const std::string& key_,
325  const ArtColor& default_,
326  ArtColorPref& ac__
327  );
328 
339  virtual bool getBoolPref(const std::string& key_, BoolPref& b__) const;
340 
353  virtual bool getOrCreateBoolPref(const std::string& key_, const bool default_, BoolPref& b__);
354 
365  virtual bool getColorPref(const std::string& key_, ColorPref& c__) const;
366 
379  virtual bool getOrCreateColorPref(const std::string& key_, const Color& default_, ColorPref& c__);
380 
391  virtual bool getDashStylePref(const std::string& key_, DashStylePref& ds__);
392 
406  virtual bool getOrCreateDashStylePref(
407  const std::string& key_,
408  const DashStyle& default_,
409  DashStylePref& ds__
410  );
411 
422  virtual bool getDashStyleMapPref(const std::string& key_, DashStyleMapPref& ds__);
423 
437  virtual bool getOrCreateDashStyleMapPref(
438  const std::string& key_,
439  const DashStyle::Map& default_,
440  DashStyleMapPref& ds__
441  );
442 
453  virtual bool getDictPref(const std::string& key_, DictionaryPref& dict__) const;
454 
475  virtual bool getOrCreateDictPref(
476  const std::string& key_,
477  const PrefDataVector* members_,
478  DictionaryPref& dict__
479  );
480 
491  virtual bool getFillStylePref(const std::string& key_, FillStylePref& fs__);
492 
506  virtual bool getOrCreateFillStylePref(
507  const std::string& key_,
508  const FillStyle& default_,
509  FillStylePref& fs__
510  );
511 
522  virtual bool getFillStyleMapPref(const std::string& key_, FillStyleMapPref& fs__);
523 
537  virtual bool getOrCreateFillStyleMapPref(
538  const std::string& key_,
539  const FillStyle::Map& default_,
540  FillStyleMapPref& fs__
541  );
542 
553  virtual bool getFontPref(const std::string& key_, FontPref& font__) const;
554 
568  virtual bool getOrCreateFontPref(
569  const std::string& key_,
570  const Font& defaultFont_,
571  const double defaultSize_,
572  FontPref& font__
573  );
574 
585  virtual bool getTransformMatrixPref(const std::string& key_, TransformMatrixPref& tm__) const;
586 
599  virtual bool getOrCreateTransformMatrixPref(
600  const std::string& key_,
601  const TransformMatrix& default_,
602  TransformMatrixPref& tm__
603  );
604 
615  virtual bool getNumberPref(const std::string& key_, NumberPref& n__) const;
616 
629  virtual bool getOrCreateIntPref(const std::string& key_, const int64_t default_, NumberPref& n__);
630 
643  virtual bool getOrCreateFloatPref(const std::string& key_, const double default_, NumberPref& n__);
644 
655  virtual bool getPathStylePref(const std::string& key_, PathStylePref& ps__);
656 
670  virtual bool getOrCreatePathStylePref(
671  const std::string& key_,
672  const PathStyle& default_,
673  PathStylePref& ps__
674  );
675 
686  virtual bool getPathStyleMapPref(const std::string& key_, PathStyleMapPref& ps__);
687 
701  virtual bool getOrCreatePathStyleMapPref(
702  const std::string& key_,
703  const PathStyle::Map& default_,
704  PathStyleMapPref& ps__
705  );
706 
717  virtual bool getPointPref(const std::string& key_, PointPref& p__) const;
718 
731  virtual bool getOrCreatePointPref(const std::string& key_, const Point& default_, PointPref& p__);
732 
743  virtual bool getRectPref(const std::string& key_, RectPref& r__) const;
744 
757  virtual bool getOrCreateRectPref(const std::string& key_, const Rect& default_, RectPref& r__);
758 
769  virtual bool getSizePref(const std::string& key_, SizePref& s__) const;
770 
783  virtual bool getOrCreateSizePref(const std::string& key_, const Size& default_, SizePref& s__);
784 
795  virtual bool getStringPref(const std::string& key_, StringPref& str__) const;
796 
809  virtual bool getOrCreateStringPref(
810  const std::string& key_,
811  const std::string& default_,
812  StringPref& str__
813  );
814 
825  virtual bool getStrokeStylePref(const std::string& key_, StrokeStylePref& ss__);
826 
840  virtual bool getOrCreateStrokeStylePref(
841  const std::string& key_,
842  const StrokeStyle& default_,
843  StrokeStylePref& ss__
844  );
845 
856  virtual bool getStrokeStyleMapPref(const std::string& key_, StrokeStyleMapPref& ss__);
857 
871  virtual bool getOrCreateStrokeStyleMapPref(
872  const std::string& key_,
873  const StrokeStyle::Map& default_,
874  StrokeStyleMapPref& ss__
875  );
876 
884  virtual int32_t versionNumber() const;
885 
894  virtual bool setVersionNumber(const int32_t version_);
895 
903  virtual std::string versionString() const;
904 
913  virtual bool setVersionString(const std::string& version_);
914 
915 
916  protected:
920  void* __data;
921 
927  Preferences(const plugin::Preferences&);
928  };
929 
930  typedef std::auto_ptr<Preferences> PreferencesAP;
931  }
932 }
933 
934 #endif
935 // __HDI_CORE_PREFERENCES__
Allows for storage of path style maps.
Definition: hdicorePathStyleMapPref.h:20
virtual ~Preferences()
Destructs a Preferences object.
virtual bool addPref(const PrefData &pref_)
Adds a preference object into the prefs data tree, such that when the prefs are written the individua...
virtual bool getArrayPref(const std::string &key_, ArrayPref &array__) const
Gets an array pref from the prefs data tree.
virtual bool getRectPref(const std::string &key_, RectPref &r__) const
Gets a rect pref from the prefs data tree.
virtual bool getOrCreatePathStyleMapPref(const std::string &key_, const PathStyle::Map &default_, PathStyleMapPref &ps__)
Similar to getPathStyleMapPref(), except that, if the member does not already exist, it will be created anew with a default value.
virtual bool getStringPref(const std::string &key_, StringPref &str__) const
Gets a string pref from the prefs data tree.
Acts as a DashStyle value map, indicating which values are "known".
Definition: hdicorePathStyle.h:30
Preferences()
Constructs an empty Preferences object.
Describes a point in the 2-dimensional (x,y) coordinate system, typically in an Illustrator document ...
Definition: hdicorePoint.h:26
virtual bool getDictPref(const std::string &key_, DictionaryPref &dict__) const
Gets a dictionary pref from the prefs data tree.
virtual bool getOrCreateArtColorPref(const std::string &key_, const ArtColor &default_, ArtColorPref &ac__)
Similar to getArtColorPref(), except that, if the pref does not already exist, it will be created ane...
virtual bool setVersionString(const std::string &version_)
Sets the version string for the preferences data.
Describes an RGB color, with opacity, typically for UI purposes.
Definition: hdicoreColor.h:24
Allows for storage of 2D points.
Definition: hdicorePointPref.h:20
virtual bool getOrCreateColorPref(const std::string &key_, const Color &default_, ColorPref &c__)
Similar to getColorPref(), except that, if the pref does not already exist, it will be created anew w...
Allows for storage of artboard rects/bounds.
Definition: hdicoreArtboardRectPref.h:20
Allows for storage of colors.
Definition: hdicoreColorPref.h:20
virtual bool setVersionNumber(const int32_t version_)
Sets the number version for the preferences data.
virtual bool getOrCreatePointPref(const std::string &key_, const Point &default_, PointPref &p__)
Similar to getPointPref(), except that, if the pref does not already exist, it will be created anew w...
virtual bool getArtboardRectPref(const std::string &key_, ArtboardRectPref &abr__) const
Gets an artboard rect pref from the prefs data tree.
Allows for storage of font faces and sizes.
Definition: hdicoreFontPref.h:21
virtual bool getTransformMatrixPref(const std::string &key_, TransformMatrixPref &tm__) const
Gets a transform matrix pref from the prefs data tree.
virtual bool getOrCreateBoolPref(const std::string &key_, const bool default_, BoolPref &b__)
Similar to getBoolPref(), except that, if the pref does not already exist, it will be created anew wi...
virtual bool getOrCreateStringPref(const std::string &key_, const std::string &default_, StringPref &str__)
Similar to getStringPref(), except that, if the pref does not already exist, it will be created anew ...
virtual bool getOrCreatePathStylePref(const std::string &key_, const PathStyle &default_, PathStylePref &ps__)
Similar to getPathStylePref(), except that, if the member does not already exist, it will be created ...
virtual bool getOrCreateTransformMatrixPref(const std::string &key_, const TransformMatrix &default_, TransformMatrixPref &tm__)
Similar to getTransformMatrixPref(), except that, if the pref does not already exist, it will be created anew with a default value.
virtual bool save(const std::string &path_) const
Writes JSON preferences data to a file.
Describes all styling attributes of a path.
Definition: hdicorePathStyle.h:427
Acts as a FillStyle value map, indicating which values are "known".
Definition: hdicorePathStyle.h:146
virtual std::string versionString() const
Gets the version string for the preferences data.
virtual bool getOrCreateIntPref(const std::string &key_, const int64_t default_, NumberPref &n__)
Similar to getNumberPref(), except that, if the pref does not already exist, it will be created anew ...
Describes the stroke styling of a path.
Definition: hdicorePathStyle.h:249
Allows for storage of rects/bounds.
Definition: hdicoreRectPref.h:20
Describes a rectangular area on the Illustrator artboard.
Definition: hdicoreArtboardRect.h:25
virtual bool getOrCreateArrayPref(const std::string &key_, const PrefDataVector *elements_, ArrayPref &array__)
Similar to getArrayPref(), except that, if the pref does not already exist, it will be created anew w...
Allows for storage of dash style maps.
Definition: hdicoreDashStyleMapPref.h:25
virtual bool getStrokeStylePref(const std::string &key_, StrokeStylePref &ss__)
Gets a persistent stroke style object from the prefs data tree.
virtual bool getSizePref(const std::string &key_, SizePref &s__) const
Gets a size pref from the prefs data tree.
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 getFillStyleMapPref(const std::string &key_, FillStyleMapPref &fs__)
Gets a persistent fill style map object from the prefs data tree.
virtual bool getOrCreateArtboardRectPref(const std::string &key_, const ArtboardRect &default_, ArtboardRectPref &abr__)
Similar to getArtboardRectPref(), except that, if the pref does not already exist, it will be created anew with a default value.
virtual bool getOrCreateDashStylePref(const std::string &key_, const DashStyle &default_, DashStylePref &ds__)
Similar to getDashStylePref(), except that, if the member does not already exist, it will be created ...
Allows for 2-dimensional transformations in a single application via matrix math. ...
Definition: hdicoreTransformMatrix.h:26
virtual bool getDashStylePref(const std::string &key_, DashStylePref &ds__)
Gets a persistent dash style object from the prefs data tree.
Aids in preference storage by reading/writing the JSON data in a given file.
Definition: hdicorePreferences.h:60
Allows for storage of fill style maps.
Definition: hdicoreFillStyleMapPref.h:25
Allows for storage of stroke style maps.
Definition: hdicoreStrokeStyleMapPref.h:25
virtual bool getOrCreateDictPref(const std::string &key_, const PrefDataVector *members_, DictionaryPref &dict__)
Similar to getDictPref(), except that, if the pref does not already exist, it will be created anew wi...
Allows for storage of fill styles.
Definition: hdicoreFillStylePref.h:25
virtual int32_t versionNumber() const
Gets the number version for the preferences data.
virtual bool getPref(const std::string &key_, std::auto_ptr< PrefData > &pref__) const
Gets a single preference object from the prefs data tree.
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
virtual bool getPointPref(const std::string &key_, PointPref &p__) const
Gets a point pref from the prefs data tree.
Header file for path style-related classes.
Allows for storage of 2D sizes.
Definition: hdicoreSizePref.h:20
Allows for storage of stroke styles.
Definition: hdicoreStrokeStylePref.h:25
Allows for storage of bools.
Definition: hdicoreBoolPref.h:19
virtual bool getOrCreateFontPref(const std::string &key_, const Font &defaultFont_, const double defaultSize_, FontPref &font__)
Similar to getFontPref(), except that, if the pref does not already exist, it will be created anew wi...
virtual bool getBoolPref(const std::string &key_, BoolPref &b__) const
Gets a bool pref from the prefs data tree.
virtual bool getStrokeStyleMapPref(const std::string &key_, StrokeStyleMapPref &ss__)
Gets a persistent stroke style map object from the prefs data tree.
void * __data
Private implementation data.
Definition: hdicorePreferences.h:920
virtual bool getOrCreateFillStyleMapPref(const std::string &key_, const FillStyle::Map &default_, FillStyleMapPref &fs__)
Similar to getFillStyleMapPref(), except that, if the member does not already exist, it will be created anew with a default value.
virtual bool getPathStyleMapPref(const std::string &key_, PathStyleMapPref &ps__)
Gets a persistent path style map object from the prefs data tree.
virtual bool getOrCreateSizePref(const std::string &key_, const Size &default_, SizePref &s__)
Similar to getSizePref(), except that, if the pref does not already exist, it will be created anew wi...
virtual bool getNumberPref(const std::string &key_, NumberPref &n__) const
Gets a number pref from the prefs data tree.
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
virtual bool getOrCreateRectPref(const std::string &key_, const Rect &default_, RectPref &r__)
Similar to getRectPref(), except that, if the pref does not already exist, it will be created anew wi...
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
virtual bool getOrCreateStrokeStylePref(const std::string &key_, const StrokeStyle &default_, StrokeStylePref &ss__)
Similar to getStrokeStylePref(), except that, if the member does not already exist, it will be created anew with a default value.
Definition: hdicoreaiArray.h:12
static bool load(const std::string &path_, Preferences &prefs__)
Convenience method to create a Preferences object from JSON data in a file.
virtual bool getOrCreateFloatPref(const std::string &key_, const double default_, NumberPref &n__)
Similar to getNumberPref(), except that, if the pref does not already exist, it will be created anew ...
virtual bool getArtColorPref(const std::string &key_, ArtColorPref &ac__) const
Gets an art color pref from the prefs data tree.
virtual bool isEmpty() const
Gets whether the target Preferences object is empty (constructed with the default ctor) ...
virtual bool getOrCreateFillStylePref(const std::string &key_, const FillStyle &default_, FillStylePref &fs__)
Similar to getFillStylePref(), except that, if the member does not already exist, it will be created ...
Allows for storage of art colors.
Definition: hdicoreArtColorPref.h:20
Allows for the storage of strings.
Definition: hdicoreStringPref.h:19
Acts as a StrokeStyle value map, indicating which values are "known".
Definition: hdicorePathStyle.h:276
virtual bool getOrCreateDashStyleMapPref(const std::string &key_, const DashStyle::Map &default_, DashStyleMapPref &ds__)
Similar to getDashStyleMapPref(), except that, if the member does not already exist, it will be created anew with a default value.
virtual uint64_t saveCount() const
Gets the save count of the prefs file.
virtual bool reload(const std::string &path_)
Reloads the preferences data from disk (as it is kept in memory at runtime, this might be necessary i...
Allows for storage of 2D artboard points.
Definition: hdicoreArtboardPointPref.h:20
Describes the dash styling of a path.
Definition: hdicorePathStyle.h:19
virtual bool getFillStylePref(const std::string &key_, FillStylePref &fs__)
Gets a persistent fill style object from the prefs data tree.
Allows for the storage of numbers.
Definition: hdicoreNumberPref.h:19
virtual bool getOrCreateStrokeStyleMapPref(const std::string &key_, const StrokeStyle::Map &default_, StrokeStyleMapPref &ss__)
Similar to getStrokeStyleMapPref(), except that, if the member does not already exist, it will be created anew with a default value.
virtual bool getOrCreateArtboardPointPref(const std::string &key_, const ArtboardPoint &default_, ArtboardPointPref &abp__)
Similar to getArtboardPointPref(), except that, if the pref does not already exist, it will be created anew with a default value.
virtual bool removePref(const PrefData &pref_)
Removes a preference from the prefs data tree.
Describes a point on the Illustrator artboard.
Definition: hdicoreArtboardPoint.h:28
virtual bool getDashStyleMapPref(const std::string &key_, DashStyleMapPref &ds__)
Gets a persistent dash style map object from the prefs data tree.
virtual Preferences & operator=(const Preferences &rhs_)
Assigns one Preferences object to another.
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 getFontPref(const std::string &key_, FontPref &font__) const
Gets a font pref from the prefs data tree.
virtual bool getPathStylePref(const std::string &key_, PathStylePref &ps__)
Gets a persistent path style object from the prefs data tree.
virtual bool getColorPref(const std::string &key_, ColorPref &c__) const
Gets a color pref from the prefs data tree.
Allows for storage of path styles.
Definition: hdicorePathStylePref.h:20
virtual bool getArtboardPointPref(const std::string &key_, ArtboardPointPref &abp__) const
Gets an artboard point pref from the prefs data tree.