diff options
author | Xisco Fauli <anistenis@gmail.com> | 2015-11-16 23:21:59 +0100 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2015-11-17 07:57:25 +0000 |
commit | 970813b0a4ac0bd1e07dfb0803bdebca9c3e9e6a (patch) | |
tree | 204f89e2e026b3442c86010e082f0453910e9d36 | |
parent | da11e337441f747155fa75c19263df70bfe6c543 (diff) |
instead of converting from std::string to OUString...
... use OUString directly
Change-Id: Ibdf863d7dbbb578e7fe87eac51e3d773a5b05199
Reviewed-on: https://gerrit.libreoffice.org/20009
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r-- | filter/source/svg/parserfragments.cxx | 21 | ||||
-rw-r--r-- | filter/source/svg/parserfragments.hxx | 4 | ||||
-rw-r--r-- | filter/source/svg/svgreader.cxx | 9 |
3 files changed, 15 insertions, 19 deletions
diff --git a/filter/source/svg/parserfragments.cxx b/filter/source/svg/parserfragments.cxx index ec01fdf7da57..4e4e53748295 100644 --- a/filter/source/svg/parserfragments.cxx +++ b/filter/source/svg/parserfragments.cxx @@ -15,7 +15,6 @@ #include <com/sun/star/geometry/AffineMatrix2D.hpp> #include <osl/diagnose.h> -#include <string.h> #include <limits.h> #include <boost/bind.hpp> #include <boost/spirit/include/classic.hpp> @@ -573,22 +572,20 @@ bool parsePaintUri( std::pair<const char*,const char*>& o_rPaintUri, -bool parseXlinkHref( const char* sXlinkHref, std::string& data ) +bool parseXlinkHref( const char* sXlinkHref, OUString& data ) { - using namespace ::boost::spirit::classic; - - data.erase(data.begin(),data.end()); + OUString sLink(OUString::createFromAscii(sXlinkHref)); - std::string sLink(sXlinkHref); - - if (!sLink.compare(0,5,"data:")) + if (sLink.startsWith("data:")) { + sal_Int32 nIndex=0; + OUString aCurrToken = sLink.getToken(0,',',nIndex); + // the inplace "data" uri - size_t position = sLink.rfind(','); - if (position > 0 && position < std::string::npos) + if ( !aCurrToken.isEmpty() ) { - data = sLink.substr(position+1); - OSL_TRACE("%s", data.c_str()); + data = sLink.copy(nIndex); + SAL_INFO("%s", data); return true; } } diff --git a/filter/source/svg/parserfragments.hxx b/filter/source/svg/parserfragments.hxx index 6d4c3522a140..a93a5fb98379 100644 --- a/filter/source/svg/parserfragments.hxx +++ b/filter/source/svg/parserfragments.hxx @@ -12,7 +12,7 @@ #include <sal/config.h> #include <vector> #include <utility> -#include <string> +#include <rtl/ustring.hxx> namespace basegfx { @@ -60,7 +60,7 @@ namespace svgi const char* sPaintUri ); /// Parse given string for the xlink attribute - bool parseXlinkHref( const char* xlink, std::string& data ); + bool parseXlinkHref( const char* xlink, OUString& data ); } // namespace svgi diff --git a/filter/source/svg/svgreader.cxx b/filter/source/svg/svgreader.cxx index 4c0d3c8a15e7..0554099325eb 100644 --- a/filter/source/svg/svgreader.cxx +++ b/filter/source/svg/svgreader.cxx @@ -44,7 +44,6 @@ #include <boost/bind.hpp> #include <map> -#include <string.h> #define OASIS_STR "urn:oasis:names:tc:opendocument:xmlns:" @@ -1539,10 +1538,10 @@ struct ShapeWritingVisitor OUString sValue = xElem->hasAttribute("href") ? xElem->getAttribute("href") : ""; OString aValueUtf8( sValue.getStr(), sValue.getLength(), RTL_TEXTENCODING_UTF8 ); - std::string sLinkValue; + OUString sLinkValue; parseXlinkHref(aValueUtf8.getStr(), sLinkValue); - if (!sLinkValue.empty()) + if (!sLinkValue.isEmpty()) writeBinaryData(xAttrs, xUnoAttrs, xElem, basegfx::B2DRange(x,y,x+width,y+height), sLinkValue); break; } @@ -1642,7 +1641,7 @@ struct ShapeWritingVisitor const uno::Reference<xml::sax::XAttributeList>& xUnoAttrs, const uno::Reference<xml::dom::XElement>& /* xElem */, const basegfx::B2DRange& rShapeBounds, - const std::string& data) + const OUString& data) { xAttrs->Clear(); xAttrs->AddAttribute( "svg:x", OUString::number(pt2mm(rShapeBounds.getMinX()))+"mm"); @@ -1657,7 +1656,7 @@ struct ShapeWritingVisitor mxDocumentHandler->startElement("office:binary-data", xUnoAttrs); - mxDocumentHandler->characters(OUString::createFromAscii(data.c_str())); + mxDocumentHandler->characters(data); mxDocumentHandler->endElement("office:binary-data"); |