Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Use rpputils::find_and_replace instead of std::regex_replace #359

Merged
merged 1 commit into from
Jun 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions rmw_connext_shared_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ if(NOT Connext_FOUND)
message(WARNING "Could not find RTI Connext - skipping '${PROJECT_NAME}'")
return()
endif()
find_package(rcpputils REQUIRED)
find_package(rcutils REQUIRED)
find_package(rmw REQUIRED)

Expand Down Expand Up @@ -57,6 +58,7 @@ add_library(
src/types/custom_publisher_listener.cpp
src/types/custom_subscriber_listener.cpp)
ament_target_dependencies(rmw_connext_shared_cpp
"rcpputils"
"rcutils"
"rmw"
"Connext")
Expand Down
1 change: 1 addition & 0 deletions rmw_connext_shared_cpp/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<buildtool_export_depend>ament_cmake</buildtool_export_depend>

<build_depend>connext_cmake_module</build_depend>
<build_depend>rcpputils</build_depend>
<build_depend>rcutils</build_depend>
<build_depend>rmw</build_depend>
<build_depend>rti-connext-dds-5.3.1</build_depend>
Expand Down
6 changes: 3 additions & 3 deletions rmw_connext_shared_cpp/src/demangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
#include <algorithm>
#include <cstring>
#include <map>
#include <regex>
#include <string>
#include <vector>

#include "rcpputils/find_and_replace.hpp"
#include "rcutils/logging_macros.h"

#include "rmw_connext_shared_cpp/namespace_prefix.hpp"
Expand All @@ -44,7 +44,7 @@ _demangle_if_ros_type(const std::string & dds_type_string)
substring_position != std::string::npos)
{
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;
Expand Down Expand Up @@ -131,7 +131,7 @@ _demangle_service_type_only(const std::string & dds_type_name)
// everything checks out, reformat it from '<namespace>::dds_::<type><suffix>'
// to '<namespace>/<type>'
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;
Expand Down