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 11SkString 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 19bool SkPdfStructureTreeRootDictionary::has_Type() const { 20 return get("Type", "") != NULL; 21} 22 23bool SkPdfStructureTreeRootDictionary::isKADictionary(SkPdfNativeDoc* doc) { 24 SkPdfNativeObject* ret = get("K", ""); 25 if (doc) {ret = doc->resolveReference(ret);} 26 return ret != NULL && ret->isDictionary(); 27} 28 29SkPdfDictionary* 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 37bool SkPdfStructureTreeRootDictionary::isKAArray(SkPdfNativeDoc* doc) { 38 SkPdfNativeObject* ret = get("K", ""); 39 if (doc) {ret = doc->resolveReference(ret);} 40 return ret != NULL && ret->isArray(); 41} 42 43SkPdfArray* 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 51bool SkPdfStructureTreeRootDictionary::has_K() const { 52 return get("K", "") != NULL; 53} 54 55bool SkPdfStructureTreeRootDictionary::isIDTreeAName(SkPdfNativeDoc* doc) { 56 SkPdfNativeObject* ret = get("IDTree", ""); 57 if (doc) {ret = doc->resolveReference(ret);} 58 return ret != NULL && ret->isName(); 59} 60 61SkString 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 69bool SkPdfStructureTreeRootDictionary::isIDTreeATree(SkPdfNativeDoc* doc) { 70 SkPdfNativeObject* ret = get("IDTree", ""); 71 if (doc) {ret = doc->resolveReference(ret);} 72 return ret != NULL && false; 73} 74 75SkPdfTree 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 83bool SkPdfStructureTreeRootDictionary::has_IDTree() const { 84 return get("IDTree", "") != NULL; 85} 86 87bool SkPdfStructureTreeRootDictionary::isParentTreeANumber(SkPdfNativeDoc* doc) { 88 SkPdfNativeObject* ret = get("ParentTree", ""); 89 if (doc) {ret = doc->resolveReference(ret);} 90 return ret != NULL && ret->isNumber(); 91} 92 93double 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 101bool SkPdfStructureTreeRootDictionary::isParentTreeATree(SkPdfNativeDoc* doc) { 102 SkPdfNativeObject* ret = get("ParentTree", ""); 103 if (doc) {ret = doc->resolveReference(ret);} 104 return ret != NULL && false; 105} 106 107SkPdfTree 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 115bool SkPdfStructureTreeRootDictionary::has_ParentTree() const { 116 return get("ParentTree", "") != NULL; 117} 118 119int64_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 127bool SkPdfStructureTreeRootDictionary::has_ParentTreeNextKey() const { 128 return get("ParentTreeNextKey", "") != NULL; 129} 130 131SkPdfDictionary* 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 139bool SkPdfStructureTreeRootDictionary::has_RoleMap() const { 140 return get("RoleMap", "") != NULL; 141} 142 143SkPdfDictionary* 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 151bool SkPdfStructureTreeRootDictionary::has_ClassMap() const { 152 return get("ClassMap", "") != NULL; 153} 154