Slightly reorder cpdf_dictionary.h.
Slightly improve the order of getter methods for CPDF_Dictionary. Then
make cpdf_dictionary.cpp match the order in the header.
Change-Id: I655524b394ab824578b029dc216564b9f8836ce4
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/70850
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfapi/parser/cpdf_dictionary.cpp b/core/fpdfapi/parser/cpdf_dictionary.cpp
index b1f61be..fc0981d 100644
--- a/core/fpdfapi/parser/cpdf_dictionary.cpp
+++ b/core/fpdfapi/parser/cpdf_dictionary.cpp
@@ -108,6 +108,12 @@
return p ? p->GetString() : ByteString();
}
+ByteString CPDF_Dictionary::GetStringFor(const ByteString& key,
+ const ByteString& def) const {
+ const CPDF_Object* p = GetObjectFor(key);
+ return p ? p->GetString() : ByteString(def);
+}
+
WideString CPDF_Dictionary::GetUnicodeTextFor(const ByteString& key) const {
const CPDF_Object* p = GetObjectFor(key);
if (const CPDF_Reference* pRef = ToReference(p))
@@ -115,10 +121,10 @@
return p ? p->GetUnicodeText() : WideString();
}
-ByteString CPDF_Dictionary::GetStringFor(const ByteString& key,
- const ByteString& def) const {
+bool CPDF_Dictionary::GetBooleanFor(const ByteString& key,
+ bool bDefault) const {
const CPDF_Object* p = GetObjectFor(key);
- return p ? p->GetString() : ByteString(def);
+ return ToBoolean(p) ? p->GetInteger() != 0 : bDefault;
}
int CPDF_Dictionary::GetIntegerFor(const ByteString& key) const {
@@ -136,12 +142,6 @@
return p ? p->GetNumber() : 0;
}
-bool CPDF_Dictionary::GetBooleanFor(const ByteString& key,
- bool bDefault) const {
- const CPDF_Object* p = GetObjectFor(key);
- return ToBoolean(p) ? p->GetInteger() != 0 : bDefault;
-}
-
const CPDF_Dictionary* CPDF_Dictionary::GetDictFor(
const ByteString& key) const {
const CPDF_Object* p = GetDirectObjectFor(key);
diff --git a/core/fpdfapi/parser/cpdf_dictionary.h b/core/fpdfapi/parser/cpdf_dictionary.h
index f8ff3ca..1911ef0 100644
--- a/core/fpdfapi/parser/cpdf_dictionary.h
+++ b/core/fpdfapi/parser/cpdf_dictionary.h
@@ -52,16 +52,16 @@
ByteString GetStringFor(const ByteString& key,
const ByteString& default_str) const;
WideString GetUnicodeTextFor(const ByteString& key) const;
+ bool GetBooleanFor(const ByteString& key, bool bDefault) const;
int GetIntegerFor(const ByteString& key) const;
int GetIntegerFor(const ByteString& key, int default_int) const;
- bool GetBooleanFor(const ByteString& key, bool bDefault) const;
float GetNumberFor(const ByteString& key) const;
const CPDF_Dictionary* GetDictFor(const ByteString& key) const;
CPDF_Dictionary* GetDictFor(const ByteString& key);
- const CPDF_Stream* GetStreamFor(const ByteString& key) const;
- CPDF_Stream* GetStreamFor(const ByteString& key);
const CPDF_Array* GetArrayFor(const ByteString& key) const;
CPDF_Array* GetArrayFor(const ByteString& key);
+ const CPDF_Stream* GetStreamFor(const ByteString& key) const;
+ CPDF_Stream* GetStreamFor(const ByteString& key);
CFX_FloatRect GetRectFor(const ByteString& key) const;
CFX_Matrix GetMatrixFor(const ByteString& key) const;
float GetFloatFor(const ByteString& key) const { return GetNumberFor(key); }