Further modifications to FastAttributeIter:
attempt to further reduce unnecessary allocation and freeing of OUString. Change-Id: I85169cfcd2311a5e6a96dc0292ce0686d1b0e43d Reviewed-on: https://gerrit.libreoffice.org/34092 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Jenkins <ci@libreoffice.org>
This commit is contained in:
committed by
Michael Meeks
parent
fc81a580dd
commit
32c0ab80aa
@@ -145,6 +145,12 @@ public:
|
||||
mrList.AttributeValueLength(mnIdx),
|
||||
RTL_TEXTENCODING_UTF8);
|
||||
}
|
||||
|
||||
const char* toCString()
|
||||
{
|
||||
assert(mnIdx < mrList.maAttributeTokens.size());
|
||||
return mrList.getFastAttributeValue(mnIdx);
|
||||
}
|
||||
bool isString(const char *str)
|
||||
{
|
||||
assert(mnIdx < mrList.maAttributeTokens.size());
|
||||
|
@@ -3291,6 +3291,10 @@ namespace xmloff { namespace token {
|
||||
XMLOFF_DLLPUBLIC bool IsXMLToken(
|
||||
const OUString& rString,
|
||||
enum XMLTokenEnum eToken );
|
||||
|
||||
XMLOFF_DLLPUBLIC bool IsXMLToken(
|
||||
const char* pCString,
|
||||
enum XMLTokenEnum eToken );
|
||||
} }
|
||||
|
||||
#endif
|
||||
|
@@ -104,7 +104,7 @@ ScXMLBodyContext::ScXMLBodyContext( ScXMLImport& rImport,
|
||||
{
|
||||
const sal_Int32 nLocalToken = nToken & TOKEN_MASK;
|
||||
if( nLocalToken == XML_STRUCTURE_PROTECTED )
|
||||
bProtected = IsXMLToken( it.toString(), XML_TRUE );
|
||||
bProtected = IsXMLToken( it.toCString(), XML_TRUE );
|
||||
else if ( nLocalToken == XML_PROTECTION_KEY )
|
||||
sPassword = it.toString();
|
||||
else if ( nLocalToken == XML_PROTECTION_KEY_DIGEST_ALGORITHM )
|
||||
|
@@ -258,13 +258,12 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport,
|
||||
{
|
||||
if (!it.isEmpty())
|
||||
{
|
||||
const OUString sValue = it.toString();
|
||||
if ( IsXMLToken(sValue, XML_TRUE) )
|
||||
if ( IsXMLToken( it.toCString(), XML_TRUE ) )
|
||||
fValue = 1.0;
|
||||
else if ( IsXMLToken(sValue, XML_FALSE) )
|
||||
else if ( IsXMLToken( it.toCString(), XML_FALSE ) )
|
||||
fValue = 0.0;
|
||||
else
|
||||
::sax::Converter::convertDouble(fValue, sValue);
|
||||
::sax::Converter::convertDouble(fValue, it.toString() );
|
||||
bIsEmpty = false;
|
||||
}
|
||||
}
|
||||
|
@@ -162,7 +162,7 @@ ScXMLTableContext::ScXMLTableContext( ScXMLImport& rImport,
|
||||
sStyleName = it.toString();
|
||||
break;
|
||||
case XML_TOK_TABLE_PROTECTED:
|
||||
aProtectData.mbProtected = IsXMLToken( it.toString(), XML_TRUE );
|
||||
aProtectData.mbProtected = IsXMLToken( it.toCString(), XML_TRUE );
|
||||
break;
|
||||
case XML_TOK_TABLE_PRINT_RANGES:
|
||||
sPrintRanges = it.toString();
|
||||
@@ -178,7 +178,7 @@ ScXMLTableContext::ScXMLTableContext( ScXMLImport& rImport,
|
||||
break;
|
||||
case XML_TOK_TABLE_PRINT:
|
||||
{
|
||||
if (IsXMLToken( it.toString(), XML_FALSE) )
|
||||
if (IsXMLToken( it.toCString(), XML_FALSE) )
|
||||
bPrintEntireSheet = false;
|
||||
}
|
||||
break;
|
||||
|
@@ -3328,6 +3328,17 @@ namespace xmloff { namespace token {
|
||||
const XMLTokenEntry* pToken = &aTokenList[(sal_uInt16)eToken];
|
||||
return rString.equalsAsciiL( pToken->pChar, pToken->nLength );
|
||||
}
|
||||
|
||||
bool IsXMLToken(
|
||||
const char* pCString,
|
||||
enum XMLTokenEnum eToken )
|
||||
{
|
||||
assert(XML_TOKEN_INVALID < eToken);
|
||||
assert(eToken < XML_TOKEN_END);
|
||||
|
||||
const XMLTokenEntry* pToken = &aTokenList[(sal_uInt16)eToken];
|
||||
return !strcmp( pCString, pToken->pChar );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user