TCode Library
A library to aid in decoding/using of Toy Code ("T-Code") data.
Loading...
Searching...
No Matches
Settings Class Reference

Wrapper for handling settings. More...

#include <SettingManagement.h>

Public Member Functions

bool init (const char *filepath)
 Initializes the Settings class and mounts the SPIFFS filesystem.
 
bool isMounted ()
 checks if the filesystem is mounted and filepath created
 
bool hasSetting (const char *setting)
 checks if the given setting is in the settings file
 
void reset ()
 
template<class T >
bool getSetting (const char *setting, T &settingValue)
 gets the value for a setting
 
template<class T >
bool setSetting (const char *setting, const T &settingValue)
 gets the value for a setting
 
bool getSystemUsage (SettingsUsage &out)
 gets the system usage of the Settings system
 

Detailed Description

Wrapper for handling settings.

an interface for saving settings with SPIFFS

Definition at line 29 of file SettingManagement.h.

Constructor & Destructor Documentation

◆ Settings()

Settings::Settings ( )
inline

Definition at line 79 of file SettingManagement.h.

Member Function Documentation

◆ getSetting()

template<class T >
bool Settings::getSetting ( const char *  setting,
T &  settingValue 
)
inline

gets the value for a setting

Parameters
settingC-String representation of the setting name being accessed
settingValuesetting being obtained (is a generic type and does allow for type casting)
Returns
true if setting is found

Definition at line 109 of file SettingManagement.h.

◆ getSystemUsage()

bool Settings::getSystemUsage ( SettingsUsage out)

gets the system usage of the Settings system

Parameters
outthe struct used to store the settings details
Returns
returns false if the filesystem is not mounted

Definition at line 95 of file SettingManagement.cpp.

◆ hasSetting()

bool Settings::hasSetting ( const char *  setting)

checks if the given setting is in the settings file

Parameters
settingC-String representation of the setting being accessed
Returns
true if setting is in the settings file

Definition at line 61 of file SettingManagement.cpp.

◆ init()

bool Settings::init ( const char *  filepath)

Initializes the Settings class and mounts the SPIFFS filesystem.

Parameters
filepathFilepath in the SPIFFS filesystem to the relevent Settings Storage

Definition at line 10 of file SettingManagement.cpp.

◆ isMounted()

bool Settings::isMounted ( )

checks if the filesystem is mounted and filepath created

Returns
true if filesystem is mounted and filepath found

Definition at line 56 of file SettingManagement.cpp.

◆ reset()

void Settings::reset ( )

Overwrites the stored settings with the values specified by the createConfigFile function

Definition at line 88 of file SettingManagement.cpp.

◆ setSetting()

template<class T >
bool Settings::setSetting ( const char *  setting,
const T &  settingValue 
)
inline

gets the value for a setting

Parameters
settingC-String representation of the setting name being accessed
settingValuesetting being stored (is a generic type and does allow for type casting)
Returns
true if setting is set

Definition at line 166 of file SettingManagement.h.


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