summaryrefslogtreecommitdiff
path: root/sc/inc/interpretercontext.hxx
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.co.uk>2017-11-17 15:30:35 +0530
committerDennis Francis <dennis.francis@collabora.co.uk>2017-11-21 16:09:44 +0530
commit2b12d3d11fe116d0fb886518ae831b9effd53284 (patch)
tree878a6bbf5da46721f6311816920ea01dc308cd24 /sc/inc/interpretercontext.hxx
parent4284cdcc3e82bf2a6029ce2502c82605d9a74f86 (diff)
Move token-cache for doubles to ScInterpreterContext...
...from ScInterpreter and in the s/w interpreter, create a ScInterpreterContext for each thread for passing into per thread ScInterpreter constructor. Change-Id: I4e0abce043c7e1e70859efb2e5001fc284f416a9
Diffstat (limited to 'sc/inc/interpretercontext.hxx')
-rw-r--r--sc/inc/interpretercontext.hxx14
1 files changed, 13 insertions, 1 deletions
diff --git a/sc/inc/interpretercontext.hxx b/sc/inc/interpretercontext.hxx
index cbf05349ca5f..ff52267dfb26 100644
--- a/sc/inc/interpretercontext.hxx
+++ b/sc/inc/interpretercontext.hxx
@@ -10,6 +10,11 @@
#ifndef INCLUDED_SC_INC_INTERPRETERCONTEXT_HXX
#define INCLUDED_SC_INC_INTERPRETERCONTEXT_HXX
+#include <vector>
+#include <formula/token.hxx>
+
+#define TOKEN_CACHE_SIZE 8
+
class ScDocument;
class SvNumberFormatter;
@@ -17,15 +22,22 @@ struct ScInterpreterContext
{
const ScDocument& mrDoc;
SvNumberFormatter* mpFormatter;
+ size_t mnTokenCachePos;
+ std::vector<formula::FormulaToken*> maTokens;
ScInterpreterContext(const ScDocument& rDoc, SvNumberFormatter* pFormatter) :
mrDoc(rDoc),
- mpFormatter(pFormatter)
+ mpFormatter(pFormatter),
+ mnTokenCachePos(0),
+ maTokens(TOKEN_CACHE_SIZE, nullptr)
{
}
~ScInterpreterContext()
{
+ for ( auto p : maTokens )
+ if ( p )
+ p->DecRef();
}
SvNumberFormatter* GetFormatTable() const