Subject: [Boost-bugs] [Boost C++ Libraries] #13232: u32regex_replace - None of these prototypes have callback formatter capability
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-09-28 21:08:29
#13232: u32regex_replace - None of these prototypes have callback formatter
capability
------------------------------+--------------------------
Reporter: robic@⦠| Owner: John Maddock
Type: Feature Requests | Status: new
Milestone: To Be Determined | Component: regex
Version: Boost 1.65.0 | Severity: Problem
Keywords: |
------------------------------+--------------------------
I've had to do a workaround using a u32regex_iterator.\\
This one takes parameters wstring, u32regex, and function address.\\
(Internally it converts the wstring to u32string and does\\
the replacement with the user callback).
I just have to add more prototypes for the different forms\\
needed, but it would be nice if I didn't have to do this.
{{{
void U_Regex_Replace_Callback(
X_string& strSrc,
U_X_regex& Rx,
X_32string (*func)(X_u32smatch) )
{
X_32string str32Src, str32Repl, str32Out;
WstrToU32string( strSrc, str32Src );
str32Out.clear();
boost::u32regex_iterator<std::u32string::const_iterator>
i(boost::make_u32regex_iterator( str32Src, Rx)), j;
U32SITR last = str32Src.begin();
while(i != j)
{
str32Out.append( (*i).prefix() );
str32Out.append( func( (*i) ) ) ;
last = (*i)[0].second;
++i;
}
str32Out.append( last, str32Src.end() );
U32stringToWstr( str32Out, strSrc );
}
}}}
-- Ticket URL: <https://svn.boost.org/trac10/boost/ticket/13232> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-09-28 21:14:41 UTC