Skip to content
This repository has been archived by the owner on Oct 7, 2021. It is now read-only.

Use rcpputils::find_and_replace instead of std::regex_replace #272

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
3 changes: 3 additions & 0 deletions rmw_opensplice_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jacobperron The package exports the rcpputils dependency but doesn't declare that run dependency in the manifest.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in #277

rcutils
rmw
rosidl_generator_c
Expand Down Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions rmw_opensplice_cpp/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<buildtool_export_depend>opensplice_cmake_module</buildtool_export_depend>
<buildtool_export_depend>rosidl_cmake</buildtool_export_depend>

<build_depend>rcpputils</build_depend>
<build_depend>rcutils</build_depend>
<build_depend>libopensplice69</build_depend>
<build_depend>rmw</build_depend>
Expand Down
6 changes: 3 additions & 3 deletions rmw_opensplice_cpp/src/demangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
// limitations under the License.

#include <algorithm>
#include <regex>
#include <string>
#include <vector>

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

#include "namespace_prefix.hpp"
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -145,7 +145,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