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 "SkPdfStructureTreeRootDictionary_autogen.h" 9 #include "SkPdfNativeDoc.h" 10 11 SkString SkPdfStructureTreeRootDictionary::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 required field, assert for known good pdfs 16 return SkString(); 17 } 18 19 bool SkPdfStructureTreeRootDictionary::has_Type() const { 20 return get("Type", "") != NULL; 21 } 22 23 bool SkPdfStructureTreeRootDictionary::isKADictionary(SkPdfNativeDoc* doc) { 24 SkPdfNativeObject* ret = get("K", ""); 25 if (doc) {ret = doc->resolveReference(ret);} 26 return ret != NULL && ret->isDictionary(); 27 } 28 29 SkPdfDictionary* SkPdfStructureTreeRootDictionary::getKAsDictionary(SkPdfNativeDoc* doc) { 30 SkPdfNativeObject* ret = get("K", ""); 31 if (doc) {ret = doc->resolveReference(ret);} 32 if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfDictionary*)ret; 33 // TODO(edisonn): warn about missing default value for optional fields 34 return NULL; 35 } 36 37 bool SkPdfStructureTreeRootDictionary::isKAArray(SkPdfNativeDoc* doc) { 38 SkPdfNativeObject* ret = get("K", ""); 39 if (doc) {ret = doc->resolveReference(ret);} 40 return ret != NULL && ret->isArray(); 41 } 42 43 SkPdfArray* SkPdfStructureTreeRootDictionary::getKAsArray(SkPdfNativeDoc* doc) { 44 SkPdfNativeObject* ret = get("K", ""); 45 if (doc) {ret = doc->resolveReference(ret);} 46 if ((ret != NULL && ret->isArray()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfArray*)ret; 47 // TODO(edisonn): warn about missing default value for optional fields 48 return NULL; 49 } 50 51 bool SkPdfStructureTreeRootDictionary::has_K() const { 52 return get("K", "") != NULL; 53 } 54 55 bool SkPdfStructureTreeRootDictionary::isIDTreeAName(SkPdfNativeDoc* doc) { 56 SkPdfNativeObject* ret = get("IDTree", ""); 57 if (doc) {ret = doc->resolveReference(ret);} 58 return ret != NULL && ret->isName(); 59 } 60 61 SkString SkPdfStructureTreeRootDictionary::getIDTreeAsName(SkPdfNativeDoc* doc) { 62 SkPdfNativeObject* ret = get("IDTree", ""); 63 if (doc) {ret = doc->resolveReference(ret);} 64 if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->nameValue2(); 65 // TODO(edisonn): warn about missing default value for optional fields 66 return SkString(); 67 } 68 69 bool SkPdfStructureTreeRootDictionary::isIDTreeATree(SkPdfNativeDoc* doc) { 70 SkPdfNativeObject* ret = get("IDTree", ""); 71 if (doc) {ret = doc->resolveReference(ret);} 72 return ret != NULL && false; 73 } 74 75 SkPdfTree SkPdfStructureTreeRootDictionary::getIDTreeAsTree(SkPdfNativeDoc* doc) { 76 SkPdfNativeObject* ret = get("IDTree", ""); 77 if (doc) {ret = doc->resolveReference(ret);} 78 if ((ret != NULL && false) || (doc == NULL && ret != NULL && ret->isReference())) return ret->treeValue(); 79 // TODO(edisonn): warn about missing default value for optional fields 80 return SkPdfTree(); 81 } 82 83 bool SkPdfStructureTreeRootDictionary::has_IDTree() const { 84 return get("IDTree", "") != NULL; 85 } 86 87 bool SkPdfStructureTreeRootDictionary::isParentTreeANumber(SkPdfNativeDoc* doc) { 88 SkPdfNativeObject* ret = get("ParentTree", ""); 89 if (doc) {ret = doc->resolveReference(ret);} 90 return ret != NULL && ret->isNumber(); 91 } 92 93 double SkPdfStructureTreeRootDictionary::getParentTreeAsNumber(SkPdfNativeDoc* doc) { 94 SkPdfNativeObject* ret = get("ParentTree", ""); 95 if (doc) {ret = doc->resolveReference(ret);} 96 if ((ret != NULL && ret->isNumber()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->numberValue(); 97 // TODO(edisonn): warn about missing default value for optional fields 98 return 0; 99 } 100 101 bool SkPdfStructureTreeRootDictionary::isParentTreeATree(SkPdfNativeDoc* doc) { 102 SkPdfNativeObject* ret = get("ParentTree", ""); 103 if (doc) {ret = doc->resolveReference(ret);} 104 return ret != NULL && false; 105 } 106 107 SkPdfTree SkPdfStructureTreeRootDictionary::getParentTreeAsTree(SkPdfNativeDoc* doc) { 108 SkPdfNativeObject* ret = get("ParentTree", ""); 109 if (doc) {ret = doc->resolveReference(ret);} 110 if ((ret != NULL && false) || (doc == NULL && ret != NULL && ret->isReference())) return ret->treeValue(); 111 // TODO(edisonn): warn about missing default value for optional fields 112 return SkPdfTree(); 113 } 114 115 bool SkPdfStructureTreeRootDictionary::has_ParentTree() const { 116 return get("ParentTree", "") != NULL; 117 } 118 119 int64_t SkPdfStructureTreeRootDictionary::ParentTreeNextKey(SkPdfNativeDoc* doc) { 120 SkPdfNativeObject* ret = get("ParentTreeNextKey", ""); 121 if (doc) {ret = doc->resolveReference(ret);} 122 if ((ret != NULL && ret->isInteger()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->intValue(); 123 // TODO(edisonn): warn about missing default value for optional fields 124 return 0; 125 } 126 127 bool SkPdfStructureTreeRootDictionary::has_ParentTreeNextKey() const { 128 return get("ParentTreeNextKey", "") != NULL; 129 } 130 131 SkPdfDictionary* SkPdfStructureTreeRootDictionary::RoleMap(SkPdfNativeDoc* doc) { 132 SkPdfNativeObject* ret = get("RoleMap", ""); 133 if (doc) {ret = doc->resolveReference(ret);} 134 if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfDictionary*)ret; 135 // TODO(edisonn): warn about missing default value for optional fields 136 return NULL; 137 } 138 139 bool SkPdfStructureTreeRootDictionary::has_RoleMap() const { 140 return get("RoleMap", "") != NULL; 141 } 142 143 SkPdfDictionary* SkPdfStructureTreeRootDictionary::ClassMap(SkPdfNativeDoc* doc) { 144 SkPdfNativeObject* ret = get("ClassMap", ""); 145 if (doc) {ret = doc->resolveReference(ret);} 146 if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfDictionary*)ret; 147 // TODO(edisonn): warn about missing default value for optional fields 148 return NULL; 149 } 150 151 bool SkPdfStructureTreeRootDictionary::has_ClassMap() const { 152 return get("ClassMap", "") != NULL; 153 } 154