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 "SkPdfIccProfileStreamDictionary_autogen.h"
      9 #include "SkPdfNativeDoc.h"
     10 
     11 int64_t SkPdfIccProfileStreamDictionary::N(SkPdfNativeDoc* doc) {
     12   SkPdfNativeObject* ret = get("N", "");
     13   if (doc) {ret = doc->resolveReference(ret);}
     14   if ((ret != NULL && ret->isInteger()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->intValue();
     15   // TODO(edisonn): warn about missing required field, assert for known good pdfs
     16   return 0;
     17 }
     18 
     19 bool SkPdfIccProfileStreamDictionary::has_N() const {
     20   return get("N", "") != NULL;
     21 }
     22 
     23 bool SkPdfIccProfileStreamDictionary::isAlternateAArray(SkPdfNativeDoc* doc) {
     24   SkPdfNativeObject* ret = get("Alternate", "");
     25   if (doc) {ret = doc->resolveReference(ret);}
     26   return ret != NULL && ret->isArray();
     27 }
     28 
     29 SkPdfArray* SkPdfIccProfileStreamDictionary::getAlternateAsArray(SkPdfNativeDoc* doc) {
     30   SkPdfNativeObject* ret = get("Alternate", "");
     31   if (doc) {ret = doc->resolveReference(ret);}
     32   if ((ret != NULL && ret->isArray()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfArray*)ret;
     33   // TODO(edisonn): warn about missing default value for optional fields
     34   return NULL;
     35 }
     36 
     37 bool SkPdfIccProfileStreamDictionary::isAlternateAName(SkPdfNativeDoc* doc) {
     38   SkPdfNativeObject* ret = get("Alternate", "");
     39   if (doc) {ret = doc->resolveReference(ret);}
     40   return ret != NULL && ret->isName();
     41 }
     42 
     43 SkString SkPdfIccProfileStreamDictionary::getAlternateAsName(SkPdfNativeDoc* doc) {
     44   SkPdfNativeObject* ret = get("Alternate", "");
     45   if (doc) {ret = doc->resolveReference(ret);}
     46   if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->nameValue2();
     47   // TODO(edisonn): warn about missing default value for optional fields
     48   return SkString();
     49 }
     50 
     51 bool SkPdfIccProfileStreamDictionary::has_Alternate() const {
     52   return get("Alternate", "") != NULL;
     53 }
     54 
     55 SkPdfArray* SkPdfIccProfileStreamDictionary::Range(SkPdfNativeDoc* doc) {
     56   SkPdfNativeObject* ret = get("Range", "");
     57   if (doc) {ret = doc->resolveReference(ret);}
     58   if ((ret != NULL && ret->isArray()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfArray*)ret;
     59   // TODO(edisonn): warn about missing default value for optional fields
     60   return NULL;
     61 }
     62 
     63 bool SkPdfIccProfileStreamDictionary::has_Range() const {
     64   return get("Range", "") != NULL;
     65 }
     66 
     67 SkPdfStream* SkPdfIccProfileStreamDictionary::Metadata(SkPdfNativeDoc* doc) {
     68   SkPdfNativeObject* ret = get("Metadata", "");
     69   if (doc) {ret = doc->resolveReference(ret);}
     70   if ((ret != NULL && ret->hasStream()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->getStream();
     71   // TODO(edisonn): warn about missing default value for optional fields
     72   return NULL;
     73 }
     74 
     75 bool SkPdfIccProfileStreamDictionary::has_Metadata() const {
     76   return get("Metadata", "") != NULL;
     77 }
     78