mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-19 06:06:54 -06:00
plugin/pcre: new methods
git-svn-id: svn://ultimatepp.org/upp/trunk@7496 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
c610835560
commit
c08fab60fb
2 changed files with 26 additions and 0 deletions
|
|
@ -162,6 +162,27 @@ void RegExp::GetMatchPos(int i, int& iPosStart, int& iPosAfterEnd)
|
|||
iPosAfterEnd = pos[i + 1];
|
||||
}
|
||||
|
||||
int RegExp::GetOffset() const
|
||||
{
|
||||
return rc > 0 ? pos[0] : -1;
|
||||
}
|
||||
|
||||
int RegExp::GetLength() const
|
||||
{
|
||||
return rc > 0 ? pos[1] - pos[0] : -1;
|
||||
}
|
||||
|
||||
int RegExp::GetSubOffset(int i) const
|
||||
{
|
||||
ASSERT(i < rc - 1);
|
||||
return pos[2 * i + 2];
|
||||
}
|
||||
|
||||
int RegExp::GetSubLength(int i) const
|
||||
{
|
||||
return pos[2 * i + 3] - pos[2 * i + 2];
|
||||
}
|
||||
|
||||
bool RegExp::ReplacePos(String& t, int p, int q, const String& r)
|
||||
{
|
||||
if(p>=0 && q<=t.GetLength() && q>p){
|
||||
|
|
|
|||
|
|
@ -90,6 +90,11 @@ public:
|
|||
int GetCount();
|
||||
String GetString(int i);
|
||||
void GetMatchPos(int i, int& iPosStart, int& iPosAfterEnd);
|
||||
|
||||
int GetOffset() const;
|
||||
int GetLength() const;
|
||||
int GetSubOffset(int i) const;
|
||||
int GetSubLength(int i) const;
|
||||
|
||||
int Replace(String& t, const Vector<String>& rv, bool backref=false);
|
||||
int Replace(String& t, const String& r, bool backref=false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue