Skip to content

Commit

Permalink
Refs #20567: Make StringMatching private
Browse files Browse the repository at this point in the history
Signed-off-by: EduPonz <eduardoponz@eprosima.com>
  • Loading branch information
EduPonz committed Mar 11, 2024
1 parent 75ad22d commit e3c515b
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 49 deletions.
3 changes: 2 additions & 1 deletion src/cpp/rtps/builtin/discovery/endpoint/EDP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,15 @@
#include <fastdds/rtps/writer/RTPSWriter.h>
#include <fastdds/rtps/writer/WriterListener.h>
#include <fastrtps/types/TypeObjectFactory.h>
#include <fastrtps/utils/StringMatching.h>
#include <utils/StringMatching.hpp>

#include <rtps/builtin/data/ProxyHashTables.hpp>
#include <rtps/builtin/discovery/participant/PDP.h>
#include <rtps/network/ExternalLocatorsProcessor.hpp>
#include <rtps/participant/RTPSParticipantImpl.h>
#include <utils/collections/node_size_helpers.hpp>

using namespace eprosima::fastdds::rtps;
using namespace eprosima::fastrtps;
using namespace eprosima::fastrtps::types;
using eprosima::fastdds::dds::PublicationMatchedStatus;
Expand Down
34 changes: 17 additions & 17 deletions src/cpp/security/accesscontrol/Permissions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,10 @@
* @file Permissions.cpp
*/

#include <security/accesscontrol/Permissions.h>
#include <security/accesscontrol/AccessPermissionsHandle.h>
#include <security/accesscontrol/GovernanceParser.h>
#include <security/accesscontrol/PermissionsParser.h>
#include <security/authentication/PKIIdentityHandle.h>
#include <security/logging/LogTopic.h>
#include <fastdds/rtps/builtin/data/ParticipantProxyData.h>
#include <fastdds/rtps/security/exceptions/SecurityException.h>
#include <fastdds/rtps/attributes/RTPSParticipantAttributes.h>
#include <fastrtps/utils/StringMatching.h>
#include <fastdds/rtps/builtin/data/WriterProxyData.h>
#include <fastdds/rtps/builtin/data/ReaderProxyData.h>
#include <cassert>
#include <fstream>

#include <openssl/opensslv.h>

#if OPENSSL_VERSION_NUMBER >= 0x10100000L
#define IS_OPENSSL_1_1 1
#define OPENSSL_CONST const
Expand All @@ -43,17 +32,28 @@
#include <openssl/err.h>
#include <openssl/obj_mac.h>

#include <security/artifact_providers/FileProvider.hpp>
#include <security/accesscontrol/DistinguishedName.h>
#include <fastdds/rtps/attributes/RTPSParticipantAttributes.h>
#include <fastdds/rtps/builtin/data/ParticipantProxyData.h>
#include <fastdds/rtps/builtin/data/ReaderProxyData.h>
#include <fastdds/rtps/builtin/data/WriterProxyData.h>
#include <fastdds/rtps/security/exceptions/SecurityException.h>

#include <cassert>
#include <fstream>
#include <security/accesscontrol/AccessPermissionsHandle.h>
#include <security/accesscontrol/DistinguishedName.h>
#include <security/accesscontrol/GovernanceParser.h>
#include <security/accesscontrol/Permissions.h>
#include <security/accesscontrol/PermissionsParser.h>
#include <security/artifact_providers/FileProvider.hpp>
#include <security/authentication/PKIIdentityHandle.h>
#include <security/logging/LogTopic.h>
#include <utils/StringMatching.hpp>

#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;
Expand Down
6 changes: 3 additions & 3 deletions src/cpp/utils/StringMatching.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*
*/

#include <fastrtps/utils/StringMatching.h>
#include <utils/StringMatching.hpp>
#include <limits.h>
#include <errno.h>

Expand All @@ -31,7 +31,7 @@
#endif // if defined(__cplusplus_winrt)

namespace eprosima {
namespace fastrtps {
namespace fastdds {
namespace rtps {

StringMatching::StringMatching()
Expand Down Expand Up @@ -152,6 +152,6 @@ bool StringMatching::matchString(

#endif // if defined(__cplusplus_winrt)

} // namespace rtps
} /* namespace rtps */
} /* namespace fastdds */
} /* namespace eprosima */
Original file line number Diff line number Diff line change
Expand Up @@ -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 <fastdds/fastdds_dll.hpp>

#include <cstdint>
#include <string>
#include <vector>
#include <stdint.h>

#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
Expand Down Expand Up @@ -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_
49 changes: 29 additions & 20 deletions test/unittest/utils/StringMatchingTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,38 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <fastrtps/utils/StringMatching.h>
#include <gtest/gtest.h>

#include <fastdds/dds/log/Log.hpp>

using namespace eprosima::fastrtps;
using namespace eprosima::fastrtps::rtps;
#include <utils/StringMatching.hpp>

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";
};


Expand All @@ -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);
Expand Down

0 comments on commit e3c515b

Please sign in to comment.