ssu
Loading...
Searching...
No Matches
SsuVariables Class Reference
Inheritance diagram for SsuVariables:

Public Member Functions

void setSettings (SsuSettings *settings)
SsuSettingssettings ()
QVariant variable (const QString &section, const QString &key)
void variableSection (const QString &section, QHash< QString, QString > *storageHash)

Static Public Member Functions

static QString defaultSection (SsuSettings *settings, const QString &section)
static QString resolveString (const QString &pattern, QHash< QString, QString > *variables, int recursionDepth=0)
static QString resolveVariable (const QString &variable, QHash< QString, QString > *variables)
static QVariant variable (SsuSettings *settings, const QString &section, const QString &key)
static void variableSection (SsuSettings *settings, const QString &section, QHash< QString, QString > *storageHash)

Detailed Description

Definition at line 16 of file ssuvariables_p.h.

Constructor & Destructor Documentation

◆ SsuVariables()

SsuVariables::SsuVariables ( )

Definition at line 17 of file ssuvariables.cpp.

Member Function Documentation

◆ defaultSection()

QString SsuVariables::defaultSection ( SsuSettings * settings,
const QString & section )
static

Return a default variable section, if exists, or an empty string.

To identify the default section the section name gets split at '-', and the first token (or second token for "var-" sections) replaced with "default". You should therefore avoid "-" in section names.

Definition at line 22 of file ssuvariables.cpp.

◆ resolveString()

QString SsuVariables::resolveString ( const QString & pattern,
QHash< QString, QString > * variables,
int recursionDepth = 0 )
static

Resolve a whole string, containing several variables. Variables inside variables are allowed

Definition at line 39 of file ssuvariables.cpp.

◆ resolveVariable()

QString SsuVariables::resolveVariable ( const QString & variable,
QHash< QString, QString > * variables )
static

Resolve variables; variable can be passed as %(var) or var

Definition at line 81 of file ssuvariables.cpp.

◆ setSettings()

void SsuVariables::setSettings ( SsuSettings * settings)

Set the settings object to use

Definition at line 139 of file ssuvariables.cpp.

◆ settings()

SsuSettings * SsuVariables::settings ( )

Definition at line 144 of file ssuvariables.cpp.

◆ variable() [1/2]

QVariant SsuVariables::variable ( const QString & section,
const QString & key )

Return a variable from the given variable section. 'var'- is automatically prepended to the section name if not specified already. Recursive search through several variable sections (specified in the section) is supported, returned will be the last occurence of the variable.

Todo
add override capability with an override-section in ssu.ini

Definition at line 150 of file ssuvariables.cpp.

◆ variable() [2/2]

QVariant SsuVariables::variable ( SsuSettings * settings,
const QString & section,
const QString & key )
static

Definition at line 158 of file ssuvariables.cpp.

◆ variableSection() [1/2]

void SsuVariables::variableSection ( const QString & section,
QHash< QString, QString > * storageHash )

Return the requested variable section, recursively looking up all variable sections referenced inside with the 'variable' keyword. 'var-' is automatically prepended to the section names of included variable sections, but not for the parent section.

Variables starting with _ are treated as local variables and are ignored. The special key 'local' may contain a section-specific stringlist with additional keys which should be treated local.

This function tries to identify a default configuration section, and merges the default section with the requested section.

Definition at line 173 of file ssuvariables.cpp.

◆ variableSection() [2/2]

void SsuVariables::variableSection ( SsuSettings * settings,
const QString & section,
QHash< QString, QString > * storageHash )
static

Definition at line 179 of file ssuvariables.cpp.


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