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 "SkPdfFileTrailerDictionary_autogen.h"
9 #include "SkPdfNativeDoc.h"
10
Size(SkPdfNativeDoc * doc)11 int64_t SkPdfFileTrailerDictionary::Size(SkPdfNativeDoc* doc) {
12 SkPdfNativeObject* ret = get("Size", "");
13 if (doc) {ret = doc->resolveReference(ret);}
14 if ((ret != NULL && ret->isInteger()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->intValue();
15 // TODO(edisonn): warn about missing required field, assert for known good pdfs
16 return 0;
17 }
18
has_Size() const19 bool SkPdfFileTrailerDictionary::has_Size() const {
20 return get("Size", "") != NULL;
21 }
22
Prev(SkPdfNativeDoc * doc)23 int64_t SkPdfFileTrailerDictionary::Prev(SkPdfNativeDoc* doc) {
24 SkPdfNativeObject* ret = get("Prev", "");
25 if (doc) {ret = doc->resolveReference(ret);}
26 if ((ret != NULL && ret->isInteger()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->intValue();
27 // TODO(edisonn): warn about missing default value for optional fields
28 return 0;
29 }
30
has_Prev() const31 bool SkPdfFileTrailerDictionary::has_Prev() const {
32 return get("Prev", "") != NULL;
33 }
34
Root(SkPdfNativeDoc * doc)35 SkPdfDictionary* SkPdfFileTrailerDictionary::Root(SkPdfNativeDoc* doc) {
36 SkPdfNativeObject* ret = get("Root", "");
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_Root() const43 bool SkPdfFileTrailerDictionary::has_Root() const {
44 return get("Root", "") != NULL;
45 }
46
Encrypt(SkPdfNativeDoc * doc)47 SkPdfDictionary* SkPdfFileTrailerDictionary::Encrypt(SkPdfNativeDoc* doc) {
48 SkPdfNativeObject* ret = get("Encrypt", "");
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_Encrypt() const55 bool SkPdfFileTrailerDictionary::has_Encrypt() const {
56 return get("Encrypt", "") != NULL;
57 }
58
Info(SkPdfNativeDoc * doc)59 SkPdfDictionary* SkPdfFileTrailerDictionary::Info(SkPdfNativeDoc* doc) {
60 SkPdfNativeObject* ret = get("Info", "");
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_Info() const67 bool SkPdfFileTrailerDictionary::has_Info() const {
68 return get("Info", "") != NULL;
69 }
70
ID(SkPdfNativeDoc * doc)71 SkPdfArray* SkPdfFileTrailerDictionary::ID(SkPdfNativeDoc* doc) {
72 SkPdfNativeObject* ret = get("ID", "");
73 if (doc) {ret = doc->resolveReference(ret);}
74 if ((ret != NULL && ret->isArray()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfArray*)ret;
75 // TODO(edisonn): warn about missing default value for optional fields
76 return NULL;
77 }
78
has_ID() const79 bool SkPdfFileTrailerDictionary::has_ID() const {
80 return get("ID", "") != NULL;
81 }
82