/* -*- 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 INCLUDED_FORMULA_VECTORTOKEN_HXX #define INCLUDED_FORMULA_VECTORTOKEN_HXX #include "formula/token.hxx" namespace formula { /** * Single unit of vector reference consists of two physical arrays. * *
If the whole data array consists of only numeric values, mpStringArray * will be NULL, and NaN values in the numeric array represent empty * cells.
* *If the whole data array consists of only string values, mpNumericArray * will be NULL, and NULL values in the string array represent empty * cells.
* *If the data array consists of numeric and string values, then both * mpNumericArray and mpStringArray will be non-NULL, and a string cell will * be represented by a non-NULL pointer value in the string array. If the * string value is NULL, check the corresponding value in the numeric array. * If the value in the numeric array is NaN, it's an empty cell, otherwise * it's a numeric cell.
*/ struct FORMULA_DLLPUBLIC VectorRefArray { const double* mpNumericArray; rtl_uString** mpStringArray; VectorRefArray(); VectorRefArray( const double* pArray ); VectorRefArray( rtl_uString** pArray ); VectorRefArray( const double* pNumArray, rtl_uString** pStrArray ); bool isValid() const; }; /** * This token represents a single cell reference in a vectorized formula * calculation context. */ class FORMULA_DLLPUBLIC SingleVectorRefToken : public FormulaToken { VectorRefArray maArray; size_t mnArrayLength; public: SingleVectorRefToken( const double* pArray, size_t nLength ); SingleVectorRefToken( const VectorRefArray& rArray, size_t nLength ); virtual FormulaToken* Clone() const; const VectorRefArray& GetArray() const; size_t GetArrayLength() const; }; /** * This token represents a range reference in a vectorized formula * calculation context. */ class FORMULA_DLLPUBLIC DoubleVectorRefToken : public FormulaToken { std::vector