2013-08-21 16:31:37 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2013 Google Inc.
|
2013-08-20 18:56:49 +00:00
|
|
|
|
2013-08-21 16:31:37 +00:00
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
2013-08-20 18:56:49 +00:00
|
|
|
|
2013-08-21 16:31:37 +00:00
|
|
|
#include "SkPdfFDFNamedPageReferenceDictionary_autogen.h"
|
2013-08-20 18:56:49 +00:00
|
|
|
#include "SkPdfNativeDoc.h"
|
2013-08-21 16:31:37 +00:00
|
|
|
|
2013-08-20 18:56:49 +00:00
|
|
|
SkString SkPdfFDFNamedPageReferenceDictionary::Name(SkPdfNativeDoc* doc) {
|
|
|
|
SkPdfNativeObject* ret = get("Name", "");
|
|
|
|
if (doc) {ret = doc->resolveReference(ret);}
|
|
|
|
if ((ret != NULL && ret->isAnyString()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->stringValue2();
|
|
|
|
// TODO(edisonn): warn about missing required field, assert for known good pdfs
|
|
|
|
return SkString();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SkPdfFDFNamedPageReferenceDictionary::has_Name() const {
|
|
|
|
return get("Name", "") != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
SkPdfFileSpec SkPdfFDFNamedPageReferenceDictionary::F(SkPdfNativeDoc* doc) {
|
|
|
|
SkPdfNativeObject* ret = get("F", "");
|
|
|
|
if (doc) {ret = doc->resolveReference(ret);}
|
|
|
|
if ((ret != NULL && false) || (doc == NULL && ret != NULL && ret->isReference())) return ret->fileSpecValue();
|
|
|
|
// TODO(edisonn): warn about missing default value for optional fields
|
|
|
|
return SkPdfFileSpec();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SkPdfFDFNamedPageReferenceDictionary::has_F() const {
|
|
|
|
return get("F", "") != NULL;
|
|
|
|
}
|