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 "SkPdfMovieAnnotationDictionary_autogen.h"
9 #include "SkPdfNativeDoc.h"
10 
Subtype(SkPdfNativeDoc * doc)11 SkString SkPdfMovieAnnotationDictionary::Subtype(SkPdfNativeDoc* doc) {
12   SkPdfNativeObject* ret = get("Subtype", "");
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_Subtype() const19 bool SkPdfMovieAnnotationDictionary::has_Subtype() const {
20   return get("Subtype", "") != NULL;
21 }
22 
Movie(SkPdfNativeDoc * doc)23 SkPdfDictionary* SkPdfMovieAnnotationDictionary::Movie(SkPdfNativeDoc* doc) {
24   SkPdfNativeObject* ret = get("Movie", "");
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 required field, assert for known good pdfs
28   return NULL;
29 }
30 
has_Movie() const31 bool SkPdfMovieAnnotationDictionary::has_Movie() const {
32   return get("Movie", "") != NULL;
33 }
34 
Contents(SkPdfNativeDoc * doc)35 SkString SkPdfMovieAnnotationDictionary::Contents(SkPdfNativeDoc* doc) {
36   SkPdfNativeObject* ret = get("Contents", "");
37   if (doc) {ret = doc->resolveReference(ret);}
38   if ((ret != NULL && ret->isAnyString()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->stringValue2();
39   // TODO(edisonn): warn about missing default value for optional fields
40   return SkString();
41 }
42 
has_Contents() const43 bool SkPdfMovieAnnotationDictionary::has_Contents() const {
44   return get("Contents", "") != NULL;
45 }
46 
isAABoolean(SkPdfNativeDoc * doc)47 bool SkPdfMovieAnnotationDictionary::isAABoolean(SkPdfNativeDoc* doc) {
48   SkPdfNativeObject* ret = get("A", "");
49   if (doc) {ret = doc->resolveReference(ret);}
50   return ret != NULL && ret->isBoolean();
51 }
52 
getAAsBoolean(SkPdfNativeDoc * doc)53 bool SkPdfMovieAnnotationDictionary::getAAsBoolean(SkPdfNativeDoc* doc) {
54   SkPdfNativeObject* ret = get("A", "");
55   if (doc) {ret = doc->resolveReference(ret);}
56   if ((ret != NULL && ret->isBoolean()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->boolValue();
57   // TODO(edisonn): warn about missing default value for optional fields
58   return false;
59 }
60 
isAADictionary(SkPdfNativeDoc * doc)61 bool SkPdfMovieAnnotationDictionary::isAADictionary(SkPdfNativeDoc* doc) {
62   SkPdfNativeObject* ret = get("A", "");
63   if (doc) {ret = doc->resolveReference(ret);}
64   return ret != NULL && ret->isDictionary();
65 }
66 
getAAsDictionary(SkPdfNativeDoc * doc)67 SkPdfDictionary* SkPdfMovieAnnotationDictionary::getAAsDictionary(SkPdfNativeDoc* doc) {
68   SkPdfNativeObject* ret = get("A", "");
69   if (doc) {ret = doc->resolveReference(ret);}
70   if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfDictionary*)ret;
71   // TODO(edisonn): warn about missing default value for optional fields
72   return NULL;
73 }
74 
has_A() const75 bool SkPdfMovieAnnotationDictionary::has_A() const {
76   return get("A", "") != NULL;
77 }
78