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 "SkPdfWebCaptureImageSetDictionary_autogen.h"
9 #include "SkPdfNativeDoc.h"
10 
S(SkPdfNativeDoc * doc)11 SkString SkPdfWebCaptureImageSetDictionary::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 
has_S() const19 bool SkPdfWebCaptureImageSetDictionary::has_S() const {
20   return get("S", "") != NULL;
21 }
22 
isRAInteger(SkPdfNativeDoc * doc)23 bool SkPdfWebCaptureImageSetDictionary::isRAInteger(SkPdfNativeDoc* doc) {
24   SkPdfNativeObject* ret = get("R", "");
25   if (doc) {ret = doc->resolveReference(ret);}
26   return ret != NULL && ret->isInteger();
27 }
28 
getRAsInteger(SkPdfNativeDoc * doc)29 int64_t SkPdfWebCaptureImageSetDictionary::getRAsInteger(SkPdfNativeDoc* doc) {
30   SkPdfNativeObject* ret = get("R", "");
31   if (doc) {ret = doc->resolveReference(ret);}
32   if ((ret != NULL && ret->isInteger()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->intValue();
33   // TODO(edisonn): warn about missing required field, assert for known good pdfs
34   return 0;
35 }
36 
isRAArray(SkPdfNativeDoc * doc)37 bool SkPdfWebCaptureImageSetDictionary::isRAArray(SkPdfNativeDoc* doc) {
38   SkPdfNativeObject* ret = get("R", "");
39   if (doc) {ret = doc->resolveReference(ret);}
40   return ret != NULL && ret->isArray();
41 }
42 
getRAsArray(SkPdfNativeDoc * doc)43 SkPdfArray* SkPdfWebCaptureImageSetDictionary::getRAsArray(SkPdfNativeDoc* doc) {
44   SkPdfNativeObject* ret = get("R", "");
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 required field, assert for known good pdfs
48   return NULL;
49 }
50 
has_R() const51 bool SkPdfWebCaptureImageSetDictionary::has_R() const {
52   return get("R", "") != NULL;
53 }
54