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 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 19 bool SkPdfWebCaptureDictionary::has_Type() const { 20 return get("Type", "") != NULL; 21 } 22 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 31 bool SkPdfWebCaptureDictionary::has_S() const { 32 return get("S", "") != NULL; 33 } 34 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 43 bool SkPdfWebCaptureDictionary::has_ID() const { 44 return get("ID", "") != NULL; 45 } 46 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 55 bool SkPdfWebCaptureDictionary::has_O() const { 56 return get("O", "") != NULL; 57 } 58 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 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 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 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 87 bool SkPdfWebCaptureDictionary::has_SI() const { 88 return get("SI", "") != NULL; 89 } 90 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 99 bool SkPdfWebCaptureDictionary::has_CT() const { 100 return get("CT", "") != NULL; 101 } 102 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 111 bool SkPdfWebCaptureDictionary::has_TS() const { 112 return get("TS", "") != NULL; 113 } 114