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
S(SkPdfNativeDoc * doc)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->isReference())) return ret->nameValue2();
15 // TODO(edisonn): warn about missing required field, assert for known good pdfs
16 return SkString();
17 }
18
has_S() const19 bool SkPdfThreadActionDictionary::has_S() const {
20 return get("S", "") != NULL;
21 }
22
F(SkPdfNativeDoc * doc)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
has_F() const31 bool SkPdfThreadActionDictionary::has_F() const {
32 return get("F", "") != NULL;
33 }
34
isDADictionary(SkPdfNativeDoc * doc)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
getDAsDictionary(SkPdfNativeDoc * doc)41 SkPdfDictionary* SkPdfThreadActionDictionary::getDAsDictionary(SkPdfNativeDoc* doc) {
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 pdfs
46 return NULL;
47 }
48
isDAInteger(SkPdfNativeDoc * doc)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
getDAsInteger(SkPdfNativeDoc * doc)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->isReference())) return ret->intValue();
59 // TODO(edisonn): warn about missing required field, assert for known good pdfs
60 return 0;
61 }
62
isDAString(SkPdfNativeDoc * doc)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
getDAsString(SkPdfNativeDoc * doc)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 pdfs
74 return SkString();
75 }
76
has_D() const77 bool SkPdfThreadActionDictionary::has_D() const {
78 return get("D", "") != NULL;
79 }
80
isBADictionary(SkPdfNativeDoc * doc)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
getBAsDictionary(SkPdfNativeDoc * doc)87 SkPdfDictionary* SkPdfThreadActionDictionary::getBAsDictionary(SkPdfNativeDoc* doc) {
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
isBAInteger(SkPdfNativeDoc * doc)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
getBAsInteger(SkPdfNativeDoc * doc)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->isReference())) return ret->intValue();
105 // TODO(edisonn): warn about missing default value for optional fields
106 return 0;
107 }
108
has_B() const109 bool SkPdfThreadActionDictionary::has_B() const {
110 return get("B", "") != NULL;
111 }
112