build fix: no comphelper/profilezone.hxx in this branch
[LibreOffice.git] / include / formula / vectortoken.hxx
blob61d4725916b35690d7a63e09f3c8405ede8761f0
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #ifndef INCLUDED_FORMULA_VECTORTOKEN_HXX
11 #define INCLUDED_FORMULA_VECTORTOKEN_HXX
13 #include <cstddef>
14 #include <vector>
16 #include <formula/formuladllapi.h>
17 #include <formula/token.hxx>
18 #include <rtl/ustring.hxx>
20 namespace formula {
22 /**
23 * Single unit of vector reference consists of two physical arrays.
25 * <p>If the whole data array consists of only numeric values, mpStringArray
26 * will be NULL, and NaN values in the numeric array represent empty
27 * cells.</p>
29 * <p>If the whole data array consists of only string values, mpNumericArray
30 * will be NULL, and NULL values in the string array represent empty
31 * cells.</p>
33 * <p>If the data array consists of numeric and string values, then both
34 * mpNumericArray and mpStringArray will be non-NULL, and a string cell will
35 * be represented by a non-NULL pointer value in the string array. If the
36 * string value is NULL, check the corresponding value in the numeric array.
37 * If the value in the numeric array is NaN, it's an empty cell, otherwise
38 * it's a numeric cell.</p>
40 struct FORMULA_DLLPUBLIC VectorRefArray
42 enum InitInvalid { Invalid };
44 const double* mpNumericArray;
45 rtl_uString** mpStringArray;
47 bool mbValid;
49 VectorRefArray();
50 VectorRefArray( InitInvalid );
51 VectorRefArray( const double* pArray );
52 VectorRefArray( rtl_uString** pArray );
53 VectorRefArray( const double* pNumArray, rtl_uString** pStrArray );
55 bool isValid() const;
58 /**
59 * This token represents a single cell reference in a vectorized formula
60 * calculation context.
62 class FORMULA_DLLPUBLIC SingleVectorRefToken : public FormulaToken
64 VectorRefArray maArray;
65 size_t mnRequestedLength;
66 size_t mnArrayLength;
68 public:
69 SingleVectorRefToken( const VectorRefArray& rArray, size_t nReqLength, size_t nArrayLength );
71 virtual FormulaToken* Clone() const override;
73 const VectorRefArray& GetArray() const;
74 size_t GetArrayLength() const;
77 /**
78 * This token represents a range reference in a vectorized formula
79 * calculation context.
81 class FORMULA_DLLPUBLIC DoubleVectorRefToken : public FormulaToken
83 std::vector<VectorRefArray> maArrays;
85 size_t mnRequestedLength; /// requested length of all arrays which include trailing empty region.
86 size_t mnArrayLength; /// length of all arrays which does not include trailing empty region.
87 size_t mnRefRowSize; /// original reference row size. The row size may
88 /// change as it goes down the array if either the
89 /// start or end position is fixed.
91 bool mbStartFixed:1; /// whether or not the start row position is absolute.
92 bool mbEndFixed:1; /// whether or not the end row position is absolute.
94 public:
95 DoubleVectorRefToken(
96 const std::vector<VectorRefArray>& rArrays, size_t nReqLength, size_t nArrayLength,
97 size_t nRefRowSize, bool bStartFixed, bool bEndFixed );
99 virtual FormulaToken* Clone() const override;
101 const std::vector<VectorRefArray>& GetArrays() const;
102 size_t GetArrayLength() const;
103 size_t GetRefRowSize() const;
104 bool IsStartFixed() const;
105 bool IsEndFixed() const;
110 #endif
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */