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 "SkPdfFileTrailerDictionary_autogen.h"
      9 #include "SkPdfNativeDoc.h"
     10 
     11 int64_t SkPdfFileTrailerDictionary::Size(SkPdfNativeDoc* doc) {
     12   SkPdfNativeObject* ret = get("Size", "");
     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 SkPdfFileTrailerDictionary::has_Size() const {
     20   return get("Size", "") != NULL;
     21 }
     22 
     23 int64_t SkPdfFileTrailerDictionary::Prev(SkPdfNativeDoc* doc) {
     24   SkPdfNativeObject* ret = get("Prev", "");
     25   if (doc) {ret = doc->resolveReference(ret);}
     26   if ((ret != NULL && ret->isInteger()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->intValue();
     27   // TODO(edisonn): warn about missing default value for optional fields
     28   return 0;
     29 }
     30 
     31 bool SkPdfFileTrailerDictionary::has_Prev() const {
     32   return get("Prev", "") != NULL;
     33 }
     34 
     35 SkPdfDictionary* SkPdfFileTrailerDictionary::Root(SkPdfNativeDoc* doc) {
     36   SkPdfNativeObject* ret = get("Root", "");
     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 SkPdfFileTrailerDictionary::has_Root() const {
     44   return get("Root", "") != NULL;
     45 }
     46 
     47 SkPdfDictionary* SkPdfFileTrailerDictionary::Encrypt(SkPdfNativeDoc* doc) {
     48   SkPdfNativeObject* ret = get("Encrypt", "");
     49   if (doc) {ret = doc->resolveReference(ret);}
     50   if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfDictionary*)ret;
     51   // TODO(edisonn): warn about missing default value for optional fields
     52   return NULL;
     53 }
     54 
     55 bool SkPdfFileTrailerDictionary::has_Encrypt() const {
     56   return get("Encrypt", "") != NULL;
     57 }
     58 
     59 SkPdfDictionary* SkPdfFileTrailerDictionary::Info(SkPdfNativeDoc* doc) {
     60   SkPdfNativeObject* ret = get("Info", "");
     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 SkPdfFileTrailerDictionary::has_Info() const {
     68   return get("Info", "") != NULL;
     69 }
     70 
     71 SkPdfArray* SkPdfFileTrailerDictionary::ID(SkPdfNativeDoc* doc) {
     72   SkPdfNativeObject* ret = get("ID", "");
     73   if (doc) {ret = doc->resolveReference(ret);}
     74   if ((ret != NULL && ret->isArray()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfArray*)ret;
     75   // TODO(edisonn): warn about missing default value for optional fields
     76   return NULL;
     77 }
     78 
     79 bool SkPdfFileTrailerDictionary::has_ID() const {
     80   return get("ID", "") != NULL;
     81 }
     82