diff options
Diffstat (limited to 'core/include')
-rw-r--r-- | core/include/fpdfapi/fpdf_objects.h | 13 | ||||
-rw-r--r-- | core/include/fpdfapi/fpdf_parser.h | 20 | ||||
-rw-r--r-- | core/include/fxcrt/fx_basic.h | 16 | ||||
-rw-r--r-- | core/include/fxcrt/fx_string.h | 1 |
4 files changed, 18 insertions, 32 deletions
diff --git a/core/include/fpdfapi/fpdf_objects.h b/core/include/fpdfapi/fpdf_objects.h index ddc16d95b0..129eebfcfc 100644 --- a/core/include/fpdfapi/fpdf_objects.h +++ b/core/include/fpdfapi/fpdf_objects.h @@ -58,9 +58,7 @@ class CPDF_Object { virtual CFX_ByteString GetString() const { return CFX_ByteString(); } virtual CFX_ByteStringC GetConstString() const { return CFX_ByteStringC(); } - virtual CFX_WideString GetUnicodeText(CFX_CharMap* pCharMap = nullptr) const { - return CFX_WideString(); - } + virtual CFX_WideString GetUnicodeText() const { return CFX_WideString(); } virtual FX_FLOAT GetNumber() const { return 0; } virtual int GetInteger() const { return 0; } virtual CPDF_Dictionary* GetDict() const { return nullptr; } @@ -207,7 +205,7 @@ class CPDF_String : public CPDF_Object { CFX_ByteStringC GetConstString() const override { return CFX_ByteStringC(m_String); } - CFX_WideString GetUnicodeText(CFX_CharMap* pCharMap = nullptr) const override; + CFX_WideString GetUnicodeText() const override; void SetString(const CFX_ByteString& str) override { m_String = str; } bool IsString() const override { return true; } CPDF_String* AsString() override { return this; } @@ -245,7 +243,7 @@ class CPDF_Name : public CPDF_Object { CFX_ByteStringC GetConstString() const override { return CFX_ByteStringC(m_Name); } - CFX_WideString GetUnicodeText(CFX_CharMap* pCharMap = nullptr) const override; + CFX_WideString GetUnicodeText() const override; void SetString(const CFX_ByteString& str) override { m_Name = str; } bool IsName() const override { return true; } CPDF_Name* AsName() override { return this; } @@ -355,8 +353,7 @@ class CPDF_Dictionary : public CPDF_Object { const CFX_ByteStringC& default_str) const; CFX_ByteStringC GetConstStringBy(const CFX_ByteStringC& key, const CFX_ByteStringC& default_str) const; - CFX_WideString GetUnicodeTextBy(const CFX_ByteStringC& key, - CFX_CharMap* pCharMap = NULL) const; + CFX_WideString GetUnicodeTextBy(const CFX_ByteStringC& key) const; int GetIntegerBy(const CFX_ByteStringC& key) const; int GetIntegerBy(const CFX_ByteStringC& key, int default_int) const; FX_BOOL GetBooleanBy(const CFX_ByteStringC& key, @@ -428,7 +425,7 @@ class CPDF_Stream : public CPDF_Object { Type GetType() const override { return STREAM; } CPDF_Object* Clone(FX_BOOL bDirect = FALSE) const override; CPDF_Dictionary* GetDict() const override { return m_pDict; } - CFX_WideString GetUnicodeText(CFX_CharMap* pCharMap = nullptr) const override; + CFX_WideString GetUnicodeText() const override; bool IsStream() const override { return true; } CPDF_Stream* AsStream() override { return this; } const CPDF_Stream* AsStream() const override { return this; } diff --git a/core/include/fpdfapi/fpdf_parser.h b/core/include/fpdfapi/fpdf_parser.h index f57ee5593c..9fa05c75ed 100644 --- a/core/include/fpdfapi/fpdf_parser.h +++ b/core/include/fpdfapi/fpdf_parser.h @@ -697,21 +697,11 @@ CFX_ByteString PDF_NameDecode(const CFX_ByteString& orig); CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig); CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, FX_BOOL bHex = FALSE); -CFX_WideString PDF_DecodeText(const uint8_t* pData, - FX_DWORD size, - CFX_CharMap* pCharMap = NULL); -inline CFX_WideString PDF_DecodeText(const CFX_ByteString& bstr, - CFX_CharMap* pCharMap = NULL) { - return PDF_DecodeText((const uint8_t*)bstr.c_str(), bstr.GetLength(), - pCharMap); -} -CFX_ByteString PDF_EncodeText(const FX_WCHAR* pString, - int len = -1, - CFX_CharMap* pCharMap = NULL); -inline CFX_ByteString PDF_EncodeText(const CFX_WideString& str, - CFX_CharMap* pCharMap = NULL) { - return PDF_EncodeText(str.c_str(), str.GetLength(), pCharMap); -} +CFX_WideString PDF_DecodeText(const uint8_t* pData, FX_DWORD size); +CFX_WideString PDF_DecodeText(const CFX_ByteString& bstr); +CFX_ByteString PDF_EncodeText(const FX_WCHAR* pString, int len = -1); +CFX_ByteString PDF_EncodeText(const CFX_WideString& str); + FX_FLOAT PDF_ClipFloat(FX_FLOAT f); class CFDF_Document : public CPDF_IndirectObjectHolder { public: diff --git a/core/include/fxcrt/fx_basic.h b/core/include/fxcrt/fx_basic.h index 4402856996..3e30b1d1a1 100644 --- a/core/include/fxcrt/fx_basic.h +++ b/core/include/fxcrt/fx_basic.h @@ -221,17 +221,17 @@ class CFX_FileBufferArchive : public IFX_BufferArchive { FX_BOOL m_bTakeover; }; -struct CFX_CharMap { - static CFX_CharMap* GetDefaultMapper(int32_t codepage = 0); - - CFX_WideString (*m_GetWideString)(CFX_CharMap* pMap, - const CFX_ByteString& bstr); +class CFX_CharMap { + public: + static CFX_ByteString GetByteString(FX_WORD codepage, + const CFX_WideString& wstr); - CFX_ByteString (*m_GetByteString)(CFX_CharMap* pMap, - const CFX_WideString& wstr); + static CFX_WideString GetWideString(FX_WORD codepage, + const CFX_ByteString& bstr); - int32_t (*m_GetCodePage)(); + CFX_CharMap() = delete; }; + class CFX_UTF8Decoder { public: CFX_UTF8Decoder() { m_PendingBytes = 0; } diff --git a/core/include/fxcrt/fx_string.h b/core/include/fxcrt/fx_string.h index c625bfa925..ca29e1321a 100644 --- a/core/include/fxcrt/fx_string.h +++ b/core/include/fxcrt/fx_string.h @@ -16,7 +16,6 @@ class CFX_BinaryBuf; class CFX_ByteString; class CFX_WideString; -struct CFX_CharMap; // An immutable string with caller-provided storage which must outlive the // string itself. |