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 11SkString 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 19bool SkPdfDocumentInformationDictionary::has_Title() const { 20 return get("Title", "") != NULL; 21} 22 23SkString 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 31bool SkPdfDocumentInformationDictionary::has_Author() const { 32 return get("Author", "") != NULL; 33} 34 35SkString 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 43bool SkPdfDocumentInformationDictionary::has_Subject() const { 44 return get("Subject", "") != NULL; 45} 46 47SkString 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 55bool SkPdfDocumentInformationDictionary::has_Keywords() const { 56 return get("Keywords", "") != NULL; 57} 58 59SkString 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 67bool SkPdfDocumentInformationDictionary::has_Creator() const { 68 return get("Creator", "") != NULL; 69} 70 71SkString 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 79bool SkPdfDocumentInformationDictionary::has_Producer() const { 80 return get("Producer", "") != NULL; 81} 82 83SkPdfDate 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 91bool SkPdfDocumentInformationDictionary::has_CreationDate() const { 92 return get("CreationDate", "") != NULL; 93} 94 95SkPdfDate 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 103bool SkPdfDocumentInformationDictionary::has_ModDate() const { 104 return get("ModDate", "") != NULL; 105} 106 107SkString 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 115bool SkPdfDocumentInformationDictionary::has_Trapped() const { 116 return get("Trapped", "") != NULL; 117} 118