Skip to content

Commit a4afb26

Browse files
author
xiao.dong
committed
fix string util
1 parent d4dc829 commit a4afb26

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

src/iceberg/file_format.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
#include "iceberg/iceberg_export.h"
2929
#include "iceberg/result.h"
30-
#include "iceberg/util/string_utils_internal.h"
30+
#include "iceberg/util/string_utils.h"
3131

3232
namespace iceberg {
3333

@@ -57,7 +57,7 @@ ICEBERG_EXPORT inline std::string_view ToString(FileFormatType format_type) {
5757
/// \brief Convert a string to a FileFormatType
5858
ICEBERG_EXPORT inline Result<FileFormatType> FileFormatTypeFromString(
5959
std::string_view str) noexcept {
60-
auto lower = internal::StringUtils::ToLower(str);
60+
auto lower = StringUtils::ToLower(str);
6161
if (lower == "parquet") return FileFormatType::kParquet;
6262
if (lower == "avro") return FileFormatType::kAvro;
6363
if (lower == "orc") return FileFormatType::kOrc;

src/iceberg/util/string_utils_internal.h renamed to src/iceberg/util/string_utils.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@
2525

2626
#include "iceberg/iceberg_export.h"
2727

28-
namespace iceberg::internal {
28+
namespace iceberg {
2929

30-
class StringUtils {
30+
class ICEBERG_EXPORT StringUtils {
3131
public:
3232
static std::string ToLower(std::string_view str) {
3333
std::string input(str);
3434
// TODO(xiao.dong) gcc 13.3 didn't support std::ranges::to
3535
std::transform(input.begin(), input.end(), input.begin(), // NOLINT
3636
[](char c) { return std::tolower(c); }); // NOLINT
3737
return input;
38-
} // namespace iceberg::internal
38+
}
3939

4040
static std::string ToUpper(std::string_view str) {
4141
std::string input(str);
@@ -46,4 +46,4 @@ class StringUtils {
4646
}
4747
};
4848

49-
} // namespace iceberg::internal
49+
} // namespace iceberg

test/string_utils_test.cc

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,28 @@
1717
* under the License.
1818
*/
1919

20-
#include <gtest/gtest.h>
20+
#include "iceberg/util/string_utils.h"
2121

22-
#include "iceberg/util/string_utils_internal.h"
22+
#include <gtest/gtest.h>
2323

2424
namespace iceberg {
2525

2626
TEST(StringUtilsTest, ToLower) {
27-
ASSERT_EQ(internal::StringUtils::ToLower("AbC"), "abc");
28-
ASSERT_EQ(internal::StringUtils::ToLower("A-bC"), "a-bc");
29-
ASSERT_EQ(internal::StringUtils::ToLower("A_bC"), "a_bc");
30-
ASSERT_EQ(internal::StringUtils::ToLower(""), "");
31-
ASSERT_EQ(internal::StringUtils::ToLower(" "), " ");
32-
ASSERT_EQ(internal::StringUtils::ToLower("123"), "123");
27+
ASSERT_EQ(StringUtils::ToLower("AbC"), "abc");
28+
ASSERT_EQ(StringUtils::ToLower("A-bC"), "a-bc");
29+
ASSERT_EQ(StringUtils::ToLower("A_bC"), "a_bc");
30+
ASSERT_EQ(StringUtils::ToLower(""), "");
31+
ASSERT_EQ(StringUtils::ToLower(" "), " ");
32+
ASSERT_EQ(StringUtils::ToLower("123"), "123");
3333
}
3434

3535
TEST(StringUtilsTest, ToUpper) {
36-
ASSERT_EQ(internal::StringUtils::ToUpper("abc"), "ABC");
37-
ASSERT_EQ(internal::StringUtils::ToUpper("A-bC"), "A-BC");
38-
ASSERT_EQ(internal::StringUtils::ToUpper("A_bC"), "A_BC");
39-
ASSERT_EQ(internal::StringUtils::ToUpper(""), "");
40-
ASSERT_EQ(internal::StringUtils::ToUpper(" "), " ");
41-
ASSERT_EQ(internal::StringUtils::ToUpper("123"), "123");
36+
ASSERT_EQ(StringUtils::ToUpper("abc"), "ABC");
37+
ASSERT_EQ(StringUtils::ToUpper("A-bC"), "A-BC");
38+
ASSERT_EQ(StringUtils::ToUpper("A_bC"), "A_BC");
39+
ASSERT_EQ(StringUtils::ToUpper(""), "");
40+
ASSERT_EQ(StringUtils::ToUpper(" "), " ");
41+
ASSERT_EQ(StringUtils::ToUpper("123"), "123");
4242
}
4343

4444
} // namespace iceberg

0 commit comments

Comments
 (0)