diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-06-10 16:51:15 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-06-10 16:51:15 -0700 |
commit | 6f0a64a1bf18ab6636404cdfb883897459083a4d (patch) | |
tree | 1ef1326c8bb015213e0cdf0d726a27a537d09c73 /core/include | |
parent | e4503ea9947d2f9c61704da20271b413a364a9c0 (diff) | |
download | pdfium-6f0a64a1bf18ab6636404cdfb883897459083a4d.tar.xz |
Remove FX_BSTR and FX_WSTR typedefs.chromium/2434chromium/2433chromium/2432chromium/2431chromium/2430
These stand for const CFX_{Byte,Wide}StringC&, which is just
monumentally confusing, since there are so many string types
running around here.
The following had manual changes:
core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp
core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
core/src/fpdfdoc/doc_form.cpp
fpdfsdk/src/fpdf_ext.cpp
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1180593004.
Diffstat (limited to 'core/include')
-rw-r--r-- | core/include/fpdfapi/fpdf_objects.h | 78 | ||||
-rw-r--r-- | core/include/fpdfapi/fpdf_page.h | 2 | ||||
-rw-r--r-- | core/include/fpdfapi/fpdf_pageobj.h | 6 | ||||
-rw-r--r-- | core/include/fpdfapi/fpdf_parser.h | 18 | ||||
-rw-r--r-- | core/include/fpdfapi/fpdf_resource.h | 2 | ||||
-rw-r--r-- | core/include/fpdfdoc/fpdf_doc.h | 30 | ||||
-rw-r--r-- | core/include/fpdfdoc/fpdf_tagged.h | 10 | ||||
-rw-r--r-- | core/include/fxcrt/fx_basic.h | 36 | ||||
-rw-r--r-- | core/include/fxcrt/fx_stream.h | 20 | ||||
-rw-r--r-- | core/include/fxcrt/fx_string.h | 42 | ||||
-rw-r--r-- | core/include/fxcrt/fx_xml.h | 50 | ||||
-rw-r--r-- | core/include/fxge/fpf.h | 4 | ||||
-rw-r--r-- | core/include/fxge/fx_font.h | 2 |
13 files changed, 149 insertions, 151 deletions
diff --git a/core/include/fpdfapi/fpdf_objects.h b/core/include/fpdfapi/fpdf_objects.h index 39a05c64f9..5a30c8b45c 100644 --- a/core/include/fpdfapi/fpdf_objects.h +++ b/core/include/fpdfapi/fpdf_objects.h @@ -144,7 +144,7 @@ public: return new CPDF_Number(value); } - static CPDF_Number* Create(FX_BSTR str) + static CPDF_Number* Create(const CFX_ByteStringC& str) { return new CPDF_Number(str); } @@ -162,13 +162,13 @@ public: CPDF_Number(FX_FLOAT value); - CPDF_Number(FX_BSTR str); + CPDF_Number(const CFX_ByteStringC& str); FX_BOOL Identical(CPDF_Number* pOther) const; CFX_ByteString GetString() const; - void SetString(FX_BSTR str); + void SetString(const CFX_ByteStringC& str); FX_BOOL IsInteger() const { @@ -260,7 +260,7 @@ public: return new CPDF_Name(str); } - static CPDF_Name* Create(FX_BSTR str) + static CPDF_Name* Create(const CFX_ByteStringC& str) { return new CPDF_Name(str); } @@ -271,7 +271,7 @@ public: } CPDF_Name(const CFX_ByteString& str) : CPDF_Object(PDFOBJ_NAME), m_Name(str) { } - CPDF_Name(FX_BSTR str) : CPDF_Object(PDFOBJ_NAME), m_Name(str) { } + CPDF_Name(const CFX_ByteStringC& str) : CPDF_Object(PDFOBJ_NAME), m_Name(str) { } CPDF_Name(const FX_CHAR* str) : CPDF_Object(PDFOBJ_NAME), m_Name(str) { } CFX_ByteString& GetString() @@ -396,95 +396,95 @@ public: CPDF_Dictionary() : CPDF_Object(PDFOBJ_DICTIONARY) { } - CPDF_Object* GetElement(FX_BSTR key) const; + CPDF_Object* GetElement(const CFX_ByteStringC& key) const; - CPDF_Object* GetElementValue(FX_BSTR key) const; + CPDF_Object* GetElementValue(const CFX_ByteStringC& key) const; - CFX_ByteString GetString(FX_BSTR key) const; + CFX_ByteString GetString(const CFX_ByteStringC& key) const; - CFX_ByteStringC GetConstString(FX_BSTR key) const; + CFX_ByteStringC GetConstString(const CFX_ByteStringC& key) const; - CFX_ByteString GetString(FX_BSTR key, FX_BSTR default_str) const; + CFX_ByteString GetString(const CFX_ByteStringC& key, const CFX_ByteStringC& default_str) const; - CFX_ByteStringC GetConstString(FX_BSTR key, FX_BSTR default_str) const; + CFX_ByteStringC GetConstString(const CFX_ByteStringC& key, const CFX_ByteStringC& default_str) const; - CFX_WideString GetUnicodeText(FX_BSTR key, CFX_CharMap* pCharMap = NULL) const; + CFX_WideString GetUnicodeText(const CFX_ByteStringC& key, CFX_CharMap* pCharMap = NULL) const; - int GetInteger(FX_BSTR key) const; + int GetInteger(const CFX_ByteStringC& key) const; - int GetInteger(FX_BSTR key, int default_int) const; + int GetInteger(const CFX_ByteStringC& key, int default_int) const; - FX_BOOL GetBoolean(FX_BSTR key, FX_BOOL bDefault = FALSE) const; + FX_BOOL GetBoolean(const CFX_ByteStringC& key, FX_BOOL bDefault = FALSE) const; - FX_FLOAT GetNumber(FX_BSTR key) const; + FX_FLOAT GetNumber(const CFX_ByteStringC& key) const; - CPDF_Dictionary* GetDict(FX_BSTR key) const; + CPDF_Dictionary* GetDict(const CFX_ByteStringC& key) const; - CPDF_Stream* GetStream(FX_BSTR key) const; + CPDF_Stream* GetStream(const CFX_ByteStringC& key) const; - CPDF_Array* GetArray(FX_BSTR key) const; + CPDF_Array* GetArray(const CFX_ByteStringC& key) const; - CFX_FloatRect GetRect(FX_BSTR key) const; + CFX_FloatRect GetRect(const CFX_ByteStringC& key) const; - CFX_AffineMatrix GetMatrix(FX_BSTR key) const; + CFX_AffineMatrix GetMatrix(const CFX_ByteStringC& key) const; - FX_FLOAT GetFloat(FX_BSTR key) const + FX_FLOAT GetFloat(const CFX_ByteStringC& key) const { return GetNumber(key); } - FX_BOOL KeyExist(FX_BSTR key) const; + FX_BOOL KeyExist(const CFX_ByteStringC& key) const; FX_POSITION GetStartPos() const; CPDF_Object* GetNextElement(FX_POSITION& pos, CFX_ByteString& key) const; - void SetAt(FX_BSTR key, CPDF_Object* pObj, CPDF_IndirectObjects* pObjs = NULL); + void SetAt(const CFX_ByteStringC& key, CPDF_Object* pObj, CPDF_IndirectObjects* pObjs = NULL); - void SetAtName(FX_BSTR key, const CFX_ByteString& name); + void SetAtName(const CFX_ByteStringC& key, const CFX_ByteString& name); - void SetAtString(FX_BSTR key, const CFX_ByteString& string); + void SetAtString(const CFX_ByteStringC& key, const CFX_ByteString& string); - void SetAtInteger(FX_BSTR key, int i); + void SetAtInteger(const CFX_ByteStringC& key, int i); - void SetAtNumber(FX_BSTR key, FX_FLOAT f); + void SetAtNumber(const CFX_ByteStringC& key, FX_FLOAT f); - void SetAtReference(FX_BSTR key, CPDF_IndirectObjects* pDoc, FX_DWORD objnum); + void SetAtReference(const CFX_ByteStringC& key, CPDF_IndirectObjects* pDoc, FX_DWORD objnum); - void SetAtReference(FX_BSTR key, CPDF_IndirectObjects* pDoc, CPDF_Object* obj) + void SetAtReference(const CFX_ByteStringC& key, CPDF_IndirectObjects* pDoc, CPDF_Object* obj) { SetAtReference(key, pDoc, obj->GetObjNum()); } - void AddReference(FX_BSTR key, CPDF_IndirectObjects* pDoc, FX_DWORD objnum); + void AddReference(const CFX_ByteStringC& key, CPDF_IndirectObjects* pDoc, FX_DWORD objnum); - void AddReference(FX_BSTR key, CPDF_IndirectObjects* pDoc, CPDF_Object* obj) + void AddReference(const CFX_ByteStringC& key, CPDF_IndirectObjects* pDoc, CPDF_Object* obj) { AddReference(key, pDoc, obj->GetObjNum()); } - void SetAtRect(FX_BSTR key, const CFX_FloatRect& rect); + void SetAtRect(const CFX_ByteStringC& key, const CFX_FloatRect& rect); - void SetAtMatrix(FX_BSTR key, const CFX_AffineMatrix& matrix); + void SetAtMatrix(const CFX_ByteStringC& key, const CFX_AffineMatrix& matrix); - void SetAtBoolean(FX_BSTR key, FX_BOOL bValue); + void SetAtBoolean(const CFX_ByteStringC& key, FX_BOOL bValue); - void RemoveAt(FX_BSTR key); + void RemoveAt(const CFX_ByteStringC& key); - void ReplaceKey(FX_BSTR oldkey, FX_BSTR newkey); + void ReplaceKey(const CFX_ByteStringC& oldkey, const CFX_ByteStringC& newkey); FX_BOOL Identical(CPDF_Dictionary* pDict) const; @@ -493,7 +493,7 @@ public: return m_Map.GetCount(); } - void AddValue(FX_BSTR key, CPDF_Object* pObj); + void AddValue(const CFX_ByteStringC& key, CPDF_Object* pObj); protected: ~CPDF_Dictionary(); @@ -622,7 +622,7 @@ protected: uint8_t* m_pSrcData; }; -CFX_DataFilter* FPDF_CreateFilter(FX_BSTR name, const CPDF_Dictionary* pParam, int width = 0, int height = 0); +CFX_DataFilter* FPDF_CreateFilter(const CFX_ByteStringC& name, const CPDF_Dictionary* pParam, int width = 0, int height = 0); #define FPDF_FILTER_BUFFER_SIZE 20480 class CPDF_StreamFilter { diff --git a/core/include/fpdfapi/fpdf_page.h b/core/include/fpdfapi/fpdf_page.h index 867f00208b..959ed1382f 100644 --- a/core/include/fpdfapi/fpdf_page.h +++ b/core/include/fpdfapi/fpdf_page.h @@ -173,7 +173,7 @@ public: return m_PageMatrix; } - CPDF_Object* GetPageAttr(FX_BSTR name) const; + CPDF_Object* GetPageAttr(const CFX_ByteStringC& name) const; diff --git a/core/include/fpdfapi/fpdf_pageobj.h b/core/include/fpdfapi/fpdf_pageobj.h index e09c0456fe..340c8d3b75 100644 --- a/core/include/fpdfapi/fpdf_pageobj.h +++ b/core/include/fpdfapi/fpdf_pageobj.h @@ -274,7 +274,7 @@ public: CPDF_GeneralStateData(const CPDF_GeneralStateData& src); ~CPDF_GeneralStateData(); - void SetBlendMode(FX_BSTR blend_mode); + void SetBlendMode(const CFX_ByteStringC& blend_mode); char m_BlendMode[16]; @@ -422,9 +422,9 @@ public: return m_pObject ? m_pObject->GetMCID() : -1; } - FX_BOOL HasMark(FX_BSTR mark) const; + FX_BOOL HasMark(const CFX_ByteStringC& mark) const; - FX_BOOL LookupMark(FX_BSTR mark, CPDF_Dictionary*& pDict) const; + FX_BOOL LookupMark(const CFX_ByteStringC& mark, CPDF_Dictionary*& pDict) const; }; #define PDFPAGE_TEXT 1 #define PDFPAGE_PATH 2 diff --git a/core/include/fpdfapi/fpdf_parser.h b/core/include/fpdfapi/fpdf_parser.h index cdd7aaaa11..f579527db4 100644 --- a/core/include/fpdfapi/fpdf_parser.h +++ b/core/include/fpdfapi/fpdf_parser.h @@ -204,18 +204,18 @@ public: CPDF_SimpleParser(const uint8_t* pData, FX_DWORD dwSize); - CPDF_SimpleParser(FX_BSTR str); + CPDF_SimpleParser(const CFX_ByteStringC& str); CFX_ByteStringC GetWord(); - FX_BOOL SearchToken(FX_BSTR token); + FX_BOOL SearchToken(const CFX_ByteStringC& token); - FX_BOOL SkipWord(FX_BSTR token); + FX_BOOL SkipWord(const CFX_ByteStringC& token); - FX_BOOL FindTagPair(FX_BSTR start_token, FX_BSTR end_token, + FX_BOOL FindTagPair(const CFX_ByteStringC& start_token, const CFX_ByteStringC& end_token, FX_DWORD& start_pos, FX_DWORD& end_pos); - FX_BOOL FindTagParam(FX_BSTR token, int nParams); + FX_BOOL FindTagParam(const CFX_ByteStringC& token, int nParams); FX_DWORD GetPos() { @@ -275,11 +275,11 @@ public: void ToNextWord(); - FX_BOOL SearchWord(FX_BSTR word, FX_BOOL bWholeWord, FX_BOOL bForward, FX_FILESIZE limit); + FX_BOOL SearchWord(const CFX_ByteStringC& word, FX_BOOL bWholeWord, FX_BOOL bForward, FX_FILESIZE limit); - int SearchMultiWord(FX_BSTR words, FX_BOOL bWholeWord, FX_FILESIZE limit); + int SearchMultiWord(const CFX_ByteStringC& words, FX_BOOL bWholeWord, FX_FILESIZE limit); - FX_FILESIZE FindTag(FX_BSTR tag, FX_FILESIZE limit); + FX_FILESIZE FindTag(const CFX_ByteStringC& tag, FX_FILESIZE limit); void SetEncrypt(CPDF_CryptoHandler* pCryptoHandler) { @@ -756,7 +756,7 @@ public: #define CPDF_Rect CFX_FloatRect #define CPDF_Matrix CFX_AffineMatrix -CFX_ByteString PDF_NameDecode(FX_BSTR orig); +CFX_ByteString PDF_NameDecode(const CFX_ByteStringC& orig); 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); diff --git a/core/include/fpdfapi/fpdf_resource.h b/core/include/fpdfapi/fpdf_resource.h index 501e3be2f0..d49ed4ec5c 100644 --- a/core/include/fpdfapi/fpdf_resource.h +++ b/core/include/fpdfapi/fpdf_resource.h @@ -72,7 +72,7 @@ class CPDF_Font { public: static CPDF_Font* CreateFontF(CPDF_Document* pDoc, CPDF_Dictionary* pFontDict); - static CPDF_Font* GetStockFont(CPDF_Document* pDoc, FX_BSTR fontname); + static CPDF_Font* GetStockFont(CPDF_Document* pDoc, const CFX_ByteStringC& fontname); virtual ~CPDF_Font(); diff --git a/core/include/fpdfdoc/fpdf_doc.h b/core/include/fpdfdoc/fpdf_doc.h index 67b799d06e..cb91b96f43 100644 --- a/core/include/fpdfdoc/fpdf_doc.h +++ b/core/include/fpdfdoc/fpdf_doc.h @@ -49,13 +49,13 @@ public: m_pRoot = pRoot; } - CPDF_NameTree(CPDF_Document* pDoc, FX_BSTR category); + CPDF_NameTree(CPDF_Document* pDoc, const CFX_ByteStringC& category); CPDF_Object* LookupValue(int nIndex, CFX_ByteString& csName) const; CPDF_Object* LookupValue(const CFX_ByteString& csName) const; - CPDF_Array* LookupNamedDest(CPDF_Document* pDoc, FX_BSTR sName); + CPDF_Array* LookupNamedDest(CPDF_Document* pDoc, const CFX_ByteStringC& sName); int GetIndex(const CFX_ByteString& csName) const; @@ -167,7 +167,7 @@ public: void ResetOCContext(); protected: - FX_BOOL LoadOCGStateFromConfig(FX_BSTR csConfig, const CPDF_Dictionary *pOCGDict, FX_BOOL &bValidConfig) const; + FX_BOOL LoadOCGStateFromConfig(const CFX_ByteStringC& csConfig, const CPDF_Dictionary *pOCGDict, FX_BOOL &bValidConfig) const; FX_BOOL LoadOCGState(const CPDF_Dictionary *pOCGDict) const; @@ -459,7 +459,7 @@ public: CPDF_Stream* GetFileStream() const; - void SetFileName(FX_WSTR wsFileName, FX_BOOL bURL = FALSE); + void SetFileName(const CFX_WideStringC& wsFileName, FX_BOOL bURL = FALSE); protected: CPDF_Object *m_pObj; @@ -882,9 +882,9 @@ public: CPDF_FormField* CheckRequiredFields(const CFX_PtrArray *fields = NULL, FX_BOOL bIncludeOrExclude = TRUE) const; - CFDF_Document* ExportToFDF(FX_WSTR pdf_path, FX_BOOL bSimpleFileSpec = FALSE) const; + CFDF_Document* ExportToFDF(const CFX_WideStringC& pdf_path, FX_BOOL bSimpleFileSpec = FALSE) const; - CFDF_Document* ExportToFDF(FX_WSTR pdf_path, CFX_PtrArray& fields, FX_BOOL bIncludeOrExclude = TRUE, FX_BOOL bSimpleFileSpec = FALSE) const; + CFDF_Document* ExportToFDF(const CFX_WideStringC& pdf_path, CFX_PtrArray& fields, FX_BOOL bIncludeOrExclude = TRUE, FX_BOOL bSimpleFileSpec = FALSE) const; FX_BOOL ImportFromFDF(const CFDF_Document* pFDFDoc, FX_BOOL bNotify = FALSE); @@ -1518,10 +1518,10 @@ public: CFX_WideString GetLabel(int nPage) const; - int32_t GetPageByLabel(FX_BSTR bsLabel) const; + int32_t GetPageByLabel(const CFX_ByteStringC& bsLabel) const; - int32_t GetPageByLabel(FX_WSTR wsLabel) const; + int32_t GetPageByLabel(const CFX_WideStringC& wsLabel) const; protected: CPDF_Document* m_pDocument; @@ -1538,7 +1538,7 @@ public: void LoadDoc(CPDF_Document *pDoc); - int32_t GetString(FX_BSTR bsItem, CFX_WideString &wsStr); + int32_t GetString(const CFX_ByteStringC& bsItem, CFX_WideString &wsStr); CXML_Element* GetRoot() const; @@ -1584,7 +1584,7 @@ public: return m_pDict; } - FX_BOOL HasMKEntry(FX_BSTR csEntry); + FX_BOOL HasMKEntry(const CFX_ByteStringC& csEntry); @@ -1687,15 +1687,15 @@ public: CPDF_Dictionary* m_pDict; protected: - FX_ARGB GetColor(int& iColorType, FX_BSTR csEntry); + FX_ARGB GetColor(int& iColorType, const CFX_ByteStringC& csEntry); - FX_FLOAT GetOriginalColor(int index, FX_BSTR csEntry); + FX_FLOAT GetOriginalColor(int index, const CFX_ByteStringC& csEntry); - void GetOriginalColor(int& iColorType, FX_FLOAT fc[4], FX_BSTR csEntry); + void GetOriginalColor(int& iColorType, FX_FLOAT fc[4], const CFX_ByteStringC& csEntry); - CFX_WideString GetCaption(FX_BSTR csEntry); + CFX_WideString GetCaption(const CFX_ByteStringC& csEntry); - CPDF_Stream* GetIcon(FX_BSTR csEntry); + CPDF_Stream* GetIcon(const CFX_ByteStringC& csEntry); friend class CPDF_FormControl; }; diff --git a/core/include/fpdfdoc/fpdf_tagged.h b/core/include/fpdfdoc/fpdf_tagged.h index 4943ad0ce6..58f613bf96 100644 --- a/core/include/fpdfdoc/fpdf_tagged.h +++ b/core/include/fpdfdoc/fpdf_tagged.h @@ -85,17 +85,17 @@ public: virtual CFX_PtrArray* GetObjectArray() = 0; - virtual CPDF_Object* GetAttr(FX_BSTR owner, FX_BSTR name, FX_BOOL bInheritable = FALSE, FX_FLOAT fLevel = 0.0F) = 0; + virtual CPDF_Object* GetAttr(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, FX_BOOL bInheritable = FALSE, FX_FLOAT fLevel = 0.0F) = 0; - virtual CFX_ByteString GetName(FX_BSTR owner, FX_BSTR name, FX_BSTR default_value, FX_BOOL bInheritable = FALSE, int subindex = -1) = 0; + virtual CFX_ByteString GetName(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, const CFX_ByteStringC& default_value, FX_BOOL bInheritable = FALSE, int subindex = -1) = 0; - virtual FX_ARGB GetColor(FX_BSTR owner, FX_BSTR name, FX_ARGB default_value, FX_BOOL bInheritable = FALSE, int subindex = -1) = 0; + virtual FX_ARGB GetColor(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, FX_ARGB default_value, FX_BOOL bInheritable = FALSE, int subindex = -1) = 0; - virtual FX_FLOAT GetNumber(FX_BSTR owner, FX_BSTR name, FX_FLOAT default_value, FX_BOOL bInheritable = FALSE, int subindex = -1) = 0; + virtual FX_FLOAT GetNumber(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, FX_FLOAT default_value, FX_BOOL bInheritable = FALSE, int subindex = -1) = 0; - virtual int GetInteger(FX_BSTR owner, FX_BSTR name, int default_value, FX_BOOL bInheritable = FALSE, int subindex = -1) = 0; + virtual int GetInteger(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, int default_value, FX_BOOL bInheritable = FALSE, int subindex = -1) = 0; }; diff --git a/core/include/fxcrt/fx_basic.h b/core/include/fxcrt/fx_basic.h index 004b01875b..df36c26a02 100644 --- a/core/include/fxcrt/fx_basic.h +++ b/core/include/fxcrt/fx_basic.h @@ -43,7 +43,7 @@ public: void AppendFill(uint8_t byte, FX_STRSIZE count); - void AppendString(FX_BSTR str) + void AppendString(const CFX_ByteStringC& str) { AppendBlock(str.GetPtr(), str.GetLength()); } @@ -95,7 +95,7 @@ class CFX_ByteTextBuf : public CFX_BinaryBuf { public: - void operator = (FX_BSTR str); + void operator = (const CFX_ByteStringC& str); void AppendChar(int ch) { @@ -108,7 +108,7 @@ public: CFX_ByteTextBuf& operator << (double f); - CFX_ByteTextBuf& operator << (FX_BSTR lpsz); + CFX_ByteTextBuf& operator << (const CFX_ByteStringC& lpsz); CFX_ByteTextBuf& operator << (const CFX_ByteTextBuf& buf); @@ -123,7 +123,7 @@ public: void operator = (const FX_WCHAR* lpsz); - void operator = (FX_WSTR str); + void operator = (const CFX_WideStringC& str); void AppendChar(FX_WCHAR wch); @@ -133,7 +133,7 @@ public: CFX_WideTextBuf& operator << (const FX_WCHAR* lpsz); - CFX_WideTextBuf& operator << (FX_WSTR str); + CFX_WideTextBuf& operator << (const CFX_WideStringC& str); CFX_WideTextBuf& operator << (const CFX_WideString &str); CFX_WideTextBuf& operator << (const CFX_WideTextBuf& buf); @@ -170,7 +170,7 @@ public: CFX_ArchiveSaver& operator << (double i); - CFX_ArchiveSaver& operator << (FX_BSTR bstr); + CFX_ArchiveSaver& operator << (const CFX_ByteStringC& bstr); CFX_ArchiveSaver& operator << (const FX_WCHAR* bstr); @@ -248,7 +248,7 @@ public: int32_t AppendDWord(FX_DWORD i); - int32_t AppendString(FX_BSTR lpsz); + int32_t AppendString(const CFX_ByteStringC& lpsz); protected: @@ -332,7 +332,7 @@ public: void Input(FX_WCHAR unicode); - void AppendStr(FX_BSTR str) + void AppendStr(const CFX_ByteStringC& str) { m_UTF16First = 0; m_Buffer << str; @@ -934,16 +934,16 @@ public: return m_nCount == 0; } - FX_BOOL Lookup(FX_BSTR key, void*& rValue) const; + FX_BOOL Lookup(const CFX_ByteStringC& key, void*& rValue) const; - void*& operator[](FX_BSTR key); + void*& operator[](const CFX_ByteStringC& key); - void SetAt(FX_BSTR key, void* newValue) + void SetAt(const CFX_ByteStringC& key, void* newValue) { (*this)[key] = newValue; } - FX_BOOL RemoveKey(FX_BSTR key); + FX_BOOL RemoveKey(const CFX_ByteStringC& key); void RemoveAll(); @@ -963,7 +963,7 @@ public: void InitHashTable(FX_DWORD hashSize, FX_BOOL bAllocNow = TRUE); - FX_DWORD HashKey(FX_BSTR key) const; + FX_DWORD HashKey(const CFX_ByteStringC& key) const; protected: CAssoc** m_pHashTable; @@ -982,7 +982,7 @@ protected: void FreeAssoc(CAssoc* pAssoc); - CAssoc* GetAssocAt(FX_BSTR key, FX_DWORD& hash) const; + CAssoc* GetAssocAt(const CFX_ByteStringC& key, FX_DWORD& hash) const; public: ~CFX_MapByteStringToPtr(); @@ -1002,15 +1002,15 @@ public: void* GetNextValue(FX_POSITION& rNextPosition) const; - FX_BOOL Lookup(FX_BSTR key, void*& rValue) const; + FX_BOOL Lookup(const CFX_ByteStringC& key, void*& rValue) const; - void SetAt(FX_BSTR key, void* value); + void SetAt(const CFX_ByteStringC& key, void* value); - void RemoveKey(FX_BSTR key); + void RemoveKey(const CFX_ByteStringC& key); int GetCount() const; - void AddValue(FX_BSTR key, void* pValue); + void AddValue(const CFX_ByteStringC& key, void* pValue); private: CFX_BaseSegmentedArray m_Buffer; diff --git a/core/include/fxcrt/fx_stream.h b/core/include/fxcrt/fx_stream.h index 44f911d150..4099befcfc 100644 --- a/core/include/fxcrt/fx_stream.h +++ b/core/include/fxcrt/fx_stream.h @@ -44,8 +44,8 @@ typedef struct FX_HFILE_ { #define FX_FILEMODE_Write 0 #define FX_FILEMODE_ReadOnly 1 #define FX_FILEMODE_Truncate 2 -FX_HFILE FX_File_Open(FX_BSTR fileName, FX_DWORD dwMode); -FX_HFILE FX_File_Open(FX_WSTR fileName, FX_DWORD dwMode); +FX_HFILE FX_File_Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode); +FX_HFILE FX_File_Open(const CFX_WideStringC& fileName, FX_DWORD dwMode); void FX_File_Close(FX_HFILE hFile); FX_FILESIZE FX_File_GetSize(FX_HFILE hFile); FX_FILESIZE FX_File_GetPosition(FX_HFILE hFile); @@ -56,14 +56,14 @@ size_t FX_File_Write(FX_HFILE hFile, const void* pBuffer, size_t szBuffer); size_t FX_File_WritePos(FX_HFILE hFile, const void* pBuffer, size_t szBuffer, FX_FILESIZE pos); FX_BOOL FX_File_Flush(FX_HFILE hFile); FX_BOOL FX_File_Truncate(FX_HFILE hFile, FX_FILESIZE szFile); -FX_BOOL FX_File_Exist(FX_BSTR fileName); -FX_BOOL FX_File_Exist(FX_WSTR fileName); -FX_BOOL FX_File_Delete(FX_BSTR fileName); -FX_BOOL FX_File_Delete(FX_WSTR fileName); -FX_BOOL FX_File_Copy(FX_BSTR fileNameSrc, FX_BSTR fileNameDst); -FX_BOOL FX_File_Copy(FX_WSTR fileNameSrc, FX_WSTR fileNameDst); -FX_BOOL FX_File_Move(FX_BSTR fileNameSrc, FX_BSTR fileNameDst); -FX_BOOL FX_File_Move(FX_WSTR fileNameSrc, FX_WSTR fileNameDst); +FX_BOOL FX_File_Exist(const CFX_ByteStringC& fileName); +FX_BOOL FX_File_Exist(const CFX_WideStringC& fileName); +FX_BOOL FX_File_Delete(const CFX_ByteStringC& fileName); +FX_BOOL FX_File_Delete(const CFX_WideStringC& fileName); +FX_BOOL FX_File_Copy(const CFX_ByteStringC& fileNameSrc, const CFX_ByteStringC& fileNameDst); +FX_BOOL FX_File_Copy(const CFX_WideStringC& fileNameSrc, const CFX_WideStringC& fileNameDst); +FX_BOOL FX_File_Move(const CFX_ByteStringC& fileNameSrc, const CFX_ByteStringC& fileNameDst); +FX_BOOL FX_File_Move(const CFX_WideStringC& fileNameSrc, const CFX_WideStringC& fileNameDst); class IFX_StreamWrite { public: diff --git a/core/include/fxcrt/fx_string.h b/core/include/fxcrt/fx_string.h index 5923ffdf2d..4ce8b81937 100644 --- a/core/include/fxcrt/fx_string.h +++ b/core/include/fxcrt/fx_string.h @@ -167,7 +167,6 @@ inline bool operator== (const char* lhs, const CFX_ByteStringC& rhs) { inline bool operator!= (const char* lhs, const CFX_ByteStringC& rhs) { return rhs != lhs; } -typedef const CFX_ByteStringC& FX_BSTR; #define FX_BSTRC(str) CFX_ByteStringC(str, sizeof str-1) #define FXBSTR_ID(c1, c2, c3, c4) ((c1 << 24) | (c2 << 16) | (c3 << 8) | (c4)) @@ -196,8 +195,8 @@ public: CFX_ByteString(const FX_CHAR* ptr, FX_STRSIZE len); CFX_ByteString(const uint8_t* ptr, FX_STRSIZE len); - CFX_ByteString(FX_BSTR bstrc); - CFX_ByteString(FX_BSTR bstrc1, FX_BSTR bstrc2); + CFX_ByteString(const CFX_ByteStringC& bstrc); + CFX_ByteString(const CFX_ByteStringC& bstrc1, const CFX_ByteStringC& bstrc2); ~CFX_ByteString(); @@ -232,14 +231,14 @@ public: return !GetLength(); } - int Compare(FX_BSTR str) const; + int Compare(const CFX_ByteStringC& str) const; bool Equal(const char* ptr) const; bool Equal(const CFX_ByteStringC& str) const; bool Equal(const CFX_ByteString& other) const; - bool EqualNoCase(FX_BSTR str) const; + bool EqualNoCase(const CFX_ByteStringC& str) const; bool operator== (const char* ptr) const { return Equal(ptr); } bool operator== (const CFX_ByteStringC& str) const { return Equal(str); } @@ -263,7 +262,7 @@ public: const CFX_ByteString& operator = (const FX_CHAR* str); - const CFX_ByteString& operator = (FX_BSTR bstrc); + const CFX_ByteString& operator = (const CFX_ByteStringC& bstrc); const CFX_ByteString& operator = (const CFX_ByteString& stringSrc); @@ -277,7 +276,7 @@ public: const CFX_ByteString& operator += (const CFX_ByteString& str); - const CFX_ByteString& operator += (FX_BSTR bstrc); + const CFX_ByteString& operator += (const CFX_ByteStringC& bstrc); uint8_t GetAt(FX_STRSIZE nIndex) const { @@ -315,7 +314,7 @@ public: CFX_ByteString Right(FX_STRSIZE count) const; - FX_STRSIZE Find(FX_BSTR lpszSub, FX_STRSIZE start = 0) const; + FX_STRSIZE Find(const CFX_ByteStringC& lpszSub, FX_STRSIZE start = 0) const; FX_STRSIZE Find(FX_CHAR ch, FX_STRSIZE start = 0) const; @@ -329,15 +328,15 @@ public: void TrimRight(FX_CHAR chTarget); - void TrimRight(FX_BSTR lpszTargets); + void TrimRight(const CFX_ByteStringC& lpszTargets); void TrimLeft(); void TrimLeft(FX_CHAR chTarget); - void TrimLeft(FX_BSTR lpszTargets); + void TrimLeft(const CFX_ByteStringC& lpszTargets); - FX_STRSIZE Replace(FX_BSTR lpszOld, FX_BSTR lpszNew); + FX_STRSIZE Replace(const CFX_ByteStringC& lpszOld, const CFX_ByteStringC& lpszNew); FX_STRSIZE Remove(FX_CHAR ch); @@ -418,23 +417,23 @@ inline bool operator!= (const CFX_ByteStringC& lhs, const CFX_ByteString& rhs) { return rhs != lhs; } -inline CFX_ByteString operator + (FX_BSTR str1, FX_BSTR str2) +inline CFX_ByteString operator + (const CFX_ByteStringC& str1, const CFX_ByteStringC& str2) { return CFX_ByteString(str1, str2); } -inline CFX_ByteString operator + (FX_BSTR str1, const FX_CHAR* str2) +inline CFX_ByteString operator + (const CFX_ByteStringC& str1, const FX_CHAR* str2) { return CFX_ByteString(str1, str2); } -inline CFX_ByteString operator + (const FX_CHAR* str1, FX_BSTR str2) +inline CFX_ByteString operator + (const FX_CHAR* str1, const CFX_ByteStringC& str2) { return CFX_ByteString(str1, str2); } -inline CFX_ByteString operator + (FX_BSTR str1, FX_CHAR ch) +inline CFX_ByteString operator + (const CFX_ByteStringC& str1, FX_CHAR ch) { return CFX_ByteString(str1, CFX_ByteStringC(ch)); } -inline CFX_ByteString operator + (FX_CHAR ch, FX_BSTR str2) +inline CFX_ByteString operator + (FX_CHAR ch, const CFX_ByteStringC& str2) { return CFX_ByteString(ch, str2); } @@ -458,11 +457,11 @@ inline CFX_ByteString operator + (const FX_CHAR* str1, const CFX_ByteString& str { return CFX_ByteString(str1, str2); } -inline CFX_ByteString operator + (const CFX_ByteString& str1, FX_BSTR str2) +inline CFX_ByteString operator + (const CFX_ByteString& str1, const CFX_ByteStringC& str2) { return CFX_ByteString(str1, str2); } -inline CFX_ByteString operator + (FX_BSTR str1, const CFX_ByteString& str2) +inline CFX_ByteString operator + (const CFX_ByteStringC& str1, const CFX_ByteString& str2) { return CFX_ByteString(str1, str2); } @@ -615,7 +614,6 @@ inline bool operator== (const wchar_t* lhs, const CFX_WideStringC& rhs) { inline bool operator!= (const wchar_t* lhs, const CFX_WideStringC& rhs) { return rhs != lhs; } -typedef const CFX_WideStringC& FX_WSTR; #define FX_WSTRC(wstr) CFX_WideStringC(wstr, FX_ArraySize(wstr) - 1) // A mutable string with shared buffers using copy-on-write semantics that @@ -896,11 +894,11 @@ inline bool operator!= (const wchar_t* lhs, const CFX_WideString& rhs) { inline bool operator!= (const CFX_WideStringC& lhs, const CFX_WideString& rhs) { return rhs != lhs; } -FX_FLOAT FX_atof(FX_BSTR str); -void FX_atonum(FX_BSTR str, FX_BOOL& bInteger, void* pData); +FX_FLOAT FX_atof(const CFX_ByteStringC& str); +void FX_atonum(const CFX_ByteStringC& str, FX_BOOL& bInteger, void* pData); FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_CHAR* buf); CFX_ByteString FX_UTF8Encode(const FX_WCHAR* pwsStr, FX_STRSIZE len); -inline CFX_ByteString FX_UTF8Encode(FX_WSTR wsStr) +inline CFX_ByteString FX_UTF8Encode(const CFX_WideStringC& wsStr) { return FX_UTF8Encode(wsStr.GetPtr(), wsStr.GetLength()); } diff --git a/core/include/fxcrt/fx_xml.h b/core/include/fxcrt/fx_xml.h index b2fb24c6df..fb24f61b13 100644 --- a/core/include/fxcrt/fx_xml.h +++ b/core/include/fxcrt/fx_xml.h @@ -27,9 +27,9 @@ public: { RemoveAll(); } - const CFX_WideString* Lookup(FX_BSTR space, FX_BSTR name) const; - void SetAt(FX_BSTR space, FX_BSTR name, FX_WSTR value); - void RemoveAt(FX_BSTR space, FX_BSTR name); + const CFX_WideString* Lookup(const CFX_ByteStringC& space, const CFX_ByteStringC& name) const; + void SetAt(const CFX_ByteStringC& space, const CFX_ByteStringC& name, const CFX_WideStringC& value); + void RemoveAt(const CFX_ByteStringC& space, const CFX_ByteStringC& name); void RemoveAll(); int GetSize() const; CXML_AttrItem& GetAt(int index) const; @@ -39,7 +39,7 @@ class CXML_Content { public: CXML_Content() : m_bCDATA(FALSE), m_Content() {} - void Set(FX_BOOL bCDATA, FX_WSTR content) + void Set(FX_BOOL bCDATA, const CFX_WideStringC& content) { m_bCDATA = bCDATA; m_Content = content; @@ -53,8 +53,8 @@ public: static CXML_Element* Parse(const void* pBuffer, size_t size, FX_BOOL bSaveSpaceChars = FALSE, FX_FILESIZE* pParsedSize = NULL); static CXML_Element* Parse(IFX_FileRead *pFile, FX_BOOL bSaveSpaceChars = FALSE, FX_FILESIZE* pParsedSize = NULL); static CXML_Element* Parse(IFX_BufferRead *pBuffer, FX_BOOL bSaveSpaceChars = FALSE, FX_FILESIZE* pParsedSize = NULL); - CXML_Element(FX_BSTR qSpace, FX_BSTR tagName); - CXML_Element(FX_BSTR qTagName); + CXML_Element(const CFX_ByteStringC& qSpace, const CFX_ByteStringC& tagName); + CXML_Element(const CFX_ByteStringC& qTagName); CXML_Element(); ~CXML_Element(); @@ -67,7 +67,7 @@ public: CFX_ByteString GetNamespace(FX_BOOL bQualified = FALSE) const; - CFX_ByteString GetNamespaceURI(FX_BSTR qName) const; + CFX_ByteString GetNamespaceURI(const CFX_ByteStringC& qName) const; CXML_Element* GetParent() const { @@ -81,50 +81,50 @@ public: void GetAttrByIndex(int index, CFX_ByteString &space, CFX_ByteString &name, CFX_WideString &value) const; - FX_BOOL HasAttr(FX_BSTR qName) const; + FX_BOOL HasAttr(const CFX_ByteStringC& qName) const; - FX_BOOL GetAttrValue(FX_BSTR name, CFX_WideString& attribute) const; - CFX_WideString GetAttrValue(FX_BSTR name) const + FX_BOOL GetAttrValue(const CFX_ByteStringC& name, CFX_WideString& attribute) const; + CFX_WideString GetAttrValue(const CFX_ByteStringC& name) const { CFX_WideString attr; GetAttrValue(name, attr); return attr; } - FX_BOOL GetAttrValue(FX_BSTR space, FX_BSTR name, CFX_WideString& attribute) const; - CFX_WideString GetAttrValue(FX_BSTR space, FX_BSTR name) const + FX_BOOL GetAttrValue(const CFX_ByteStringC& space, const CFX_ByteStringC& name, CFX_WideString& attribute) const; + CFX_WideString GetAttrValue(const CFX_ByteStringC& space, const CFX_ByteStringC& name) const { CFX_WideString attr; GetAttrValue(space, name, attr); return attr; } - FX_BOOL GetAttrInteger(FX_BSTR name, int& attribute) const; - int GetAttrInteger(FX_BSTR name) const + FX_BOOL GetAttrInteger(const CFX_ByteStringC& name, int& attribute) const; + int GetAttrInteger(const CFX_ByteStringC& name) const { int attr = 0; GetAttrInteger(name, attr); return attr; } - FX_BOOL GetAttrInteger(FX_BSTR space, FX_BSTR name, int& attribute) const; - int GetAttrInteger(FX_BSTR space, FX_BSTR name) const + FX_BOOL GetAttrInteger(const CFX_ByteStringC& space, const CFX_ByteStringC& name, int& attribute) const; + int GetAttrInteger(const CFX_ByteStringC& space, const CFX_ByteStringC& name) const { int attr = 0; GetAttrInteger(space, name, attr); return attr; } - FX_BOOL GetAttrFloat(FX_BSTR name, FX_FLOAT& attribute) const; - FX_FLOAT GetAttrFloat(FX_BSTR name) const + FX_BOOL GetAttrFloat(const CFX_ByteStringC& name, FX_FLOAT& attribute) const; + FX_FLOAT GetAttrFloat(const CFX_ByteStringC& name) const { FX_FLOAT attr = 0; GetAttrFloat(name, attr); return attr; } - FX_BOOL GetAttrFloat(FX_BSTR space, FX_BSTR name, FX_FLOAT& attribute) const; - FX_FLOAT GetAttrFloat(FX_BSTR space, FX_BSTR name) const + FX_BOOL GetAttrFloat(const CFX_ByteStringC& space, const CFX_ByteStringC& name, FX_FLOAT& attribute) const; + FX_FLOAT GetAttrFloat(const CFX_ByteStringC& space, const CFX_ByteStringC& name) const { FX_FLOAT attr = 0; GetAttrFloat(space, name, attr); @@ -141,23 +141,23 @@ public: CXML_Element* GetElement(FX_DWORD index) const; - CXML_Element* GetElement(FX_BSTR space, FX_BSTR tag) const + CXML_Element* GetElement(const CFX_ByteStringC& space, const CFX_ByteStringC& tag) const { return GetElement(space, tag, 0); } - FX_DWORD CountElements(FX_BSTR space, FX_BSTR tag) const; + FX_DWORD CountElements(const CFX_ByteStringC& space, const CFX_ByteStringC& tag) const; - CXML_Element* GetElement(FX_BSTR space, FX_BSTR tag, int index) const; + CXML_Element* GetElement(const CFX_ByteStringC& space, const CFX_ByteStringC& tag, int index) const; FX_DWORD FindElement(CXML_Element *pChild) const; - void SetTag(FX_BSTR qSpace, FX_BSTR tagname); + void SetTag(const CFX_ByteStringC& qSpace, const CFX_ByteStringC& tagname); - void SetTag(FX_BSTR qTagName); + void SetTag(const CFX_ByteStringC& qTagName); void RemoveChildren(); diff --git a/core/include/fxge/fpf.h b/core/include/fxge/fpf.h index 710600c84f..e288d1847b 100644 --- a/core/include/fxge/fpf.h +++ b/core/include/fxge/fpf.h @@ -55,10 +55,10 @@ public: virtual ~IFPF_FontMgr() { } virtual void LoadSystemFonts() = 0; virtual void LoadPrivateFont(IFX_FileRead* pFontFile) = 0; - virtual void LoadPrivateFont(FX_BSTR bsFileName) = 0; + virtual void LoadPrivateFont(const CFX_ByteStringC& bsFileName) = 0; virtual void LoadPrivateFont(void* pBuffer, size_t szBuffer) = 0; - virtual IFPF_Font* CreateFont(FX_BSTR bsFamilyname, uint8_t charset, FX_DWORD dwStyle, FX_DWORD dwMatch = 0) = 0; + virtual IFPF_Font* CreateFont(const CFX_ByteStringC& bsFamilyname, uint8_t charset, FX_DWORD dwStyle, FX_DWORD dwMatch = 0) = 0; }; #endif // CORE_INCLUDE_FXGE_FPF_H_ diff --git a/core/include/fxge/fx_font.h b/core/include/fxge/fx_font.h index df752b4f77..29cc5df13d 100644 --- a/core/include/fxge/fx_font.h +++ b/core/include/fxge/fx_font.h @@ -320,7 +320,7 @@ class CFX_FolderFontInfo : public IFX_SystemFontInfo public: CFX_FolderFontInfo(); virtual ~CFX_FolderFontInfo(); - void AddPath(FX_BSTR path); + void AddPath(const CFX_ByteStringC& path); virtual void Release(); virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper); virtual void* MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* face, FX_BOOL& bExact); |