diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-11-20 22:09:45 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-11-20 22:15:29 -0500 |
commit | 22ea573b7417db0392c006dff06cde50ddbcd469 (patch) | |
tree | 649ac5ae9315710f213f82ea0c983a4062922e48 /sax/source/tools/fastattribs.cxx | |
parent | f9041c386c2193c7d669691927261e0fd7608e3e (diff) |
Expose raw char array and use it to avoid OUString allocations.
In SheetDataContext::importCell().
Change-Id: I52db64219f672ea5fbbda17686bf1173ceac5926
Diffstat (limited to 'sax/source/tools/fastattribs.cxx')
-rw-r--r-- | sax/source/tools/fastattribs.cxx | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/sax/source/tools/fastattribs.cxx b/sax/source/tools/fastattribs.cxx index 1705c3089dd4..17b9a3f6c1fd 100644 --- a/sax/source/tools/fastattribs.cxx +++ b/sax/source/tools/fastattribs.cxx @@ -157,6 +157,27 @@ bool FastAttributeList::getAsDouble( sal_Int32 nToken, double &rDouble) return false; } +bool FastAttributeList::getAsChar( sal_Int32 nToken, const char*& rPos, size_t& rLen ) const +{ + for (size_t i = 0, n = maAttributeTokens.size(); i < n; ++i) + { + if (maAttributeTokens[i] != nToken) + continue; + + sal_Int32 nOffset = maAttributeValues[i]; + rPos = mpChunk + nOffset; + + if (i + 1 < maAttributeValues.size()) + rLen = maAttributeValues[i+1] - nOffset - 1; + else + rLen = mnChunkLength - nOffset - 1; + + return true; + } + + return false; +} + OUString FastAttributeList::getValue( ::sal_Int32 Token ) throw (SAXException, RuntimeException) { for (size_t i = 0; i < maAttributeTokens.size(); ++i) |