mirror of
https://github.com/znc/znc.git
synced 2026-05-05 04:52:31 +02:00
Introduce CaseSensitivity enum class
The enum is a bit more verbose, but leads to more readable code:
str.Equals("foo", true)
// vs.
str.Equals("foo", CString::CaseSensitive)
Deprecate the old Equals() and leave out the length parameter
from the new version => use StartsWith() or StrCmp() instead.
This commit is contained in:
@@ -79,6 +79,14 @@ int CString::StrCmp(const CString& s, CString::size_type uLen) const {
|
||||
return strcmp(c_str(), s.c_str());
|
||||
}
|
||||
|
||||
bool CString::Equals(const CString& s, CaseSensitivity cs) const {
|
||||
if (cs == CaseSensitive) {
|
||||
return (StrCmp(s) == 0);
|
||||
} else {
|
||||
return (CaseCmp(s) == 0);
|
||||
}
|
||||
}
|
||||
|
||||
bool CString::Equals(const CString& s, bool bCaseSensitive, CString::size_type uLen) const {
|
||||
if (bCaseSensitive) {
|
||||
return (StrCmp(s, uLen) == 0);
|
||||
|
||||
Reference in New Issue
Block a user