| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright 2013 Google Inc. | |
| 3 | |
| 4 * Use of this source code is governed by a BSD-style license that can be | |
| 5 * found in the LICENSE file. | |
| 6 */ | |
| 7 | |
| 8 #include "SkPdfThreadActionDictionary_autogen.h" | |
| 9 #include "SkPdfNativeDoc.h" | |
| 10 | |
| 11 SkString SkPdfThreadActionDictionary::S(SkPdfNativeDoc* doc) { | |
| 12 SkPdfNativeObject* ret = get("S", ""); | |
| 13 if (doc) {ret = doc->resolveReference(ret);} | |
| 14 if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isRe
ference())) return ret->nameValue2(); | |
| 15 // TODO(edisonn): warn about missing required field, assert for known good pdf
s | |
| 16 return SkString(); | |
| 17 } | |
| 18 | |
| 19 bool SkPdfThreadActionDictionary::has_S() const { | |
| 20 return get("S", "") != NULL; | |
| 21 } | |
| 22 | |
| 23 SkPdfFileSpec SkPdfThreadActionDictionary::F(SkPdfNativeDoc* doc) { | |
| 24 SkPdfNativeObject* ret = get("F", ""); | |
| 25 if (doc) {ret = doc->resolveReference(ret);} | |
| 26 if ((ret != NULL && false) || (doc == NULL && ret != NULL && ret->isReference(
))) return ret->fileSpecValue(); | |
| 27 // TODO(edisonn): warn about missing default value for optional fields | |
| 28 return SkPdfFileSpec(); | |
| 29 } | |
| 30 | |
| 31 bool SkPdfThreadActionDictionary::has_F() const { | |
| 32 return get("F", "") != NULL; | |
| 33 } | |
| 34 | |
| 35 bool SkPdfThreadActionDictionary::isDADictionary(SkPdfNativeDoc* doc) { | |
| 36 SkPdfNativeObject* ret = get("D", ""); | |
| 37 if (doc) {ret = doc->resolveReference(ret);} | |
| 38 return ret != NULL && ret->isDictionary(); | |
| 39 } | |
| 40 | |
| 41 SkPdfDictionary* SkPdfThreadActionDictionary::getDAsDictionary(SkPdfNativeDoc* d
oc) { | |
| 42 SkPdfNativeObject* ret = get("D", ""); | |
| 43 if (doc) {ret = doc->resolveReference(ret);} | |
| 44 if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret
->isReference())) return (SkPdfDictionary*)ret; | |
| 45 // TODO(edisonn): warn about missing required field, assert for known good pdf
s | |
| 46 return NULL; | |
| 47 } | |
| 48 | |
| 49 bool SkPdfThreadActionDictionary::isDAInteger(SkPdfNativeDoc* doc) { | |
| 50 SkPdfNativeObject* ret = get("D", ""); | |
| 51 if (doc) {ret = doc->resolveReference(ret);} | |
| 52 return ret != NULL && ret->isInteger(); | |
| 53 } | |
| 54 | |
| 55 int64_t SkPdfThreadActionDictionary::getDAsInteger(SkPdfNativeDoc* doc) { | |
| 56 SkPdfNativeObject* ret = get("D", ""); | |
| 57 if (doc) {ret = doc->resolveReference(ret);} | |
| 58 if ((ret != NULL && ret->isInteger()) || (doc == NULL && ret != NULL && ret->i
sReference())) return ret->intValue(); | |
| 59 // TODO(edisonn): warn about missing required field, assert for known good pdf
s | |
| 60 return 0; | |
| 61 } | |
| 62 | |
| 63 bool SkPdfThreadActionDictionary::isDAString(SkPdfNativeDoc* doc) { | |
| 64 SkPdfNativeObject* ret = get("D", ""); | |
| 65 if (doc) {ret = doc->resolveReference(ret);} | |
| 66 return ret != NULL && ret->isAnyString(); | |
| 67 } | |
| 68 | |
| 69 SkString SkPdfThreadActionDictionary::getDAsString(SkPdfNativeDoc* doc) { | |
| 70 SkPdfNativeObject* ret = get("D", ""); | |
| 71 if (doc) {ret = doc->resolveReference(ret);} | |
| 72 if ((ret != NULL && ret->isAnyString()) || (doc == NULL && ret != NULL && ret-
>isReference())) return ret->stringValue2(); | |
| 73 // TODO(edisonn): warn about missing required field, assert for known good pdf
s | |
| 74 return SkString(); | |
| 75 } | |
| 76 | |
| 77 bool SkPdfThreadActionDictionary::has_D() const { | |
| 78 return get("D", "") != NULL; | |
| 79 } | |
| 80 | |
| 81 bool SkPdfThreadActionDictionary::isBADictionary(SkPdfNativeDoc* doc) { | |
| 82 SkPdfNativeObject* ret = get("B", ""); | |
| 83 if (doc) {ret = doc->resolveReference(ret);} | |
| 84 return ret != NULL && ret->isDictionary(); | |
| 85 } | |
| 86 | |
| 87 SkPdfDictionary* SkPdfThreadActionDictionary::getBAsDictionary(SkPdfNativeDoc* d
oc) { | |
| 88 SkPdfNativeObject* ret = get("B", ""); | |
| 89 if (doc) {ret = doc->resolveReference(ret);} | |
| 90 if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret
->isReference())) return (SkPdfDictionary*)ret; | |
| 91 // TODO(edisonn): warn about missing default value for optional fields | |
| 92 return NULL; | |
| 93 } | |
| 94 | |
| 95 bool SkPdfThreadActionDictionary::isBAInteger(SkPdfNativeDoc* doc) { | |
| 96 SkPdfNativeObject* ret = get("B", ""); | |
| 97 if (doc) {ret = doc->resolveReference(ret);} | |
| 98 return ret != NULL && ret->isInteger(); | |
| 99 } | |
| 100 | |
| 101 int64_t SkPdfThreadActionDictionary::getBAsInteger(SkPdfNativeDoc* doc) { | |
| 102 SkPdfNativeObject* ret = get("B", ""); | |
| 103 if (doc) {ret = doc->resolveReference(ret);} | |
| 104 if ((ret != NULL && ret->isInteger()) || (doc == NULL && ret != NULL && ret->i
sReference())) return ret->intValue(); | |
| 105 // TODO(edisonn): warn about missing default value for optional fields | |
| 106 return 0; | |
| 107 } | |
| 108 | |
| 109 bool SkPdfThreadActionDictionary::has_B() const { | |
| 110 return get("B", "") != NULL; | |
| 111 } | |
| OLD | NEW |