From e3c515b9726ee9dc3cbdebea9c7d6448af553b00 Mon Sep 17 00:00:00 2001 From: EduPonz Date: Sun, 10 Mar 2024 14:59:51 +0100 Subject: [PATCH] Refs #20567: Make StringMatching private Signed-off-by: EduPonz --- .../rtps/builtin/discovery/endpoint/EDP.cpp | 3 +- .../security/accesscontrol/Permissions.cpp | 34 ++++++------- src/cpp/utils/StringMatching.cpp | 6 +-- .../cpp/utils/StringMatching.hpp | 16 +++--- test/unittest/utils/StringMatchingTests.cpp | 49 +++++++++++-------- 5 files changed, 59 insertions(+), 49 deletions(-) rename include/fastrtps/utils/StringMatching.h => src/cpp/utils/StringMatching.hpp (88%) diff --git a/src/cpp/rtps/builtin/discovery/endpoint/EDP.cpp b/src/cpp/rtps/builtin/discovery/endpoint/EDP.cpp index 20f142fb583..912b7af67f3 100644 --- a/src/cpp/rtps/builtin/discovery/endpoint/EDP.cpp +++ b/src/cpp/rtps/builtin/discovery/endpoint/EDP.cpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include @@ -43,6 +43,7 @@ #include #include +using namespace eprosima::fastdds::rtps; using namespace eprosima::fastrtps; using namespace eprosima::fastrtps::types; using eprosima::fastdds::dds::PublicationMatchedStatus; diff --git a/src/cpp/security/accesscontrol/Permissions.cpp b/src/cpp/security/accesscontrol/Permissions.cpp index 23ee39bbca2..58bd5a8f531 100644 --- a/src/cpp/security/accesscontrol/Permissions.cpp +++ b/src/cpp/security/accesscontrol/Permissions.cpp @@ -16,21 +16,10 @@ * @file Permissions.cpp */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include #include - #if OPENSSL_VERSION_NUMBER >= 0x10100000L #define IS_OPENSSL_1_1 1 #define OPENSSL_CONST const @@ -43,17 +32,28 @@ #include #include -#include -#include +#include +#include +#include +#include +#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #define S1(x) #x #define S2(x) S1(x) #define LOCATION " (" __FILE__ ":" S2(__LINE__) ")" #define _SecurityException_(str) SecurityException(std::string(str) + LOCATION) +using namespace eprosima::fastdds::rtps; using namespace eprosima::fastrtps; using namespace eprosima::fastrtps::rtps; using namespace eprosima::fastrtps::rtps::security; diff --git a/src/cpp/utils/StringMatching.cpp b/src/cpp/utils/StringMatching.cpp index 4e254a9297a..cb8cd28ecc2 100644 --- a/src/cpp/utils/StringMatching.cpp +++ b/src/cpp/utils/StringMatching.cpp @@ -17,7 +17,7 @@ * */ -#include +#include #include #include @@ -31,7 +31,7 @@ #endif // if defined(__cplusplus_winrt) namespace eprosima { -namespace fastrtps { +namespace fastdds { namespace rtps { StringMatching::StringMatching() @@ -152,6 +152,6 @@ bool StringMatching::matchString( #endif // if defined(__cplusplus_winrt) -} // namespace rtps } /* namespace rtps */ +} /* namespace fastdds */ } /* namespace eprosima */ diff --git a/include/fastrtps/utils/StringMatching.h b/src/cpp/utils/StringMatching.hpp similarity index 88% rename from include/fastrtps/utils/StringMatching.h rename to src/cpp/utils/StringMatching.hpp index 81b0fbc5495..d21f96ccdd1 100644 --- a/include/fastrtps/utils/StringMatching.h +++ b/src/cpp/utils/StringMatching.hpp @@ -13,22 +13,22 @@ // limitations under the License. /*! - * @file StringMatching.h + * @file StringMatching.hpp * */ -#ifndef STRINGMATCHING_H_ -#define STRINGMATCHING_H_ +#ifndef _FASTDDS_STRINGMATCHING_H_ +#define _FASTDDS_STRINGMATCHING_H_ #include +#include #include #include -#include #ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC namespace eprosima { -namespace fastrtps { +namespace fastdds { namespace rtps { /** * Class StringMatching used to match different strings against each other as defined by the POSIX fnmatch API (1003.2-1992 @@ -58,9 +58,9 @@ class FASTDDS_EXPORTED_API StringMatching const char* input); }; -} // namespace rtps -} /* namespace rtps */ +} /*/ namespace rtps */ +} /* namespace fastdds */ } /* namespace eprosima */ #endif // ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC -#endif // ifndef STRINGMATCHING_H_ +#endif // _FASTDDS_STRINGMATCHING_H_ diff --git a/test/unittest/utils/StringMatchingTests.cpp b/test/unittest/utils/StringMatchingTests.cpp index dfaba43ff8a..3ef84302476 100644 --- a/test/unittest/utils/StringMatchingTests.cpp +++ b/test/unittest/utils/StringMatchingTests.cpp @@ -12,31 +12,38 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include #include + #include -using namespace eprosima::fastrtps; -using namespace eprosima::fastrtps::rtps; +#include + +using namespace eprosima::fastdds::rtps; -class StringMatchingTests: public ::testing::Test +class StringMatchingTests : public ::testing::Test { - public: - StringMatchingTests(){} - ~StringMatchingTests(){} +public: + + StringMatchingTests() + { + } + + ~StringMatchingTests() + { + } - char const *path = "foo/bar/baz"; - char const *pattern0 = "foo/bar/baz"; - char const *pattern1 = "foo*"; - char const *pattern2 = "*baz"; - char const *pattern3 = "foo/*/baz"; - char const *pattern4 = "foo/bar/ba?"; - char const *pattern5 = "*ba?*"; - char const *pattern6 = "foo\\bar\\baz"; - char const *pattern7 = "*bar"; - char const *pattern8 = "*"; - char const *pattern9 = "foo/bar/qux"; - char const *pattern10 = "FOO/BAR/QUX"; + char const* path = "foo/bar/baz"; + char const* pattern0 = "foo/bar/baz"; + char const* pattern1 = "foo*"; + char const* pattern2 = "*baz"; + char const* pattern3 = "foo/*/baz"; + char const* pattern4 = "foo/bar/ba?"; + char const* pattern5 = "*ba?*"; + char const* pattern6 = "foo\\bar\\baz"; + char const* pattern7 = "*bar"; + char const* pattern8 = "*"; + char const* pattern9 = "foo/bar/qux"; + char const* pattern10 = "FOO/BAR/QUX"; }; @@ -56,7 +63,9 @@ TEST_F(StringMatchingTests, patterns_with_wildcards) } -int main(int argc, char **argv) +int main( + int argc, + char** argv) { eprosima::fastdds::dds::Log::SetVerbosity(eprosima::fastdds::dds::Log::Info); testing::InitGoogleTest(&argc, argv);