diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2022-08-02 18:26:57 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-08-02 19:29:31 +0200 |
commit | 562b67b78783e578dea91669dbb7770d3249d1d8 (patch) | |
tree | 5285f7a8c4ad3a1cf9898092e87c2dbe64284e5a /oox/source/helper | |
parent | 189b65b02fe1f3ce6be5b7637cc59443561855e4 (diff) |
elide some temporary OUString construction in oox parsing
Change-Id: I2ea01ef4724dd375d641c8e39a7028c0e5ccec2e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137702
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'oox/source/helper')
-rw-r--r-- | oox/source/helper/attributelist.cxx | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/oox/source/helper/attributelist.cxx b/oox/source/helper/attributelist.cxx index 0215588b2b97..d61f3bb2bf44 100644 --- a/oox/source/helper/attributelist.cxx +++ b/oox/source/helper/attributelist.cxx @@ -213,9 +213,9 @@ std::optional< sal_uInt32 > AttributeList::getUnsigned( sal_Int32 nAttrToken ) c std::optional< sal_Int64 > AttributeList::getHyper( sal_Int32 nAttrToken ) const { - OUString aValue = mxAttribs->getOptionalValue( nAttrToken ); - bool bValid = !aValue.isEmpty(); - return bValid ? std::optional< sal_Int64 >( AttributeConversion::decodeHyper( aValue ) ) : std::optional< sal_Int64 >(); + std::string_view aValue = getView( nAttrToken ); + bool bValid = !aValue.empty(); + return bValid ? std::optional< sal_Int64 >( o3tl::toInt64( aValue ) ) : std::optional< sal_Int64 >(); } std::optional< sal_Int32 > AttributeList::getIntegerHex( sal_Int32 nAttrToken ) const @@ -256,18 +256,18 @@ std::optional< bool > AttributeList::getBool( sal_Int32 nAttrToken ) const std::optional< util::DateTime > AttributeList::getDateTime( sal_Int32 nAttrToken ) const { - OUString aValue = mxAttribs->getOptionalValue( nAttrToken ); + std::string_view aValue = getView( nAttrToken ); util::DateTime aDateTime; - bool bValid = (aValue.getLength() == 19) && (aValue[ 4 ] == '-') && (aValue[ 7 ] == '-') && + bool bValid = (aValue.size() == 19) && (aValue[ 4 ] == '-') && (aValue[ 7 ] == '-') && (aValue[ 10 ] == 'T') && (aValue[ 13 ] == ':') && (aValue[ 16 ] == ':'); if (!bValid) return std::optional< util::DateTime >(); - aDateTime.Year = static_cast< sal_uInt16 >( o3tl::toInt32(aValue.subView( 0, 4 )) ); - aDateTime.Month = static_cast< sal_uInt16 >( o3tl::toInt32(aValue.subView( 5, 2 )) ); - aDateTime.Day = static_cast< sal_uInt16 >( o3tl::toInt32(aValue.subView( 8, 2 )) ); - aDateTime.Hours = static_cast< sal_uInt16 >( o3tl::toInt32(aValue.subView( 11, 2 )) ); - aDateTime.Minutes = static_cast< sal_uInt16 >( o3tl::toInt32(aValue.subView( 14, 2 )) ); - aDateTime.Seconds = static_cast< sal_uInt16 >( o3tl::toInt32(aValue.subView( 17, 2 )) ); + aDateTime.Year = static_cast< sal_uInt16 >( o3tl::toInt32(aValue.substr( 0, 4 )) ); + aDateTime.Month = static_cast< sal_uInt16 >( o3tl::toInt32(aValue.substr( 5, 2 )) ); + aDateTime.Day = static_cast< sal_uInt16 >( o3tl::toInt32(aValue.substr( 8, 2 )) ); + aDateTime.Hours = static_cast< sal_uInt16 >( o3tl::toInt32(aValue.substr( 11, 2 )) ); + aDateTime.Minutes = static_cast< sal_uInt16 >( o3tl::toInt32(aValue.substr( 14, 2 )) ); + aDateTime.Seconds = static_cast< sal_uInt16 >( o3tl::toInt32(aValue.substr( 17, 2 )) ); return std::optional< util::DateTime >( aDateTime ); } |