Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
CSettingsMigration Class Reference

#include <SettingsMigration.h>

Classes

struct  SettingBoolToIntMapping
 

Public Types

enum class  SettingConversionResult { FAILURE , NOT_PRESENT , INVALID , CONVERTED }
 
using StepList = std::vector<std::shared_ptr<ISettingsMigrationStep>>
 

Public Member Functions

 CSettingsMigration ()
 
 CSettingsMigration (StepList steps)
 
bool UpdateXMLSettings (TiXmlElement *root, int currentVersion, int targetVersion)
 Upgrade the settings contained in root from fromVersion to targetVersion. Multiple steps will be executed automatically when fromVersion is more than one version away from targetVersion.
 

Static Public Member Functions

static SettingConversionResult ConvertSettingBoolToInt (TiXmlElement *root, std::string_view oldSettingId, std::string_view newSettingId, const SettingBoolToIntMapping &mapping)
 

Member Typedef Documentation

◆ StepList

using CSettingsMigration::StepList = std::vector<std::shared_ptr<ISettingsMigrationStep>>

Member Enumeration Documentation

◆ SettingConversionResult

Enumerator
FAILURE 
NOT_PRESENT 
INVALID 
CONVERTED 

Constructor & Destructor Documentation

◆ CSettingsMigration() [1/2]

CSettingsMigration::CSettingsMigration ( )

◆ CSettingsMigration() [2/2]

CSettingsMigration::CSettingsMigration ( StepList steps)

Member Function Documentation

◆ ConvertSettingBoolToInt()

CSettingsMigration::SettingConversionResult CSettingsMigration::ConvertSettingBoolToInt ( TiXmlElement * root,
std::string_view oldSettingId,
std::string_view newSettingId,
const SettingBoolToIntMapping & mapping )
static

maybe future

Todo
: strategy - read/write settings without dependency on CSetting* classes?

◆ UpdateXMLSettings()

bool CSettingsMigration::UpdateXMLSettings ( TiXmlElement * root,
int currentVersion,
int targetVersion )

Upgrade the settings contained in root from fromVersion to targetVersion. Multiple steps will be executed automatically when fromVersion is more than one version away from targetVersion.

Parameters
[in,out]rootSettings XML representation.
[in]fromVersionVersion to upgrade from.
[in]targetVersionVersion to upgrade to.
Returns
False for catastrophic failure (for example root left in an inconsistent state due to out of memory. A setting that doesn't convert properly due to an invalid value is not a catastrophic failure: the situation is logged and the setting receives its default value). True otherwise.
Todo
would be nice to include the filename or something to identify more precisely in the log

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