[Libreoffice-commits] core.git: formula/source include/formula

Tor Lillqvist tml at collabora.com
Tue Jun 13 14:47:22 UTC 2017


 formula/source/core/api/token.cxx |   14 ++++++++++++++
 include/formula/tokenarray.hxx    |    2 ++
 2 files changed, 16 insertions(+)

New commits:
commit 7b67e3fc5566f4172c69fa8460aea0c006e97a4d
Author: Tor Lillqvist <tml at collabora.com>
Date:   Tue Jun 13 17:09:24 2017 +0300

    Add FirstToken() and FirstRPNToken() functions that don't touch nIndex
    
    ... to FormulaTokenArray. Intermediate commit, these new functions
    aren't used yet.
    
    Change-Id: Ie505fe9dbd787087fa29f701d29ff9b4495c8699

diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx
index 978dc2e198b6..a451e2a6c107 100644
--- a/formula/source/core/api/token.cxx
+++ b/formula/source/core/api/token.cxx
@@ -600,6 +600,13 @@ void FormulaTokenArray::DelRPN()
     nRPN = nIndex = 0;
 }
 
+FormulaToken* FormulaTokenArray::FirstToken() const
+{
+    if (!pCode || nLen == 0)
+        return nullptr;
+    return pCode[0];
+}
+
 FormulaToken* FormulaTokenArray::PeekPrev( sal_uInt16 & nIdx )
 {
     if (0 < nIdx && nIdx <= nLen)
@@ -647,6 +654,13 @@ FormulaToken* FormulaTokenArray::PeekPrevNoSpaces()
         return nullptr;
 }
 
+FormulaToken* FormulaTokenArray::FirstRPNToken() const
+{
+    if (!pRPN || nRPN == 0)
+        return nullptr;
+    return pRPN[0];
+}
+
 bool FormulaTokenArray::HasReferences() const
 {
     for (sal_uInt16 i = 0; i < nLen; ++i)
diff --git a/include/formula/tokenarray.hxx b/include/formula/tokenarray.hxx
index 575ead626286..109146c56b87 100644
--- a/include/formula/tokenarray.hxx
+++ b/include/formula/tokenarray.hxx
@@ -206,6 +206,7 @@ public:
     void Clear();
     void DelRPN();
     FormulaToken* First() { nIndex = 0; return Next(); }
+    FormulaToken* FirstToken() const;
     FormulaToken* Next();
     FormulaToken* NextNoSpaces();
     FormulaToken* GetNextName();
@@ -219,6 +220,7 @@ public:
     FormulaToken* PeekPrevNoSpaces();    /// Only after Reset/First/Next/Last/Prev!
     FormulaToken* PeekNextNoSpaces();    /// Only after Reset/First/Next/Last/Prev!
     FormulaToken* FirstRPN() { nIndex = 0; return NextRPN(); }
+    FormulaToken* FirstRPNToken() const;
     FormulaToken* NextRPN();
     FormulaToken* LastRPN() { nIndex = nRPN; return PrevRPN(); }
     FormulaToken* PrevRPN();


More information about the Libreoffice-commits mailing list