summaryrefslogtreecommitdiff
path: root/core/fxcrt
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxcrt')
-rw-r--r--core/fxcrt/bytestring.cpp4
-rw-r--r--core/fxcrt/bytestring.h7
-rw-r--r--core/fxcrt/bytestring_unittest.cpp4
-rw-r--r--core/fxcrt/maybe_owned_unittest.cpp1
-rw-r--r--core/fxcrt/observable_unittest.cpp3
-rw-r--r--core/fxcrt/retain_ptr_unittest.cpp3
-rw-r--r--core/fxcrt/shared_copy_on_write_unittest.cpp3
-rw-r--r--core/fxcrt/string_pool_template.h (renamed from core/fxcrt/cfx_string_pool_template.h)22
-rw-r--r--core/fxcrt/string_pool_template_unittest.cpp (renamed from core/fxcrt/cfx_string_pool_template_unittest.cpp)10
-rw-r--r--core/fxcrt/widestring.cpp4
-rw-r--r--core/fxcrt/widestring.h6
-rw-r--r--core/fxcrt/widestring_unittest.cpp4
12 files changed, 48 insertions, 23 deletions
diff --git a/core/fxcrt/bytestring.cpp b/core/fxcrt/bytestring.cpp
index a78020bae4..aa1fb57775 100644
--- a/core/fxcrt/bytestring.cpp
+++ b/core/fxcrt/bytestring.cpp
@@ -12,17 +12,17 @@
#include <cctype>
#include <string>
-#include "core/fxcrt/cfx_string_pool_template.h"
#include "core/fxcrt/cfx_utf8decoder.h"
#include "core/fxcrt/fx_codepage.h"
#include "core/fxcrt/fx_extension.h"
#include "core/fxcrt/fx_safe_types.h"
+#include "core/fxcrt/string_pool_template.h"
#include "third_party/base/numerics/safe_math.h"
#include "third_party/base/stl_util.h"
template class fxcrt::StringDataTemplate<char>;
template class fxcrt::StringViewTemplate<char>;
-template class CFX_StringPoolTemplate<ByteString>;
+template class fxcrt::StringPoolTemplate<ByteString>;
template struct std::hash<ByteString>;
namespace {
diff --git a/core/fxcrt/bytestring.h b/core/fxcrt/bytestring.h
index c2c41e8c47..eba9744402 100644
--- a/core/fxcrt/bytestring.h
+++ b/core/fxcrt/bytestring.h
@@ -18,11 +18,10 @@
#include "core/fxcrt/string_view_template.h"
#include "third_party/base/optional.h"
-class ByteString_Concat_Test;
-class fxcrt_ByteStringPool_Test;
-
namespace fxcrt {
+class ByteString_Concat_Test;
+class StringPool_ByteString_Test;
class WideString;
// A mutable string with shared buffers using copy-on-write semantics that
@@ -198,7 +197,7 @@ class ByteString {
RetainPtr<StringData> m_pData;
friend ByteString_Concat_Test;
- friend fxcrt_ByteStringPool_Test;
+ friend class StringPool_ByteString_Test;
};
inline bool operator==(const char* lhs, const ByteString& rhs) {
diff --git a/core/fxcrt/bytestring_unittest.cpp b/core/fxcrt/bytestring_unittest.cpp
index 06ba1f42fd..e1c832e114 100644
--- a/core/fxcrt/bytestring_unittest.cpp
+++ b/core/fxcrt/bytestring_unittest.cpp
@@ -11,6 +11,8 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/base/stl_util.h"
+namespace fxcrt {
+
TEST(ByteString, ElementAccess) {
const ByteString abc("abc");
EXPECT_EQ('a', abc[0]);
@@ -1640,3 +1642,5 @@ TEST(ByteString, FormatInteger) {
EXPECT_EQ("2147483647", ByteString::FormatInteger(INT_MAX));
EXPECT_EQ("-2147483648", ByteString::FormatInteger(INT_MIN));
}
+
+} // namespace fxcrt
diff --git a/core/fxcrt/maybe_owned_unittest.cpp b/core/fxcrt/maybe_owned_unittest.cpp
index 686fa6ffd2..7182647207 100644
--- a/core/fxcrt/maybe_owned_unittest.cpp
+++ b/core/fxcrt/maybe_owned_unittest.cpp
@@ -12,7 +12,6 @@
#include "third_party/base/ptr_util.h"
namespace fxcrt {
-
namespace {
class PseudoDeletable {
diff --git a/core/fxcrt/observable_unittest.cpp b/core/fxcrt/observable_unittest.cpp
index 8edc58f613..5e64743d86 100644
--- a/core/fxcrt/observable_unittest.cpp
+++ b/core/fxcrt/observable_unittest.cpp
@@ -9,6 +9,7 @@
#include "testing/gtest/include/gtest/gtest.h"
+namespace fxcrt {
namespace {
class PseudoObservable : public Observable<PseudoObservable> {
@@ -183,3 +184,5 @@ TEST(ObservePtr, Bool) {
EXPECT_FALSE(null_bool);
EXPECT_TRUE(obj1_bool);
}
+
+} // namespace fxcrt
diff --git a/core/fxcrt/retain_ptr_unittest.cpp b/core/fxcrt/retain_ptr_unittest.cpp
index 3e14478dbf..f4b2994eae 100644
--- a/core/fxcrt/retain_ptr_unittest.cpp
+++ b/core/fxcrt/retain_ptr_unittest.cpp
@@ -9,6 +9,7 @@
#include "testing/gtest/include/gtest/gtest.h"
+namespace fxcrt {
namespace {
class PseudoRetainable {
@@ -298,3 +299,5 @@ TEST(RetainPtr, VectorMove) {
EXPECT_EQ(1, obj.retain_count());
EXPECT_EQ(1, obj.release_count());
}
+
+} // namespace fxcrt
diff --git a/core/fxcrt/shared_copy_on_write_unittest.cpp b/core/fxcrt/shared_copy_on_write_unittest.cpp
index a683767054..01cc09468c 100644
--- a/core/fxcrt/shared_copy_on_write_unittest.cpp
+++ b/core/fxcrt/shared_copy_on_write_unittest.cpp
@@ -9,6 +9,7 @@
#include "testing/gtest/include/gtest/gtest.h"
+namespace fxcrt {
namespace {
class Observer {
@@ -126,3 +127,5 @@ TEST(SharedCopyOnWrite, GetModify) {
}
EXPECT_EQ(2, observer.GetDestructionCount("one"));
}
+
+} // namespace fxcrt
diff --git a/core/fxcrt/cfx_string_pool_template.h b/core/fxcrt/string_pool_template.h
index b170a84127..2f9fb09a9f 100644
--- a/core/fxcrt/cfx_string_pool_template.h
+++ b/core/fxcrt/string_pool_template.h
@@ -4,15 +4,17 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef CORE_FXCRT_CFX_STRING_POOL_TEMPLATE_H_
-#define CORE_FXCRT_CFX_STRING_POOL_TEMPLATE_H_
+#ifndef CORE_FXCRT_STRING_POOL_TEMPLATE_H_
+#define CORE_FXCRT_STRING_POOL_TEMPLATE_H_
#include <unordered_set>
#include "core/fxcrt/fx_string.h"
+namespace fxcrt {
+
template <typename StringType>
-class CFX_StringPoolTemplate {
+class StringPoolTemplate {
public:
StringType Intern(const StringType& str) { return *m_Pool.insert(str).first; }
void Clear() { m_Pool.clear(); }
@@ -21,10 +23,14 @@ class CFX_StringPoolTemplate {
std::unordered_set<StringType> m_Pool;
};
-using ByteStringPool = CFX_StringPoolTemplate<ByteString>;
-using WideStringPool = CFX_StringPoolTemplate<WideString>;
+extern template class StringPoolTemplate<ByteString>;
+extern template class StringPoolTemplate<WideString>;
+
+} // namespace fxcrt
+
+using fxcrt::StringPoolTemplate;
-extern template class CFX_StringPoolTemplate<ByteString>;
-extern template class CFX_StringPoolTemplate<WideString>;
+using ByteStringPool = StringPoolTemplate<ByteString>;
+using WideStringPool = StringPoolTemplate<WideString>;
-#endif // CORE_FXCRT_CFX_STRING_POOL_TEMPLATE_H_
+#endif // CORE_FXCRT_STRING_POOL_TEMPLATE_H_
diff --git a/core/fxcrt/cfx_string_pool_template_unittest.cpp b/core/fxcrt/string_pool_template_unittest.cpp
index 9a5ac5d3ed..717e33d919 100644
--- a/core/fxcrt/cfx_string_pool_template_unittest.cpp
+++ b/core/fxcrt/string_pool_template_unittest.cpp
@@ -2,11 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "core/fxcrt/cfx_string_pool_template.h"
+#include "core/fxcrt/string_pool_template.h"
#include "core/fxcrt/fx_string.h"
#include "testing/gtest/include/gtest/gtest.h"
-TEST(fxcrt, ByteStringPool) {
+namespace fxcrt {
+
+TEST(StringPool, ByteString) {
ByteStringPool pool;
ByteString null1;
@@ -49,7 +51,7 @@ TEST(fxcrt, ByteStringPool) {
EXPECT_EQ(goats2.m_pData, reinterned_goats2.m_pData);
}
-TEST(fxcrt, WideStringPool) {
+TEST(StringPool, WideString) {
WideStringPool pool;
WideString null1;
@@ -91,3 +93,5 @@ TEST(fxcrt, WideStringPool) {
EXPECT_EQ(goats2.m_pData, reinterned_goats1.m_pData);
EXPECT_EQ(goats2.m_pData, reinterned_goats2.m_pData);
}
+
+} // namespace fxcrt
diff --git a/core/fxcrt/widestring.cpp b/core/fxcrt/widestring.cpp
index e5925845be..5fe7ee4777 100644
--- a/core/fxcrt/widestring.cpp
+++ b/core/fxcrt/widestring.cpp
@@ -12,17 +12,17 @@
#include <cctype>
#include <cwctype>
-#include "core/fxcrt/cfx_string_pool_template.h"
#include "core/fxcrt/cfx_utf8decoder.h"
#include "core/fxcrt/fx_codepage.h"
#include "core/fxcrt/fx_extension.h"
#include "core/fxcrt/fx_safe_types.h"
+#include "core/fxcrt/string_pool_template.h"
#include "third_party/base/numerics/safe_math.h"
#include "third_party/base/stl_util.h"
template class fxcrt::StringDataTemplate<wchar_t>;
template class fxcrt::StringViewTemplate<wchar_t>;
-template class CFX_StringPoolTemplate<WideString>;
+template class fxcrt::StringPoolTemplate<WideString>;
template struct std::hash<WideString>;
#define FORCE_ANSI 0x10000
diff --git a/core/fxcrt/widestring.h b/core/fxcrt/widestring.h
index df7d95fc6f..f56703f1ab 100644
--- a/core/fxcrt/widestring.h
+++ b/core/fxcrt/widestring.h
@@ -18,12 +18,12 @@
#include "core/fxcrt/string_view_template.h"
#include "third_party/base/optional.h"
-class WideString_ConcatInPlace_Test;
-class fxcrt_WideStringPool_Test;
namespace fxcrt {
class ByteString;
+class StringPool_WideString_Test;
+class WideString_ConcatInPlace_Test;
// A mutable string with shared buffers using copy-on-write semantics that
// avoids the cost of std::string's iterator stability guarantees.
@@ -195,7 +195,7 @@ class WideString {
RetainPtr<StringData> m_pData;
friend WideString_ConcatInPlace_Test;
- friend fxcrt_WideStringPool_Test;
+ friend StringPool_WideString_Test;
};
inline WideString operator+(const WideStringView& str1,
diff --git a/core/fxcrt/widestring_unittest.cpp b/core/fxcrt/widestring_unittest.cpp
index 949827f6f1..5eba72eea7 100644
--- a/core/fxcrt/widestring_unittest.cpp
+++ b/core/fxcrt/widestring_unittest.cpp
@@ -10,6 +10,8 @@
#include "core/fxcrt/fx_string.h"
#include "testing/gtest/include/gtest/gtest.h"
+namespace fxcrt {
+
TEST(WideString, ElementAccess) {
const WideString abc(L"abc");
EXPECT_EQ(L'a', abc[0]);
@@ -1603,3 +1605,5 @@ TEST(WideStringView, WideOStreamOverload) {
EXPECT_EQ(L"abcdef", stream.str());
}
}
+
+} // namespace fxcrt