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 "SkPdfNameDictionary_autogen.h"
9 #include "SkPdfNativeDoc.h"
10 
isDestsAName(SkPdfNativeDoc * doc)11 bool SkPdfNameDictionary::isDestsAName(SkPdfNativeDoc* doc) {
12   SkPdfNativeObject* ret = get("Dests", "");
13   if (doc) {ret = doc->resolveReference(ret);}
14   return ret != NULL && ret->isName();
15 }
16 
getDestsAsName(SkPdfNativeDoc * doc)17 SkString SkPdfNameDictionary::getDestsAsName(SkPdfNativeDoc* doc) {
18   SkPdfNativeObject* ret = get("Dests", "");
19   if (doc) {ret = doc->resolveReference(ret);}
20   if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->nameValue2();
21   // TODO(edisonn): warn about missing default value for optional fields
22   return SkString();
23 }
24 
isDestsATree(SkPdfNativeDoc * doc)25 bool SkPdfNameDictionary::isDestsATree(SkPdfNativeDoc* doc) {
26   SkPdfNativeObject* ret = get("Dests", "");
27   if (doc) {ret = doc->resolveReference(ret);}
28   return ret != NULL && false;
29 }
30 
getDestsAsTree(SkPdfNativeDoc * doc)31 SkPdfTree SkPdfNameDictionary::getDestsAsTree(SkPdfNativeDoc* doc) {
32   SkPdfNativeObject* ret = get("Dests", "");
33   if (doc) {ret = doc->resolveReference(ret);}
34   if ((ret != NULL && false) || (doc == NULL && ret != NULL && ret->isReference())) return ret->treeValue();
35   // TODO(edisonn): warn about missing default value for optional fields
36   return SkPdfTree();
37 }
38 
has_Dests() const39 bool SkPdfNameDictionary::has_Dests() const {
40   return get("Dests", "") != NULL;
41 }
42 
isAPAName(SkPdfNativeDoc * doc)43 bool SkPdfNameDictionary::isAPAName(SkPdfNativeDoc* doc) {
44   SkPdfNativeObject* ret = get("AP", "");
45   if (doc) {ret = doc->resolveReference(ret);}
46   return ret != NULL && ret->isName();
47 }
48 
getAPAsName(SkPdfNativeDoc * doc)49 SkString SkPdfNameDictionary::getAPAsName(SkPdfNativeDoc* doc) {
50   SkPdfNativeObject* ret = get("AP", "");
51   if (doc) {ret = doc->resolveReference(ret);}
52   if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->nameValue2();
53   // TODO(edisonn): warn about missing default value for optional fields
54   return SkString();
55 }
56 
isAPATree(SkPdfNativeDoc * doc)57 bool SkPdfNameDictionary::isAPATree(SkPdfNativeDoc* doc) {
58   SkPdfNativeObject* ret = get("AP", "");
59   if (doc) {ret = doc->resolveReference(ret);}
60   return ret != NULL && false;
61 }
62 
getAPAsTree(SkPdfNativeDoc * doc)63 SkPdfTree SkPdfNameDictionary::getAPAsTree(SkPdfNativeDoc* doc) {
64   SkPdfNativeObject* ret = get("AP", "");
65   if (doc) {ret = doc->resolveReference(ret);}
66   if ((ret != NULL && false) || (doc == NULL && ret != NULL && ret->isReference())) return ret->treeValue();
67   // TODO(edisonn): warn about missing default value for optional fields
68   return SkPdfTree();
69 }
70 
has_AP() const71 bool SkPdfNameDictionary::has_AP() const {
72   return get("AP", "") != NULL;
73 }
74 
isJavaScriptAName(SkPdfNativeDoc * doc)75 bool SkPdfNameDictionary::isJavaScriptAName(SkPdfNativeDoc* doc) {
76   SkPdfNativeObject* ret = get("JavaScript", "");
77   if (doc) {ret = doc->resolveReference(ret);}
78   return ret != NULL && ret->isName();
79 }
80 
getJavaScriptAsName(SkPdfNativeDoc * doc)81 SkString SkPdfNameDictionary::getJavaScriptAsName(SkPdfNativeDoc* doc) {
82   SkPdfNativeObject* ret = get("JavaScript", "");
83   if (doc) {ret = doc->resolveReference(ret);}
84   if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->nameValue2();
85   // TODO(edisonn): warn about missing default value for optional fields
86   return SkString();
87 }
88 
isJavaScriptATree(SkPdfNativeDoc * doc)89 bool SkPdfNameDictionary::isJavaScriptATree(SkPdfNativeDoc* doc) {
90   SkPdfNativeObject* ret = get("JavaScript", "");
91   if (doc) {ret = doc->resolveReference(ret);}
92   return ret != NULL && false;
93 }
94 
getJavaScriptAsTree(SkPdfNativeDoc * doc)95 SkPdfTree SkPdfNameDictionary::getJavaScriptAsTree(SkPdfNativeDoc* doc) {
96   SkPdfNativeObject* ret = get("JavaScript", "");
97   if (doc) {ret = doc->resolveReference(ret);}
98   if ((ret != NULL && false) || (doc == NULL && ret != NULL && ret->isReference())) return ret->treeValue();
99   // TODO(edisonn): warn about missing default value for optional fields
100   return SkPdfTree();
101 }
102 
has_JavaScript() const103 bool SkPdfNameDictionary::has_JavaScript() const {
104   return get("JavaScript", "") != NULL;
105 }
106 
isPagesAName(SkPdfNativeDoc * doc)107 bool SkPdfNameDictionary::isPagesAName(SkPdfNativeDoc* doc) {
108   SkPdfNativeObject* ret = get("Pages", "");
109   if (doc) {ret = doc->resolveReference(ret);}
110   return ret != NULL && ret->isName();
111 }
112 
getPagesAsName(SkPdfNativeDoc * doc)113 SkString SkPdfNameDictionary::getPagesAsName(SkPdfNativeDoc* doc) {
114   SkPdfNativeObject* ret = get("Pages", "");
115   if (doc) {ret = doc->resolveReference(ret);}
116   if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->nameValue2();
117   // TODO(edisonn): warn about missing default value for optional fields
118   return SkString();
119 }
120 
isPagesATree(SkPdfNativeDoc * doc)121 bool SkPdfNameDictionary::isPagesATree(SkPdfNativeDoc* doc) {
122   SkPdfNativeObject* ret = get("Pages", "");
123   if (doc) {ret = doc->resolveReference(ret);}
124   return ret != NULL && false;
125 }
126 
getPagesAsTree(SkPdfNativeDoc * doc)127 SkPdfTree SkPdfNameDictionary::getPagesAsTree(SkPdfNativeDoc* doc) {
128   SkPdfNativeObject* ret = get("Pages", "");
129   if (doc) {ret = doc->resolveReference(ret);}
130   if ((ret != NULL && false) || (doc == NULL && ret != NULL && ret->isReference())) return ret->treeValue();
131   // TODO(edisonn): warn about missing default value for optional fields
132   return SkPdfTree();
133 }
134 
has_Pages() const135 bool SkPdfNameDictionary::has_Pages() const {
136   return get("Pages", "") != NULL;
137 }
138 
isTemplatesAName(SkPdfNativeDoc * doc)139 bool SkPdfNameDictionary::isTemplatesAName(SkPdfNativeDoc* doc) {
140   SkPdfNativeObject* ret = get("Templates", "");
141   if (doc) {ret = doc->resolveReference(ret);}
142   return ret != NULL && ret->isName();
143 }
144 
getTemplatesAsName(SkPdfNativeDoc * doc)145 SkString SkPdfNameDictionary::getTemplatesAsName(SkPdfNativeDoc* doc) {
146   SkPdfNativeObject* ret = get("Templates", "");
147   if (doc) {ret = doc->resolveReference(ret);}
148   if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->nameValue2();
149   // TODO(edisonn): warn about missing default value for optional fields
150   return SkString();
151 }
152 
isTemplatesATree(SkPdfNativeDoc * doc)153 bool SkPdfNameDictionary::isTemplatesATree(SkPdfNativeDoc* doc) {
154   SkPdfNativeObject* ret = get("Templates", "");
155   if (doc) {ret = doc->resolveReference(ret);}
156   return ret != NULL && false;
157 }
158 
getTemplatesAsTree(SkPdfNativeDoc * doc)159 SkPdfTree SkPdfNameDictionary::getTemplatesAsTree(SkPdfNativeDoc* doc) {
160   SkPdfNativeObject* ret = get("Templates", "");
161   if (doc) {ret = doc->resolveReference(ret);}
162   if ((ret != NULL && false) || (doc == NULL && ret != NULL && ret->isReference())) return ret->treeValue();
163   // TODO(edisonn): warn about missing default value for optional fields
164   return SkPdfTree();
165 }
166 
has_Templates() const167 bool SkPdfNameDictionary::has_Templates() const {
168   return get("Templates", "") != NULL;
169 }
170 
isIDSAName(SkPdfNativeDoc * doc)171 bool SkPdfNameDictionary::isIDSAName(SkPdfNativeDoc* doc) {
172   SkPdfNativeObject* ret = get("IDS", "");
173   if (doc) {ret = doc->resolveReference(ret);}
174   return ret != NULL && ret->isName();
175 }
176 
getIDSAsName(SkPdfNativeDoc * doc)177 SkString SkPdfNameDictionary::getIDSAsName(SkPdfNativeDoc* doc) {
178   SkPdfNativeObject* ret = get("IDS", "");
179   if (doc) {ret = doc->resolveReference(ret);}
180   if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->nameValue2();
181   // TODO(edisonn): warn about missing default value for optional fields
182   return SkString();
183 }
184 
isIDSATree(SkPdfNativeDoc * doc)185 bool SkPdfNameDictionary::isIDSATree(SkPdfNativeDoc* doc) {
186   SkPdfNativeObject* ret = get("IDS", "");
187   if (doc) {ret = doc->resolveReference(ret);}
188   return ret != NULL && false;
189 }
190 
getIDSAsTree(SkPdfNativeDoc * doc)191 SkPdfTree SkPdfNameDictionary::getIDSAsTree(SkPdfNativeDoc* doc) {
192   SkPdfNativeObject* ret = get("IDS", "");
193   if (doc) {ret = doc->resolveReference(ret);}
194   if ((ret != NULL && false) || (doc == NULL && ret != NULL && ret->isReference())) return ret->treeValue();
195   // TODO(edisonn): warn about missing default value for optional fields
196   return SkPdfTree();
197 }
198 
has_IDS() const199 bool SkPdfNameDictionary::has_IDS() const {
200   return get("IDS", "") != NULL;
201 }
202 
isURLSAName(SkPdfNativeDoc * doc)203 bool SkPdfNameDictionary::isURLSAName(SkPdfNativeDoc* doc) {
204   SkPdfNativeObject* ret = get("URLS", "");
205   if (doc) {ret = doc->resolveReference(ret);}
206   return ret != NULL && ret->isName();
207 }
208 
getURLSAsName(SkPdfNativeDoc * doc)209 SkString SkPdfNameDictionary::getURLSAsName(SkPdfNativeDoc* doc) {
210   SkPdfNativeObject* ret = get("URLS", "");
211   if (doc) {ret = doc->resolveReference(ret);}
212   if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->nameValue2();
213   // TODO(edisonn): warn about missing default value for optional fields
214   return SkString();
215 }
216 
isURLSATree(SkPdfNativeDoc * doc)217 bool SkPdfNameDictionary::isURLSATree(SkPdfNativeDoc* doc) {
218   SkPdfNativeObject* ret = get("URLS", "");
219   if (doc) {ret = doc->resolveReference(ret);}
220   return ret != NULL && false;
221 }
222 
getURLSAsTree(SkPdfNativeDoc * doc)223 SkPdfTree SkPdfNameDictionary::getURLSAsTree(SkPdfNativeDoc* doc) {
224   SkPdfNativeObject* ret = get("URLS", "");
225   if (doc) {ret = doc->resolveReference(ret);}
226   if ((ret != NULL && false) || (doc == NULL && ret != NULL && ret->isReference())) return ret->treeValue();
227   // TODO(edisonn): warn about missing default value for optional fields
228   return SkPdfTree();
229 }
230 
has_URLS() const231 bool SkPdfNameDictionary::has_URLS() const {
232   return get("URLS", "") != NULL;
233 }
234 
isEmbeddedFilesAName(SkPdfNativeDoc * doc)235 bool SkPdfNameDictionary::isEmbeddedFilesAName(SkPdfNativeDoc* doc) {
236   SkPdfNativeObject* ret = get("EmbeddedFiles", "");
237   if (doc) {ret = doc->resolveReference(ret);}
238   return ret != NULL && ret->isName();
239 }
240 
getEmbeddedFilesAsName(SkPdfNativeDoc * doc)241 SkString SkPdfNameDictionary::getEmbeddedFilesAsName(SkPdfNativeDoc* doc) {
242   SkPdfNativeObject* ret = get("EmbeddedFiles", "");
243   if (doc) {ret = doc->resolveReference(ret);}
244   if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->nameValue2();
245   // TODO(edisonn): warn about missing default value for optional fields
246   return SkString();
247 }
248 
isEmbeddedFilesATree(SkPdfNativeDoc * doc)249 bool SkPdfNameDictionary::isEmbeddedFilesATree(SkPdfNativeDoc* doc) {
250   SkPdfNativeObject* ret = get("EmbeddedFiles", "");
251   if (doc) {ret = doc->resolveReference(ret);}
252   return ret != NULL && false;
253 }
254 
getEmbeddedFilesAsTree(SkPdfNativeDoc * doc)255 SkPdfTree SkPdfNameDictionary::getEmbeddedFilesAsTree(SkPdfNativeDoc* doc) {
256   SkPdfNativeObject* ret = get("EmbeddedFiles", "");
257   if (doc) {ret = doc->resolveReference(ret);}
258   if ((ret != NULL && false) || (doc == NULL && ret != NULL && ret->isReference())) return ret->treeValue();
259   // TODO(edisonn): warn about missing default value for optional fields
260   return SkPdfTree();
261 }
262 
has_EmbeddedFiles() const263 bool SkPdfNameDictionary::has_EmbeddedFiles() const {
264   return get("EmbeddedFiles", "") != NULL;
265 }
266