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 "SkPdfResourceDictionary_autogen.h"
9 #include "SkPdfNativeDoc.h"
10 
ExtGState(SkPdfNativeDoc * doc)11 SkPdfDictionary* SkPdfResourceDictionary::ExtGState(SkPdfNativeDoc* doc) {
12   SkPdfNativeObject* ret = get("ExtGState", "");
13   if (doc) {ret = doc->resolveReference(ret);}
14   if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfDictionary*)ret;
15   // TODO(edisonn): warn about missing default value for optional fields
16   return NULL;
17 }
18 
has_ExtGState() const19 bool SkPdfResourceDictionary::has_ExtGState() const {
20   return get("ExtGState", "") != NULL;
21 }
22 
ColorSpace(SkPdfNativeDoc * doc)23 SkPdfDictionary* SkPdfResourceDictionary::ColorSpace(SkPdfNativeDoc* doc) {
24   SkPdfNativeObject* ret = get("ColorSpace", "");
25   if (doc) {ret = doc->resolveReference(ret);}
26   if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfDictionary*)ret;
27   // TODO(edisonn): warn about missing default value for optional fields
28   return NULL;
29 }
30 
has_ColorSpace() const31 bool SkPdfResourceDictionary::has_ColorSpace() const {
32   return get("ColorSpace", "") != NULL;
33 }
34 
Pattern(SkPdfNativeDoc * doc)35 SkPdfDictionary* SkPdfResourceDictionary::Pattern(SkPdfNativeDoc* doc) {
36   SkPdfNativeObject* ret = get("Pattern", "");
37   if (doc) {ret = doc->resolveReference(ret);}
38   if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfDictionary*)ret;
39   // TODO(edisonn): warn about missing default value for optional fields
40   return NULL;
41 }
42 
has_Pattern() const43 bool SkPdfResourceDictionary::has_Pattern() const {
44   return get("Pattern", "") != NULL;
45 }
46 
Shading(SkPdfNativeDoc * doc)47 SkPdfDictionary* SkPdfResourceDictionary::Shading(SkPdfNativeDoc* doc) {
48   SkPdfNativeObject* ret = get("Shading", "");
49   if (doc) {ret = doc->resolveReference(ret);}
50   if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfDictionary*)ret;
51   // TODO(edisonn): warn about missing default value for optional fields
52   return NULL;
53 }
54 
has_Shading() const55 bool SkPdfResourceDictionary::has_Shading() const {
56   return get("Shading", "") != NULL;
57 }
58 
XObject(SkPdfNativeDoc * doc)59 SkPdfDictionary* SkPdfResourceDictionary::XObject(SkPdfNativeDoc* doc) {
60   SkPdfNativeObject* ret = get("XObject", "");
61   if (doc) {ret = doc->resolveReference(ret);}
62   if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfDictionary*)ret;
63   // TODO(edisonn): warn about missing default value for optional fields
64   return NULL;
65 }
66 
has_XObject() const67 bool SkPdfResourceDictionary::has_XObject() const {
68   return get("XObject", "") != NULL;
69 }
70 
Font(SkPdfNativeDoc * doc)71 SkPdfDictionary* SkPdfResourceDictionary::Font(SkPdfNativeDoc* doc) {
72   SkPdfNativeObject* ret = get("Font", "");
73   if (doc) {ret = doc->resolveReference(ret);}
74   if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfDictionary*)ret;
75   // TODO(edisonn): warn about missing default value for optional fields
76   return NULL;
77 }
78 
has_Font() const79 bool SkPdfResourceDictionary::has_Font() const {
80   return get("Font", "") != NULL;
81 }
82 
ProcSet(SkPdfNativeDoc * doc)83 SkPdfArray* SkPdfResourceDictionary::ProcSet(SkPdfNativeDoc* doc) {
84   SkPdfNativeObject* ret = get("ProcSet", "");
85   if (doc) {ret = doc->resolveReference(ret);}
86   if ((ret != NULL && ret->isArray()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfArray*)ret;
87   // TODO(edisonn): warn about missing default value for optional fields
88   return NULL;
89 }
90 
has_ProcSet() const91 bool SkPdfResourceDictionary::has_ProcSet() const {
92   return get("ProcSet", "") != NULL;
93 }
94 
Properties(SkPdfNativeDoc * doc)95 SkPdfDictionary* SkPdfResourceDictionary::Properties(SkPdfNativeDoc* doc) {
96   SkPdfNativeObject* ret = get("Properties", "");
97   if (doc) {ret = doc->resolveReference(ret);}
98   if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfDictionary*)ret;
99   // TODO(edisonn): warn about missing default value for optional fields
100   return NULL;
101 }
102 
has_Properties() const103 bool SkPdfResourceDictionary::has_Properties() const {
104   return get("Properties", "") != NULL;
105 }
106