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 "SkPdfEmbeddedFileParameterDictionary_autogen.h"
9 #include "SkPdfNativeDoc.h"
10 
Size(SkPdfNativeDoc * doc)11 int64_t SkPdfEmbeddedFileParameterDictionary::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 default value for optional fields
16   return 0;
17 }
18 
has_Size() const19 bool SkPdfEmbeddedFileParameterDictionary::has_Size() const {
20   return get("Size", "") != NULL;
21 }
22 
CreationDate(SkPdfNativeDoc * doc)23 SkPdfDate SkPdfEmbeddedFileParameterDictionary::CreationDate(SkPdfNativeDoc* doc) {
24   SkPdfNativeObject* ret = get("CreationDate", "");
25   if (doc) {ret = doc->resolveReference(ret);}
26   if ((ret != NULL && ret->isDate()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->dateValue();
27   // TODO(edisonn): warn about missing default value for optional fields
28   return SkPdfDate();
29 }
30 
has_CreationDate() const31 bool SkPdfEmbeddedFileParameterDictionary::has_CreationDate() const {
32   return get("CreationDate", "") != NULL;
33 }
34 
ModDate(SkPdfNativeDoc * doc)35 SkPdfDate SkPdfEmbeddedFileParameterDictionary::ModDate(SkPdfNativeDoc* doc) {
36   SkPdfNativeObject* ret = get("ModDate", "");
37   if (doc) {ret = doc->resolveReference(ret);}
38   if ((ret != NULL && ret->isDate()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->dateValue();
39   // TODO(edisonn): warn about missing default value for optional fields
40   return SkPdfDate();
41 }
42 
has_ModDate() const43 bool SkPdfEmbeddedFileParameterDictionary::has_ModDate() const {
44   return get("ModDate", "") != NULL;
45 }
46 
Mac(SkPdfNativeDoc * doc)47 SkPdfDictionary* SkPdfEmbeddedFileParameterDictionary::Mac(SkPdfNativeDoc* doc) {
48   SkPdfNativeObject* ret = get("Mac", "");
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 
has_Mac() const55 bool SkPdfEmbeddedFileParameterDictionary::has_Mac() const {
56   return get("Mac", "") != NULL;
57 }
58 
CheckSum(SkPdfNativeDoc * doc)59 SkString SkPdfEmbeddedFileParameterDictionary::CheckSum(SkPdfNativeDoc* doc) {
60   SkPdfNativeObject* ret = get("CheckSum", "");
61   if (doc) {ret = doc->resolveReference(ret);}
62   if ((ret != NULL && ret->isAnyString()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->stringValue2();
63   // TODO(edisonn): warn about missing default value for optional fields
64   return SkString();
65 }
66 
has_CheckSum() const67 bool SkPdfEmbeddedFileParameterDictionary::has_CheckSum() const {
68   return get("CheckSum", "") != NULL;
69 }
70