summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-02-07 09:06:00 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-02-07 07:43:32 +0000
commitb2453d1f41b369ca4b1c98e03b803be1773d0aff (patch)
tree3f51d68a3b058e7f2da6306dd4cad3c838979873
parent3aeaa73a2e3568bd932b16cf4d3fea3fb39ebf13 (diff)
convert DEBUG_TIME to scoped enum
Change-Id: I91b286d8415ebc8c6675aca6ee143850c956c74b Reviewed-on: https://gerrit.libreoffice.org/33986 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rwxr-xr-xcompilerplugins/clang/unusedenumconstants.py1
-rw-r--r--sc/inc/datastreamgettime.hxx9
-rw-r--r--sc/source/core/tool/interpr7.cxx6
-rw-r--r--sc/source/ui/docshell/datastream.cxx18
4 files changed, 17 insertions, 17 deletions
diff --git a/compilerplugins/clang/unusedenumconstants.py b/compilerplugins/clang/unusedenumconstants.py
index 670bb005eaab..6ee56d87657f 100755
--- a/compilerplugins/clang/unusedenumconstants.py
+++ b/compilerplugins/clang/unusedenumconstants.py
@@ -97,6 +97,7 @@ for d in definitionSet:
"include/registry/refltype.hxx",
"include/registry/version.h",
"include/svtools/rtftoken.h",
+ "sc/source/filter/inc/xltracer.hxx",
# unit test code
"cppu/source/uno/check.cxx",
# general weird nonsense going on
diff --git a/sc/inc/datastreamgettime.hxx b/sc/inc/datastreamgettime.hxx
index 6c39727fff97..632cf8723159 100644
--- a/sc/inc/datastreamgettime.hxx
+++ b/sc/inc/datastreamgettime.hxx
@@ -24,7 +24,14 @@
namespace sc {
-double datastream_get_time(int nIdx);
+enum class DebugTime {
+ Import,
+ Recalc,
+ Render,
+ LAST = Render
+};
+
+double datastream_get_time(DebugTime nIdx);
}
diff --git a/sc/source/core/tool/interpr7.cxx b/sc/source/core/tool/interpr7.cxx
index 69eed575810b..8b3e5375545b 100644
--- a/sc/source/core/tool/interpr7.cxx
+++ b/sc/source/core/tool/interpr7.cxx
@@ -367,11 +367,11 @@ void ScInterpreter::ScDebugVar()
PushDouble(fVal);
}
else if (aStrUpper == "DATASTREAM_IMPORT")
- PushDouble( sc::datastream_get_time( 0 ) );
+ PushDouble( sc::datastream_get_time( sc::DebugTime::Import ) );
else if (aStrUpper == "DATASTREAM_RECALC")
- PushDouble( sc::datastream_get_time( 1 ) );
+ PushDouble( sc::datastream_get_time( sc::DebugTime::Recalc ) );
else if (aStrUpper == "DATASTREAM_RENDER")
- PushDouble( sc::datastream_get_time( 2 ) );
+ PushDouble( sc::datastream_get_time( sc::DebugTime::Render ) );
else
PushIllegalParameter();
}
diff --git a/sc/source/ui/docshell/datastream.cxx b/sc/source/ui/docshell/datastream.cxx
index d42382478a7b..97ad4203576c 100644
--- a/sc/source/ui/docshell/datastream.cxx
+++ b/sc/source/ui/docshell/datastream.cxx
@@ -25,6 +25,7 @@
#include <viewdata.hxx>
#include <stringutil.hxx>
#include <documentlinkmgr.hxx>
+#include <o3tl/enumarray.hxx>
#include "officecfg/Office/Calc.hxx"
@@ -38,19 +39,10 @@
namespace sc {
-enum {
- DEBUG_TIME_IMPORT,
- DEBUG_TIME_RECALC,
- DEBUG_TIME_RENDER,
- DEBUG_TIME_MAX
-};
-
-static double fTimes[DEBUG_TIME_MAX] = { 0.0, 0.0, 0.0 };
+static o3tl::enumarray<DebugTime, double> fTimes { 0.0, 0.0, 0.0 };
-double datastream_get_time(int nIdx)
+double datastream_get_time(DebugTime nIdx)
{
- if( nIdx < 0 || nIdx >= (int)SAL_N_ELEMENTS( fTimes ) )
- return -1;
return fTimes[ nIdx ];
}
@@ -449,7 +441,7 @@ void DataStream::Refresh()
mpDocShell->DoHardRecalc(true);
mpDocShell->SetDocumentModified();
- fTimes[ DEBUG_TIME_RECALC ] = getNow() - fStart;
+ fTimes[ DebugTime::Recalc ] = getNow() - fStart;
mfLastRefreshTime = getNow();
mnLinesSinceRefresh = 0;
@@ -531,7 +523,7 @@ void DataStream::Text2Doc()
}
}
- fTimes[ DEBUG_TIME_IMPORT ] = getNow() - fStart;
+ fTimes[ DebugTime::Import ] = getNow() - fStart;
if (meMove == NO_MOVE)
return;