예제 #1
0
/**
*  @brief
*    Returns the value of a configuration class variable
*/
String Config::GetVar(const String &sClass, const String &sVariable)
{
	// Get configuration class
	ConfigGroup *pClass = GetClass(sClass);
	if (pClass) {
		// Get attribute
		const DynVar *pDynVar = pClass->GetAttribute(sVariable);
		if (pDynVar)
			return pDynVar->GetString();
	}

	// Error!
	return "";
}
예제 #2
0
/**
*  @brief
*    Set the value of a configuration class variable
*/
bool Config::SetVar(const String &sClass, const String &sVariable, const String &sValue)
{
	// Get configuration class
	ConfigGroup *pClass = GetClass(sClass);
	if (pClass) {
		// Get attribute
		DynVar *pDynVar = pClass->GetAttribute(sVariable);
		if (pDynVar) {
			pDynVar->SetString(sValue);

			// Done
			return true;
		}
	}

	// Error!
	return false;
}
예제 #3
0
/**
*  @brief
*    Set a class to default configuration settings
*/
bool Config::SetClassDefault(const String &sClass, const String &sVariable)
{
	// Get class
	ConfigGroup *pClass = GetClass(sClass);
	if (!pClass || !pClass->GetClass())
		return false; // Error!

	// Set all variables to default?
	if (sVariable.GetLength()) {
		// Get attribute
		DynVar *pDynVar = pClass->GetAttribute(sVariable);
		if (pDynVar)
			pDynVar->SetDefault();
	} else {
		pClass->SetDefaultValues();
	}

	// Done
	return true;
}