> produces a working plugin linked to pcrecpp.dll.
> I didn't amend your code as per your message dated 10.12.2006 21:38
but
> I don't think it should have any bearing on what doesn't compile.
>
The only thing I think you must do in my suggestions is change the
call the to RE constructor to use RE_Options object, rather than
plain
I have some ideas which I will describe in following. If you'd
prefer me to code them and upload, let me know.
> There's a problem with the Arg class as you suspected. I got errors
like
> this one (truncated):
OK, lets try to get just FullMatch working. Can you comment out all
the calls to pcrecpp functions, including the fullmatch call, which I
will replace by new approach.
> re.cpp:315: error: no matching function for call to
> `pcrecpp::RE::FullMatch(CHAR*&, std::string, ...
I am hoping that it is just the Args usage that is wrong. He uses
Args to allow you to pass many different types of variables. He also
allows a variable number of arguments and uses a special Arg static
(no_arg) to do that.
So the first thing I would suggest is to try the define
#define NULL_RE_ARG no_arg
(I think no-arg is extern declared in pcrecpp.h so I am hoping this
works)
If that does not do it, lets try a different approach that is less
elegant but may work. Replace the long statement
bool b = re->Fullmatch(... //etc for 16 lines) by the following
bool b
switch (n)
{
case 0: b = re->FullMatch(*(szargs+2)); break;
case 1: b = re->FullMatch(*(szargs+2), &s[0]); break;
default: b=false;
}
This should work for the cases where 0 or 1 argument is passed to the
plugin for capturing the matched strings. If it does, we can add the
other cases later.
> yields more errors but replacing them with that works:
> *NULL_RE_ARG,
> Because I'm not sure what that part of the code is supposed to do
or how
> the Arg class works, I didn't try to fix your code in a way that
would
> preserve it's functionality.
I am confused by the above. Do you mean it compiled if NULL_RE_ARG
is defined to new Arg()? That's interesting but you are right I
don't think it would work as I am trying to signal a missing argument
and a new Arg() would probably not be interpreted that way.
>
> It looks like there's a typo in your code BTW:
> (n>6?s[5]:NULL_RE_ARG)
Agreed, this should be n>5.
>
> > `pcrecpp::RE::GlobalReplace(std::string&, std::string&)'
Yes, the last argument should be a string*, so I think you just have
to put an & in front of it in the call. Same for Extract and plain
Replace, I believe.
>