Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libcore: Continuing removal of Qt dependencies
Added C++ wrapper for iRegExp.
- Loading branch information
Showing
20 changed files
with
252 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,8 +21,7 @@ | |
#define LIBCORE_FEED_H | ||
|
||
#include "../libcore.h" | ||
|
||
#include <list> | ||
#include "../List" | ||
|
||
namespace de { | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/** @file regexp.cpp | ||
* | ||
* @authors Copyright (c) 2018 Jaakko Keränen <jaakko.keranen@iki.fi> | ||
* | ||
* @par License | ||
* LGPL: http://www.gnu.org/licenses/lgpl.html | ||
* | ||
* <small>This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation; either version 3 of the License, or (at your | ||
* option) any later version. This program is distributed in the hope that it | ||
* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty | ||
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser | ||
* General Public License for more details. You should have received a copy of | ||
* the GNU Lesser General Public License along with this program; if not, see: | ||
* http://www.gnu.org/licenses</small> | ||
*/ | ||
|
||
#include "de/RegExp" | ||
|
||
#include <c_plus/object.h> | ||
|
||
namespace de { | ||
|
||
RegExpMatch::RegExpMatch() | ||
{ | ||
clear(); | ||
} | ||
|
||
const char *RegExpMatch::begin() const | ||
{ | ||
return match.subject + match.range.start; | ||
} | ||
|
||
const char *RegExpMatch::end() const | ||
{ | ||
return match.subject + match.range.end; | ||
} | ||
|
||
void RegExpMatch::clear() | ||
{ | ||
zap(match); | ||
} | ||
|
||
String RegExpMatch::captured(int index) const | ||
{ | ||
iString *cap = captured_RegExpMatch(&match, index); | ||
String str(cap); | ||
delete_String(cap); | ||
return str; | ||
} | ||
|
||
RegExp::RegExp(const String &expression, String::CaseSensitivity cs) | ||
{ | ||
_d = new_RegExp(expression, cs == String::CaseSensitive? caseSensitive_RegExpOption | ||
: caseInsensitive_RegExpOption); | ||
} | ||
|
||
RegExp::~RegExp() | ||
{ | ||
iRelease(_d); | ||
} | ||
|
||
bool RegExp::exactMatch(const String &subject) const | ||
{ | ||
iRegExpMatch match; | ||
if (matchString_RegExp(_d, subject, &match)) | ||
{ | ||
return match.range.start == 0 && match.range.end == subject.sizei(); | ||
} | ||
return false; | ||
} | ||
|
||
bool RegExp::match(const String &subject, RegExpMatch &match) const | ||
{ | ||
return matchString_RegExp(_d, subject, &match.match); | ||
} | ||
|
||
bool RegExp::hasMatch(const String &subject) const | ||
{ | ||
iRegExpMatch match; | ||
return matchString_RegExp(_d, subject, &match); | ||
} | ||
|
||
} // namespace de |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.