• 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 "SkPdfWebCaptureDictionary_autogen.h"
9 #include "SkPdfNativeDoc.h"
10 
Type(SkPdfNativeDoc * doc)11 SkString SkPdfWebCaptureDictionary::Type(SkPdfNativeDoc* doc) {
12   SkPdfNativeObject* ret = get("Type", "");
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 default value for optional fields
16   return SkString();
17 }
18 
has_Type() const19 bool SkPdfWebCaptureDictionary::has_Type() const {
20   return get("Type", "") != NULL;
21 }
22 
S(SkPdfNativeDoc * doc)23 SkString SkPdfWebCaptureDictionary::S(SkPdfNativeDoc* doc) {
24   SkPdfNativeObject* ret = get("S", "");
25   if (doc) {ret = doc->resolveReference(ret);}
26   if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->nameValue2();
27   // TODO(edisonn): warn about missing required field, assert for known good pdfs
28   return SkString();
29 }
30 
has_S() const31 bool SkPdfWebCaptureDictionary::has_S() const {
32   return get("S", "") != NULL;
33 }
34 
ID(SkPdfNativeDoc * doc)35 SkString SkPdfWebCaptureDictionary::ID(SkPdfNativeDoc* doc) {
36   SkPdfNativeObject* ret = get("ID", "");
37   if (doc) {ret = doc->resolveReference(ret);}
38   if ((ret != NULL && ret->isAnyString()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->stringValue2();
39   // TODO(edisonn): warn about missing required field, assert for known good pdfs
40   return SkString();
41 }
42 
has_ID() const43 bool SkPdfWebCaptureDictionary::has_ID() const {
44   return get("ID", "") != NULL;
45 }
46 
O(SkPdfNativeDoc * doc)47 SkPdfArray* SkPdfWebCaptureDictionary::O(SkPdfNativeDoc* doc) {
48   SkPdfNativeObject* ret = get("O", "");
49   if (doc) {ret = doc->resolveReference(ret);}
50   if ((ret != NULL && ret->isArray()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfArray*)ret;
51   // TODO(edisonn): warn about missing required field, assert for known good pdfs
52   return NULL;
53 }
54 
has_O() const55 bool SkPdfWebCaptureDictionary::has_O() const {
56   return get("O", "") != NULL;
57 }
58 
isSIADictionary(SkPdfNativeDoc * doc)59 bool SkPdfWebCaptureDictionary::isSIADictionary(SkPdfNativeDoc* doc) {
60   SkPdfNativeObject* ret = get("SI", "");
61   if (doc) {ret = doc->resolveReference(ret);}
62   return ret != NULL && ret->isDictionary();
63 }
64 
getSIAsDictionary(SkPdfNativeDoc * doc)65 SkPdfDictionary* SkPdfWebCaptureDictionary::getSIAsDictionary(SkPdfNativeDoc* doc) {
66   SkPdfNativeObject* ret = get("SI", "");
67   if (doc) {ret = doc->resolveReference(ret);}
68   if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfDictionary*)ret;
69   // TODO(edisonn): warn about missing required field, assert for known good pdfs
70   return NULL;
71 }
72 
isSIAArray(SkPdfNativeDoc * doc)73 bool SkPdfWebCaptureDictionary::isSIAArray(SkPdfNativeDoc* doc) {
74   SkPdfNativeObject* ret = get("SI", "");
75   if (doc) {ret = doc->resolveReference(ret);}
76   return ret != NULL && ret->isArray();
77 }
78 
getSIAsArray(SkPdfNativeDoc * doc)79 SkPdfArray* SkPdfWebCaptureDictionary::getSIAsArray(SkPdfNativeDoc* doc) {
80   SkPdfNativeObject* ret = get("SI", "");
81   if (doc) {ret = doc->resolveReference(ret);}
82   if ((ret != NULL && ret->isArray()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfArray*)ret;
83   // TODO(edisonn): warn about missing required field, assert for known good pdfs
84   return NULL;
85 }
86 
has_SI() const87 bool SkPdfWebCaptureDictionary::has_SI() const {
88   return get("SI", "") != NULL;
89 }
90 
CT(SkPdfNativeDoc * doc)91 SkString SkPdfWebCaptureDictionary::CT(SkPdfNativeDoc* doc) {
92   SkPdfNativeObject* ret = get("CT", "");
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 
has_CT() const99 bool SkPdfWebCaptureDictionary::has_CT() const {
100   return get("CT", "") != NULL;
101 }
102 
TS(SkPdfNativeDoc * doc)103 SkPdfDate SkPdfWebCaptureDictionary::TS(SkPdfNativeDoc* doc) {
104   SkPdfNativeObject* ret = get("TS", "");
105   if (doc) {ret = doc->resolveReference(ret);}
106   if ((ret != NULL && ret->isDate()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->dateValue();
107   // TODO(edisonn): warn about missing default value for optional fields
108   return SkPdfDate();
109 }
110 
has_TS() const111 bool SkPdfWebCaptureDictionary::has_TS() const {
112   return get("TS", "") != NULL;
113 }
114