Skip to content

Commit

Permalink
Move into format namespace.
Browse files Browse the repository at this point in the history
  • Loading branch information
lhruby committed Sep 27, 2024
1 parent a31cf01 commit 4337864
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions modules/ipc/apps/zenoh_topic_echo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<std::chrono::system_clock>(
utils::format::toString(std::chrono::time_point<std::chrono::system_clock>(
std::chrono::duration_cast<std::chrono::system_clock::duration>(metadata.timestamp))),
msg_json);
}
Expand Down
4 changes: 2 additions & 2 deletions modules/types/src/dummy_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <magic_enum.hpp>

#include "hephaestus/random/random_object_creator.h"
#include "hephaestus/utils/string/type_formatting.h"
#include "hephaestus/utils/format/format.h"

namespace heph::types {

Expand Down Expand Up @@ -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"
<< "}";
}

Expand Down
4 changes: 2 additions & 2 deletions modules/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#include "hephaestus/utils/concepts.h"

namespace heph::utils::string {
namespace heph::utils::format {

//=================================================================================================
// Array and Vector
Expand Down Expand Up @@ -87,4 +87,4 @@ template <ChronoSteadyClockType T>
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
Original file line number Diff line number Diff line change
Expand Up @@ -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)
12 changes: 6 additions & 6 deletions modules/utils/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
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 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
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 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
PUBLIC_LINK_LIBS ""
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
#include <fmt/core.h>
#include <gtest/gtest.h>

#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
Expand Down Expand Up @@ -175,4 +175,4 @@ TEST(TypeFormattingTests, ChronoTimestampFormattingSystemClock) {
ASSERT_EQ(str[19], '.');
}

} // namespace heph::utils::string::tests
} // namespace heph::utils::format::tests

0 comments on commit 4337864

Please sign in to comment.