Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(360)

Unified Diff: core/fpdfdoc/cpdf_viewerpreferences.cpp

Issue 2475923003: Implement FPDF_VIEWERREF_GetName() API. (Closed)
Patch Set: Comment Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fpdfdoc/cpdf_viewerpreferences.h ('k') | fpdfsdk/fpdfview.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfdoc/cpdf_viewerpreferences.cpp
diff --git a/core/fpdfdoc/cpdf_viewerpreferences.cpp b/core/fpdfdoc/cpdf_viewerpreferences.cpp
index 799f2d58144d1ffc6e23842233f64b52f01d60aa..f1fc4b0347d3da0d069a0d2de8451b793bf9aca9 100644
--- a/core/fpdfdoc/cpdf_viewerpreferences.cpp
+++ b/core/fpdfdoc/cpdf_viewerpreferences.cpp
@@ -7,6 +7,7 @@
#include "core/fpdfdoc/cpdf_viewerpreferences.h"
#include "core/fpdfapi/parser/cpdf_document.h"
+#include "core/fpdfapi/parser/cpdf_name.h"
CPDF_ViewerPreferences::CPDF_ViewerPreferences(CPDF_Document* pDoc)
: m_pDoc(pDoc) {}
@@ -38,6 +39,21 @@ CFX_ByteString CPDF_ViewerPreferences::Duplex() const {
return pDict ? pDict->GetStringFor("Duplex") : CFX_ByteString("None");
}
+bool CPDF_ViewerPreferences::GenericName(const CFX_ByteString& bsKey,
+ CFX_ByteString* bsVal) const {
+ ASSERT(bsVal);
+ CPDF_Dictionary* pDict = GetViewerPreferences();
+ if (!pDict)
+ return false;
+
+ const CPDF_Name* pName = ToName(pDict->GetObjectFor(bsKey));
+ if (!pName)
+ return false;
+
+ *bsVal = pName->GetString();
+ return true;
+}
+
CPDF_Dictionary* CPDF_ViewerPreferences::GetViewerPreferences() const {
CPDF_Dictionary* pDict = m_pDoc->GetRoot();
return pDict ? pDict->GetDictFor("ViewerPreferences") : nullptr;
« no previous file with comments | « core/fpdfdoc/cpdf_viewerpreferences.h ('k') | fpdfsdk/fpdfview.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698