summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2017-06-06 19:37:16 +0300
committerTor Lillqvist <tml@collabora.com>2017-06-06 21:11:41 +0300
commitc2b256084b086b63a13d16f65d1be2966f4febb3 (patch)
tree7bb756a868268e98bb5fbc95984c56078cc80ffc /include
parent8d998ae06a742033d4a343e6daae7285a2a3207b (diff)
Partial start of separating the iterator out from FormulaTokenArray
The plan is to drop the iterator functionality from FormulaTokenArray and instead use separate iterator objects. This will make parallelising code that uses these data structures easier. I call the new separate iterator class FormulaTokenArrayPlainIterator for now, feel free to come up with a better name. No change to what code actually gets run yet, so yeah, this adds "unused" code. Change-Id: Ie86f80529354174f0ce8bde1085a54bc6c5ac67b
Diffstat (limited to 'include')
-rw-r--r--include/formula/tokenarray.hxx69
1 files changed, 69 insertions, 0 deletions
diff --git a/include/formula/tokenarray.hxx b/include/formula/tokenarray.hxx
index f7a8228a0d0e..575ead626286 100644
--- a/include/formula/tokenarray.hxx
+++ b/include/formula/tokenarray.hxx
@@ -115,6 +115,7 @@ class FORMULA_DLLPUBLIC FormulaTokenArray
{
friend class FormulaCompiler;
friend class FormulaTokenIterator;
+ friend class FormulaTokenArrayPlainIterator;
friend class FormulaMissingContext;
protected:
@@ -404,6 +405,74 @@ public:
private:
const FormulaToken* GetNonEndOfPathToken( short nIdx ) const;
};
+
+class FORMULA_DLLPUBLIC FormulaTokenArrayPlainIterator
+{
+ friend class FormulaCompiler;
+
+private:
+ const FormulaTokenArray& mrFTA;
+ sal_uInt16 mnIndex; // Current step index
+
+public:
+ FormulaTokenArrayPlainIterator( const FormulaTokenArray& rFTA ) :
+ mrFTA( rFTA ),
+ mnIndex( 0 )
+ {
+ }
+
+ void Reset()
+ {
+ mnIndex = 0;
+ }
+
+ sal_uInt16 GetIndex() const
+ {
+ return mnIndex;
+ }
+
+ FormulaToken* First()
+ {
+ mnIndex = 0;
+ return Next();
+ }
+
+ void Jump(sal_uInt16 nIndex)
+ {
+ mnIndex = nIndex;
+ }
+
+ FormulaToken* Next();
+ FormulaToken* NextNoSpaces();
+ FormulaToken* GetNextName();
+ FormulaToken* GetNextReference();
+ FormulaToken* GetNextReferenceRPN();
+ FormulaToken* GetNextReferenceOrName();
+ FormulaToken* GetNextColRowName();
+ FormulaToken* PeekNext();
+ FormulaToken* PeekPrevNoSpaces() const; /// Only after Reset/First/Next/Last/Prev!
+ FormulaToken* PeekNextNoSpaces() const; /// Only after Reset/First/Next/Last/Prev!
+
+ FormulaToken* FirstRPN()
+ {
+ mnIndex = 0;
+ return NextRPN();
+ }
+
+ FormulaToken* NextRPN();
+
+ FormulaToken* LastRPN()
+ {
+ mnIndex = mrFTA.nRPN;
+ return PrevRPN();
+ }
+
+ FormulaToken* PrevRPN();
+
+ void AfterRemoveToken( sal_uInt16 nOffset, sal_uInt16 nCount );
+};
+
+
} // formula
#endif // INCLUDED_FORMULA_TOKENARRAY_HXX