ORE Studio 0.0.4
Loading...
Searching...
No Matches
Signals | Public Member Functions | List of all members
BadgeCache Class Referencefinal

Client-side cache of badge definitions and mappings. More...

#include <BadgeCache.hpp>

Inherits QObject.

Collaboration diagram for BadgeCache:
Collaboration graph

Signals

void loaded ()
 Emitted when both definitions and mappings are loaded.
 
void loadError (const QString &error_message)
 Emitted when an error occurs during loading.
 

Public Member Functions

 BadgeCache (ClientManager *clientManager, QObject *parent=nullptr)
 
void loadAll ()
 Load badge definitions and mappings from the server.
 
bool isLoaded () const
 Returns true once both definitions and mappings are loaded.
 
const dq::domain::badge_definitionresolve (const std::string &code_domain_code, const std::string &entity_code) const
 Resolve a badge definition for a given (code_domain, entity_code) pair.
 

Detailed Description

Client-side cache of badge definitions and mappings.

Loaded at startup after login. Provides fast synchronous lookup of a badge definition for any (code_domain_code, entity_code) pair.

Typical usage:

  1. Create once in MainWindow, call loadAll() after loggedIn signal.
  2. Pass to any widget that needs to render badges.
  3. Call resolve() at render time — always returns immediately.

Member Function Documentation

◆ loadAll()

void loadAll ( )

Load badge definitions and mappings from the server.

Should be called after successful login. Safe to call multiple times; a load already in progress is a no-op.

◆ resolve()

const dq::domain::badge_definition * resolve ( const std::string &  code_domain_code,
const std::string &  entity_code 
) const

Resolve a badge definition for a given (code_domain, entity_code) pair.

Parameters
code_domain_codeThe code domain (e.g., "party_status").
entity_codeThe entity value (e.g., "ACTIVE").
Returns
Pointer to the badge_definition if a mapping exists, nullptr otherwise.

Always returns immediately without blocking. Returns nullptr if the cache is not yet loaded or no mapping exists for the given pair.