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... | |
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.
Definition at line 116 of file compressedarray.hxx.
void ScCompressedArray< A, D >::CopyFrom | ( | const ScCompressedArray< A, D > & | rArray, |
A | nDestStart, | ||
A | nDestEnd, | ||
A | nSrcStart | ||
) |
Definition at line 190 of file compressedarray.cxx.
References A, D, ScCompressedArray< A, D >::GetNextValue(), ScCompressedArray< A, D >::GetValue(), nIndex, and SetValue().
|
inline |
Copy rArray.nStart+nSourceDy to this.nStart.
Definition at line 106 of file compressedarray.hxx.
References ScCompressedArray< A, D >::CopyFrom().
Referenced by ScCompressedArray< A, D >::CopyFrom().
Definition at line 81 of file compressedarray.hxx.
References A, ScCompressedArray< A, D >::nCount, and ScCompressedArray< A, D >::pData.
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 170 of file compressedarray.hxx.
References D, nCount, nIndex, and pData.
Referenced by ScCompressedArray< A, D >::CopyFrom(), and ScBitMaskCompressedArray< A, D >::CopyFromAnded().
ScCompressedArray< A, D >::RangeData ScCompressedArray< A, D >::GetRangeData | ( | A | nPos | ) | const |
Definition at line 144 of file compressedarray.hxx.
References D, nIndex, nPos, pData, and Search.
Referenced by ScCompressedArray< A, D >::CopyFrom(), ScBitMaskCompressedArray< A, D >::CopyFromAnded(), ScDocument::GetNextDifferentChangedRowFlagsWidth(), and ScColumn::GetOptimalHeight().
const D & ScCompressedArray< A, D >::Insert | ( | A | nStart, |
size_t | nCount | ||
) |
void ScCompressedArray< A, D >::InsertPreservingSize | ( | A | nStart, |
size_t | nCount, | ||
const D & | rFillValue | ||
) |
Definition at line 232 of file compressedarray.cxx.
References A, i, Insert(), Remove, and SetValue().
void ScCompressedArray< A, D >::Remove | ( | A | nStart, |
size_t | nCount | ||
) |
Definition at line 245 of file compressedarray.cxx.
References A, nCount, nIndex, pData, Search, and SetValue().
void ScCompressedArray< A, D >::RemovePreservingSize | ( | A | nStart, |
size_t | nCount, | ||
const D & | rFillValue | ||
) |
Definition at line 281 of file compressedarray.cxx.
Definition at line 126 of file compressedarray.hxx.
Obtain index into entries for nPos.
Definition at line 35 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 138 of file compressedarray.hxx.
References nPos, and SetValue().
Referenced by ScBitMaskCompressedArray< A, D >::AndValue(), ScBitMaskCompressedArray< A, D >::CopyFromAnded(), ScColumn::GetOptimalHeight(), and ScBitMaskCompressedArray< A, D >::OrValue().
Definition at line 65 of file compressedarray.cxx.
References Reset.
|
protected |
Definition at line 119 of file compressedarray.hxx.
Referenced by ScBitMaskCompressedArray< A, D >::AndValue(), ScBitMaskCompressedArray< A, D >::GetLastAnyBitAccess(), ScCompressedArray< A, D >::GetLastPos(), and ScBitMaskCompressedArray< A, D >::OrValue().
|
protected |
Definition at line 120 of file compressedarray.hxx.
Definition at line 122 of file compressedarray.hxx.
Referenced by ScCompressedArray< A, D >::ScCompressedArray().
|
protected |
Definition at line 121 of file compressedarray.hxx.
Referenced by ScBitMaskCompressedArray< A, D >::AndValue(), ScBitMaskCompressedArray< A, D >::GetLastAnyBitAccess(), ScCompressedArray< A, D >::GetLastPos(), ScCompressedArray< A, D >::Iterator::operator*(), ScCompressedArray< A, D >::Iterator::operator++(), ScBitMaskCompressedArray< A, D >::OrValue(), and ScCompressedArray< A, D >::ScCompressedArray().