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 "SkPdfHideActionDictionary_autogen.h" 9 #include "SkPdfNativeDoc.h" 10 11 SkString SkPdfHideActionDictionary::S(SkPdfNativeDoc* doc) { 12 SkPdfNativeObject* ret = get("S", ""); 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 SkPdfHideActionDictionary::has_S() const { 20 return get("S", "") != NULL; 21 } 22 23 bool SkPdfHideActionDictionary::isTADictionary(SkPdfNativeDoc* doc) { 24 SkPdfNativeObject* ret = get("T", ""); 25 if (doc) {ret = doc->resolveReference(ret);} 26 return ret != NULL && ret->isDictionary(); 27 } 28 29 SkPdfDictionary* SkPdfHideActionDictionary::getTAsDictionary(SkPdfNativeDoc* doc) { 30 SkPdfNativeObject* ret = get("T", ""); 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 required field, assert for known good pdfs 34 return NULL; 35 } 36 37 bool SkPdfHideActionDictionary::isTAString(SkPdfNativeDoc* doc) { 38 SkPdfNativeObject* ret = get("T", ""); 39 if (doc) {ret = doc->resolveReference(ret);} 40 return ret != NULL && ret->isAnyString(); 41 } 42 43 SkString SkPdfHideActionDictionary::getTAsString(SkPdfNativeDoc* doc) { 44 SkPdfNativeObject* ret = get("T", ""); 45 if (doc) {ret = doc->resolveReference(ret);} 46 if ((ret != NULL && ret->isAnyString()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->stringValue2(); 47 // TODO(edisonn): warn about missing required field, assert for known good pdfs 48 return SkString(); 49 } 50 51 bool SkPdfHideActionDictionary::isTAArray(SkPdfNativeDoc* doc) { 52 SkPdfNativeObject* ret = get("T", ""); 53 if (doc) {ret = doc->resolveReference(ret);} 54 return ret != NULL && ret->isArray(); 55 } 56 57 SkPdfArray* SkPdfHideActionDictionary::getTAsArray(SkPdfNativeDoc* doc) { 58 SkPdfNativeObject* ret = get("T", ""); 59 if (doc) {ret = doc->resolveReference(ret);} 60 if ((ret != NULL && ret->isArray()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfArray*)ret; 61 // TODO(edisonn): warn about missing required field, assert for known good pdfs 62 return NULL; 63 } 64 65 bool SkPdfHideActionDictionary::has_T() const { 66 return get("T", "") != NULL; 67 } 68 69 bool SkPdfHideActionDictionary::H(SkPdfNativeDoc* doc) { 70 SkPdfNativeObject* ret = get("H", ""); 71 if (doc) {ret = doc->resolveReference(ret);} 72 if ((ret != NULL && ret->isBoolean()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->boolValue(); 73 // TODO(edisonn): warn about missing default value for optional fields 74 return false; 75 } 76 77 bool SkPdfHideActionDictionary::has_H() const { 78 return get("H", "") != NULL; 79 } 80