fix DConfig warnings when PRC_SAVE_DESCRIPTIONS is not defined

This commit is contained in:
David Rose 2004-12-17 17:56:33 +00:00
parent feb4266c44
commit 5ad50c7bcd
3 changed files with 25 additions and 19 deletions

View File

@ -30,6 +30,7 @@
#include "configVariableInt.h"
#include "configVariableDouble.h"
#include "configVariableList.h"
#include "configFlags.h"
#include <vector>
#include <map>
@ -157,7 +158,7 @@ ConfigTable::Symbol& Config<GetConfig>::GetAll(const ConfigString sym,
ConfigTable::Symbol& s)
{
Init();
ConfigVariableList var(sym, "DConfig");
ConfigVariableList var(sym, "DConfig", ConfigFlags::F_dconfig);
int num_values = var.get_num_values();
for (int i = 0; i < num_values; i++) {
@ -172,7 +173,7 @@ template<class GetConfig>
bool Config<GetConfig>::GetBool(const ConfigString sym, bool def)
{
Init();
ConfigVariableBool var(sym, def, "DConfig");
ConfigVariableBool var(sym, def, "DConfig", ConfigFlags::F_dconfig);
return var.get_value();
}
@ -180,7 +181,7 @@ template<class GetConfig>
int Config<GetConfig>::GetInt(const ConfigString sym, int def)
{
Init();
ConfigVariableInt var(sym, def, "DConfig");
ConfigVariableInt var(sym, def, "DConfig", ConfigFlags::F_dconfig);
return var.get_value();
}
@ -188,7 +189,7 @@ template<class GetConfig>
float Config<GetConfig>::GetFloat(const ConfigString sym, float def)
{
Init();
ConfigVariableDouble var(sym, def, "DConfig");
ConfigVariableDouble var(sym, def, "DConfig", ConfigFlags::F_dconfig);
return var.get_value();
}
@ -196,7 +197,7 @@ template<class GetConfig>
double Config<GetConfig>::GetDouble(const ConfigString sym, double def)
{
Init();
ConfigVariableDouble var(sym, def, "DConfig");
ConfigVariableDouble var(sym, def, "DConfig", ConfigFlags::F_dconfig);
return var.get_value();
}
@ -205,7 +206,7 @@ ConfigString Config<GetConfig>::GetString(const ConfigString sym,
const ConfigString def)
{
Init();
ConfigVariableString var(sym, def, "DConfig");
ConfigVariableString var(sym, def, "DConfig", ConfigFlags::F_dconfig);
return var.get_value();
}

View File

@ -54,6 +54,11 @@ PUBLISHED:
// (possibly from a very large pool) and should not be included in
// the normal list of variable names.
F_dynamic = 0x00004000,
// F_dconfig means that the variable was constructed from the
// legacy DConfig system, rather than directly by the user. You
// shouldn't pass this in directly.
F_dconfig = 0x00008000,
};
};

View File

@ -95,11 +95,11 @@ ConfigVariableCore::
void ConfigVariableCore::
set_value_type(ConfigVariableCore::ValueType value_type) {
if (_value_queried && _value_type != value_type) {
if (_description == "DConfig") {
// As a special exception, if the current description is
// "DConfig", we don't report a warning for changing the type,
// assuming the variable is being defined through the older
// DConfig interface.
if ((_flags & F_dconfig) != 0) {
// As a special exception, if the flags include F_dconfig, we
// don't report a warning for changing the type, assuming the
// variable is being defined through the older DConfig
// interface.
} else {
prc_cat->warning()
@ -147,9 +147,9 @@ set_flags(int flags) {
void ConfigVariableCore::
set_description(const string &description) {
if (_value_queried && _description != description) {
if (description == "DConfig") {
// As a special exception, if the new description is "DConfig",
// we don't change it, since this is presumably coming from the
if ((_flags & F_dconfig) != 0) {
// As a special exception, if the flags include F_dconfig, we
// don't change it, since this is presumably coming from the
// older DConfig interface.
return;
}
@ -179,11 +179,11 @@ set_default_value(const string &default_value) {
// Modifying an existing default value.
if (_default_value->get_string_value() != default_value) {
if (_description == "DConfig") {
// As a special exception, if the current description is
// "DConfig", we don't report a warning for changing the
// default value, assuming the variable is being defined
// through the older DConfig interface.
if ((_flags & F_dconfig) != 0) {
// As a special exception, if the flags include F_dconfig, we
// don't report a warning for changing the default value,
// assuming the variable is being defined through the older
// DConfig interface.
} else {
prc_cat->warning()