[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - formula/Library_for.mk formula/source include/formula

Kohei Yoshida kohei.yoshida at gmail.com
Mon Apr 29 08:17:03 PDT 2013


 formula/Library_for.mk                  |    1 
 formula/source/core/api/vectortoken.cxx |   37 +++++++++++++++++++
 include/formula/token.hxx               |    2 +
 include/formula/vectortoken.hxx         |   60 ++++++++++++++++++++++++++++++++
 4 files changed, 100 insertions(+)

New commits:
commit 445dfb5419fd794309326d62a988718ad91a41ee
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Mon Apr 29 11:18:54 2013 -0400

    Initial cut on vector formula ref tokens. Not used yet.
    
    Change-Id: I4b28c269759bc01bfc94cfdd6a1c651d03d829c7

diff --git a/formula/Library_for.mk b/formula/Library_for.mk
index 52e157f..832d7cd 100644
--- a/formula/Library_for.mk
+++ b/formula/Library_for.mk
@@ -43,6 +43,7 @@ $(eval $(call gb_Library_add_exception_objects,for,\
     formula/source/core/api/FormulaOpCodeMapperObj \
     formula/source/core/api/services \
     formula/source/core/api/token \
+    formula/source/core/api/vectortoken \
     formula/source/core/resource/core_resource \
 ))
 
diff --git a/formula/source/core/api/vectortoken.cxx b/formula/source/core/api/vectortoken.cxx
new file mode 100644
index 0000000..b7cab77
--- /dev/null
+++ b/formula/source/core/api/vectortoken.cxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "formula/vectortoken.hxx"
+
+namespace formula {
+
+VectorArray::VectorArray( const double* pArray, size_t nLength ) :
+    mpArray(pArray), mnLength(nLength) {}
+
+SingleVectorRefToken::SingleVectorRefToken( const double* pArray, size_t nLength ) :
+    FormulaToken(svSingleVectorRef, ocPush), maArray(pArray, nLength) {}
+
+const VectorArray& SingleVectorRefToken::GetArray() const
+{
+    return maArray;
+}
+
+DoubleVectorRefToken::DoubleVectorRefToken(
+    const std::vector<VectorArray>& rArrays, size_t nColSize, size_t nRowSize, bool bAbsStart, bool bAbsEnd ) :
+    FormulaToken(svDoubleVectorRef, ocPush),
+    maArrays(rArrays), mnColSize(nColSize), mnRowSize(nRowSize), mbAbsStart(bAbsStart), mbAbsEnd(bAbsEnd) {}
+
+const std::vector<VectorArray>& DoubleVectorRefToken::GetArrays() const
+{
+    return maArrays;
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/token.hxx b/include/formula/token.hxx
index 82bdf7f..c7fa0cd 100644
--- a/include/formula/token.hxx
+++ b/include/formula/token.hxx
@@ -63,6 +63,8 @@ enum StackVarEnum
     svExternalSingleRef,
     svExternalDoubleRef,
     svExternalName,
+    svSingleVectorRef,
+    svDoubleVectorRef,
     svSubroutine,                       // A token with a subroutine token array.
     svError,                            // error token
     svMissing = 0x70,                   // 0 or ""
diff --git a/include/formula/vectortoken.hxx b/include/formula/vectortoken.hxx
new file mode 100644
index 0000000..5af2690
--- /dev/null
+++ b/include/formula/vectortoken.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef FORMULA_VECTORTOKEN_HXX
+#define FORMULA_VECTORTOKEN_HXX
+
+#include "formula/token.hxx"
+
+namespace formula {
+
+struct VectorArray
+{
+    const double* mpArray;
+    size_t mnLength;
+
+    VectorArray( const double* pArray, size_t nLength );
+};
+
+class FORMULA_DLLPUBLIC SingleVectorRefToken : public FormulaToken
+{
+    const VectorArray maArray;
+public:
+    SingleVectorRefToken( const double* pArray, size_t nLength );
+
+    const VectorArray& GetArray() const;
+};
+
+/**
+ * This token describes a range reference in a vectorized formula
+ * calculation context.
+ */
+class FORMULA_DLLPUBLIC DoubleVectorRefToken : public FormulaToken
+{
+    std::vector<VectorArray> maArrays;
+
+    size_t mnColSize;
+    size_t mnRowSize;
+
+    bool mbAbsStart:1; /// whether or not the start row position is absolute.
+    bool mbAbsEnd:1; /// whether or not the end row position is absolute.
+
+public:
+    DoubleVectorRefToken(
+        const std::vector<VectorArray>& rArrays, size_t nColSize, size_t nRowSize,
+        bool bAbsStart, bool bAbsEnd );
+
+    const std::vector<VectorArray>& GetArrays() const;
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list