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 "SkPdfInlineLevelStructureElementsDictionary_autogen.h" 9 #include "SkPdfNativeDoc.h" 10 11 bool SkPdfInlineLevelStructureElementsDictionary::isLineHeightANumber(SkPdfNativeDoc* doc) { 12 SkPdfNativeObject* ret = get("LineHeight", ""); 13 if (doc) {ret = doc->resolveReference(ret);} 14 return ret != NULL && ret->isNumber(); 15 } 16 17 double SkPdfInlineLevelStructureElementsDictionary::getLineHeightAsNumber(SkPdfNativeDoc* doc) { 18 SkPdfNativeObject* ret = get("LineHeight", ""); 19 if (doc) {ret = doc->resolveReference(ret);} 20 if ((ret != NULL && ret->isNumber()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->numberValue(); 21 // TODO(edisonn): warn about missing default value for optional fields 22 return 0; 23 } 24 25 bool SkPdfInlineLevelStructureElementsDictionary::isLineHeightAName(SkPdfNativeDoc* doc) { 26 SkPdfNativeObject* ret = get("LineHeight", ""); 27 if (doc) {ret = doc->resolveReference(ret);} 28 return ret != NULL && ret->isName(); 29 } 30 31 SkString SkPdfInlineLevelStructureElementsDictionary::getLineHeightAsName(SkPdfNativeDoc* doc) { 32 SkPdfNativeObject* ret = get("LineHeight", ""); 33 if (doc) {ret = doc->resolveReference(ret);} 34 if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->nameValue2(); 35 // TODO(edisonn): warn about missing default value for optional fields 36 return SkString(); 37 } 38 39 bool SkPdfInlineLevelStructureElementsDictionary::has_LineHeight() const { 40 return get("LineHeight", "") != NULL; 41 } 42