libdisplaydevice v2026.322.2407
C++ library to modify display devices.
display_device::PersistentState Class Reference

A simple wrapper around the SettingsPersistenceInterface and cached local state to keep them in sync. More...

#include <src/windows/include/display_device/windows/persistent_state.h>

Public Member Functions

const std::optional< SingleDisplayConfigState > & getState () const
 Get cached state.
 
 PersistentState (std::shared_ptr< SettingsPersistenceInterface > settings_persistence_api, bool throw_on_load_error=false)
 
bool persistState (const std::optional< SingleDisplayConfigState > &state)
 Store the new state via the interface and cache it.
 

Protected Attributes

std::shared_ptr< SettingsPersistenceInterfacem_settings_persistence_api
 

Detailed Description

A simple wrapper around the SettingsPersistenceInterface and cached local state to keep them in sync.

Constructor & Destructor Documentation

◆ PersistentState()

display_device::PersistentState::PersistentState ( std::shared_ptr< SettingsPersistenceInterface > settings_persistence_api,
bool throw_on_load_error = false )
explicit

Default constructor for the class.

Parameters
settings_persistence_api[Optional] A pointer to the Settings Persistence interface.
throw_on_load_errorSpecify whether to throw exception in constructor in case settings fail to load.

Member Function Documentation

◆ getState()

const std::optional< SingleDisplayConfigState > & display_device::PersistentState::getState ( ) const
nodiscard

Get cached state.

Returns
Cached state

◆ persistState()

bool display_device::PersistentState::persistState ( const std::optional< SingleDisplayConfigState > & state)
nodiscard

Store the new state via the interface and cache it.

Parameters
stateNew state to be set.
Returns
True if the state was succesfully updated, false otherwise.

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