Do not use wxRegEx in wxCmpNaturalGeneric()

Using wxRegEx in wxCmpNaturalGeneric() introduced a dependency of the
base library on the regex library.

Replace wxRegEx with character classification functions wxIsspace(),
wxIspunct(), and wxIsdigit() to remove this rather unnecessary
dependency.

Closes https://github.com/wxWidgets/wxWidgets/pull/2014
This commit is contained in:
PB
2020-08-06 15:42:23 +02:00
committed by Vadim Zeitlin
parent 8e2aad2621
commit a4647825cb
3 changed files with 35 additions and 49 deletions

View File

@@ -784,9 +784,6 @@ void ArraysTestCase::IndexFromEnd()
TEST_CASE("wxNaturalStringComparisonGeneric()", "[wxString][compare]")
{
#if !wxUSE_REGEX
WARN("Skipping wxCmpNaturalGeneric() tests: wxRegEx not available");
#else
// simple string comparison
CHECK(wxCmpNaturalGeneric("a", "a") == 0);
CHECK(wxCmpNaturalGeneric("a", "z") < 0);
@@ -858,6 +855,5 @@ TEST_CASE("wxNaturalStringComparisonGeneric()", "[wxString][compare]")
CHECK(wxCmpNaturalGeneric("a5th5", "a10th10") < 0);
CHECK(wxCmpNaturalGeneric("a 10th 10", "a5th 5") < 0);
CHECK(wxCmpNaturalGeneric("a5th 5", "a 10th 10") > 0);
#endif // #if !wxUSE_REGEX
}