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
11SkString 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
19bool SkPdfMovieAnnotationDictionary::has_Subtype() const {
20  return get("Subtype", "") != NULL;
21}
22
23SkPdfDictionary* 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
31bool SkPdfMovieAnnotationDictionary::has_Movie() const {
32  return get("Movie", "") != NULL;
33}
34
35SkString 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
43bool SkPdfMovieAnnotationDictionary::has_Contents() const {
44  return get("Contents", "") != NULL;
45}
46
47bool SkPdfMovieAnnotationDictionary::isAABoolean(SkPdfNativeDoc* doc) {
48  SkPdfNativeObject* ret = get("A", "");
49  if (doc) {ret = doc->resolveReference(ret);}
50  return ret != NULL && ret->isBoolean();
51}
52
53bool 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
61bool SkPdfMovieAnnotationDictionary::isAADictionary(SkPdfNativeDoc* doc) {
62  SkPdfNativeObject* ret = get("A", "");
63  if (doc) {ret = doc->resolveReference(ret);}
64  return ret != NULL && ret->isDictionary();
65}
66
67SkPdfDictionary* 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
75bool SkPdfMovieAnnotationDictionary::has_A() const {
76  return get("A", "") != NULL;
77}
78