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

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

#include <lookupcache.hxx>

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

Classes

struct  Hash
 
class  QueryCriteria
 
struct  QueryCriteriaAndResult
 
struct  QueryKey
 

Public Types

enum  Result {
  NOT_CACHED,
  CRITERIA_DIFFERENT,
  NOT_AVAILABLE,
  FOUND
}
 
enum  QueryOp {
  UNKNOWN,
  EQUAL,
  LESS_EQUAL,
  GREATER_EQUAL
}
 

Public Member Functions

 ScLookupCache (ScDocument *pDoc, const ScRange &rRange, ScLookupCacheMap &cacheMap)
 MUST be new'd because Notify() deletes. More...
 
virtual ~ScLookupCache () override
 
virtual void Notify (const SfxHint &rHint) override
 Remove from document structure and delete (!) cache on modify hint. More...
 
Result lookup (ScAddress &o_rResultAddress, const QueryCriteria &rCriteria, const ScAddress &rQueryAddress) const
 
SCROW lookup (const QueryCriteria &rCriteria) const
 
bool insert (const ScAddress &rResultAddress, const QueryCriteria &rCriteria, const ScAddress &rQueryAddress, const bool bAvailable)
 Insert query and result. More...
 
const ScRangegetRange () const
 
ScLookupCacheMapgetCacheMap () const
 
- Public Member Functions inherited from SvtListener
 SvtListener ()
 
 SvtListener (const SvtListener &r)
 
virtual ~SvtListener () COVERITY_NOEXCEPT_FALSE
 
bool StartListening (SvtBroadcaster &rBroadcaster)
 
bool EndListening (SvtBroadcaster &rBroadcaster)
 
void EndListeningAll ()
 
void CopyAllBroadcasters (const SvtListener &r)
 
bool HasBroadcaster () const
 
virtual void Query (QueryBase &rQuery) const
 

Private Member Functions

 ScLookupCache (const ScLookupCache &)=delete
 
ScLookupCacheoperator= (const ScLookupCache &)=delete
 

Private Attributes

std::unordered_map< QueryKey, QueryCriteriaAndResult, QueryKey::HashmaQueryMap
 
ScRange maRange
 
ScDocumentmpDoc
 
ScLookupCacheMapmCacheMap
 

Detailed Description

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

Caches query for a specific row and the resulting address looked up, in case other lookups of the same query in the same row are to be performed, which usually occur to obtain a different offset column of the same query.

Definition at line 40 of file lookupcache.hxx.

Member Enumeration Documentation

Enumerator
UNKNOWN 
EQUAL 
LESS_EQUAL 
GREATER_EQUAL 

Definition at line 52 of file lookupcache.hxx.

Enumerator
NOT_CACHED 
CRITERIA_DIFFERENT 

Query not found in cache.

NOT_AVAILABLE 

Different criteria for same query position exists.

FOUND 

Criteria not available in lookup range.

Criteria found.

Definition at line 44 of file lookupcache.hxx.

Constructor & Destructor Documentation

ScLookupCache::ScLookupCache ( ScDocument pDoc,
const ScRange rRange,
ScLookupCacheMap cacheMap 
)

MUST be new'd because Notify() deletes.

Definition at line 71 of file lookupcache.cxx.

ScLookupCache::~ScLookupCache ( )
overridevirtual

Definition at line 78 of file lookupcache.cxx.

ScLookupCache::ScLookupCache ( const ScLookupCache )
privatedelete

Member Function Documentation

ScLookupCacheMap& ScLookupCache::getCacheMap ( ) const
inline

Definition at line 139 of file lookupcache.hxx.

References mCacheMap.

Referenced by ScDocument::RemoveLookupCache().

const ScRange& ScLookupCache::getRange ( ) const
inline

Definition at line 137 of file lookupcache.hxx.

References maRange.

Referenced by ScDocument::RemoveLookupCache().

bool ScLookupCache::insert ( const ScAddress rResultAddress,
const QueryCriteria rCriteria,
const ScAddress rQueryAddress,
const bool  bAvailable 
)

Insert query and result.

Parameters
bAvailablePass sal_False if the search didn't deliver a result. A subsequent lookup() then will return Result::NOT_AVAILABLE.
Returns
successful insertion.

Definition at line 112 of file lookupcache.cxx.

References ScLookupCache::QueryCriteria::getQueryOp(), and maQueryMap.

Referenced by ScInterpreter::LookupQueryWithCache().

ScLookupCache::Result ScLookupCache::lookup ( ScAddress o_rResultAddress,
const QueryCriteria rCriteria,
const ScAddress rQueryAddress 
) const
SCROW ScLookupCache::lookup ( const QueryCriteria rCriteria) const

Definition at line 98 of file lookupcache.cxx.

References maQueryMap.

void ScLookupCache::Notify ( const SfxHint rHint)
overridevirtual

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

Reimplemented from SvtListener.

Definition at line 126 of file lookupcache.cxx.

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

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

Member Data Documentation

std::unordered_map< QueryKey, QueryCriteriaAndResult, QueryKey::Hash > ScLookupCache::maQueryMap
private

Definition at line 193 of file lookupcache.hxx.

Referenced by insert(), and lookup().

ScRange ScLookupCache::maRange
private

Definition at line 194 of file lookupcache.hxx.

Referenced by getRange().

ScLookupCacheMap& ScLookupCache::mCacheMap
private

Definition at line 196 of file lookupcache.hxx.

Referenced by getCacheMap().

ScDocument* ScLookupCache::mpDoc
private

Definition at line 195 of file lookupcache.hxx.

Referenced by Notify().


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