summaryrefslogtreecommitdiff
path: root/oox/source/helper
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2013-11-26 17:26:01 +0000
committerMichael Meeks <michael.meeks@collabora.com>2013-11-26 17:33:44 +0000
commitf3d1f950aa259ebe8e3b8c65091e5b6e4462e0e3 (patch)
tree48383e696ceb308bbaecca9623f1f52379cd2801 /oox/source/helper
parent30a8fbbf1b7bdc849d88445a28e86e03e5dc2166 (diff)
oox: accelerate common case boolean reading.
Diffstat (limited to 'oox/source/helper')
-rw-r--r--oox/source/helper/attributelist.cxx13
1 files changed, 13 insertions, 0 deletions
diff --git a/oox/source/helper/attributelist.cxx b/oox/source/helper/attributelist.cxx
index 2efc3a3ed4ba..8f0707a80703 100644
--- a/oox/source/helper/attributelist.cxx
+++ b/oox/source/helper/attributelist.cxx
@@ -201,6 +201,19 @@ OptValue< sal_Int32 > AttributeList::getIntegerHex( sal_Int32 nAttrToken ) const
OptValue< bool > AttributeList::getBool( sal_Int32 nAttrToken ) const
{
+ const char *pAttr;
+
+ // catch the common cases as quickly as possible first
+ bool bHasAttr = getAttribList()->getAsChar( nAttrToken, pAttr );
+ if( !bHasAttr )
+ return OptValue< bool >();
+ if( !strcmp( pAttr, "false" ) )
+ return OptValue< bool >( false );
+ if( !strcmp( pAttr, "true" ) )
+ return OptValue< bool >( true );
+
+ // now for all the crazy stuff
+
// boolean attributes may be "t", "f", "true", "false", "on", "off", "1", or "0"
switch( getToken( nAttrToken, XML_TOKEN_INVALID ) )
{