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 "SkPdfVariableTextFieldDictionary_autogen.h"
9#include "SkPdfNativeDoc.h"
10
11SkPdfDictionary* SkPdfVariableTextFieldDictionary::DR(SkPdfNativeDoc* doc) {
12  SkPdfNativeObject* ret = get("DR", "");
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 required field, assert for known good pdfs
16  return NULL;
17}
18
19bool SkPdfVariableTextFieldDictionary::has_DR() const {
20  return get("DR", "") != NULL;
21}
22
23SkString SkPdfVariableTextFieldDictionary::DA(SkPdfNativeDoc* doc) {
24  SkPdfNativeObject* ret = get("DA", "");
25  if (doc) {ret = doc->resolveReference(ret);}
26  if ((ret != NULL && ret->isAnyString()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->stringValue2();
27  // TODO(edisonn): warn about missing required field, assert for known good pdfs
28  return SkString();
29}
30
31bool SkPdfVariableTextFieldDictionary::has_DA() const {
32  return get("DA", "") != NULL;
33}
34
35int64_t SkPdfVariableTextFieldDictionary::Q(SkPdfNativeDoc* doc) {
36  SkPdfNativeObject* ret = get("Q", "");
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
43bool SkPdfVariableTextFieldDictionary::has_Q() const {
44  return get("Q", "") != NULL;
45}
46