Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
PhosphorLayer::ISurfaceStore Class Referenceabstract

Key-value JSON store for surface-related persistence. More...

#include <phosphor-layer/include/PhosphorLayer/ISurfaceStore.h>

Inheritance diagram for PhosphorLayer::ISurfaceStore:
[legend]

Public Member Functions

 ISurfaceStore ()=default
 
virtual ~ISurfaceStore ()=default
 
virtual bool save (const QString &key, const QJsonObject &data)=0
 Persist data under key.
 
virtual QJsonObject load (const QString &key) const =0
 Load the JSON object previously stored under key.
 
virtual bool has (const QString &key) const =0
 True if key exists in the store.
 
virtual void remove (const QString &key)=0
 Remove the entry for key (no-op if absent).
 

Detailed Description

Key-value JSON store for surface-related persistence.

Layer-shell surfaces have no per-instance runtime state that the compositor doesn't already manage (position comes from anchors/margins, size from configure events). What consumers DO want to persist is application state: "which surfaces were visible", "which shader preset was last selected in the modal dialog", etc.

This interface is deliberately thin — a glorified QJsonObject bag keyed by string. The library does not automatically persist anything through it; consumers decide what to save and when.

Implementations:

  • JsonSurfaceStore — file-backed, atomic write via QSaveFile
  • consumer-written: wrap KConfig, QSettings, a database, …

Constructor & Destructor Documentation

◆ ISurfaceStore()

PhosphorLayer::ISurfaceStore::ISurfaceStore ( )
default

◆ ~ISurfaceStore()

virtual PhosphorLayer::ISurfaceStore::~ISurfaceStore ( )
virtualdefault

Member Function Documentation

◆ has()

virtual bool PhosphorLayer::ISurfaceStore::has ( const QString &  key) const
pure virtual

True if key exists in the store.

Implemented in PhosphorLayer::JsonSurfaceStore.

◆ load()

virtual QJsonObject PhosphorLayer::ISurfaceStore::load ( const QString &  key) const
pure virtual

Load the JSON object previously stored under key.

Returns an empty object if the key does not exist or the stored data cannot be parsed.

Implemented in PhosphorLayer::JsonSurfaceStore.

◆ remove()

virtual void PhosphorLayer::ISurfaceStore::remove ( const QString &  key)
pure virtual

Remove the entry for key (no-op if absent).

Implemented in PhosphorLayer::JsonSurfaceStore.

◆ save()

virtual bool PhosphorLayer::ISurfaceStore::save ( const QString &  key,
const QJsonObject &  data 
)
pure virtual

Persist data under key.

Overwrites any existing entry. Returns false on I/O failure (the implementation logs the reason).

Implemented in PhosphorLayer::JsonSurfaceStore.


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