• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "SkPdfOutlineItemDictionary_autogen.h"
9 #include "SkPdfNativeDoc.h"
10 
Title(SkPdfNativeDoc * doc)11 SkString SkPdfOutlineItemDictionary::Title(SkPdfNativeDoc* doc) {
12   SkPdfNativeObject* ret = get("Title", "");
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 pdfs
16   return SkString();
17 }
18 
has_Title() const19 bool SkPdfOutlineItemDictionary::has_Title() const {
20   return get("Title", "") != NULL;
21 }
22 
Parent(SkPdfNativeDoc * doc)23 SkPdfDictionary* SkPdfOutlineItemDictionary::Parent(SkPdfNativeDoc* doc) {
24   SkPdfNativeObject* ret = get("Parent", "");
25   if (doc) {ret = doc->resolveReference(ret);}
26   if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfDictionary*)ret;
27   // TODO(edisonn): warn about missing default value for optional fields
28   return NULL;
29 }
30 
has_Parent() const31 bool SkPdfOutlineItemDictionary::has_Parent() const {
32   return get("Parent", "") != NULL;
33 }
34 
Prev(SkPdfNativeDoc * doc)35 SkPdfDictionary* SkPdfOutlineItemDictionary::Prev(SkPdfNativeDoc* doc) {
36   SkPdfNativeObject* ret = get("Prev", "");
37   if (doc) {ret = doc->resolveReference(ret);}
38   if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfDictionary*)ret;
39   // TODO(edisonn): warn about missing default value for optional fields
40   return NULL;
41 }
42 
has_Prev() const43 bool SkPdfOutlineItemDictionary::has_Prev() const {
44   return get("Prev", "") != NULL;
45 }
46 
Next(SkPdfNativeDoc * doc)47 SkPdfDictionary* SkPdfOutlineItemDictionary::Next(SkPdfNativeDoc* doc) {
48   SkPdfNativeObject* ret = get("Next", "");
49   if (doc) {ret = doc->resolveReference(ret);}
50   if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfDictionary*)ret;
51   // TODO(edisonn): warn about missing default value for optional fields
52   return NULL;
53 }
54 
has_Next() const55 bool SkPdfOutlineItemDictionary::has_Next() const {
56   return get("Next", "") != NULL;
57 }
58 
First(SkPdfNativeDoc * doc)59 SkPdfDictionary* SkPdfOutlineItemDictionary::First(SkPdfNativeDoc* doc) {
60   SkPdfNativeObject* ret = get("First", "");
61   if (doc) {ret = doc->resolveReference(ret);}
62   if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfDictionary*)ret;
63   // TODO(edisonn): warn about missing default value for optional fields
64   return NULL;
65 }
66 
has_First() const67 bool SkPdfOutlineItemDictionary::has_First() const {
68   return get("First", "") != NULL;
69 }
70 
Last(SkPdfNativeDoc * doc)71 SkPdfDictionary* SkPdfOutlineItemDictionary::Last(SkPdfNativeDoc* doc) {
72   SkPdfNativeObject* ret = get("Last", "");
73   if (doc) {ret = doc->resolveReference(ret);}
74   if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfDictionary*)ret;
75   // TODO(edisonn): warn about missing default value for optional fields
76   return NULL;
77 }
78 
has_Last() const79 bool SkPdfOutlineItemDictionary::has_Last() const {
80   return get("Last", "") != NULL;
81 }
82 
Count(SkPdfNativeDoc * doc)83 int64_t SkPdfOutlineItemDictionary::Count(SkPdfNativeDoc* doc) {
84   SkPdfNativeObject* ret = get("Count", "");
85   if (doc) {ret = doc->resolveReference(ret);}
86   if ((ret != NULL && ret->isInteger()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->intValue();
87   // TODO(edisonn): warn about missing default value for optional fields
88   return 0;
89 }
90 
has_Count() const91 bool SkPdfOutlineItemDictionary::has_Count() const {
92   return get("Count", "") != NULL;
93 }
94 
isDestAName(SkPdfNativeDoc * doc)95 bool SkPdfOutlineItemDictionary::isDestAName(SkPdfNativeDoc* doc) {
96   SkPdfNativeObject* ret = get("Dest", "");
97   if (doc) {ret = doc->resolveReference(ret);}
98   return ret != NULL && ret->isName();
99 }
100 
getDestAsName(SkPdfNativeDoc * doc)101 SkString SkPdfOutlineItemDictionary::getDestAsName(SkPdfNativeDoc* doc) {
102   SkPdfNativeObject* ret = get("Dest", "");
103   if (doc) {ret = doc->resolveReference(ret);}
104   if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->nameValue2();
105   // TODO(edisonn): warn about missing default value for optional fields
106   return SkString();
107 }
108 
isDestAString(SkPdfNativeDoc * doc)109 bool SkPdfOutlineItemDictionary::isDestAString(SkPdfNativeDoc* doc) {
110   SkPdfNativeObject* ret = get("Dest", "");
111   if (doc) {ret = doc->resolveReference(ret);}
112   return ret != NULL && ret->isAnyString();
113 }
114 
getDestAsString(SkPdfNativeDoc * doc)115 SkString SkPdfOutlineItemDictionary::getDestAsString(SkPdfNativeDoc* doc) {
116   SkPdfNativeObject* ret = get("Dest", "");
117   if (doc) {ret = doc->resolveReference(ret);}
118   if ((ret != NULL && ret->isAnyString()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->stringValue2();
119   // TODO(edisonn): warn about missing default value for optional fields
120   return SkString();
121 }
122 
isDestAArray(SkPdfNativeDoc * doc)123 bool SkPdfOutlineItemDictionary::isDestAArray(SkPdfNativeDoc* doc) {
124   SkPdfNativeObject* ret = get("Dest", "");
125   if (doc) {ret = doc->resolveReference(ret);}
126   return ret != NULL && ret->isArray();
127 }
128 
getDestAsArray(SkPdfNativeDoc * doc)129 SkPdfArray* SkPdfOutlineItemDictionary::getDestAsArray(SkPdfNativeDoc* doc) {
130   SkPdfNativeObject* ret = get("Dest", "");
131   if (doc) {ret = doc->resolveReference(ret);}
132   if ((ret != NULL && ret->isArray()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfArray*)ret;
133   // TODO(edisonn): warn about missing default value for optional fields
134   return NULL;
135 }
136 
has_Dest() const137 bool SkPdfOutlineItemDictionary::has_Dest() const {
138   return get("Dest", "") != NULL;
139 }
140 
A(SkPdfNativeDoc * doc)141 SkPdfDictionary* SkPdfOutlineItemDictionary::A(SkPdfNativeDoc* doc) {
142   SkPdfNativeObject* ret = get("A", "");
143   if (doc) {ret = doc->resolveReference(ret);}
144   if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfDictionary*)ret;
145   // TODO(edisonn): warn about missing default value for optional fields
146   return NULL;
147 }
148 
has_A() const149 bool SkPdfOutlineItemDictionary::has_A() const {
150   return get("A", "") != NULL;
151 }
152 
SE(SkPdfNativeDoc * doc)153 SkPdfDictionary* SkPdfOutlineItemDictionary::SE(SkPdfNativeDoc* doc) {
154   SkPdfNativeObject* ret = get("SE", "");
155   if (doc) {ret = doc->resolveReference(ret);}
156   if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfDictionary*)ret;
157   // TODO(edisonn): warn about missing default value for optional fields
158   return NULL;
159 }
160 
has_SE() const161 bool SkPdfOutlineItemDictionary::has_SE() const {
162   return get("SE", "") != NULL;
163 }
164 
C(SkPdfNativeDoc * doc)165 SkPdfArray* SkPdfOutlineItemDictionary::C(SkPdfNativeDoc* doc) {
166   SkPdfNativeObject* ret = get("C", "");
167   if (doc) {ret = doc->resolveReference(ret);}
168   if ((ret != NULL && ret->isArray()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfArray*)ret;
169   // TODO(edisonn): warn about missing default value for optional fields
170   return NULL;
171 }
172 
has_C() const173 bool SkPdfOutlineItemDictionary::has_C() const {
174   return get("C", "") != NULL;
175 }
176 
F(SkPdfNativeDoc * doc)177 int64_t SkPdfOutlineItemDictionary::F(SkPdfNativeDoc* doc) {
178   SkPdfNativeObject* ret = get("F", "");
179   if (doc) {ret = doc->resolveReference(ret);}
180   if ((ret != NULL && ret->isInteger()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->intValue();
181   // TODO(edisonn): warn about missing default value for optional fields
182   return 0;
183 }
184 
has_F() const185 bool SkPdfOutlineItemDictionary::has_F() const {
186   return get("F", "") != NULL;
187 }
188