summaryrefslogtreecommitdiff
path: root/svl/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-02-28 09:49:17 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-02-28 10:53:55 +0000
commit94b18584e1332bc4bb529fc3a7d13ab5ce15f8fb (patch)
treee228c94fbe75af2932a9e8576c6a5d17afa2a0cb /svl/source
parentd6ae28fe07497d217a53ee9062ddbf82766121a7 (diff)
no need to allocate Date separately in ImpSvNumberInputScan
it is only one pointer big Change-Id: I8b0b7ea0cf69cecabc2ddfb7e5d134037221057c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147946 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svl/source')
-rw-r--r--svl/source/numbers/zforfind.cxx13
-rw-r--r--svl/source/numbers/zforfind.hxx5
2 files changed, 6 insertions, 12 deletions
diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index 029b2b556d0f..de5aacf69d2b 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -81,7 +81,7 @@ ImpSvNumberInputScan::ImpSvNumberInputScan( SvNumberFormatter* pFormatterP )
eSetType( SvNumFormatType::UNDEFINED )
{
pFormatter = pFormatterP;
- pNullDate.reset( new Date(30,12,1899) );
+ moNullDate.emplace( 30,12,1899 );
nYear2000 = SvNumberFormatter::GetYear2000Default();
Reset();
ChangeIntl();
@@ -2262,7 +2262,7 @@ input for the following reasons:
if ( res && pCal->isValid() )
{
- double fDiff = DateTime(*pNullDate) - pCal->getEpochStart();
+ double fDiff = DateTime(*moNullDate) - pCal->getEpochStart();
fDays = ::rtl::math::approxFloor( pCal->getLocalDateTime() );
fDays -= fDiff;
nTryOrder = nFormatOrder; // break for
@@ -3831,14 +3831,7 @@ void ImpSvNumberInputScan::ChangeNullDate( const sal_uInt16 Day,
const sal_uInt16 Month,
const sal_Int16 Year )
{
- if ( pNullDate )
- {
- *pNullDate = Date(Day, Month, Year);
- }
- else
- {
- pNullDate.reset(new Date(Day, Month, Year));
- }
+ moNullDate = Date(Day, Month, Year);
}
diff --git a/svl/source/numbers/zforfind.hxx b/svl/source/numbers/zforfind.hxx
index 5696b6ca21a3..dea732b93297 100644
--- a/svl/source/numbers/zforfind.hxx
+++ b/svl/source/numbers/zforfind.hxx
@@ -23,9 +23,10 @@
#include <com/sun/star/uno/Sequence.hxx>
#include <rtl/ustring.hxx>
#include <svl/zforlist.hxx>
+#include <tools/date.hxx>
#include <memory>
+#include <optional>
-class Date;
class SvNumberformat;
class SvNumberFormatter;
enum class SvNumFormatType : sal_Int16;
@@ -89,7 +90,7 @@ private:
bool bTextInitialized; //* Whether days and months are initialized
bool bScanGenitiveMonths; //* Whether to scan an input for genitive months
bool bScanPartitiveMonths; //* Whether to scan an input for partitive months
- std::unique_ptr<Date> pNullDate; //* 30Dec1899
+ std::optional<Date> moNullDate; //* 30Dec1899
// Variables for provisional results:
OUString sStrArray[SV_MAX_COUNT_INPUT_STRINGS];//* Array of scanned substrings
bool IsNum[SV_MAX_COUNT_INPUT_STRINGS]; //* Whether a substring is numeric