coastline 0.0.4
Loading...
Searching...
No Matches
coastline::ConfigSaver Class Reference

Writes copies of the configuration on a thread, away from the frames. More...

#include <configsaver.h>

Public Member Functions

 ConfigSaver ()
 ~ConfigSaver ()
 Write the copy that waits, if any, and stop the thread.
 ConfigSaver (const ConfigSaver &)=delete
 Prevent copying the writing thread.
ConfigSaver & operator= (const ConfigSaver &)=delete
 Prevent assignment of the writing thread.
void Save (GameConfig config, std::filesystem::path path)
 Queue a copy of the configuration for writing.
bool Flush ()
 Wait until every queued copy is written.
bool Failed ()

Detailed Description

Writes copies of the configuration on a thread, away from the frames.

A copy saved while another waits replaces it, and the copies are written in the order they are saved.

Constructor & Destructor Documentation

◆ ConfigSaver() [1/2]

coastline::ConfigSaver::ConfigSaver ( )

◆ ~ConfigSaver()

coastline::ConfigSaver::~ConfigSaver ( )

Write the copy that waits, if any, and stop the thread.

◆ ConfigSaver() [2/2]

coastline::ConfigSaver::ConfigSaver ( const ConfigSaver & )
delete

Prevent copying the writing thread.

Member Function Documentation

◆ operator=()

ConfigSaver & coastline::ConfigSaver::operator= ( const ConfigSaver & )
delete

Prevent assignment of the writing thread.

◆ Save()

void coastline::ConfigSaver::Save ( GameConfig config,
std::filesystem::path path )

Queue a copy of the configuration for writing.

Parameters
configThe configuration to write.
pathThe INI file.

◆ Flush()

bool coastline::ConfigSaver::Flush ( )

Wait until every queued copy is written.

Returns
Whether the last write succeeded, or true when nothing was written.

◆ Failed()

bool coastline::ConfigSaver::Failed ( )
Returns
Whether the last finished write failed, without waiting.

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