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/fxge/android/cfpf_skiafont.cpp | 12 ++++++------ core/fxge/android/cfpf_skiafont.h | 6 +++--- core/fxge/android/cfpf_skiafontmgr.cpp | 30 +++++++++++++++--------------- core/fxge/android/cfpf_skiafontmgr.h | 8 ++++---- core/fxge/android/cfx_androidfontinfo.cpp | 2 +- core/fxge/android/cfx_androidfontinfo.h | 2 +- 6 files changed, 30 insertions(+), 30 deletions(-) (limited to 'core/fxge/android') diff --git a/core/fxge/android/cfpf_skiafont.cpp b/core/fxge/android/cfpf_skiafont.cpp index e00aa840e4..1ca0f576be 100644 --- a/core/fxge/android/cfpf_skiafont.cpp +++ b/core/fxge/android/cfpf_skiafont.cpp @@ -41,15 +41,15 @@ CFPF_SkiaFont* CFPF_SkiaFont::Retain() { return this; } -CFX_ByteString CFPF_SkiaFont::GetFamilyName() { +ByteString CFPF_SkiaFont::GetFamilyName() { if (!m_Face) - return CFX_ByteString(); - return CFX_ByteString(FXFT_Get_Face_Family_Name(m_Face)); + return ByteString(); + return ByteString(FXFT_Get_Face_Family_Name(m_Face)); } -CFX_ByteString CFPF_SkiaFont::GetPsName() { +ByteString CFPF_SkiaFont::GetPsName() { if (!m_Face) - return CFX_ByteString(); + return ByteString(); return FXFT_Get_Postscript_Name(m_Face); } @@ -181,7 +181,7 @@ uint32_t CFPF_SkiaFont::GetFontData(uint32_t dwTable, bool CFPF_SkiaFont::InitFont(CFPF_SkiaFontMgr* pFontMgr, CFPF_SkiaFontDescriptor* pFontDes, - const CFX_ByteStringC& bsFamily, + const ByteStringView& bsFamily, uint32_t dwStyle, uint8_t uCharset) { if (!pFontMgr || !pFontDes) diff --git a/core/fxge/android/cfpf_skiafont.h b/core/fxge/android/cfpf_skiafont.h index 5686e9e31f..c842d5abb9 100644 --- a/core/fxge/android/cfpf_skiafont.h +++ b/core/fxge/android/cfpf_skiafont.h @@ -22,8 +22,8 @@ class CFPF_SkiaFont { void Release(); CFPF_SkiaFont* Retain(); - CFX_ByteString GetFamilyName(); - CFX_ByteString GetPsName(); + ByteString GetFamilyName(); + ByteString GetPsName(); uint32_t GetFontStyle() const { return m_dwStyle; } uint8_t GetCharset() const { return m_uCharset; } int32_t GetGlyphIndex(wchar_t wUnicode); @@ -38,7 +38,7 @@ class CFPF_SkiaFont { bool InitFont(CFPF_SkiaFontMgr* pFontMgr, CFPF_SkiaFontDescriptor* pFontDes, - const CFX_ByteStringC& bsFamily, + const ByteStringView& bsFamily, uint32_t dwStyle, uint8_t uCharset); diff --git a/core/fxge/android/cfpf_skiafontmgr.cpp b/core/fxge/android/cfpf_skiafontmgr.cpp index 16a6df5f8f..a50b9ead63 100644 --- a/core/fxge/android/cfpf_skiafontmgr.cpp +++ b/core/fxge/android/cfpf_skiafontmgr.cpp @@ -158,7 +158,7 @@ uint32_t FPF_SkiaGetCharset(uint8_t uCharset) { return FPF_SKIACHARSET_Default; } -uint32_t FPF_SKIANormalizeFontName(const CFX_ByteStringC& bsfamily) { +uint32_t FPF_SKIANormalizeFontName(const ByteStringView& bsfamily) { uint32_t dwHash = 0; int32_t iLength = bsfamily.GetLength(); const char* pBuffer = bsfamily.unterminated_c_str(); @@ -171,10 +171,10 @@ uint32_t FPF_SKIANormalizeFontName(const CFX_ByteStringC& bsfamily) { return dwHash; } -uint32_t FPF_SKIAGetFamilyHash(const CFX_ByteStringC& bsFamily, +uint32_t FPF_SKIAGetFamilyHash(const ByteStringView& bsFamily, uint32_t dwStyle, uint8_t uCharset) { - CFX_ByteString bsFont(bsFamily); + ByteString bsFont(bsFamily); if (dwStyle & FXFONT_BOLD) bsFont += "Bold"; if (dwStyle & FXFONT_ITALIC) @@ -191,14 +191,14 @@ bool FPF_SkiaIsCJK(uint8_t uCharset) { (uCharset == FX_CHARSET_Hangul) || (uCharset == FX_CHARSET_ShiftJIS); } -bool FPF_SkiaMaybeSymbol(const CFX_ByteStringC& bsFacename) { - CFX_ByteString bsName(bsFacename); +bool FPF_SkiaMaybeSymbol(const ByteStringView& bsFacename) { + ByteString bsName(bsFacename); bsName.MakeLower(); return bsName.Contains("symbol"); } -bool FPF_SkiaMaybeArabic(const CFX_ByteStringC& bsFacename) { - CFX_ByteString bsName(bsFacename); +bool FPF_SkiaMaybeArabic(const ByteStringView& bsFacename) { + ByteString bsName(bsFacename); bsName.MakeLower(); return bsName.Contains("arabic"); } @@ -280,7 +280,7 @@ void CFPF_SkiaFontMgr::LoadSystemFonts() { m_bLoaded = true; } -CFPF_SkiaFont* CFPF_SkiaFontMgr::CreateFont(const CFX_ByteStringC& bsFamilyname, +CFPF_SkiaFont* CFPF_SkiaFontMgr::CreateFont(const ByteStringView& bsFamilyname, uint8_t uCharset, uint32_t dwStyle, uint32_t dwMatch) { @@ -387,7 +387,7 @@ FXFT_Face CFPF_SkiaFontMgr::GetFontFace( return face; } -FXFT_Face CFPF_SkiaFontMgr::GetFontFace(const CFX_ByteStringC& bsFile, +FXFT_Face CFPF_SkiaFontMgr::GetFontFace(const ByteStringView& bsFile, int32_t iFaceIndex) { if (bsFile.IsEmpty()) return nullptr; @@ -421,23 +421,23 @@ FXFT_Face CFPF_SkiaFontMgr::GetFontFace(const uint8_t* pBuffer, return face; } -void CFPF_SkiaFontMgr::ScanPath(const CFX_ByteString& path) { +void CFPF_SkiaFontMgr::ScanPath(const ByteString& path) { DIR* handle = FX_OpenFolder(path.c_str()); if (!handle) return; - CFX_ByteString filename; + ByteString filename; bool bFolder = false; while (FX_GetNextFile(handle, &filename, &bFolder)) { if (bFolder) { if (filename == "." || filename == "..") continue; } else { - CFX_ByteString ext = filename.Right(4); + ByteString ext = filename.Right(4); ext.MakeLower(); if (ext != ".ttf" && ext != ".ttc" && ext != ".otf") continue; } - CFX_ByteString fullpath(path); + ByteString fullpath(path); fullpath += "/"; fullpath += filename; if (bFolder) @@ -448,8 +448,8 @@ void CFPF_SkiaFontMgr::ScanPath(const CFX_ByteString& path) { FX_CloseFolder(handle); } -void CFPF_SkiaFontMgr::ScanFile(const CFX_ByteString& file) { - FXFT_Face face = GetFontFace(file.AsStringC()); +void CFPF_SkiaFontMgr::ScanFile(const ByteString& file) { + FXFT_Face face = GetFontFace(file.AsStringView()); if (!face) return; CFPF_SkiaPathFont* pFontDesc = new CFPF_SkiaPathFont; diff --git a/core/fxge/android/cfpf_skiafontmgr.h b/core/fxge/android/cfpf_skiafontmgr.h index 4d0ea0e0d2..78d01717b9 100644 --- a/core/fxge/android/cfpf_skiafontmgr.h +++ b/core/fxge/android/cfpf_skiafontmgr.h @@ -25,7 +25,7 @@ class CFPF_SkiaFontMgr { ~CFPF_SkiaFontMgr(); void LoadSystemFonts(); - CFPF_SkiaFont* CreateFont(const CFX_ByteStringC& bsFamilyname, + CFPF_SkiaFont* CreateFont(const ByteStringView& bsFamilyname, uint8_t uCharset, uint32_t dwStyle, uint32_t dwMatch = 0); @@ -33,14 +33,14 @@ class CFPF_SkiaFontMgr { bool InitFTLibrary(); FXFT_Face GetFontFace(const CFX_RetainPtr& pFileRead, int32_t iFaceIndex = 0); - FXFT_Face GetFontFace(const CFX_ByteStringC& bsFile, int32_t iFaceIndex = 0); + FXFT_Face GetFontFace(const ByteStringView& bsFile, int32_t iFaceIndex = 0); FXFT_Face GetFontFace(const uint8_t* pBuffer, size_t szBuffer, int32_t iFaceIndex = 0); private: - void ScanPath(const CFX_ByteString& path); - void ScanFile(const CFX_ByteString& file); + void ScanPath(const ByteString& path); + void ScanFile(const ByteString& file); void ReportFace(FXFT_Face face, CFPF_SkiaFontDescriptor* pFontDesc); bool m_bLoaded; diff --git a/core/fxge/android/cfx_androidfontinfo.cpp b/core/fxge/android/cfx_androidfontinfo.cpp index 1183cdeaaa..c6c3e61866 100644 --- a/core/fxge/android/cfx_androidfontinfo.cpp +++ b/core/fxge/android/cfx_androidfontinfo.cpp @@ -63,7 +63,7 @@ uint32_t CFX_AndroidFontInfo::GetFontData(void* hFont, return static_cast(hFont)->GetFontData(table, buffer, size); } -bool CFX_AndroidFontInfo::GetFaceName(void* hFont, CFX_ByteString* name) { +bool CFX_AndroidFontInfo::GetFaceName(void* hFont, ByteString* name) { if (!hFont) return false; diff --git a/core/fxge/android/cfx_androidfontinfo.h b/core/fxge/android/cfx_androidfontinfo.h index 17bbf89a3e..3fde349fb3 100644 --- a/core/fxge/android/cfx_androidfontinfo.h +++ b/core/fxge/android/cfx_androidfontinfo.h @@ -35,7 +35,7 @@ class CFX_AndroidFontInfo : public IFX_SystemFontInfo { uint32_t table, uint8_t* buffer, uint32_t size) override; - bool GetFaceName(void* hFont, CFX_ByteString* name) override; + bool GetFaceName(void* hFont, ByteString* name) override; bool GetFontCharset(void* hFont, int* charset) override; void DeleteFont(void* hFont) override; -- cgit v1.2.3