#include "support/lyxlib.h" // float_equal
#include "support/Translator.h"
-#include "support/regex.h"
-
#include <cmath> // abs
+#include <regex>
#include <sstream>
using namespace std;
typedef Translator<RotationData::OriginType, string> OriginTranslator;
OriginTranslator const & originTranslator();
-} // namespace anon
+} // namespace
void RotationData::origin(string const & o)
return os;
}
-} // namespace anon
+} // namespace
string const RotationLatexCommand::front_impl() const
ostringstream os;
if (!data.bbox.empty())
- os << "bb=" << data.bbox << ',';
+ os << "bb=" << data.bbox.xl.asLatexString() << ' '
+ << data.bbox.yb.asLatexString() << ' '
+ << data.bbox.xr.asLatexString() << ' '
+ << data.bbox.yt.asLatexString() << ',';
if (data.clip)
os << "clip,";
return os.str();
// Strip any leading commas
// "[,,,,foo..." -> "foo..." ("foo..." may be empty)
string output;
- lyx::smatch what;
- static lyx::regex const front("^( *[[],*)(.*)$");
+ smatch what;
+ static regex const front("^( *\\[,*)(.*)$");
- regex_match(it, end, what, front, regex_constants::match_partial);
- if (!what[0].matched) {
+ if (!regex_match(it, end, what, front)) {
lyxerr << "Unable to sanitize LaTeX \"Option\": "
<< input << '\n';
return string();
// Replace any consecutive commas with a single one
// "foo,,,,bar" -> "foo,bar"
// with iterator now pointing to 'b'
- static lyx::regex const commas("([^,]*)(,,*)(.*)$");
+ static regex const commas("([^,]*)(,,*)(.*)$");
for (; it != end;) {
- regex_match(it, end, what, commas, regex_constants::match_partial);
- if (!what[0].matched) {
+ if (!regex_match(it, end, what, commas)) {
output += string(it, end);
break;
}
// Strip any trailing commas
// "...foo,,,]" -> "...foo" ("...foo,,," may be empty)
- static lyx::regex const back("^(.*[^,])?,*[]] *$");
- regex_match(output, what, back);
- if (!what[0].matched) {
+ static regex const back("^(.*[^,])?,*\\] *$");
+ if (!regex_match(output, what, back)) {
lyxerr << "Unable to sanitize LaTeX \"Option\": "
<< output << '\n';
return string();
namespace {
template <typename Factory, typename Data, typename Transformer>
-void extractIt(boost::any const & any_factory,
+void extractIt(any const & any_factory,
Data const & data, Transformer & transformer)
{
if (any_factory.type() != typeid(Factory))
return;
- Factory factory = boost::any_cast<Factory>(any_factory);
- if (!factory.empty())
+ Factory factory = any_cast<Factory>(any_factory);
+ if (factory)
transformer = factory(data);
}
-} // namespace anon
+} // namespace
TransformCommand::ptr_type
return translator;
}
-} // namespace anon
+} // namespace
} // namespace external
} // namespace lyx