[Libreoffice-commits] core.git: include/xmloff xmloff/source
Daniel Sikeler
d.sikeler94 at gmail.com
Fri Aug 26 07:41:02 UTC 2016
include/xmloff/xmltkmap.hxx | 17 +++++++++++++++--
xmloff/source/core/xmltkmap.cxx | 30 ++++++++++++++++++++++--------
2 files changed, 37 insertions(+), 10 deletions(-)
New commits:
commit e3b3c3fe41fde28b01ab1b2d8408d92dfa837dc5
Author: Daniel Sikeler <d.sikeler94 at gmail.com>
Date: Thu Aug 25 02:19:48 2016 +0530
Make SvXMLTokenMap compatible with FastTokens:
Added new methods for the fasttokens and
a lot of entries must be updated in later commits.
Change-Id: I37de9c8d4bdeb75f678902a422a5961670480562
Reviewed-on: https://gerrit.libreoffice.org/28355
Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
Tested-by: Noel Grandin <noelgrandin at gmail.com>
diff --git a/include/xmloff/xmltkmap.hxx b/include/xmloff/xmltkmap.hxx
index 4cf6403..c54d801 100644
--- a/include/xmloff/xmltkmap.hxx
+++ b/include/xmloff/xmltkmap.hxx
@@ -28,20 +28,32 @@
class SvXMLTokenMap_Impl;
+class SvXMLTokenMapEntry_Impl;
#define XML_TOK_UNKNOWN 0xffffU
-#define XML_TOKEN_MAP_END { 0xffffU, ::xmloff::token::XML_TOKEN_INVALID, 0U }
+#define XML_TOKEN_MAP_END { 0xffffU, xmloff::token::XML_TOKEN_INVALID, 0U, 0 }
struct SvXMLTokenMapEntry
{
sal_uInt16 nPrefixKey;
- enum ::xmloff::token::XMLTokenEnum eLocalName;
+ enum xmloff::token::XMLTokenEnum eLocalName;
sal_uInt16 nToken;
+ sal_Int32 nFastToken;
+
+ SvXMLTokenMapEntry( sal_uInt16 nPrefix, xmloff::token::XMLTokenEnum eName,
+ sal_uInt16 nTok = XML_TOK_UNKNOWN, sal_Int32 nFastTok = 0 ) :
+ nPrefixKey( nPrefix ),
+ eLocalName( eName ),
+ nToken( nTok ),
+ nFastToken( nFastTok )
+ {}
};
class XMLOFF_DLLPUBLIC SvXMLTokenMap
{
+private:
std::unique_ptr<SvXMLTokenMap_Impl> m_pImpl;
+ sal_uInt16 Get( const SvXMLTokenMapEntry_Impl& rEntry ) const;
public:
@@ -49,6 +61,7 @@ public:
~SvXMLTokenMap();
sal_uInt16 Get( sal_uInt16 nPrefix, const OUString& rLName ) const;
+ sal_uInt16 Get( sal_Int32 nFastTok ) const;
};
#endif // INCLUDED_XMLOFF_XMLTKMAP_HXX
diff --git a/xmloff/source/core/xmltkmap.cxx b/xmloff/source/core/xmltkmap.cxx
index 1b5810f..6888b62 100644
--- a/xmloff/source/core/xmltkmap.cxx
+++ b/xmloff/source/core/xmltkmap.cxx
@@ -30,22 +30,25 @@ class SvXMLTokenMapEntry_Impl
sal_uInt16 nPrefixKey;
OUString sLocalName;
sal_uInt16 nToken;
+ sal_Int32 nFastToken;
public:
sal_uInt16 GetToken() const { return nToken; }
SvXMLTokenMapEntry_Impl( sal_uInt16 nPrefix, const OUString& rLName,
- sal_uInt16 nTok=XML_TOK_UNKNOWN ) :
+ sal_uInt16 nTok = XML_TOK_UNKNOWN, sal_Int32 nFastTok = 0 ) :
nPrefixKey( nPrefix ),
sLocalName( rLName ),
- nToken( nTok )
+ nToken( nTok ),
+ nFastToken( nFastTok )
{}
explicit SvXMLTokenMapEntry_Impl( const SvXMLTokenMapEntry& rEntry ) :
nPrefixKey( rEntry.nPrefixKey ),
sLocalName( GetXMLToken( rEntry.eLocalName ) ),
- nToken( rEntry.nToken )
+ nToken( rEntry.nToken ),
+ nFastToken( rEntry.nFastToken )
{}
bool operator<( const SvXMLTokenMapEntry_Impl& r ) const
@@ -72,13 +75,10 @@ SvXMLTokenMap::~SvXMLTokenMap()
{
}
-sal_uInt16 SvXMLTokenMap::Get( sal_uInt16 nKeyPrefix,
- const OUString& rLName ) const
+sal_uInt16 SvXMLTokenMap::Get( const SvXMLTokenMapEntry_Impl& rEntry ) const
{
SvXMLTokenMapEntry_Impl const* pEntry = nullptr;
- SvXMLTokenMapEntry_Impl aTst( nKeyPrefix, rLName );
-
- SvXMLTokenMap_Impl::iterator it = m_pImpl->find( aTst );
+ SvXMLTokenMap_Impl::iterator it = m_pImpl->find( rEntry );
if (it != m_pImpl->end())
{
pEntry = &*it;
@@ -90,4 +90,18 @@ sal_uInt16 SvXMLTokenMap::Get( sal_uInt16 nKeyPrefix,
return XML_TOK_UNKNOWN;
}
+sal_uInt16 SvXMLTokenMap::Get( sal_uInt16 nKeyPrefix,
+ const OUString& rLName ) const
+{
+ SvXMLTokenMapEntry_Impl aTst( nKeyPrefix, rLName );
+ return( Get( aTst ) );
+}
+
+sal_uInt16 SvXMLTokenMap::Get( sal_Int32 nFastTok ) const
+{
+ static const OUString sEmptyString("");
+ SvXMLTokenMapEntry_Impl aTst( 0, sEmptyString, XML_TOK_UNKNOWN, nFastTok );
+ return( Get( aTst ) );
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list