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 "SkPdfWebCaptureCommandDictionary_autogen.h" | |
9 #include "SkPdfNativeDoc.h" | |
10 | |
11 SkString SkPdfWebCaptureCommandDictionary::URL(SkPdfNativeDoc* doc) { | |
12 SkPdfNativeObject* ret = get("URL", ""); | |
13 if (doc) {ret = doc->resolveReference(ret);} | |
14 if ((ret != NULL && ret->isAnyString()) || (doc == NULL && ret != NULL && ret-
>isReference())) return ret->stringValue2(); | |
15 // TODO(edisonn): warn about missing required field, assert for known good pdf
s | |
16 return SkString(); | |
17 } | |
18 | |
19 bool SkPdfWebCaptureCommandDictionary::has_URL() const { | |
20 return get("URL", "") != NULL; | |
21 } | |
22 | |
23 int64_t SkPdfWebCaptureCommandDictionary::L(SkPdfNativeDoc* doc) { | |
24 SkPdfNativeObject* ret = get("L", ""); | |
25 if (doc) {ret = doc->resolveReference(ret);} | |
26 if ((ret != NULL && ret->isInteger()) || (doc == NULL && ret != NULL && ret->i
sReference())) return ret->intValue(); | |
27 // TODO(edisonn): warn about missing default value for optional fields | |
28 return 0; | |
29 } | |
30 | |
31 bool SkPdfWebCaptureCommandDictionary::has_L() const { | |
32 return get("L", "") != NULL; | |
33 } | |
34 | |
35 int64_t SkPdfWebCaptureCommandDictionary::F(SkPdfNativeDoc* doc) { | |
36 SkPdfNativeObject* ret = get("F", ""); | |
37 if (doc) {ret = doc->resolveReference(ret);} | |
38 if ((ret != NULL && ret->isInteger()) || (doc == NULL && ret != NULL && ret->i
sReference())) return ret->intValue(); | |
39 // TODO(edisonn): warn about missing default value for optional fields | |
40 return 0; | |
41 } | |
42 | |
43 bool SkPdfWebCaptureCommandDictionary::has_F() const { | |
44 return get("F", "") != NULL; | |
45 } | |
46 | |
47 bool SkPdfWebCaptureCommandDictionary::isPAString(SkPdfNativeDoc* doc) { | |
48 SkPdfNativeObject* ret = get("P", ""); | |
49 if (doc) {ret = doc->resolveReference(ret);} | |
50 return ret != NULL && ret->isAnyString(); | |
51 } | |
52 | |
53 SkString SkPdfWebCaptureCommandDictionary::getPAsString(SkPdfNativeDoc* doc) { | |
54 SkPdfNativeObject* ret = get("P", ""); | |
55 if (doc) {ret = doc->resolveReference(ret);} | |
56 if ((ret != NULL && ret->isAnyString()) || (doc == NULL && ret != NULL && ret-
>isReference())) return ret->stringValue2(); | |
57 // TODO(edisonn): warn about missing default value for optional fields | |
58 return SkString(); | |
59 } | |
60 | |
61 bool SkPdfWebCaptureCommandDictionary::isPAStream(SkPdfNativeDoc* doc) { | |
62 SkPdfNativeObject* ret = get("P", ""); | |
63 if (doc) {ret = doc->resolveReference(ret);} | |
64 return ret != NULL && ret->hasStream(); | |
65 } | |
66 | |
67 SkPdfStream* SkPdfWebCaptureCommandDictionary::getPAsStream(SkPdfNativeDoc* doc)
{ | |
68 SkPdfNativeObject* ret = get("P", ""); | |
69 if (doc) {ret = doc->resolveReference(ret);} | |
70 if ((ret != NULL && ret->hasStream()) || (doc == NULL && ret != NULL && ret->i
sReference())) return ret->getStream(); | |
71 // TODO(edisonn): warn about missing default value for optional fields | |
72 return NULL; | |
73 } | |
74 | |
75 bool SkPdfWebCaptureCommandDictionary::has_P() const { | |
76 return get("P", "") != NULL; | |
77 } | |
78 | |
79 SkString SkPdfWebCaptureCommandDictionary::CT(SkPdfNativeDoc* doc) { | |
80 SkPdfNativeObject* ret = get("CT", ""); | |
81 if (doc) {ret = doc->resolveReference(ret);} | |
82 if ((ret != NULL && ret->isAnyString()) || (doc == NULL && ret != NULL && ret-
>isReference())) return ret->stringValue2(); | |
83 // TODO(edisonn): warn about missing default value for optional fields | |
84 return SkString(); | |
85 } | |
86 | |
87 bool SkPdfWebCaptureCommandDictionary::has_CT() const { | |
88 return get("CT", "") != NULL; | |
89 } | |
90 | |
91 SkString SkPdfWebCaptureCommandDictionary::H(SkPdfNativeDoc* doc) { | |
92 SkPdfNativeObject* ret = get("H", ""); | |
93 if (doc) {ret = doc->resolveReference(ret);} | |
94 if ((ret != NULL && ret->isAnyString()) || (doc == NULL && ret != NULL && ret-
>isReference())) return ret->stringValue2(); | |
95 // TODO(edisonn): warn about missing default value for optional fields | |
96 return SkString(); | |
97 } | |
98 | |
99 bool SkPdfWebCaptureCommandDictionary::has_H() const { | |
100 return get("H", "") != NULL; | |
101 } | |
102 | |
103 SkPdfDictionary* SkPdfWebCaptureCommandDictionary::S(SkPdfNativeDoc* doc) { | |
104 SkPdfNativeObject* ret = get("S", ""); | |
105 if (doc) {ret = doc->resolveReference(ret);} | |
106 if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret
->isReference())) return (SkPdfDictionary*)ret; | |
107 // TODO(edisonn): warn about missing default value for optional fields | |
108 return NULL; | |
109 } | |
110 | |
111 bool SkPdfWebCaptureCommandDictionary::has_S() const { | |
112 return get("S", "") != NULL; | |
113 } | |
OLD | NEW |