LibreOffice Module sc (master) 1
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
ScSortedRangeCache Class Referencefinal

Sorted cache for one range used with interpreter functions such as VLOOKUP and MATCH. More...

#include <rangecache.hxx>

Inheritance diagram for ScSortedRangeCache:
[legend]
Collaboration diagram for ScSortedRangeCache:
[legend]

Classes

struct  Hash
 
struct  HashKey
 

Public Types

enum class  ValueType {
  Values ,
  StringsCaseSensitive ,
  StringsCaseInsensitive
}
 

Public Member Functions

 ScSortedRangeCache (ScDocument *pDoc, const ScRange &rRange, const ScQueryParam &param, ScInterpreterContext *context, bool invalid=false)
 MUST be new'd because Notify() deletes. More...
 
bool isValid () const
 Returns if the cache is usable. More...
 
virtual void Notify (const SfxHint &rHint) override
 Remove from document structure and delete (!) cache on modify hint. More...
 
const ScRangegetRange () const
 
HashKey getHashKey () const
 
const std::vector< SCROW > & sortedRows () const
 
size_t size () const
 
size_t indexForRow (SCROW row) const
 
SCROW rowForIndex (size_t index) const
 
- Public Member Functions inherited from SvtListener
 SvtListener ()=default
 
 SvtListener (const SvtListener &r)=default
 
virtual ~SvtListener () COVERITY_NOEXCEPT_FALSE
 
bool StartListening (SvtBroadcaster &rBroadcaster)
 
void EndListening (SvtBroadcaster &rBroadcaster)
 
void EndListeningAll ()
 
void CopyAllBroadcasters (const SvtListener &r)
 
bool HasBroadcaster () const
 
virtual void Notify (const SfxHint &rHint)
 
virtual void Query (QueryBase &rQuery) const
 

Static Public Member Functions

static HashKey makeHashKey (const ScRange &range, const ScQueryParam &param)
 

Private Member Functions

 ScSortedRangeCache (const ScSortedRangeCache &)=delete
 
ScSortedRangeCacheoperator= (const ScSortedRangeCache &)=delete
 

Private Attributes

std::vector< SCROWmSortedRows
 
std::vector< size_t > mRowToIndex
 
ScRange maRange
 
ScDocumentmpDoc
 
bool mValid
 
ValueType mValueType
 
ScQueryOp mQueryOp
 
ScQueryEntry::QueryType mQueryType
 

Detailed Description

Sorted cache for one range used with interpreter functions such as VLOOKUP and MATCH.

Caches sorted order for cells in the given range, which must be one column. This allows faster lookups when cells are not sorted.

The class has a vector of SCROW items, which is sorted according to values of those cells. Therefore e.g. binary search of those cells can be done by doing binary search of the vector while mapping the indexes to rows.

Definition at line 44 of file rangecache.hxx.

Member Enumeration Documentation

◆ ValueType

enum class ScSortedRangeCache::ValueType
strong
Enumerator
Values 
StringsCaseSensitive 
StringsCaseInsensitive 

Definition at line 59 of file rangecache.hxx.

Constructor & Destructor Documentation

◆ ScSortedRangeCache() [1/2]

ScSortedRangeCache::ScSortedRangeCache ( ScDocument pDoc,
const ScRange rRange,
const ScQueryParam param,
ScInterpreterContext context,
bool  invalid = false 
)

◆ ScSortedRangeCache() [2/2]

ScSortedRangeCache::ScSortedRangeCache ( const ScSortedRangeCache )
privatedelete

Member Function Documentation

◆ getHashKey()

HashKey ScSortedRangeCache::getHashKey ( ) const
inline

Definition at line 77 of file rangecache.hxx.

References maRange, mQueryOp, mQueryType, and mValueType.

Referenced by ScDocument::RemoveSortedRangeCache().

◆ getRange()

const ScRange & ScSortedRangeCache::getRange ( ) const
inline

Definition at line 57 of file rangecache.hxx.

References maRange.

◆ indexForRow()

size_t ScSortedRangeCache::indexForRow ( SCROW  row) const
inline

◆ isValid()

bool ScSortedRangeCache::isValid ( ) const
inline

Returns if the cache is usable.

Definition at line 52 of file rangecache.hxx.

References mValid.

Referenced by CanBeUsedForSorterCache().

◆ makeHashKey()

ScSortedRangeCache::HashKey ScSortedRangeCache::makeHashKey ( const ScRange range,
const ScQueryParam param 
)
static

◆ Notify()

void ScSortedRangeCache::Notify ( const SfxHint rHint)
overridevirtual

Remove from document structure and delete (!) cache on modify hint.

Reimplemented from SvtListener.

Definition at line 176 of file rangecache.cxx.

References SfxHint::GetId(), ScDocument::IsInDtorClear(), mpDoc, and ScDocument::RemoveSortedRangeCache().

◆ operator=()

ScSortedRangeCache & ScSortedRangeCache::operator= ( const ScSortedRangeCache )
privatedelete

◆ rowForIndex()

SCROW ScSortedRangeCache::rowForIndex ( size_t  index) const
inline

Definition at line 101 of file rangecache.hxx.

References index, and mSortedRows.

◆ size()

size_t ScSortedRangeCache::size ( ) const
inline

Definition at line 94 of file rangecache.hxx.

References mSortedRows.

◆ sortedRows()

const std::vector< SCROW > & ScSortedRangeCache::sortedRows ( ) const
inline

Definition at line 93 of file rangecache.hxx.

References mSortedRows.

Member Data Documentation

◆ maRange

ScRange ScSortedRangeCache::maRange
private

Definition at line 107 of file rangecache.hxx.

Referenced by getHashKey(), getRange(), indexForRow(), and ScSortedRangeCache().

◆ mpDoc

ScDocument* ScSortedRangeCache::mpDoc
private

Definition at line 108 of file rangecache.hxx.

Referenced by Notify().

◆ mQueryOp

ScQueryOp ScSortedRangeCache::mQueryOp
private

Definition at line 111 of file rangecache.hxx.

Referenced by getHashKey(), and ScSortedRangeCache().

◆ mQueryType

ScQueryEntry::QueryType ScSortedRangeCache::mQueryType
private

Definition at line 112 of file rangecache.hxx.

Referenced by getHashKey(), and ScSortedRangeCache().

◆ mRowToIndex

std::vector<size_t> ScSortedRangeCache::mRowToIndex
private

Definition at line 106 of file rangecache.hxx.

Referenced by indexForRow(), and ScSortedRangeCache().

◆ mSortedRows

std::vector<SCROW> ScSortedRangeCache::mSortedRows
private

Definition at line 105 of file rangecache.hxx.

Referenced by indexForRow(), rowForIndex(), ScSortedRangeCache(), size(), and sortedRows().

◆ mValid

bool ScSortedRangeCache::mValid
private

Definition at line 109 of file rangecache.hxx.

Referenced by isValid(), and ScSortedRangeCache().

◆ mValueType

ValueType ScSortedRangeCache::mValueType
private

Definition at line 110 of file rangecache.hxx.

Referenced by getHashKey(), and ScSortedRangeCache().


The documentation for this class was generated from the following files: