mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-08-08 00:20:38 -09:00
Signed-off-by: Bernd Kuhls <bernd@kuhls.net> Signed-off-by: Julien Olivain <ju.o@free.fr>
128 lines
4.1 KiB
Diff
128 lines
4.1 KiB
Diff
From 4dd017b2eae39356cda0d96a2f5743dbb8ccf299 Mon Sep 17 00:00:00 2001
|
|
From: fuzzard <fuzzard@kodi.tv>
|
|
Date: Sun, 2 Jun 2024 12:13:01 +1000
|
|
Subject: [PATCH] RegExp remove unused methods
|
|
|
|
Upstream: https://github.com/xbmc/xbmc/commit/5df2e57368cf5867f588d00a503eb624e5121460
|
|
|
|
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
|
|
---
|
|
xbmc/utils/RegExp.cpp | 30 ------------------------------
|
|
xbmc/utils/RegExp.h | 5 -----
|
|
xbmc/utils/test/TestRegExp.cpp | 17 -----------------
|
|
3 files changed, 52 deletions(-)
|
|
|
|
diff --git a/xbmc/utils/RegExp.cpp b/xbmc/utils/RegExp.cpp
|
|
index 9667b646a9..40263a28eb 100644
|
|
--- a/xbmc/utils/RegExp.cpp
|
|
+++ b/xbmc/utils/RegExp.cpp
|
|
@@ -485,11 +485,6 @@ int CRegExp::GetSubStart(int iSub) const
|
|
return m_iOvector[iSub*2] + m_offset;
|
|
}
|
|
|
|
-int CRegExp::GetSubStart(const std::string& subName) const
|
|
-{
|
|
- return GetSubStart(GetNamedSubPatternNumber(subName.c_str()));
|
|
-}
|
|
-
|
|
int CRegExp::GetSubLength(int iSub) const
|
|
{
|
|
if (!IsValidSubNumber(iSub))
|
|
@@ -498,11 +493,6 @@ int CRegExp::GetSubLength(int iSub) const
|
|
return m_iOvector[(iSub*2)+1] - m_iOvector[(iSub*2)];
|
|
}
|
|
|
|
-int CRegExp::GetSubLength(const std::string& subName) const
|
|
-{
|
|
- return GetSubLength(GetNamedSubPatternNumber(subName.c_str()));
|
|
-}
|
|
-
|
|
std::string CRegExp::GetMatch(int iSub /* = 0 */) const
|
|
{
|
|
if (!IsValidSubNumber(iSub))
|
|
@@ -516,26 +506,6 @@ std::string CRegExp::GetMatch(int iSub /* = 0 */) const
|
|
return m_subject.substr(pos, len);
|
|
}
|
|
|
|
-std::string CRegExp::GetMatch(const std::string& subName) const
|
|
-{
|
|
- return GetMatch(GetNamedSubPatternNumber(subName.c_str()));
|
|
-}
|
|
-
|
|
-bool CRegExp::GetNamedSubPattern(const char* strName, std::string& strMatch) const
|
|
-{
|
|
- strMatch.clear();
|
|
- int iSub = pcre_get_stringnumber(m_re, strName);
|
|
- if (!IsValidSubNumber(iSub))
|
|
- return false;
|
|
- strMatch = GetMatch(iSub);
|
|
- return true;
|
|
-}
|
|
-
|
|
-int CRegExp::GetNamedSubPatternNumber(const char* strName) const
|
|
-{
|
|
- return pcre_get_stringnumber(m_re, strName);
|
|
-}
|
|
-
|
|
void CRegExp::DumpOvector(int iLog /* = LOGDEBUG */)
|
|
{
|
|
if (iLog < LOGDEBUG || iLog > LOGNONE)
|
|
diff --git a/xbmc/utils/RegExp.h b/xbmc/utils/RegExp.h
|
|
index 53f6019a8f..feea89cd0d 100644
|
|
--- a/xbmc/utils/RegExp.h
|
|
+++ b/xbmc/utils/RegExp.h
|
|
@@ -111,15 +111,10 @@ public:
|
|
};
|
|
int GetSubCount() const { return m_iMatchCount - 1; } // PCRE returns the number of sub-patterns + 1
|
|
int GetSubStart(int iSub) const;
|
|
- int GetSubStart(const std::string& subName) const;
|
|
int GetSubLength(int iSub) const;
|
|
- int GetSubLength(const std::string& subName) const;
|
|
int GetCaptureTotal() const;
|
|
std::string GetMatch(int iSub = 0) const;
|
|
- std::string GetMatch(const std::string& subName) const;
|
|
const std::string& GetPattern() const { return m_pattern; }
|
|
- bool GetNamedSubPattern(const char* strName, std::string& strMatch) const;
|
|
- int GetNamedSubPatternNumber(const char* strName) const;
|
|
void DumpOvector(int iLog);
|
|
/**
|
|
* Check is RegExp object is ready for matching
|
|
diff --git a/xbmc/utils/test/TestRegExp.cpp b/xbmc/utils/test/TestRegExp.cpp
|
|
index d757127417..9435a46aa4 100644
|
|
--- a/xbmc/utils/test/TestRegExp.cpp
|
|
+++ b/xbmc/utils/test/TestRegExp.cpp
|
|
@@ -96,19 +96,6 @@ TEST(TestRegExp, GetPattern)
|
|
EXPECT_STREQ("^(Test)\\s*(.*)\\.", regex.GetPattern().c_str());
|
|
}
|
|
|
|
-TEST(TestRegExp, GetNamedSubPattern)
|
|
-{
|
|
- CRegExp regex;
|
|
- std::string match;
|
|
-
|
|
- EXPECT_TRUE(regex.RegComp("^(?<first>Test)\\s*(?<second>.*)\\."));
|
|
- EXPECT_EQ(0, regex.RegFind("Test string."));
|
|
- EXPECT_TRUE(regex.GetNamedSubPattern("first", match));
|
|
- EXPECT_STREQ("Test", match.c_str());
|
|
- EXPECT_TRUE(regex.GetNamedSubPattern("second", match));
|
|
- EXPECT_STREQ("string", match.c_str());
|
|
-}
|
|
-
|
|
TEST(TestRegExp, operatorEqual)
|
|
{
|
|
CRegExp regex, regexcopy;
|
|
@@ -117,10 +104,6 @@ TEST(TestRegExp, operatorEqual)
|
|
EXPECT_TRUE(regex.RegComp("^(?<first>Test)\\s*(?<second>.*)\\."));
|
|
regexcopy = regex;
|
|
EXPECT_EQ(0, regexcopy.RegFind("Test string."));
|
|
- EXPECT_TRUE(regexcopy.GetNamedSubPattern("first", match));
|
|
- EXPECT_STREQ("Test", match.c_str());
|
|
- EXPECT_TRUE(regexcopy.GetNamedSubPattern("second", match));
|
|
- EXPECT_STREQ("string", match.c_str());
|
|
}
|
|
|
|
class TestRegExpLog : public testing::Test
|
|
--
|
|
2.47.3
|
|
|