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 "SkPdfSoundObjectDictionary_autogen.h"
9 #include "SkPdfNativeDoc.h"
10 
Type(SkPdfNativeDoc * doc)11 SkString SkPdfSoundObjectDictionary::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 default value for optional fields
16   return SkString();
17 }
18 
has_Type() const19 bool SkPdfSoundObjectDictionary::has_Type() const {
20   return get("Type", "") != NULL;
21 }
22 
R(SkPdfNativeDoc * doc)23 double SkPdfSoundObjectDictionary::R(SkPdfNativeDoc* doc) {
24   SkPdfNativeObject* ret = get("R", "");
25   if (doc) {ret = doc->resolveReference(ret);}
26   if ((ret != NULL && ret->isNumber()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->numberValue();
27   // TODO(edisonn): warn about missing required field, assert for known good pdfs
28   return 0;
29 }
30 
has_R() const31 bool SkPdfSoundObjectDictionary::has_R() const {
32   return get("R", "") != NULL;
33 }
34 
C(SkPdfNativeDoc * doc)35 int64_t SkPdfSoundObjectDictionary::C(SkPdfNativeDoc* doc) {
36   SkPdfNativeObject* ret = get("C", "");
37   if (doc) {ret = doc->resolveReference(ret);}
38   if ((ret != NULL && ret->isInteger()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->intValue();
39   // TODO(edisonn): warn about missing default value for optional fields
40   return 0;
41 }
42 
has_C() const43 bool SkPdfSoundObjectDictionary::has_C() const {
44   return get("C", "") != NULL;
45 }
46 
B(SkPdfNativeDoc * doc)47 int64_t SkPdfSoundObjectDictionary::B(SkPdfNativeDoc* doc) {
48   SkPdfNativeObject* ret = get("B", "");
49   if (doc) {ret = doc->resolveReference(ret);}
50   if ((ret != NULL && ret->isInteger()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->intValue();
51   // TODO(edisonn): warn about missing default value for optional fields
52   return 0;
53 }
54 
has_B() const55 bool SkPdfSoundObjectDictionary::has_B() const {
56   return get("B", "") != NULL;
57 }
58 
E(SkPdfNativeDoc * doc)59 SkString SkPdfSoundObjectDictionary::E(SkPdfNativeDoc* doc) {
60   SkPdfNativeObject* ret = get("E", "");
61   if (doc) {ret = doc->resolveReference(ret);}
62   if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->nameValue2();
63   // TODO(edisonn): warn about missing default value for optional fields
64   return SkString();
65 }
66 
has_E() const67 bool SkPdfSoundObjectDictionary::has_E() const {
68   return get("E", "") != NULL;
69 }
70 
CO(SkPdfNativeDoc * doc)71 SkString SkPdfSoundObjectDictionary::CO(SkPdfNativeDoc* doc) {
72   SkPdfNativeObject* ret = get("CO", "");
73   if (doc) {ret = doc->resolveReference(ret);}
74   if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->nameValue2();
75   // TODO(edisonn): warn about missing default value for optional fields
76   return SkString();
77 }
78 
has_CO() const79 bool SkPdfSoundObjectDictionary::has_CO() const {
80   return get("CO", "") != NULL;
81 }
82 
CP(SkPdfNativeDoc * doc)83 SkPdfNativeObject* SkPdfSoundObjectDictionary::CP(SkPdfNativeDoc* doc) {
84   SkPdfNativeObject* ret = get("CP", "");
85   if (doc) {ret = doc->resolveReference(ret);}
86   if ((ret != NULL && true) || (doc == NULL && ret != NULL && ret->isReference())) return ret;
87   // TODO(edisonn): warn about missing default value for optional fields
88   return NULL;
89 }
90 
has_CP() const91 bool SkPdfSoundObjectDictionary::has_CP() const {
92   return get("CP", "") != NULL;
93 }
94