LibreOffice Module sc (master) 1
|
Lookup cache for one range used with interpreter functions such as VLOOKUP and MATCH. More...
#include <lookupcache.hxx>
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 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 ScRange & | getRange () const |
ScLookupCacheMap & | getCacheMap () 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 |
Private Member Functions | |
ScLookupCache (const ScLookupCache &)=delete | |
ScLookupCache & | operator= (const ScLookupCache &)=delete |
Private Attributes | |
std::unordered_map< QueryKey, QueryCriteriaAndResult, QueryKey::Hash > | maQueryMap |
ScRange | maRange |
ScDocument * | mpDoc |
ScLookupCacheMap & | mCacheMap |
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 39 of file lookupcache.hxx.
Enumerator | |
---|---|
UNKNOWN | |
EQUAL | |
LESS_EQUAL | |
GREATER_EQUAL |
Definition at line 51 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 43 of file lookupcache.hxx.
|
inline |
MUST be new'd because Notify() deletes.
Definition at line 113 of file lookupcache.hxx.
|
privatedelete |
|
inline |
Definition at line 138 of file lookupcache.hxx.
References mCacheMap.
Referenced by ScDocument::RemoveLookupCache().
|
inline |
Definition at line 136 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.
bAvailable | Pass sal_False if the search didn't deliver a result. A subsequent lookup() then will return Result::NOT_AVAILABLE. |
Definition at line 101 of file lookupcache.cxx.
References ScLookupCache::QueryCriteria::getQueryOp(), ScLookupCache::QueryCriteriaAndResult::maAddress, maQueryMap, and ScAddress::SetRow().
Referenced by ScInterpreter::LookupQueryWithCache().
SCROW ScLookupCache::lookup | ( | const QueryCriteria & | rCriteria | ) | const |
Definition at line 87 of file lookupcache.cxx.
References maQueryMap.
ScLookupCache::Result ScLookupCache::lookup | ( | ScAddress & | o_rResultAddress, |
const QueryCriteria & | rCriteria, | ||
const ScAddress & | rQueryAddress | ||
) | const |
Definition at line 71 of file lookupcache.cxx.
References CRITERIA_DIFFERENT, FOUND, ScLookupCache::QueryCriteria::getQueryOp(), ScLookupCache::QueryCriteriaAndResult::maAddress, ScLookupCache::QueryCriteriaAndResult::maCriteria, maQueryMap, NOT_AVAILABLE, NOT_CACHED, and ScAddress::Row().
Referenced by lcl_getPrevRowWithEmptyValueLookup(), and ScInterpreter::LookupQueryWithCache().
|
overridevirtual |
Remove from document structure and delete (!) cache on modify hint.
Reimplemented from SvtListener.
Definition at line 115 of file lookupcache.cxx.
References SfxHint::GetId(), ScDocument::IsInDtorClear(), mpDoc, and ScDocument::RemoveLookupCache().
|
privatedelete |
|
private |
Definition at line 192 of file lookupcache.hxx.
|
private |
Definition at line 193 of file lookupcache.hxx.
Referenced by getRange().
|
private |
Definition at line 195 of file lookupcache.hxx.
Referenced by getCacheMap().
|
private |
Definition at line 194 of file lookupcache.hxx.
Referenced by Notify().