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 "SkPdfDocumentInformationDictionary_autogen.h"
9 #include "SkPdfNativeDoc.h"
10 
Title(SkPdfNativeDoc * doc)11 SkString SkPdfDocumentInformationDictionary::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 default value for optional fields
16   return SkString();
17 }
18 
has_Title() const19 bool SkPdfDocumentInformationDictionary::has_Title() const {
20   return get("Title", "") != NULL;
21 }
22 
Author(SkPdfNativeDoc * doc)23 SkString SkPdfDocumentInformationDictionary::Author(SkPdfNativeDoc* doc) {
24   SkPdfNativeObject* ret = get("Author", "");
25   if (doc) {ret = doc->resolveReference(ret);}
26   if ((ret != NULL && ret->isAnyString()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->stringValue2();
27   // TODO(edisonn): warn about missing default value for optional fields
28   return SkString();
29 }
30 
has_Author() const31 bool SkPdfDocumentInformationDictionary::has_Author() const {
32   return get("Author", "") != NULL;
33 }
34 
Subject(SkPdfNativeDoc * doc)35 SkString SkPdfDocumentInformationDictionary::Subject(SkPdfNativeDoc* doc) {
36   SkPdfNativeObject* ret = get("Subject", "");
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 default value for optional fields
40   return SkString();
41 }
42 
has_Subject() const43 bool SkPdfDocumentInformationDictionary::has_Subject() const {
44   return get("Subject", "") != NULL;
45 }
46 
Keywords(SkPdfNativeDoc * doc)47 SkString SkPdfDocumentInformationDictionary::Keywords(SkPdfNativeDoc* doc) {
48   SkPdfNativeObject* ret = get("Keywords", "");
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_Keywords() const55 bool SkPdfDocumentInformationDictionary::has_Keywords() const {
56   return get("Keywords", "") != NULL;
57 }
58 
Creator(SkPdfNativeDoc * doc)59 SkString SkPdfDocumentInformationDictionary::Creator(SkPdfNativeDoc* doc) {
60   SkPdfNativeObject* ret = get("Creator", "");
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 default value for optional fields
64   return SkString();
65 }
66 
has_Creator() const67 bool SkPdfDocumentInformationDictionary::has_Creator() const {
68   return get("Creator", "") != NULL;
69 }
70 
Producer(SkPdfNativeDoc * doc)71 SkString SkPdfDocumentInformationDictionary::Producer(SkPdfNativeDoc* doc) {
72   SkPdfNativeObject* ret = get("Producer", "");
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_Producer() const79 bool SkPdfDocumentInformationDictionary::has_Producer() const {
80   return get("Producer", "") != NULL;
81 }
82 
CreationDate(SkPdfNativeDoc * doc)83 SkPdfDate SkPdfDocumentInformationDictionary::CreationDate(SkPdfNativeDoc* doc) {
84   SkPdfNativeObject* ret = get("CreationDate", "");
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_CreationDate() const91 bool SkPdfDocumentInformationDictionary::has_CreationDate() const {
92   return get("CreationDate", "") != NULL;
93 }
94 
ModDate(SkPdfNativeDoc * doc)95 SkPdfDate SkPdfDocumentInformationDictionary::ModDate(SkPdfNativeDoc* doc) {
96   SkPdfNativeObject* ret = get("ModDate", "");
97   if (doc) {ret = doc->resolveReference(ret);}
98   if ((ret != NULL && ret->isDate()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->dateValue();
99   // TODO(edisonn): warn about missing default value for optional fields
100   return SkPdfDate();
101 }
102 
has_ModDate() const103 bool SkPdfDocumentInformationDictionary::has_ModDate() const {
104   return get("ModDate", "") != NULL;
105 }
106 
Trapped(SkPdfNativeDoc * doc)107 SkString SkPdfDocumentInformationDictionary::Trapped(SkPdfNativeDoc* doc) {
108   SkPdfNativeObject* ret = get("Trapped", "");
109   if (doc) {ret = doc->resolveReference(ret);}
110   if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->nameValue2();
111   // TODO(edisonn): warn about missing default value for optional fields
112   return SkString();
113 }
114 
has_Trapped() const115 bool SkPdfDocumentInformationDictionary::has_Trapped() const {
116   return get("Trapped", "") != NULL;
117 }
118