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),
|
mrList.AttributeValueLength(mnIdx),
|
||||||
RTL_TEXTENCODING_UTF8);
|
RTL_TEXTENCODING_UTF8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* toCString()
|
||||||
|
{
|
||||||
|
assert(mnIdx < mrList.maAttributeTokens.size());
|
||||||
|
return mrList.getFastAttributeValue(mnIdx);
|
||||||
|
}
|
||||||
bool isString(const char *str)
|
bool isString(const char *str)
|
||||||
{
|
{
|
||||||
assert(mnIdx < mrList.maAttributeTokens.size());
|
assert(mnIdx < mrList.maAttributeTokens.size());
|
||||||
|
@@ -3291,6 +3291,10 @@ namespace xmloff { namespace token {
|
|||||||
XMLOFF_DLLPUBLIC bool IsXMLToken(
|
XMLOFF_DLLPUBLIC bool IsXMLToken(
|
||||||
const OUString& rString,
|
const OUString& rString,
|
||||||
enum XMLTokenEnum eToken );
|
enum XMLTokenEnum eToken );
|
||||||
|
|
||||||
|
XMLOFF_DLLPUBLIC bool IsXMLToken(
|
||||||
|
const char* pCString,
|
||||||
|
enum XMLTokenEnum eToken );
|
||||||
} }
|
} }
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -104,7 +104,7 @@ ScXMLBodyContext::ScXMLBodyContext( ScXMLImport& rImport,
|
|||||||
{
|
{
|
||||||
const sal_Int32 nLocalToken = nToken & TOKEN_MASK;
|
const sal_Int32 nLocalToken = nToken & TOKEN_MASK;
|
||||||
if( nLocalToken == XML_STRUCTURE_PROTECTED )
|
if( nLocalToken == XML_STRUCTURE_PROTECTED )
|
||||||
bProtected = IsXMLToken( it.toString(), XML_TRUE );
|
bProtected = IsXMLToken( it.toCString(), XML_TRUE );
|
||||||
else if ( nLocalToken == XML_PROTECTION_KEY )
|
else if ( nLocalToken == XML_PROTECTION_KEY )
|
||||||
sPassword = it.toString();
|
sPassword = it.toString();
|
||||||
else if ( nLocalToken == XML_PROTECTION_KEY_DIGEST_ALGORITHM )
|
else if ( nLocalToken == XML_PROTECTION_KEY_DIGEST_ALGORITHM )
|
||||||
|
@@ -258,13 +258,12 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport,
|
|||||||
{
|
{
|
||||||
if (!it.isEmpty())
|
if (!it.isEmpty())
|
||||||
{
|
{
|
||||||
const OUString sValue = it.toString();
|
if ( IsXMLToken( it.toCString(), XML_TRUE ) )
|
||||||
if ( IsXMLToken(sValue, XML_TRUE) )
|
|
||||||
fValue = 1.0;
|
fValue = 1.0;
|
||||||
else if ( IsXMLToken(sValue, XML_FALSE) )
|
else if ( IsXMLToken( it.toCString(), XML_FALSE ) )
|
||||||
fValue = 0.0;
|
fValue = 0.0;
|
||||||
else
|
else
|
||||||
::sax::Converter::convertDouble(fValue, sValue);
|
::sax::Converter::convertDouble(fValue, it.toString() );
|
||||||
bIsEmpty = false;
|
bIsEmpty = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -162,7 +162,7 @@ ScXMLTableContext::ScXMLTableContext( ScXMLImport& rImport,
|
|||||||
sStyleName = it.toString();
|
sStyleName = it.toString();
|
||||||
break;
|
break;
|
||||||
case XML_TOK_TABLE_PROTECTED:
|
case XML_TOK_TABLE_PROTECTED:
|
||||||
aProtectData.mbProtected = IsXMLToken( it.toString(), XML_TRUE );
|
aProtectData.mbProtected = IsXMLToken( it.toCString(), XML_TRUE );
|
||||||
break;
|
break;
|
||||||
case XML_TOK_TABLE_PRINT_RANGES:
|
case XML_TOK_TABLE_PRINT_RANGES:
|
||||||
sPrintRanges = it.toString();
|
sPrintRanges = it.toString();
|
||||||
@@ -178,7 +178,7 @@ ScXMLTableContext::ScXMLTableContext( ScXMLImport& rImport,
|
|||||||
break;
|
break;
|
||||||
case XML_TOK_TABLE_PRINT:
|
case XML_TOK_TABLE_PRINT:
|
||||||
{
|
{
|
||||||
if (IsXMLToken( it.toString(), XML_FALSE) )
|
if (IsXMLToken( it.toCString(), XML_FALSE) )
|
||||||
bPrintEntireSheet = false;
|
bPrintEntireSheet = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@@ -3328,6 +3328,17 @@ namespace xmloff { namespace token {
|
|||||||
const XMLTokenEntry* pToken = &aTokenList[(sal_uInt16)eToken];
|
const XMLTokenEntry* pToken = &aTokenList[(sal_uInt16)eToken];
|
||||||
return rString.equalsAsciiL( pToken->pChar, pToken->nLength );
|
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