diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-07-20 12:14:33 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-07-20 12:14:33 +0000 |
commit | c789cf1c6f3947283aeb34acb5a22e6204f8f6f5 (patch) | |
tree | 8f5a0c1758ee49a22562b2ec715a5df4f5141792 /include | |
parent | f5181a496d79b0dbe4d96195157b25308437cf93 (diff) |
helpers for append and insert when the value is a POD.
reduces code-size and perf: fewer refs/unrefs
git-svn-id: http://skia.googlecode.com/svn/trunk@1909 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r-- | include/pdf/SkPDFTypes.h | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/include/pdf/SkPDFTypes.h b/include/pdf/SkPDFTypes.h index a115802266..5c5edd6d58 100644 --- a/include/pdf/SkPDFTypes.h +++ b/include/pdf/SkPDFTypes.h @@ -274,7 +274,22 @@ public: * @return The value argument is returned. */ SkPDFObject* append(SkPDFObject* value); - + + /** Creates a SkPDFInt object and appends it to the array. + * @param value The value to add to the array. + */ + void appendInt(int32_t value); + + /** Creates a SkPDFScalar object and appends it to the array. + * @param value The value to add to the array. + */ + void appendScalar(SkScalar value); + + /** Creates a SkPDFName object and appends it to the array. + * @param value The value to add to the array. + */ + void appendName(const char name[]); + private: static const int kMaxLen = 8191; SkTDArray<SkPDFObject*> fValue; @@ -320,7 +335,33 @@ public: * @return The value argument is returned. */ SkPDFObject* insert(const char key[], SkPDFObject* value); + + /** Add the int to the dictionary with the given key. + * @param key The text of the key for this dictionary entry. + * @param value The int value for this dictionary entry. + */ + void insertInt(const char key[], int32_t value); + + /** Add the scalar to the dictionary with the given key. + * @param key The text of the key for this dictionary entry. + * @param value The scalar value for this dictionary entry. + */ + void insertScalar(const char key[], SkScalar value); + + /** Add the name to the dictionary with the given key. + * @param key The text of the key for this dictionary entry. + * @param name The name for this dictionary entry. + */ + void insertName(const char key[], const char name[]); + /** Add the name to the dictionary with the given key. + * @param key The text of the key for this dictionary entry. + * @param name The name for this dictionary entry. + */ + void insertName(const char key[], const SkString& name) { + this->insertName(key, name.c_str()); + } + /** Remove all entries from the dictionary. */ void clear(); |