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 "SkPdfSoundActionDictionary_autogen.h"
9 #include "SkPdfNativeDoc.h"
10
S(SkPdfNativeDoc * doc)11 SkString SkPdfSoundActionDictionary::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 SkPdfSoundActionDictionary::has_S() const {
20 return get("S", "") != NULL;
21 }
22
Sound(SkPdfNativeDoc * doc)23 SkPdfStream* SkPdfSoundActionDictionary::Sound(SkPdfNativeDoc* doc) {
24 SkPdfNativeObject* ret = get("Sound", "");
25 if (doc) {ret = doc->resolveReference(ret);}
26 if ((ret != NULL && ret->hasStream()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->getStream();
27 // TODO(edisonn): warn about missing required field, assert for known good pdfs
28 return NULL;
29 }
30
has_Sound() const31 bool SkPdfSoundActionDictionary::has_Sound() const {
32 return get("Sound", "") != NULL;
33 }
34
Volume(SkPdfNativeDoc * doc)35 double SkPdfSoundActionDictionary::Volume(SkPdfNativeDoc* doc) {
36 SkPdfNativeObject* ret = get("Volume", "");
37 if (doc) {ret = doc->resolveReference(ret);}
38 if ((ret != NULL && ret->isNumber()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->numberValue();
39 // TODO(edisonn): warn about missing default value for optional fields
40 return 0;
41 }
42
has_Volume() const43 bool SkPdfSoundActionDictionary::has_Volume() const {
44 return get("Volume", "") != NULL;
45 }
46
Synchronous(SkPdfNativeDoc * doc)47 bool SkPdfSoundActionDictionary::Synchronous(SkPdfNativeDoc* doc) {
48 SkPdfNativeObject* ret = get("Synchronous", "");
49 if (doc) {ret = doc->resolveReference(ret);}
50 if ((ret != NULL && ret->isBoolean()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->boolValue();
51 // TODO(edisonn): warn about missing default value for optional fields
52 return false;
53 }
54
has_Synchronous() const55 bool SkPdfSoundActionDictionary::has_Synchronous() const {
56 return get("Synchronous", "") != NULL;
57 }
58
Repeat(SkPdfNativeDoc * doc)59 bool SkPdfSoundActionDictionary::Repeat(SkPdfNativeDoc* doc) {
60 SkPdfNativeObject* ret = get("Repeat", "");
61 if (doc) {ret = doc->resolveReference(ret);}
62 if ((ret != NULL && ret->isBoolean()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->boolValue();
63 // TODO(edisonn): warn about missing default value for optional fields
64 return false;
65 }
66
has_Repeat() const67 bool SkPdfSoundActionDictionary::has_Repeat() const {
68 return get("Repeat", "") != NULL;
69 }
70
Mix(SkPdfNativeDoc * doc)71 bool SkPdfSoundActionDictionary::Mix(SkPdfNativeDoc* doc) {
72 SkPdfNativeObject* ret = get("Mix", "");
73 if (doc) {ret = doc->resolveReference(ret);}
74 if ((ret != NULL && ret->isBoolean()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->boolValue();
75 // TODO(edisonn): warn about missing default value for optional fields
76 return false;
77 }
78
has_Mix() const79 bool SkPdfSoundActionDictionary::has_Mix() const {
80 return get("Mix", "") != NULL;
81 }
82