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 "SkPdfSignatureDictionary_autogen.h"
9 #include "SkPdfNativeDoc.h"
10 
Type(SkPdfNativeDoc * doc)11 SkString SkPdfSignatureDictionary::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 SkPdfSignatureDictionary::has_Type() const {
20   return get("Type", "") != NULL;
21 }
22 
Filter(SkPdfNativeDoc * doc)23 SkString SkPdfSignatureDictionary::Filter(SkPdfNativeDoc* doc) {
24   SkPdfNativeObject* ret = get("Filter", "");
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_Filter() const31 bool SkPdfSignatureDictionary::has_Filter() const {
32   return get("Filter", "") != NULL;
33 }
34 
SubFilter(SkPdfNativeDoc * doc)35 SkString SkPdfSignatureDictionary::SubFilter(SkPdfNativeDoc* doc) {
36   SkPdfNativeObject* ret = get("SubFilter", "");
37   if (doc) {ret = doc->resolveReference(ret);}
38   if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->nameValue2();
39   // TODO(edisonn): warn about missing default value for optional fields
40   return SkString();
41 }
42 
has_SubFilter() const43 bool SkPdfSignatureDictionary::has_SubFilter() const {
44   return get("SubFilter", "") != NULL;
45 }
46 
ByteRange(SkPdfNativeDoc * doc)47 SkPdfArray* SkPdfSignatureDictionary::ByteRange(SkPdfNativeDoc* doc) {
48   SkPdfNativeObject* ret = get("ByteRange", "");
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_ByteRange() const55 bool SkPdfSignatureDictionary::has_ByteRange() const {
56   return get("ByteRange", "") != NULL;
57 }
58 
Contents(SkPdfNativeDoc * doc)59 SkString SkPdfSignatureDictionary::Contents(SkPdfNativeDoc* doc) {
60   SkPdfNativeObject* ret = get("Contents", "");
61   if (doc) {ret = doc->resolveReference(ret);}
62   if ((ret != NULL && ret->isAnyString()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->stringValue2();
63   // TODO(edisonn): warn about missing required field, assert for known good pdfs
64   return SkString();
65 }
66 
has_Contents() const67 bool SkPdfSignatureDictionary::has_Contents() const {
68   return get("Contents", "") != NULL;
69 }
70 
Name(SkPdfNativeDoc * doc)71 SkString SkPdfSignatureDictionary::Name(SkPdfNativeDoc* doc) {
72   SkPdfNativeObject* ret = get("Name", "");
73   if (doc) {ret = doc->resolveReference(ret);}
74   if ((ret != NULL && ret->isAnyString()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->stringValue2();
75   // TODO(edisonn): warn about missing default value for optional fields
76   return SkString();
77 }
78 
has_Name() const79 bool SkPdfSignatureDictionary::has_Name() const {
80   return get("Name", "") != NULL;
81 }
82 
M(SkPdfNativeDoc * doc)83 SkPdfDate SkPdfSignatureDictionary::M(SkPdfNativeDoc* doc) {
84   SkPdfNativeObject* ret = get("M", "");
85   if (doc) {ret = doc->resolveReference(ret);}
86   if ((ret != NULL && ret->isDate()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->dateValue();
87   // TODO(edisonn): warn about missing default value for optional fields
88   return SkPdfDate();
89 }
90 
has_M() const91 bool SkPdfSignatureDictionary::has_M() const {
92   return get("M", "") != NULL;
93 }
94 
Location(SkPdfNativeDoc * doc)95 SkString SkPdfSignatureDictionary::Location(SkPdfNativeDoc* doc) {
96   SkPdfNativeObject* ret = get("Location", "");
97   if (doc) {ret = doc->resolveReference(ret);}
98   if ((ret != NULL && ret->isAnyString()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->stringValue2();
99   // TODO(edisonn): warn about missing default value for optional fields
100   return SkString();
101 }
102 
has_Location() const103 bool SkPdfSignatureDictionary::has_Location() const {
104   return get("Location", "") != NULL;
105 }
106 
Reason(SkPdfNativeDoc * doc)107 SkString SkPdfSignatureDictionary::Reason(SkPdfNativeDoc* doc) {
108   SkPdfNativeObject* ret = get("Reason", "");
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_Reason() const115 bool SkPdfSignatureDictionary::has_Reason() const {
116   return get("Reason", "") != NULL;
117 }
118