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/fxcrt/xml/cxml_parser.cpp | 47 +++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 23 deletions(-) (limited to 'core/fxcrt/xml/cxml_parser.cpp') diff --git a/core/fxcrt/xml/cxml_parser.cpp b/core/fxcrt/xml/cxml_parser.cpp index 9679e2cd41..adf83c7148 100644 --- a/core/fxcrt/xml/cxml_parser.cpp +++ b/core/fxcrt/xml/cxml_parser.cpp @@ -78,9 +78,9 @@ bool g_FXCRT_XML_IsNameChar(uint8_t ch) { } // namespace -void FX_XML_SplitQualifiedName(const CFX_ByteStringC& bsFullName, - CFX_ByteStringC& bsSpace, - CFX_ByteStringC& bsName) { +void FX_XML_SplitQualifiedName(const ByteStringView& bsFullName, + ByteStringView& bsSpace, + ByteStringView& bsName) { if (bsFullName.IsEmpty()) return; @@ -139,7 +139,7 @@ void CXML_Parser::SkipWhiteSpaces() { } while (ReadNextBlock()); } -void CXML_Parser::GetName(CFX_ByteString* space, CFX_ByteString* name) { +void CXML_Parser::GetName(ByteString* space, ByteString* name) { m_nOffset = m_nBufferOffset + static_cast(m_dwIndex); if (IsEOF()) return; @@ -149,7 +149,7 @@ void CXML_Parser::GetName(CFX_ByteString* space, CFX_ByteString* name) { while (m_dwIndex < m_dwBufferSize) { uint8_t ch = m_pBuffer[m_dwIndex]; if (ch == ':') { - *space = CFX_ByteString(buf); + *space = ByteString(buf); buf.str(""); } else if (g_FXCRT_XML_IsNameChar(ch)) { buf << static_cast(ch); @@ -162,10 +162,10 @@ void CXML_Parser::GetName(CFX_ByteString* space, CFX_ByteString* name) { if (m_dwIndex < m_dwBufferSize || IsEOF()) break; } while (ReadNextBlock()); - *name = CFX_ByteString(buf); + *name = ByteString(buf); } -void CXML_Parser::SkipLiterals(const CFX_ByteStringC& str) { +void CXML_Parser::SkipLiterals(const ByteStringView& str) { m_nOffset = m_nBufferOffset + static_cast(m_dwIndex); if (IsEOF()) { return; @@ -281,7 +281,7 @@ uint32_t CXML_Parser::GetCharRef() { return code; } -void CXML_Parser::GetAttrValue(CFX_WideString& value) { +void CXML_Parser::GetAttrValue(WideString& value) { m_nOffset = m_nBufferOffset + static_cast(m_dwIndex); if (IsEOF()) return; @@ -323,8 +323,8 @@ void CXML_Parser::GetAttrValue(CFX_WideString& value) { void CXML_Parser::GetTagName(bool bStartTag, bool* bEndTag, - CFX_ByteString* space, - CFX_ByteString* name) { + ByteString* space, + ByteString* name) { m_nOffset = m_nBufferOffset + static_cast(m_dwIndex); if (IsEOF()) return; @@ -389,18 +389,18 @@ std::unique_ptr CXML_Parser::ParseElementInternal( if (IsEOF()) return nullptr; - CFX_ByteString tag_name; - CFX_ByteString tag_space; + ByteString tag_name; + ByteString tag_space; bool bEndTag; GetTagName(bStartTag, &bEndTag, &tag_space, &tag_name); if (tag_name.IsEmpty() || bEndTag) return nullptr; auto pElement = pdfium::MakeUnique( - pParent, tag_space.AsStringC(), tag_name.AsStringC()); + pParent, tag_space.AsStringView(), tag_name.AsStringView()); do { - CFX_ByteString attr_space; - CFX_ByteString attr_name; + ByteString attr_space; + ByteString attr_name; while (m_dwIndex < m_dwBufferSize) { SkipWhiteSpaces(); if (IsEOF()) @@ -422,7 +422,7 @@ std::unique_ptr CXML_Parser::ParseElementInternal( if (IsEOF()) break; - CFX_WideString attr_value; + WideString attr_value; GetAttrValue(attr_value); pElement->m_AttrMap.SetAt(attr_space, attr_name, attr_value); } @@ -474,19 +474,20 @@ std::unique_ptr CXML_Parser::ParseElementInternal( SkipWhiteSpaces(); iState = 0; } else if (ch == '/') { - CFX_ByteString space; - CFX_ByteString name; + ByteString space; + ByteString name; GetName(&space, &name); SkipWhiteSpaces(); m_dwIndex++; iState = 10; } else { content << decoder.GetResult(); - CFX_WideString dataStr = content.MakeString(); + WideString dataStr = content.MakeString(); if (!bCDATA) dataStr.TrimRight(L" \t\r\n"); - InsertContentSegment(bCDATA, dataStr.AsStringC(), pElement.get()); + InsertContentSegment(bCDATA, dataStr.AsStringView(), + pElement.get()); content.Clear(); decoder.Clear(); bCDATA = false; @@ -524,10 +525,10 @@ std::unique_ptr CXML_Parser::ParseElementInternal( break; } while (ReadNextBlock()); content << decoder.GetResult(); - CFX_WideString dataStr = content.MakeString(); + WideString dataStr = content.MakeString(); dataStr.TrimRight(L" \t\r\n"); - InsertContentSegment(bCDATA, dataStr.AsStringC(), pElement.get()); + InsertContentSegment(bCDATA, dataStr.AsStringView(), pElement.get()); content.Clear(); decoder.Clear(); bCDATA = false; @@ -535,7 +536,7 @@ std::unique_ptr CXML_Parser::ParseElementInternal( } void CXML_Parser::InsertContentSegment(bool bCDATA, - const CFX_WideStringC& content, + const WideStringView& content, CXML_Element* pElement) { if (content.IsEmpty()) return; -- cgit v1.2.3