libdisplaydevice master
C++ library to modify display devices.
display_device::MacPersistentState Class Reference

A wrapper around SettingsPersistenceInterface and cached macOS state. More...

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

Public Member Functions

const std::shared_ptr< SettingsPersistenceInterface > & getSettingsPersistenceApi () const
 Get the settings persistence API.
 
const std::optional< MacSingleDisplayConfigState > & getState () const
 Get cached state.
 
 MacPersistentState (std::shared_ptr< SettingsPersistenceInterface > settings_persistence_api, bool throw_on_load_error=false)
 Default constructor for the class.
 
bool persistState (const std::optional< MacSingleDisplayConfigState > &state)
 Store the new state via the interface and cache it.
 

Detailed Description

A wrapper around SettingsPersistenceInterface and cached macOS state.

Constructor & Destructor Documentation

◆ MacPersistentState()

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

Default constructor for the class.

Parameters
settings_persistence_apiOptional settings persistence interface.
throw_on_load_errorSpecify whether to throw in constructor if settings fail to load.

Member Function Documentation

◆ getSettingsPersistenceApi()

const std::shared_ptr< SettingsPersistenceInterface > & display_device::MacPersistentState::getSettingsPersistenceApi ( ) const
nodiscard

Get the settings persistence API.

Returns
Settings persistence API.

◆ getState()

const std::optional< MacSingleDisplayConfigState > & display_device::MacPersistentState::getState ( ) const
nodiscard

Get cached state.

Returns
Cached state.

◆ persistState()

bool display_device::MacPersistentState::persistState ( const std::optional< MacSingleDisplayConfigState > & state)
nodiscard

Store the new state via the interface and cache it.

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

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