1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
#include "functionregexp.h"
#include "plugger.h"
#include "regexp.h"
PluginInterface2(regexp, FunctionRegexp, Function, "Mike Buland", 0, 1 );
FunctionRegexp::FunctionRegexp()
{
}
FunctionRegexp::~FunctionRegexp()
{
}
void FunctionRegexp::execute( Build *bld, const StringList &lInput, StringList &lOutput )
{
if( lParams.size() == 1 )
{
RegExp re( lParams.front().c_str() );
for( StringList::const_iterator i = lInput.begin();
i != lInput.end(); i++ )
{
if( re.execute( (*i).c_str() ) )
{
lOutput.push_back( *i );
if( bld )
{
int jmax = re.getNumSubStrings();
for( int j = 0; j < jmax; j++ )
{
char buf[30];
sprintf( buf, "re:%d", j );
bld->set( *i, buf, re.getSubString( j ) );
}
}
}
}
}
else
{
}
}
Function *FunctionRegexp::duplicate( Build &bld, const std::string &cont, VarMap *mExtra )
{
Function *pRet = new FunctionRegexp();
pRet->copyData( this, bld, cont, mExtra );
return pRet;
}
|