From ade6289de2ca3d12bee37a0ff12e314e369db1ea Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 24 Apr 2025 16:48:19 +0100 Subject: [PATCH] refactor: Add str() method to BaseTagDecorator (#2020) Fix: https://github.com/XRPLF/clio/issues/2008 --- src/util/Taggable.hpp | 13 +++++++++++++ tests/unit/rpc/RPCHelpersTests.cpp | 8 +------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/util/Taggable.hpp b/src/util/Taggable.hpp index 9092c6a1..f2265d94 100644 --- a/src/util/Taggable.hpp +++ b/src/util/Taggable.hpp @@ -96,6 +96,19 @@ public: decorator.decorate(os); return os; } + + /** + * @brief Gets the string representation of the tag. + * + * @return The string representation of the tag + */ + std::string + toString() const + { + std::ostringstream oss; + decorate(oss); + return std::move(oss).str(); + } }; /** diff --git a/tests/unit/rpc/RPCHelpersTests.cpp b/tests/unit/rpc/RPCHelpersTests.cpp index 2540e2c0..ffd69898 100644 --- a/tests/unit/rpc/RPCHelpersTests.cpp +++ b/tests/unit/rpc/RPCHelpersTests.cpp @@ -1204,19 +1204,13 @@ struct RPCHelpersLogDurationTest : LoggerFixture, testing::WithParamInterface