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 "SkPdfType2FunctionDictionary_autogen.h"
9#include "SkPdfNativeDoc.h"
10
11SkPdfArray* SkPdfType2FunctionDictionary::C0(SkPdfNativeDoc* doc) {
12  SkPdfNativeObject* ret = get("C0", "");
13  if (doc) {ret = doc->resolveReference(ret);}
14  if ((ret != NULL && ret->isArray()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfArray*)ret;
15  // TODO(edisonn): warn about missing default value for optional fields
16  return NULL;
17}
18
19bool SkPdfType2FunctionDictionary::has_C0() const {
20  return get("C0", "") != NULL;
21}
22
23SkPdfArray* SkPdfType2FunctionDictionary::C1(SkPdfNativeDoc* doc) {
24  SkPdfNativeObject* ret = get("C1", "");
25  if (doc) {ret = doc->resolveReference(ret);}
26  if ((ret != NULL && ret->isArray()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfArray*)ret;
27  // TODO(edisonn): warn about missing default value for optional fields
28  return NULL;
29}
30
31bool SkPdfType2FunctionDictionary::has_C1() const {
32  return get("C1", "") != NULL;
33}
34
35double SkPdfType2FunctionDictionary::N(SkPdfNativeDoc* doc) {
36  SkPdfNativeObject* ret = get("N", "");
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 required field, assert for known good pdfs
40  return 0;
41}
42
43bool SkPdfType2FunctionDictionary::has_N() const {
44  return get("N", "") != NULL;
45}
46