Home | History | Annotate | Download | only in pdfapi
      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 "SkPdfStructureElementDictionary_autogen.h"
      9 #include "SkPdfNativeDoc.h"
     10 
     11 SkString SkPdfStructureElementDictionary::Type(SkPdfNativeDoc* doc) {
     12   SkPdfNativeObject* ret = get("Type", "");
     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 default value for optional fields
     16   return SkString();
     17 }
     18 
     19 bool SkPdfStructureElementDictionary::has_Type() const {
     20   return get("Type", "") != NULL;
     21 }
     22 
     23 SkString SkPdfStructureElementDictionary::S(SkPdfNativeDoc* doc) {
     24   SkPdfNativeObject* ret = get("S", "");
     25   if (doc) {ret = doc->resolveReference(ret);}
     26   if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->nameValue2();
     27   // TODO(edisonn): warn about missing required field, assert for known good pdfs
     28   return SkString();
     29 }
     30 
     31 bool SkPdfStructureElementDictionary::has_S() const {
     32   return get("S", "") != NULL;
     33 }
     34 
     35 SkPdfDictionary* SkPdfStructureElementDictionary::P(SkPdfNativeDoc* doc) {
     36   SkPdfNativeObject* ret = get("P", "");
     37   if (doc) {ret = doc->resolveReference(ret);}
     38   if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfDictionary*)ret;
     39   // TODO(edisonn): warn about missing default value for optional fields
     40   return NULL;
     41 }
     42 
     43 bool SkPdfStructureElementDictionary::has_P() const {
     44   return get("P", "") != NULL;
     45 }
     46 
     47 SkString SkPdfStructureElementDictionary::ID(SkPdfNativeDoc* doc) {
     48   SkPdfNativeObject* ret = get("ID", "");
     49   if (doc) {ret = doc->resolveReference(ret);}
     50   if ((ret != NULL && ret->isAnyString()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->stringValue2();
     51   // TODO(edisonn): warn about missing default value for optional fields
     52   return SkString();
     53 }
     54 
     55 bool SkPdfStructureElementDictionary::has_ID() const {
     56   return get("ID", "") != NULL;
     57 }
     58 
     59 SkPdfDictionary* SkPdfStructureElementDictionary::Pg(SkPdfNativeDoc* doc) {
     60   SkPdfNativeObject* ret = get("Pg", "");
     61   if (doc) {ret = doc->resolveReference(ret);}
     62   if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfDictionary*)ret;
     63   // TODO(edisonn): warn about missing default value for optional fields
     64   return NULL;
     65 }
     66 
     67 bool SkPdfStructureElementDictionary::has_Pg() const {
     68   return get("Pg", "") != NULL;
     69 }
     70 
     71 SkPdfNativeObject* SkPdfStructureElementDictionary::K(SkPdfNativeDoc* doc) {
     72   SkPdfNativeObject* ret = get("K", "");
     73   if (doc) {ret = doc->resolveReference(ret);}
     74   if ((ret != NULL && true) || (doc == NULL && ret != NULL && ret->isReference())) return ret;
     75   // TODO(edisonn): warn about missing default value for optional fields
     76   return NULL;
     77 }
     78 
     79 bool SkPdfStructureElementDictionary::has_K() const {
     80   return get("K", "") != NULL;
     81 }
     82 
     83 SkPdfNativeObject* SkPdfStructureElementDictionary::A(SkPdfNativeDoc* doc) {
     84   SkPdfNativeObject* ret = get("A", "");
     85   if (doc) {ret = doc->resolveReference(ret);}
     86   if ((ret != NULL && true) || (doc == NULL && ret != NULL && ret->isReference())) return ret;
     87   // TODO(edisonn): warn about missing default value for optional fields
     88   return NULL;
     89 }
     90 
     91 bool SkPdfStructureElementDictionary::has_A() const {
     92   return get("A", "") != NULL;
     93 }
     94 
     95 bool SkPdfStructureElementDictionary::isCAName(SkPdfNativeDoc* doc) {
     96   SkPdfNativeObject* ret = get("C", "");
     97   if (doc) {ret = doc->resolveReference(ret);}
     98   return ret != NULL && ret->isName();
     99 }
    100 
    101 SkString SkPdfStructureElementDictionary::getCAsName(SkPdfNativeDoc* doc) {
    102   SkPdfNativeObject* ret = get("C", "");
    103   if (doc) {ret = doc->resolveReference(ret);}
    104   if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->nameValue2();
    105   // TODO(edisonn): warn about missing default value for optional fields
    106   return SkString();
    107 }
    108 
    109 bool SkPdfStructureElementDictionary::isCAArray(SkPdfNativeDoc* doc) {
    110   SkPdfNativeObject* ret = get("C", "");
    111   if (doc) {ret = doc->resolveReference(ret);}
    112   return ret != NULL && ret->isArray();
    113 }
    114 
    115 SkPdfArray* SkPdfStructureElementDictionary::getCAsArray(SkPdfNativeDoc* doc) {
    116   SkPdfNativeObject* ret = get("C", "");
    117   if (doc) {ret = doc->resolveReference(ret);}
    118   if ((ret != NULL && ret->isArray()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfArray*)ret;
    119   // TODO(edisonn): warn about missing default value for optional fields
    120   return NULL;
    121 }
    122 
    123 bool SkPdfStructureElementDictionary::has_C() const {
    124   return get("C", "") != NULL;
    125 }
    126 
    127 int64_t SkPdfStructureElementDictionary::R(SkPdfNativeDoc* doc) {
    128   SkPdfNativeObject* ret = get("R", "");
    129   if (doc) {ret = doc->resolveReference(ret);}
    130   if ((ret != NULL && ret->isInteger()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->intValue();
    131   // TODO(edisonn): warn about missing default value for optional fields
    132   return 0;
    133 }
    134 
    135 bool SkPdfStructureElementDictionary::has_R() const {
    136   return get("R", "") != NULL;
    137 }
    138 
    139 SkString SkPdfStructureElementDictionary::T(SkPdfNativeDoc* doc) {
    140   SkPdfNativeObject* ret = get("T", "");
    141   if (doc) {ret = doc->resolveReference(ret);}
    142   if ((ret != NULL && ret->isAnyString()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->stringValue2();
    143   // TODO(edisonn): warn about missing default value for optional fields
    144   return SkString();
    145 }
    146 
    147 bool SkPdfStructureElementDictionary::has_T() const {
    148   return get("T", "") != NULL;
    149 }
    150 
    151 SkString SkPdfStructureElementDictionary::Lang(SkPdfNativeDoc* doc) {
    152   SkPdfNativeObject* ret = get("Lang", "");
    153   if (doc) {ret = doc->resolveReference(ret);}
    154   if ((ret != NULL && ret->isAnyString()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->stringValue2();
    155   // TODO(edisonn): warn about missing default value for optional fields
    156   return SkString();
    157 }
    158 
    159 bool SkPdfStructureElementDictionary::has_Lang() const {
    160   return get("Lang", "") != NULL;
    161 }
    162 
    163 SkString SkPdfStructureElementDictionary::Alt(SkPdfNativeDoc* doc) {
    164   SkPdfNativeObject* ret = get("Alt", "");
    165   if (doc) {ret = doc->resolveReference(ret);}
    166   if ((ret != NULL && ret->isAnyString()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->stringValue2();
    167   // TODO(edisonn): warn about missing default value for optional fields
    168   return SkString();
    169 }
    170 
    171 bool SkPdfStructureElementDictionary::has_Alt() const {
    172   return get("Alt", "") != NULL;
    173 }
    174 
    175 SkString SkPdfStructureElementDictionary::ActualText(SkPdfNativeDoc* doc) {
    176   SkPdfNativeObject* ret = get("ActualText", "");
    177   if (doc) {ret = doc->resolveReference(ret);}
    178   if ((ret != NULL && ret->isAnyString()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->stringValue2();
    179   // TODO(edisonn): warn about missing default value for optional fields
    180   return SkString();
    181 }
    182 
    183 bool SkPdfStructureElementDictionary::has_ActualText() const {
    184   return get("ActualText", "") != NULL;
    185 }
    186