From 275e260a6cd4a8e506ba974feb85ebcd926c1739 Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Mon, 18 Sep 2017 14:23:18 -0400 Subject: Convert string class names Automated using git grep & sed. Replace StringC classes with StringView classes. Remove the CFX_ prefix and put string classes in fxcrt namespace. Change AsStringC() to AsStringView(). Rename tests from TEST(fxcrt, *String*Foo) to TEST(*String*, Foo). Couple of tests needed to have their names regularlized. BUG=pdfium:894 Change-Id: I7ca038685c8d803795f3ed02545124f7a224c83d Reviewed-on: https://pdfium-review.googlesource.com/14151 Reviewed-by: Tom Sepez Commit-Queue: Ryan Harrison --- core/fpdfapi/parser/cpdf_dictionary.h | 67 +++++++++++++++++------------------ 1 file changed, 32 insertions(+), 35 deletions(-) (limited to 'core/fpdfapi/parser/cpdf_dictionary.h') diff --git a/core/fpdfapi/parser/cpdf_dictionary.h b/core/fpdfapi/parser/cpdf_dictionary.h index 31a09d954d..93c00c8c10 100644 --- a/core/fpdfapi/parser/cpdf_dictionary.h +++ b/core/fpdfapi/parser/cpdf_dictionary.h @@ -24,10 +24,10 @@ class CPDF_IndirectObjectHolder; class CPDF_Dictionary : public CPDF_Object { public: using const_iterator = - std::map>::const_iterator; + std::map>::const_iterator; CPDF_Dictionary(); - explicit CPDF_Dictionary(const CFX_WeakPtr& pPool); + explicit CPDF_Dictionary(const CFX_WeakPtr& pPool); ~CPDF_Dictionary() override; // CPDF_Object: @@ -40,76 +40,73 @@ class CPDF_Dictionary : public CPDF_Object { bool WriteTo(IFX_ArchiveStream* archive) const override; size_t GetCount() const { return m_Map.size(); } - CPDF_Object* GetObjectFor(const CFX_ByteString& key) const; - CPDF_Object* GetDirectObjectFor(const CFX_ByteString& key) const; - CFX_ByteString GetStringFor(const CFX_ByteString& key) const; - CFX_ByteString GetStringFor(const CFX_ByteString& key, - const CFX_ByteString& default_str) const; - CFX_WideString GetUnicodeTextFor(const CFX_ByteString& key) const; - int GetIntegerFor(const CFX_ByteString& key) const; - int GetIntegerFor(const CFX_ByteString& key, int default_int) const; - bool GetBooleanFor(const CFX_ByteString& key, bool bDefault = false) const; - float GetNumberFor(const CFX_ByteString& key) const; - CPDF_Dictionary* GetDictFor(const CFX_ByteString& key) const; - CPDF_Stream* GetStreamFor(const CFX_ByteString& key) const; - CPDF_Array* GetArrayFor(const CFX_ByteString& key) const; - CFX_FloatRect GetRectFor(const CFX_ByteString& key) const; - CFX_Matrix GetMatrixFor(const CFX_ByteString& key) const; - float GetFloatFor(const CFX_ByteString& key) const { - return GetNumberFor(key); - } - - bool KeyExist(const CFX_ByteString& key) const; + CPDF_Object* GetObjectFor(const ByteString& key) const; + CPDF_Object* GetDirectObjectFor(const ByteString& key) const; + ByteString GetStringFor(const ByteString& key) const; + ByteString GetStringFor(const ByteString& key, + const ByteString& default_str) const; + WideString GetUnicodeTextFor(const ByteString& key) const; + int GetIntegerFor(const ByteString& key) const; + int GetIntegerFor(const ByteString& key, int default_int) const; + bool GetBooleanFor(const ByteString& key, bool bDefault = false) const; + float GetNumberFor(const ByteString& key) const; + CPDF_Dictionary* GetDictFor(const ByteString& key) const; + CPDF_Stream* GetStreamFor(const ByteString& key) const; + CPDF_Array* GetArrayFor(const ByteString& key) const; + CFX_FloatRect GetRectFor(const ByteString& key) const; + CFX_Matrix GetMatrixFor(const ByteString& key) const; + float GetFloatFor(const ByteString& key) const { return GetNumberFor(key); } + + bool KeyExist(const ByteString& key) const; bool IsSignatureDict() const; // Set* functions invalidate iterators for the element with the key |key|. // Takes ownership of |pObj|, returns an unowned pointer to it. - CPDF_Object* SetFor(const CFX_ByteString& key, - std::unique_ptr pObj); + CPDF_Object* SetFor(const ByteString& key, std::unique_ptr pObj); // Creates a new object owned by the dictionary and returns an unowned // pointer to it. template typename std::enable_if::value, T*>::type SetNewFor( - const CFX_ByteString& key, + const ByteString& key, Args&&... args) { return static_cast( SetFor(key, pdfium::MakeUnique(std::forward(args)...))); } template typename std::enable_if::value, T*>::type SetNewFor( - const CFX_ByteString& key, + const ByteString& key, Args&&... args) { return static_cast(SetFor( key, pdfium::MakeUnique(m_pPool, std::forward(args)...))); } // Convenience functions to convert native objects to array form. - void SetRectFor(const CFX_ByteString& key, const CFX_FloatRect& rect); - void SetMatrixFor(const CFX_ByteString& key, const CFX_Matrix& matrix); + void SetRectFor(const ByteString& key, const CFX_FloatRect& rect); + void SetMatrixFor(const ByteString& key, const CFX_Matrix& matrix); - void ConvertToIndirectObjectFor(const CFX_ByteString& key, + void ConvertToIndirectObjectFor(const ByteString& key, CPDF_IndirectObjectHolder* pHolder); // Invalidates iterators for the element with the key |key|. - std::unique_ptr RemoveFor(const CFX_ByteString& key); + std::unique_ptr RemoveFor(const ByteString& key); // Invalidates iterators for the element with the key |oldkey|. - void ReplaceKey(const CFX_ByteString& oldkey, const CFX_ByteString& newkey); + void ReplaceKey(const ByteString& oldkey, const ByteString& newkey); const_iterator begin() const { return m_Map.begin(); } const_iterator end() const { return m_Map.end(); } - CFX_WeakPtr GetByteStringPool() const { return m_pPool; } + CFX_WeakPtr GetByteStringPool() const { return m_pPool; } protected: - CFX_ByteString MaybeIntern(const CFX_ByteString& str); + ByteString MaybeIntern(const ByteString& str); std::unique_ptr CloneNonCyclic( bool bDirect, std::set* visited) const override; - CFX_WeakPtr m_pPool; - std::map> m_Map; + CFX_WeakPtr m_pPool; + std::map> m_Map; }; inline CPDF_Dictionary* ToDictionary(CPDF_Object* obj) { -- cgit v1.2.3