Exemplo n.º 1
0
/**
*  @brief
*    Set default configuration settings
*/
bool Config::SetDefault(const String &sClass, const String &sVariable)
{
	// Set all classes to default settings?
	if (sClass.GetLength())
		return SetClassDefault(sClass, sVariable);
	else {
		// Set a class to default settings
		bool bResult = true; // No error by default
		Iterator<ConfigGroup*> cIterator = m_lstConfig.GetIterator();
		while (cIterator.HasNext()) {
			ConfigGroup *pClass = cIterator.Next();
			if (!SetClassDefault(pClass->GetClass()->GetClassName(), sVariable))
				bResult = false; // Something went wrong
		}

		// Done
		return bResult;
	}
}
Exemplo n.º 2
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;
}