diff --git a/rmw_opensplice_cpp/CMakeLists.txt b/rmw_opensplice_cpp/CMakeLists.txt
index 1f41a718..9a756b8a 100644
--- a/rmw_opensplice_cpp/CMakeLists.txt
+++ b/rmw_opensplice_cpp/CMakeLists.txt
@@ -28,12 +28,14 @@ if(NOT rosidl_typesupport_opensplice_cpp_FOUND OR NOT rosidl_typesupport_openspl
return()
endif()
+find_package(rcpputils REQUIRED)
find_package(rcutils REQUIRED)
find_package(rmw REQUIRED)
find_package(rosidl_generator_c REQUIRED)
find_package(rosidl_generator_cpp REQUIRED)
ament_export_dependencies(
+ rcpputils
rcutils
rmw
rosidl_generator_c
@@ -80,6 +82,7 @@ add_library(rmw_opensplice_cpp SHARED
src/types.cpp
)
ament_target_dependencies(rmw_opensplice_cpp
+ "rcpputils"
"rcutils"
"rmw"
"rosidl_generator_c"
diff --git a/rmw_opensplice_cpp/package.xml b/rmw_opensplice_cpp/package.xml
index b034fff2..f3b018ba 100644
--- a/rmw_opensplice_cpp/package.xml
+++ b/rmw_opensplice_cpp/package.xml
@@ -15,6 +15,7 @@
opensplice_cmake_module
rosidl_cmake
+ rcpputils
rcutils
libopensplice69
rmw
diff --git a/rmw_opensplice_cpp/src/demangle.cpp b/rmw_opensplice_cpp/src/demangle.cpp
index e1047044..3f15ee38 100644
--- a/rmw_opensplice_cpp/src/demangle.cpp
+++ b/rmw_opensplice_cpp/src/demangle.cpp
@@ -13,10 +13,10 @@
// limitations under the License.
#include
-#include
#include
#include
+#include "rcpputils/find_and_replace.hpp"
#include "rcutils/logging_macros.h"
#include "namespace_prefix.hpp"
@@ -48,7 +48,7 @@ _demangle_if_ros_type(const std::string & dds_type_string)
}
std::string type_namespace = dds_type_string.substr(0, substring_position);
- type_namespace = std::regex_replace(type_namespace, std::regex("::"), "/");
+ type_namespace = rcpputils::find_and_replace(type_namespace, "::", "/");
size_t start = substring_position + substring.size();
std::string type_name = dds_type_string.substr(start, dds_type_string.length() - 1 - start);
return type_namespace + type_name;
@@ -145,7 +145,7 @@ _demangle_service_type_only(const std::string & dds_type_name)
// everything checks out, reformat it from '[namespace::]dds_::'
// to '[namespace/]'
std::string type_namespace = dds_type_name.substr(0, ns_substring_position);
- type_namespace = std::regex_replace(type_namespace, std::regex("::"), "/");
+ type_namespace = rcpputils::find_and_replace(type_namespace, "::", "/");
size_t start = ns_substring_position + ns_substring.length();
std::string type_name = dds_type_name.substr(start, suffix_position - start);
return type_namespace + type_name;