[Libreoffice-commits] core.git: filter/source
Helena Svobodova
hel.svo at gmail.com
Thu May 26 13:35:24 UTC 2016
filter/source/svg/parserfragments.cxx | 48 +++++++++++++++++-----------------
1 file changed, 24 insertions(+), 24 deletions(-)
New commits:
commit f90b77d0f27294b00ceb58b21f4d644fa84a3289
Author: Helena Svobodova <hel.svo at gmail.com>
Date: Wed May 25 21:18:34 2016 +0200
tdf#93243 Replacing boost::bind with C++11 lambdas
Some boost::binds replaced
Change-Id: I8a0326d930921314d02285775450ac26230620ad
Reviewed-on: https://gerrit.libreoffice.org/25071
Reviewed-by: Michael Stahl <mstahl at redhat.com>
Tested-by: Michael Stahl <mstahl at redhat.com>
diff --git a/filter/source/svg/parserfragments.cxx b/filter/source/svg/parserfragments.cxx
index 01e9d97..440226e 100644
--- a/filter/source/svg/parserfragments.cxx
+++ b/filter/source/svg/parserfragments.cxx
@@ -130,36 +130,39 @@ namespace
{
using namespace ::boost::spirit::classic;
+ auto lambdaSetEightBitColorR = [&self](const char* pStart, const char* nChar){ setEightBitColor(self.m_rColor.r, pStart, nChar); };
+ auto lambdaSetEightBitColorG = [&self](const char* pStart, const char* nChar){ setEightBitColor(self.m_rColor.g, pStart, nChar); };
+ auto lambdaSetEightBitColorB = [&self](const char* pStart, const char* nChar){ setEightBitColor(self.m_rColor.b, pStart, nChar); };
+ auto lambdaSetFourBitColorR = [&self](char nChar){ setFourBitColor(self.m_rColor.r, nChar); };
+ auto lambdaSetFourBitColorG = [&self](char nChar){ setFourBitColor(self.m_rColor.g, nChar); };
+ auto lambdaSetFourBitColorB = [&self](char nChar){ setFourBitColor(self.m_rColor.b, nChar); };
+ auto lambdaSetIntColorR = [&self](sal_uInt8 nVal){ setIntColor(self.m_rColor.r, nVal); };
+ auto lambdaSetIntColorG = [&self](sal_uInt8 nVal){ setIntColor(self.m_rColor.g, nVal); };
+ auto lambdaSetIntColorB = [&self](sal_uInt8 nVal){ setIntColor(self.m_rColor.b, nVal); };
+ auto lambdaSetPercentColorR = [&self](double nVal){ setPercentColor(self.m_rColor.r, nVal); };
+ auto lambdaSetPercentColorG = [&self](double nVal){ setPercentColor(self.m_rColor.g, nVal); };
+ auto lambdaSetPercentColorB = [&self](double nVal){ setPercentColor(self.m_rColor.b, nVal); };
int_parser<sal_uInt8,10,1,3> byte_p;
colorExpression =
(
// the #rrggbb form
- ('#' >> (xdigit_p >> xdigit_p)[boost::bind(&setEightBitColor,
- boost::ref(self.m_rColor.r),_1,_2)]
- >> (xdigit_p >> xdigit_p)[boost::bind(&setEightBitColor,
- boost::ref(self.m_rColor.g),_1,_2)]
- >> (xdigit_p >> xdigit_p)[boost::bind(&setEightBitColor,
- boost::ref(self.m_rColor.b),_1,_2)])
+ ('#' >> (xdigit_p >> xdigit_p)[ lambdaSetEightBitColorR ]
+ >> (xdigit_p >> xdigit_p)[ lambdaSetEightBitColorG ]
+ >> (xdigit_p >> xdigit_p)[ lambdaSetEightBitColorB ] )
|
// the #rgb form
- ('#' >> xdigit_p[boost::bind(&setFourBitColor,
- boost::ref(self.m_rColor.r),_1)]
- >> xdigit_p[boost::bind(&setFourBitColor,
- boost::ref(self.m_rColor.g),_1)]
- >> xdigit_p[boost::bind(&setFourBitColor,
- boost::ref(self.m_rColor.b),_1)])
+ ('#' >> xdigit_p[ lambdaSetFourBitColorR ]
+ >> xdigit_p[ lambdaSetFourBitColorG ]
+ >> xdigit_p[ lambdaSetFourBitColorB ] )
|
// rgb() form
(str_p("rgb")
>> '(' >>
(
// rgb(int,int,int)
- (byte_p[boost::bind(&setIntColor,
- boost::ref(self.m_rColor.r),_1)] >> ',' >>
- byte_p[boost::bind(&setIntColor,
- boost::ref(self.m_rColor.g),_1)] >> ',' >>
- byte_p[boost::bind(&setIntColor,
- boost::ref(self.m_rColor.b),_1)])
+ (byte_p[ lambdaSetIntColorR ] >> ',' >>
+ byte_p[ lambdaSetIntColorG ] >> ',' >>
+ byte_p[ lambdaSetIntColorB ] )
|
// rgb(double,double,double)
(real_p[assign_a(self.m_rColor.r)] >> ',' >>
@@ -167,12 +170,9 @@ namespace
real_p[assign_a(self.m_rColor.b)])
|
// rgb(percent,percent,percent)
- (real_p[boost::bind(&setPercentColor,
- boost::ref(self.m_rColor.r),_1)] >> "%," >>
- real_p[boost::bind(&setPercentColor,
- boost::ref(self.m_rColor.g),_1)] >> "%," >>
- real_p[boost::bind(&setPercentColor,
- boost::ref(self.m_rColor.b),_1)] >> "%")
+ (real_p[ lambdaSetPercentColorR ] >> "%," >>
+ real_p[ lambdaSetPercentColorG ] >> "%," >>
+ real_p[ lambdaSetPercentColorB ] >> "%")
)
>> ')')
);
More information about the Libreoffice-commits
mailing list