LibreOffice Module sc (master)
1
|
Compressed array of row (or column) entries, e.g. More...
#include <compressedarray.hxx>
Classes | |
struct | DataEntry |
class | Iterator |
struct | RangeData |
Public Member Functions | |
ScCompressedArray (A nMaxAccess, const D &rValue) | |
Construct with nMaxAccess=MAXROW, for example. More... | |
virtual | ~ScCompressedArray () |
void | Reset (const D &rValue) |
void | SetValue (A nPos, const D &rValue) |
void | SetValue (A nStart, A nEnd, const D &rValue) |
const D & | GetValue (A nPos) const |
A | GetLastPos () const |
const D & | GetValue (A nPos, size_t &nIndex, A &nEnd) const |
Get value for a row, and it's region end row. More... | |
RangeData | GetRangeData (A nPos) const |
Get range data for a row, i.e. More... | |
const D & | GetNextValue (size_t &nIndex, A &nEnd) const |
Get next value and it's region end row. More... | |
const D & | Insert (A nStart, size_t nCount) |
Insert rows before nStart and copy value for inserted rows from nStart-1, return that value. More... | |
void | InsertPreservingSize (A nStart, size_t nCount, const D &rFillValue) |
void | Remove (A nStart, size_t nCount) |
void | RemovePreservingSize (A nStart, size_t nCount, const D &rFillValue) |
void | CopyFrom (const ScCompressedArray &rArray, A nStart, A nEnd) |
Copy rArray.nStart+nSourceDy to this.nStart. More... | |
void | CopyFrom (const ScCompressedArray &rArray, A nDestStart, A nDestEnd, A nSrcStart) |
SC_DLLPUBLIC size_t | Search (A nPos) const |
Obtain index into entries for nPos. More... | |
Iterator | begin () const |
Protected Attributes | |
size_t | nCount |
size_t | nLimit |
std::unique_ptr< DataEntry[]> | pData |
A | nMaxAccess |
Compressed array of row (or column) entries, e.g.
heights, flags, ...
The array stores ranges of values such that equal consecutive values occupy only one entry. Initially it consists of one DataEntry with an implied start row/column of 0 and an end row/column of access type maximum value.
typename A := access type, e.g. SCROW or SCCOL, must be a POD.
typename D := data type, e.g. sal_uInt16 or sal_uInt8 or whatever, may also be a struct or class.
D::operator==() and D::operator=() must be implemented. Force template instantiation for a specific type in source/core/data/compressedarray.cxx
TODO: Currently the allocated memory never shrinks, must manually invoke Resize() if needed.
Definition at line 45 of file compressedarray.hxx.
ScCompressedArray< A, D >::ScCompressedArray | ( | A | nMaxAccess, |
const D & | rValue | ||
) |
Construct with nMaxAccess=MAXROW, for example.
Definition at line 24 of file compressedarray.cxx.
References nCount, ScCompressedArray< A, D >::nMaxAccess, pData, and ScCompressedArray< A, D >::pData.
|
virtual |
Definition at line 35 of file compressedarray.cxx.
|
inline |
Definition at line 118 of file compressedarray.hxx.
|
inline |
Copy rArray.nStart+nSourceDy to this.nStart.
Definition at line 108 of file compressedarray.hxx.
Referenced by ScCompressedArray< SCROW, sal_uInt16 >::CopyFrom().
void ScCompressedArray< A, D >::CopyFrom | ( | const ScCompressedArray< A, D > & | rArray, |
A | nDestStart, | ||
A | nDestEnd, | ||
A | nSrcStart | ||
) |
Definition at line 195 of file compressedarray.cxx.
References A, assert(), D, ScCompressedArray< A, D >::GetNextValue(), ScCompressedArray< A, D >::GetValue(), nIndex, rValue, and SetValue.
|
inline |
Definition at line 83 of file compressedarray.hxx.
const D & ScCompressedArray< A, D >::GetNextValue | ( | size_t & | nIndex, |
A & | nEnd | ||
) | const |
Get next value and it's region end row.
If nIndex<nCount, nIndex is incremented first. If the resulting nIndex>=nCount, the value of the last entry is returned again.
Definition at line 172 of file compressedarray.hxx.
References D, nCount, and pData.
Referenced by ScCompressedArray< A, D >::CopyFrom(), and ScBitMaskCompressedArray< A, D >::CopyFromAnded().
ScCompressedArray< A, D >::RangeData ScCompressedArray< A, D >::GetRangeData | ( | A | nPos | ) | const |
Get range data for a row, i.e.
value and start and end rows with that value
Definition at line 161 of file compressedarray.hxx.
References aData, ScCompressedArray< A, D >::RangeData::maValue, ScCompressedArray< A, D >::RangeData::mnRow1, ScCompressedArray< A, D >::RangeData::mnRow2, nIndex, pData, and Search.
const D & ScCompressedArray< A, D >::GetValue | ( | A | nPos | ) | const |
Definition at line 146 of file compressedarray.hxx.
References D, nIndex, pData, and Search.
Referenced by ScCompressedArray< A, D >::CopyFrom(), ScBitMaskCompressedArray< A, D >::CopyFromAnded(), ScTable::dumpColumnRowSizes(), ScDocument::GetNextDifferentChangedRow(), and ScColumn::GetOptimalHeight().
const D & ScCompressedArray< A, D >::GetValue | ( | A | nPos, |
size_t & | nIndex, | ||
A & | nEnd | ||
) | const |
Get value for a row, and it's region end row.
Definition at line 153 of file compressedarray.hxx.
const D & ScCompressedArray< A, D >::Insert | ( | A | nStart, |
size_t | nCount | ||
) |
void ScCompressedArray< A, D >::Remove | ( | A | nStart, |
size_t | nCount | ||
) |
void ScCompressedArray< A, D >::RemovePreservingSize | ( | A | nStart, |
size_t | nCount, | ||
const D & | rFillValue | ||
) |
Definition at line 286 of file compressedarray.cxx.
void ScCompressedArray< A, D >::Reset | ( | const D & | rValue | ) |
Definition at line 128 of file compressedarray.hxx.
size_t ScCompressedArray< A, D >::Search | ( | A | nPos | ) | const |
Obtain index into entries for nPos.
Definition at line 40 of file compressedarray.cxx.
References i, nCount, and pData.
Referenced by ScBitMaskCompressedArray< A, D >::AndValue(), and ScBitMaskCompressedArray< A, D >::OrValue().
void ScCompressedArray< A, D >::SetValue | ( | A | nPos, |
const D & | rValue | ||
) |
Definition at line 140 of file compressedarray.hxx.
References SetValue.
Referenced by ScBitMaskCompressedArray< A, D >::AndValue(), ScBitMaskCompressedArray< A, D >::CopyFromAnded(), ScColumn::GetOptimalHeight(), and ScBitMaskCompressedArray< A, D >::OrValue().
|
protected |
Definition at line 121 of file compressedarray.hxx.
Referenced by ScBitMaskCompressedArray< A, D >::AndValue(), ScBitMaskCompressedArray< A, D >::GetLastAnyBitAccess(), ScCompressedArray< SCROW, sal_uInt16 >::GetLastPos(), and ScBitMaskCompressedArray< A, D >::OrValue().
|
protected |
Definition at line 122 of file compressedarray.hxx.
|
protected |
Definition at line 124 of file compressedarray.hxx.
Referenced by ScCompressedArray< A, D >::ScCompressedArray().
|
protected |
Definition at line 123 of file compressedarray.hxx.
Referenced by ScBitMaskCompressedArray< A, D >::AndValue(), ScBitMaskCompressedArray< A, D >::GetLastAnyBitAccess(), ScCompressedArray< SCROW, sal_uInt16 >::GetLastPos(), ScCompressedArray< A, D >::Iterator::operator*(), ScCompressedArray< A, D >::Iterator::operator++(), ScBitMaskCompressedArray< A, D >::OrValue(), and ScCompressedArray< A, D >::ScCompressedArray().