game_launcher 1.1.0
Modern Linux game launcher with Steam / Proton / Wine integration
Loading...
Searching...
No Matches
core::ImageService Class Reference

Singleton accessor for the image service. More...

#include <image_service.h>

Static Public Member Functions

static bool hasInstance ()
 Check if an image service has been set.
static std::shared_ptr< IImageService > instance ()
 Get the image service instance.
static void setInstance (std::shared_ptr< IImageService > service)
 Set the image service implementation.

Detailed Description

Singleton accessor for the image service.

Usage:

  1. UI layer creates concrete implementation at startup
  2. UI layer calls ImageService::setInstance(implementation)
  3. Business logic calls ImageService::instance()->loadImage(...)

Definition at line 92 of file image_service.h.

Member Function Documentation

◆ hasInstance()

bool core::ImageService::hasInstance ( )
static

Check if an image service has been set.

Returns
true if service is available

Definition at line 44 of file image_service.cpp.

◆ instance()

std::shared_ptr< IImageService > core::ImageService::instance ( )
static

Get the image service instance.

Returns
shared_ptr to the image service, empty if not set.

Returns a shared_ptr (rather than a raw pointer) so the caller's copy keeps the underlying service alive for the duration of their call — even if another thread races setInstance(nullptr) at QApplication shutdown. Caller pattern: auto svc = ImageService::instance(); if (svc) svc->loadImage(...);

Definition at line 35 of file image_service.cpp.

◆ setInstance()

void core::ImageService::setInstance ( std::shared_ptr< IImageService > service)
static

Set the image service implementation.

Parameters
serviceShared pointer to the implementation

Must be called by UI layer before any image operations.

Definition at line 29 of file image_service.cpp.

Referenced by main().


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