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 "SkPdfFDFDictionary_autogen.h"
9 #include "SkPdfNativeDoc.h"
10 
F(SkPdfNativeDoc * doc)11 SkPdfFileSpec SkPdfFDFDictionary::F(SkPdfNativeDoc* doc) {
12   SkPdfNativeObject* ret = get("F", "");
13   if (doc) {ret = doc->resolveReference(ret);}
14   if ((ret != NULL && false) || (doc == NULL && ret != NULL && ret->isReference())) return ret->fileSpecValue();
15   // TODO(edisonn): warn about missing default value for optional fields
16   return SkPdfFileSpec();
17 }
18 
has_F() const19 bool SkPdfFDFDictionary::has_F() const {
20   return get("F", "") != NULL;
21 }
22 
ID(SkPdfNativeDoc * doc)23 SkPdfArray* SkPdfFDFDictionary::ID(SkPdfNativeDoc* doc) {
24   SkPdfNativeObject* ret = get("ID", "");
25   if (doc) {ret = doc->resolveReference(ret);}
26   if ((ret != NULL && ret->isArray()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfArray*)ret;
27   // TODO(edisonn): warn about missing default value for optional fields
28   return NULL;
29 }
30 
has_ID() const31 bool SkPdfFDFDictionary::has_ID() const {
32   return get("ID", "") != NULL;
33 }
34 
Fields(SkPdfNativeDoc * doc)35 SkPdfArray* SkPdfFDFDictionary::Fields(SkPdfNativeDoc* doc) {
36   SkPdfNativeObject* ret = get("Fields", "");
37   if (doc) {ret = doc->resolveReference(ret);}
38   if ((ret != NULL && ret->isArray()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfArray*)ret;
39   // TODO(edisonn): warn about missing default value for optional fields
40   return NULL;
41 }
42 
has_Fields() const43 bool SkPdfFDFDictionary::has_Fields() const {
44   return get("Fields", "") != NULL;
45 }
46 
Status(SkPdfNativeDoc * doc)47 SkString SkPdfFDFDictionary::Status(SkPdfNativeDoc* doc) {
48   SkPdfNativeObject* ret = get("Status", "");
49   if (doc) {ret = doc->resolveReference(ret);}
50   if ((ret != NULL && ret->isAnyString()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->stringValue2();
51   // TODO(edisonn): warn about missing default value for optional fields
52   return SkString();
53 }
54 
has_Status() const55 bool SkPdfFDFDictionary::has_Status() const {
56   return get("Status", "") != NULL;
57 }
58 
Pages(SkPdfNativeDoc * doc)59 SkPdfArray* SkPdfFDFDictionary::Pages(SkPdfNativeDoc* doc) {
60   SkPdfNativeObject* ret = get("Pages", "");
61   if (doc) {ret = doc->resolveReference(ret);}
62   if ((ret != NULL && ret->isArray()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfArray*)ret;
63   // TODO(edisonn): warn about missing default value for optional fields
64   return NULL;
65 }
66 
has_Pages() const67 bool SkPdfFDFDictionary::has_Pages() const {
68   return get("Pages", "") != NULL;
69 }
70 
Encoding(SkPdfNativeDoc * doc)71 SkString SkPdfFDFDictionary::Encoding(SkPdfNativeDoc* doc) {
72   SkPdfNativeObject* ret = get("Encoding", "");
73   if (doc) {ret = doc->resolveReference(ret);}
74   if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->nameValue2();
75   // TODO(edisonn): warn about missing default value for optional fields
76   return SkString();
77 }
78 
has_Encoding() const79 bool SkPdfFDFDictionary::has_Encoding() const {
80   return get("Encoding", "") != NULL;
81 }
82 
Annots(SkPdfNativeDoc * doc)83 SkPdfArray* SkPdfFDFDictionary::Annots(SkPdfNativeDoc* doc) {
84   SkPdfNativeObject* ret = get("Annots", "");
85   if (doc) {ret = doc->resolveReference(ret);}
86   if ((ret != NULL && ret->isArray()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfArray*)ret;
87   // TODO(edisonn): warn about missing default value for optional fields
88   return NULL;
89 }
90 
has_Annots() const91 bool SkPdfFDFDictionary::has_Annots() const {
92   return get("Annots", "") != NULL;
93 }
94 
Differences(SkPdfNativeDoc * doc)95 SkPdfStream* SkPdfFDFDictionary::Differences(SkPdfNativeDoc* doc) {
96   SkPdfNativeObject* ret = get("Differences", "");
97   if (doc) {ret = doc->resolveReference(ret);}
98   if ((ret != NULL && ret->hasStream()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->getStream();
99   // TODO(edisonn): warn about missing default value for optional fields
100   return NULL;
101 }
102 
has_Differences() const103 bool SkPdfFDFDictionary::has_Differences() const {
104   return get("Differences", "") != NULL;
105 }
106 
Target(SkPdfNativeDoc * doc)107 SkString SkPdfFDFDictionary::Target(SkPdfNativeDoc* doc) {
108   SkPdfNativeObject* ret = get("Target", "");
109   if (doc) {ret = doc->resolveReference(ret);}
110   if ((ret != NULL && ret->isAnyString()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->stringValue2();
111   // TODO(edisonn): warn about missing default value for optional fields
112   return SkString();
113 }
114 
has_Target() const115 bool SkPdfFDFDictionary::has_Target() const {
116   return get("Target", "") != NULL;
117 }
118 
EmbeddedFDFs(SkPdfNativeDoc * doc)119 SkPdfArray* SkPdfFDFDictionary::EmbeddedFDFs(SkPdfNativeDoc* doc) {
120   SkPdfNativeObject* ret = get("EmbeddedFDFs", "");
121   if (doc) {ret = doc->resolveReference(ret);}
122   if ((ret != NULL && ret->isArray()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfArray*)ret;
123   // TODO(edisonn): warn about missing default value for optional fields
124   return NULL;
125 }
126 
has_EmbeddedFDFs() const127 bool SkPdfFDFDictionary::has_EmbeddedFDFs() const {
128   return get("EmbeddedFDFs", "") != NULL;
129 }
130 
JavaScript(SkPdfNativeDoc * doc)131 SkPdfDictionary* SkPdfFDFDictionary::JavaScript(SkPdfNativeDoc* doc) {
132   SkPdfNativeObject* ret = get("JavaScript", "");
133   if (doc) {ret = doc->resolveReference(ret);}
134   if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfDictionary*)ret;
135   // TODO(edisonn): warn about missing default value for optional fields
136   return NULL;
137 }
138 
has_JavaScript() const139 bool SkPdfFDFDictionary::has_JavaScript() const {
140   return get("JavaScript", "") != NULL;
141 }
142