diff --git a/modules/ipc/apps/zenoh_topic_echo.cpp b/modules/ipc/apps/zenoh_topic_echo.cpp index 45dfc5f1..4e13c249 100644 --- a/modules/ipc/apps/zenoh_topic_echo.cpp +++ b/modules/ipc/apps/zenoh_topic_echo.cpp @@ -28,9 +28,9 @@ #include "hephaestus/serdes/dynamic_deserializer.h" #include "hephaestus/serdes/type_info.h" #include "hephaestus/utils/exception.h" +#include "hephaestus/utils/format/format.h" #include "hephaestus/utils/signal_handler.h" #include "hephaestus/utils/stack_trace.h" -#include "hephaestus/utils/string/type_formatting.h" namespace { constexpr auto DEFAULT_MAX_ARRAY_LENGTH = 100; @@ -95,7 +95,7 @@ class TopicEcho { truncateLongItems(msg_json, noarr_, max_array_length_); fmt::println("From: {}. Topic: {}\nSequence: {} | Timestamp: {}\n{}", metadata.sender_id, metadata.topic, metadata.sequence_id, - utils::string::toString(std::chrono::time_point( + utils::format::toString(std::chrono::time_point( std::chrono::duration_cast(metadata.timestamp))), msg_json); } diff --git a/modules/types/src/dummy_type.cpp b/modules/types/src/dummy_type.cpp index 07cce712..3cee4f5b 100644 --- a/modules/types/src/dummy_type.cpp +++ b/modules/types/src/dummy_type.cpp @@ -11,7 +11,7 @@ #include #include "hephaestus/random/random_object_creator.h" -#include "hephaestus/utils/string/type_formatting.h" +#include "hephaestus/utils/format/format.h" namespace heph::types { @@ -58,7 +58,7 @@ auto operator<<(std::ostream& os, const DummyType& dummy_type) -> std::ostream& << " dummy_primitives_type={" << dummy_type.dummy_primitives_type << "}\n" << " dummy_enum=" << magic_enum::enum_name(dummy_type.dummy_enum) << "\n" << " dummy_string=" << dummy_type.dummy_string << "\n" - << " dummy_vector=" << utils::string::toString(dummy_type.dummy_vector) << "\n" + << " dummy_vector=" << utils::format::toString(dummy_type.dummy_vector) << "\n" << "}"; } diff --git a/modules/utils/CMakeLists.txt b/modules/utils/CMakeLists.txt index d67718cb..c41593e3 100644 --- a/modules/utils/CMakeLists.txt +++ b/modules/utils/CMakeLists.txt @@ -20,9 +20,9 @@ configure_file(src/version.in ${CMAKE_CURRENT_SOURCE_DIR}/src/version_impl.h @ON set(SOURCES src/filesystem/file.cpp src/filesystem/scoped_path.cpp + src/format/format.cpp src/string/string_literal.cpp src/string/string_utils.cpp - src/string/type_formatting.cpp src/timing/watchdog.cpp src/bit_flag.cpp src/concepts.cpp @@ -34,9 +34,9 @@ set(SOURCES README.md include/hephaestus/utils/filesystem/file.h include/hephaestus/utils/filesystem/scoped_path.h + include/hephaestus/utils/format/format.h include/hephaestus/utils/string/string_literal.h include/hephaestus/utils/string/string_utils.h - include/hephaestus/utils/string/type_formatting.h include/hephaestus/utils/timing/watchdog.h include/hephaestus/utils/bit_flag.h include/hephaestus/utils/concepts.h diff --git a/modules/utils/include/hephaestus/utils/string/type_formatting.h b/modules/utils/include/hephaestus/utils/format/format.h similarity index 98% rename from modules/utils/include/hephaestus/utils/string/type_formatting.h rename to modules/utils/include/hephaestus/utils/format/format.h index 83e87da9..71555e27 100644 --- a/modules/utils/include/hephaestus/utils/string/type_formatting.h +++ b/modules/utils/include/hephaestus/utils/format/format.h @@ -15,7 +15,7 @@ #include "hephaestus/utils/concepts.h" -namespace heph::utils::string { +namespace heph::utils::format { //================================================================================================= // Array and Vector @@ -87,4 +87,4 @@ template return fmt::format("{}d {:02}h:{:02}m:{:02}.{:09}s", days, hours, minutes, seconds, sub_seconds * SCALER); } -}; // namespace heph::utils::string +}; // namespace heph::utils::format diff --git a/modules/utils/src/string/type_formatting.cpp b/modules/utils/src/format/format.cpp similarity index 74% rename from modules/utils/src/string/type_formatting.cpp rename to modules/utils/src/format/format.cpp index 8c0c2a86..f3d5735d 100644 --- a/modules/utils/src/string/type_formatting.cpp +++ b/modules/utils/src/format/format.cpp @@ -2,4 +2,4 @@ // Copyright (C) 2023-2024 HEPHAESTUS Contributors //================================================================================================= -#include "hephaestus/utils/string/type_formatting.h" // NOLINT(misc-include-cleaner) +#include "hephaestus/utils/format/format.h" // NOLINT(misc-include-cleaner) diff --git a/modules/utils/tests/CMakeLists.txt b/modules/utils/tests/CMakeLists.txt index 9f4a2b46..addaeb6d 100644 --- a/modules/utils/tests/CMakeLists.txt +++ b/modules/utils/tests/CMakeLists.txt @@ -31,22 +31,22 @@ define_module_test( ) define_module_test( - NAME string_utils_tests - SOURCES string_utils_tests.cpp + NAME format_tests + SOURCES format_tests.cpp PUBLIC_INCLUDE_PATHS $ PUBLIC_LINK_LIBS "" ) define_module_test( - NAME string_literal_tests - SOURCES string_literal_tests.cpp + NAME string_utils_tests + SOURCES string_utils_tests.cpp PUBLIC_INCLUDE_PATHS $ PUBLIC_LINK_LIBS "" ) define_module_test( - NAME type_formatting_tests - SOURCES type_formatting_tests.cpp + NAME string_literal_tests + SOURCES string_literal_tests.cpp PUBLIC_INCLUDE_PATHS $ PUBLIC_LINK_LIBS "" ) diff --git a/modules/utils/tests/type_formatting_tests.cpp b/modules/utils/tests/format_tests.cpp similarity index 97% rename from modules/utils/tests/type_formatting_tests.cpp rename to modules/utils/tests/format_tests.cpp index 72e612e3..1470385e 100644 --- a/modules/utils/tests/type_formatting_tests.cpp +++ b/modules/utils/tests/format_tests.cpp @@ -13,11 +13,11 @@ #include #include -#include "hephaestus/utils/string/type_formatting.h" +#include "hephaestus/utils/format/format.h" using namespace ::testing; // NOLINT(google-build-using-namespace) -namespace heph::utils::string::tests { +namespace heph::utils::format::tests { //================================================================================================= // Array @@ -175,4 +175,4 @@ TEST(TypeFormattingTests, ChronoTimestampFormattingSystemClock) { ASSERT_EQ(str[19], '.'); } -} // namespace heph::utils::string::tests +} // namespace heph::utils::format::tests