mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 09:23:03 -04:00
more config tweaks
This commit is contained in:
parent
cfe15fb80b
commit
9d234b8e0f
@ -157,7 +157,7 @@ ConfigTable::Symbol& Config<GetConfig>::GetAll(const ConfigString sym,
|
|||||||
ConfigTable::Symbol& s)
|
ConfigTable::Symbol& s)
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
ConfigVariableList var(sym, 0, "DConfig");
|
ConfigVariableList var(sym, "DConfig");
|
||||||
|
|
||||||
int num_values = var.get_num_values();
|
int num_values = var.get_num_values();
|
||||||
for (int i = 0; i < num_values; i++) {
|
for (int i = 0; i < num_values; i++) {
|
||||||
@ -172,7 +172,7 @@ template<class GetConfig>
|
|||||||
bool Config<GetConfig>::GetBool(const ConfigString sym, bool def)
|
bool Config<GetConfig>::GetBool(const ConfigString sym, bool def)
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
ConfigVariableBool var(sym, def, 0, "DConfig");
|
ConfigVariableBool var(sym, def, "DConfig");
|
||||||
return var.get_value();
|
return var.get_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,7 +180,7 @@ template<class GetConfig>
|
|||||||
int Config<GetConfig>::GetInt(const ConfigString sym, int def)
|
int Config<GetConfig>::GetInt(const ConfigString sym, int def)
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
ConfigVariableInt var(sym, def, 0, "DConfig");
|
ConfigVariableInt var(sym, def, "DConfig");
|
||||||
return var.get_value();
|
return var.get_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,7 +188,7 @@ template<class GetConfig>
|
|||||||
float Config<GetConfig>::GetFloat(const ConfigString sym, float def)
|
float Config<GetConfig>::GetFloat(const ConfigString sym, float def)
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
ConfigVariableDouble var(sym, def, 0, "DConfig");
|
ConfigVariableDouble var(sym, def, "DConfig");
|
||||||
return var.get_value();
|
return var.get_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,7 +196,7 @@ template<class GetConfig>
|
|||||||
double Config<GetConfig>::GetDouble(const ConfigString sym, double def)
|
double Config<GetConfig>::GetDouble(const ConfigString sym, double def)
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
ConfigVariableDouble var(sym, def, 0, "DConfig");
|
ConfigVariableDouble var(sym, def, "DConfig");
|
||||||
return var.get_value();
|
return var.get_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,7 +205,7 @@ ConfigString Config<GetConfig>::GetString(const ConfigString sym,
|
|||||||
const ConfigString def)
|
const ConfigString def)
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
ConfigVariableString var(sym, def, 0, "DConfig");
|
ConfigVariableString var(sym, def, "DConfig");
|
||||||
return var.get_value();
|
return var.get_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -283,19 +283,28 @@ get_directory(int n) const {
|
|||||||
Filename DSearchPath::
|
Filename DSearchPath::
|
||||||
find_file(const Filename &filename) const {
|
find_file(const Filename &filename) const {
|
||||||
if (filename.is_local()) {
|
if (filename.is_local()) {
|
||||||
Directories::const_iterator di;
|
if (_directories.empty()) {
|
||||||
for (di = _directories.begin(); di != _directories.end(); ++di) {
|
// Let's say an empty search path is the same as a search path
|
||||||
Filename match((*di), filename);
|
// containing just ".".
|
||||||
if (match.exists()) {
|
if (filename.exists()) {
|
||||||
if ((*di) == "." && filename.is_fully_qualified()) {
|
return filename;
|
||||||
// A special case for the "." directory: to avoid prefixing
|
}
|
||||||
// an endless stream of ./ in front of files, if the
|
|
||||||
// filename already has a ./ prefixed
|
} else {
|
||||||
// (i.e. is_fully_qualified() is true), we don't
|
Directories::const_iterator di;
|
||||||
// prefix another one.
|
for (di = _directories.begin(); di != _directories.end(); ++di) {
|
||||||
return filename;
|
Filename match((*di), filename);
|
||||||
} else {
|
if (match.exists()) {
|
||||||
return match;
|
if ((*di) == "." && filename.is_fully_qualified()) {
|
||||||
|
// A special case for the "." directory: to avoid prefixing
|
||||||
|
// an endless stream of ./ in front of files, if the
|
||||||
|
// filename already has a ./ prefixed
|
||||||
|
// (i.e. is_fully_qualified() is true), we don't
|
||||||
|
// prefix another one.
|
||||||
|
return filename;
|
||||||
|
} else {
|
||||||
|
return match;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -322,21 +331,30 @@ find_all_files(const Filename &filename,
|
|||||||
int num_added = 0;
|
int num_added = 0;
|
||||||
|
|
||||||
if (filename.is_local()) {
|
if (filename.is_local()) {
|
||||||
Directories::const_iterator di;
|
if (_directories.empty()) {
|
||||||
for (di = _directories.begin(); di != _directories.end(); ++di) {
|
// Let's say an empty search path is the same as a search path
|
||||||
Filename match((*di), filename);
|
// containing just ".".
|
||||||
if (match.exists()) {
|
if (filename.exists()) {
|
||||||
if ((*di) == "." && filename.is_fully_qualified()) {
|
results.add_file(filename);
|
||||||
// A special case for the "." directory: to avoid prefixing
|
}
|
||||||
// an endless stream of ./ in front of files, if the
|
|
||||||
// filename already has a ./ prefixed
|
} else {
|
||||||
// (i.e. is_fully_qualified() is true), we don't
|
Directories::const_iterator di;
|
||||||
// prefix another one.
|
for (di = _directories.begin(); di != _directories.end(); ++di) {
|
||||||
results.add_file(filename);
|
Filename match((*di), filename);
|
||||||
} else {
|
if (match.exists()) {
|
||||||
results.add_file(match);
|
if ((*di) == "." && filename.is_fully_qualified()) {
|
||||||
|
// A special case for the "." directory: to avoid prefixing
|
||||||
|
// an endless stream of ./ in front of files, if the
|
||||||
|
// filename already has a ./ prefixed
|
||||||
|
// (i.e. is_fully_qualified() is true), we don't
|
||||||
|
// prefix another one.
|
||||||
|
results.add_file(filename);
|
||||||
|
} else {
|
||||||
|
results.add_file(match);
|
||||||
|
}
|
||||||
|
num_added++;
|
||||||
}
|
}
|
||||||
num_added++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -265,5 +265,11 @@ main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (interrogate_error_flag()) {
|
||||||
|
nout << "Error reading interrogate data.\n";
|
||||||
|
output_code_filename.unlink();
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
@ -70,6 +70,5 @@ ConfigureFn(config_interrogatedb) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ConfigVariableSearchPath interrogatedb_path
|
ConfigVariableSearchPath interrogatedb_path
|
||||||
("interrogatedb-path", 0,
|
("interrogatedb-path", "The search path for interrogate's *.in files.");
|
||||||
"The search path for interrogate's *.in files.");
|
|
||||||
|
|
||||||
|
@ -37,8 +37,8 @@ ConfigVariable(const string &name, ConfigVariable::ValueType value_type) :
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE ConfigVariable::
|
INLINE ConfigVariable::
|
||||||
ConfigVariable(const string &name, ConfigVariable::ValueType value_type,
|
ConfigVariable(const string &name, ConfigVariable::ValueType value_type,
|
||||||
int flags, const string &description) :
|
const string &description, int flags) :
|
||||||
ConfigVariableBase(name, value_type, flags, description)
|
ConfigVariableBase(name, value_type, description, flags)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ class EXPCL_DTOOLCONFIG ConfigVariable : public ConfigVariableBase {
|
|||||||
protected:
|
protected:
|
||||||
INLINE ConfigVariable(const string &name, ValueType type);
|
INLINE ConfigVariable(const string &name, ValueType type);
|
||||||
INLINE ConfigVariable(const string &name, ValueType type,
|
INLINE ConfigVariable(const string &name, ValueType type,
|
||||||
int flags, const string &description);
|
const string &description, int flags);
|
||||||
|
|
||||||
PUBLISHED:
|
PUBLISHED:
|
||||||
INLINE ConfigVariable(const string &name);
|
INLINE ConfigVariable(const string &name);
|
||||||
|
@ -62,6 +62,17 @@ get_value_type() const {
|
|||||||
return _core->get_value_type();
|
return _core->get_value_type();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: ConfigVariableBase::get_description
|
||||||
|
// Access: Published
|
||||||
|
// Description: Returns the brief description of this variable, if
|
||||||
|
// it has been defined.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE const string &ConfigVariableBase::
|
||||||
|
get_description() const {
|
||||||
|
return _core->get_description();
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: ConfigVariableBase::get_flags
|
// Function: ConfigVariableBase::get_flags
|
||||||
// Access: Public
|
// Access: Public
|
||||||
@ -129,18 +140,6 @@ is_dynamic() const {
|
|||||||
return _core->is_dynamic();
|
return _core->is_dynamic();
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: ConfigVariableBase::get_description
|
|
||||||
// Access: Published
|
|
||||||
// Description: Returns the one-line description of this variable.
|
|
||||||
// If the variable has not yet been defined, this will
|
|
||||||
// be empty.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
INLINE const string &ConfigVariableBase::
|
|
||||||
get_description() const {
|
|
||||||
return _core->get_description();
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: ConfigVariableBase::clear_local_value
|
// Function: ConfigVariableBase::clear_local_value
|
||||||
// Access: Published
|
// Access: Published
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
ConfigVariableBase::
|
ConfigVariableBase::
|
||||||
ConfigVariableBase(const string &name,
|
ConfigVariableBase(const string &name,
|
||||||
ConfigVariableBase::ValueType value_type,
|
ConfigVariableBase::ValueType value_type,
|
||||||
int flags, const string &description) :
|
const string &description, int flags) :
|
||||||
_core(ConfigVariableManager::get_global_ptr()->make_variable(name))
|
_core(ConfigVariableManager::get_global_ptr()->make_variable(name))
|
||||||
{
|
{
|
||||||
_core->set_value_type(value_type);
|
_core->set_value_type(value_type);
|
||||||
|
@ -42,18 +42,18 @@ class EXPCL_DTOOLCONFIG ConfigVariableBase : public ConfigFlags {
|
|||||||
protected:
|
protected:
|
||||||
INLINE ConfigVariableBase(const string &name, ValueType type);
|
INLINE ConfigVariableBase(const string &name, ValueType type);
|
||||||
ConfigVariableBase(const string &name, ValueType type,
|
ConfigVariableBase(const string &name, ValueType type,
|
||||||
int flags, const string &description);
|
const string &description, int flags);
|
||||||
INLINE ~ConfigVariableBase();
|
INLINE ~ConfigVariableBase();
|
||||||
|
|
||||||
PUBLISHED:
|
PUBLISHED:
|
||||||
INLINE const string &get_name() const;
|
INLINE const string &get_name() const;
|
||||||
|
|
||||||
INLINE ValueType get_value_type() const;
|
INLINE ValueType get_value_type() const;
|
||||||
|
INLINE const string &get_description() const;
|
||||||
INLINE int get_flags() const;
|
INLINE int get_flags() const;
|
||||||
INLINE bool is_closed() const;
|
INLINE bool is_closed() const;
|
||||||
INLINE int get_trust_level() const;
|
INLINE int get_trust_level() const;
|
||||||
INLINE bool is_dynamic() const;
|
INLINE bool is_dynamic() const;
|
||||||
INLINE const string &get_description() const;
|
|
||||||
|
|
||||||
INLINE bool clear_local_value();
|
INLINE bool clear_local_value();
|
||||||
INLINE bool has_local_value() const;
|
INLINE bool has_local_value() const;
|
||||||
|
@ -35,9 +35,9 @@ ConfigVariableBool(const string &name) :
|
|||||||
// Description:
|
// Description:
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE ConfigVariableBool::
|
INLINE ConfigVariableBool::
|
||||||
ConfigVariableBool(const string &name, bool default_value, int flags,
|
ConfigVariableBool(const string &name, bool default_value,
|
||||||
const string &description) :
|
const string &description, int flags) :
|
||||||
ConfigVariable(name, VT_bool, flags, description)
|
ConfigVariable(name, VT_bool, description, flags)
|
||||||
{
|
{
|
||||||
_core->set_default_value(default_value ? "1" : "0");
|
_core->set_default_value(default_value ? "1" : "0");
|
||||||
_core->set_used();
|
_core->set_used();
|
||||||
|
@ -31,8 +31,7 @@ class EXPCL_DTOOLCONFIG ConfigVariableBool : public ConfigVariable {
|
|||||||
PUBLISHED:
|
PUBLISHED:
|
||||||
INLINE ConfigVariableBool(const string &name);
|
INLINE ConfigVariableBool(const string &name);
|
||||||
INLINE ConfigVariableBool(const string &name, bool default_value,
|
INLINE ConfigVariableBool(const string &name, bool default_value,
|
||||||
int flags = 0,
|
const string &description = string(), int flags = 0);
|
||||||
const string &description = string());
|
|
||||||
|
|
||||||
INLINE void operator = (bool value);
|
INLINE void operator = (bool value);
|
||||||
INLINE operator bool () const;
|
INLINE operator bool () const;
|
||||||
|
@ -50,6 +50,17 @@ get_value_type() const {
|
|||||||
return _value_type;
|
return _value_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: ConfigVariableCore::get_description
|
||||||
|
// Access: Public
|
||||||
|
// Description: Returns the brief description of this variable, if
|
||||||
|
// it has been defined.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE const string &ConfigVariableCore::
|
||||||
|
get_description() const {
|
||||||
|
return _description;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: ConfigVariableCore::get_flags
|
// Function: ConfigVariableCore::get_flags
|
||||||
// Access: Public
|
// Access: Public
|
||||||
@ -117,18 +128,6 @@ is_dynamic() const {
|
|||||||
return (_flags & F_dynamic) != 0;
|
return (_flags & F_dynamic) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: ConfigVariableCore::get_description
|
|
||||||
// Access: Public
|
|
||||||
// Description: Returns the one-line description of this variable.
|
|
||||||
// If the variable has not yet been defined, this will
|
|
||||||
// be empty.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
INLINE const string &ConfigVariableCore::
|
|
||||||
get_description() const {
|
|
||||||
return _description;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: ConfigVariableCore::get_default_value
|
// Function: ConfigVariableCore::get_default_value
|
||||||
// Access: Public
|
// Access: Public
|
||||||
|
@ -49,11 +49,11 @@ public:
|
|||||||
INLINE bool is_used() const;
|
INLINE bool is_used() const;
|
||||||
|
|
||||||
INLINE ValueType get_value_type() const;
|
INLINE ValueType get_value_type() const;
|
||||||
|
INLINE const string &get_description() const;
|
||||||
INLINE int get_flags() const;
|
INLINE int get_flags() const;
|
||||||
INLINE bool is_closed() const;
|
INLINE bool is_closed() const;
|
||||||
INLINE int get_trust_level() const;
|
INLINE int get_trust_level() const;
|
||||||
INLINE bool is_dynamic() const;
|
INLINE bool is_dynamic() const;
|
||||||
INLINE const string &get_description() const;
|
|
||||||
INLINE const ConfigDeclaration *get_default_value() const;
|
INLINE const ConfigDeclaration *get_default_value() const;
|
||||||
|
|
||||||
void set_value_type(ValueType value_type);
|
void set_value_type(ValueType value_type);
|
||||||
@ -95,8 +95,8 @@ private:
|
|||||||
string _name;
|
string _name;
|
||||||
bool _is_used;
|
bool _is_used;
|
||||||
ValueType _value_type;
|
ValueType _value_type;
|
||||||
int _flags;
|
|
||||||
string _description;
|
string _description;
|
||||||
|
int _flags;
|
||||||
ConfigDeclaration *_default_value;
|
ConfigDeclaration *_default_value;
|
||||||
ConfigDeclaration *_local_value;
|
ConfigDeclaration *_local_value;
|
||||||
|
|
||||||
|
@ -24,9 +24,9 @@
|
|||||||
// Description:
|
// Description:
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
ConfigVariableDouble::
|
ConfigVariableDouble::
|
||||||
ConfigVariableDouble(const string &name, double default_value, int flags,
|
ConfigVariableDouble(const string &name, double default_value,
|
||||||
const string &description) :
|
const string &description, int flags) :
|
||||||
ConfigVariable(name, ConfigVariableCore::VT_double, flags, description)
|
ConfigVariable(name, ConfigVariableCore::VT_double, description, flags)
|
||||||
{
|
{
|
||||||
ostringstream strm;
|
ostringstream strm;
|
||||||
strm << default_value;
|
strm << default_value;
|
||||||
|
@ -31,8 +31,7 @@ class EXPCL_DTOOLCONFIG ConfigVariableDouble : public ConfigVariable {
|
|||||||
PUBLISHED:
|
PUBLISHED:
|
||||||
INLINE ConfigVariableDouble(const string &name);
|
INLINE ConfigVariableDouble(const string &name);
|
||||||
ConfigVariableDouble(const string &name, double default_value,
|
ConfigVariableDouble(const string &name, double default_value,
|
||||||
int flags = 0,
|
const string &description = string(), int flags = 0);
|
||||||
const string &description = string());
|
|
||||||
|
|
||||||
INLINE void operator = (double value);
|
INLINE void operator = (double value);
|
||||||
INLINE operator double () const;
|
INLINE operator double () const;
|
||||||
|
@ -24,11 +24,9 @@
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class EnumType>
|
template<class EnumType>
|
||||||
INLINE ConfigVariableEnum<EnumType>::
|
INLINE ConfigVariableEnum<EnumType>::
|
||||||
ConfigVariableEnum(const string &name, ParseFunc *func,
|
ConfigVariableEnum(const string &name, EnumType default_value,
|
||||||
EnumType default_value, int flags,
|
const string &description, int flags) :
|
||||||
const string &description) :
|
ConfigVariable(name, ConfigVariableCore::VT_enum, description, flags),
|
||||||
ConfigVariable(name, ConfigVariableCore::VT_enum, flags, description),
|
|
||||||
_func(func),
|
|
||||||
_value_seq(-1),
|
_value_seq(-1),
|
||||||
_value(default_value),
|
_value(default_value),
|
||||||
_got_default_value(true),
|
_got_default_value(true),
|
||||||
@ -163,12 +161,16 @@ set_word(int n, EnumType value) {
|
|||||||
// Function: ConfigVariableEnum::parse_string
|
// Function: ConfigVariableEnum::parse_string
|
||||||
// Access: Public, Virtual
|
// Access: Public, Virtual
|
||||||
// Description: Turns the string value into a value of the enumerated
|
// Description: Turns the string value into a value of the enumerated
|
||||||
// type by calling the parse function.
|
// type by invoking its predefined operator >> (istream)
|
||||||
|
// operator.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class EnumType>
|
template<class EnumType>
|
||||||
INLINE EnumType ConfigVariableEnum<EnumType>::
|
INLINE EnumType ConfigVariableEnum<EnumType>::
|
||||||
parse_string(const string &value) const {
|
parse_string(const string &value) const {
|
||||||
return (*_func)(value);
|
istringstream strm(value);
|
||||||
|
EnumType result;
|
||||||
|
strm >> result;
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -176,8 +178,7 @@ parse_string(const string &value) const {
|
|||||||
// Access: Public, Virtual
|
// Access: Public, Virtual
|
||||||
// Description: The format_enum() method assumes the enumerated type
|
// Description: The format_enum() method assumes the enumerated type
|
||||||
// has a valid operator << (ostream) defined, which
|
// has a valid operator << (ostream) defined, which
|
||||||
// balances against the parse function passed to the
|
// balances against the operator >> (istream) operator.
|
||||||
// constructor.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class EnumType>
|
template<class EnumType>
|
||||||
INLINE string ConfigVariableEnum<EnumType>::
|
INLINE string ConfigVariableEnum<EnumType>::
|
||||||
|
@ -30,21 +30,16 @@
|
|||||||
// outside of C++ anyway.
|
// outside of C++ anyway.
|
||||||
//
|
//
|
||||||
// This variable assumes that the enumerated type in
|
// This variable assumes that the enumerated type in
|
||||||
// question has an output operator defined that does the
|
// question has input and output stream operators
|
||||||
// right thing (outputting a sensible string for the
|
// defined that do the right thing (outputting a
|
||||||
// type). It also requires a function that converts
|
// sensible string for the type, and converting a string
|
||||||
// from the strings written by the output operator back
|
// to the correct value).
|
||||||
// to the type; this function pointer should be passed
|
|
||||||
// to the constructor.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class EnumType>
|
template<class EnumType>
|
||||||
class ConfigVariableEnum : public ConfigVariable {
|
class ConfigVariableEnum : public ConfigVariable {
|
||||||
public:
|
public:
|
||||||
typedef EnumType ParseFunc(const string &value);
|
ConfigVariableEnum(const string &name, EnumType default_value,
|
||||||
|
const string &description = string(), int flags = 0);
|
||||||
ConfigVariableEnum(const string &name, ParseFunc *func,
|
|
||||||
EnumType default_value, int flags = 0,
|
|
||||||
const string &description = string());
|
|
||||||
INLINE ~ConfigVariableEnum();
|
INLINE ~ConfigVariableEnum();
|
||||||
|
|
||||||
INLINE void operator = (EnumType value);
|
INLINE void operator = (EnumType value);
|
||||||
@ -64,8 +59,6 @@ private:
|
|||||||
INLINE EnumType parse_string(const string &value) const;
|
INLINE EnumType parse_string(const string &value) const;
|
||||||
INLINE string format_enum(EnumType value) const;
|
INLINE string format_enum(EnumType value) const;
|
||||||
|
|
||||||
ParseFunc *_func;
|
|
||||||
|
|
||||||
int _value_seq;
|
int _value_seq;
|
||||||
EnumType _value;
|
EnumType _value;
|
||||||
|
|
||||||
|
@ -24,9 +24,9 @@
|
|||||||
// Description:
|
// Description:
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
ConfigVariableInt::
|
ConfigVariableInt::
|
||||||
ConfigVariableInt(const string &name, int default_value, int flags,
|
ConfigVariableInt(const string &name, int default_value,
|
||||||
const string &description) :
|
const string &description, int flags) :
|
||||||
ConfigVariable(name, ConfigVariableCore::VT_int, flags, description)
|
ConfigVariable(name, ConfigVariableCore::VT_int, description, flags)
|
||||||
{
|
{
|
||||||
ostringstream strm;
|
ostringstream strm;
|
||||||
strm << default_value;
|
strm << default_value;
|
||||||
|
@ -31,8 +31,7 @@ class EXPCL_DTOOLCONFIG ConfigVariableInt : public ConfigVariable {
|
|||||||
PUBLISHED:
|
PUBLISHED:
|
||||||
INLINE ConfigVariableInt(const string &name);
|
INLINE ConfigVariableInt(const string &name);
|
||||||
ConfigVariableInt(const string &name, int default_value,
|
ConfigVariableInt(const string &name, int default_value,
|
||||||
int flags = 0,
|
const string &description = string(), int flags = 0);
|
||||||
const string &description = string());
|
|
||||||
|
|
||||||
INLINE void operator = (int value);
|
INLINE void operator = (int value);
|
||||||
INLINE operator int () const;
|
INLINE operator int () const;
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
ConfigVariableList::
|
ConfigVariableList::
|
||||||
ConfigVariableList(const string &name,
|
ConfigVariableList(const string &name,
|
||||||
int flags, const string &description) :
|
const string &description, int flags) :
|
||||||
ConfigVariableBase(name, VT_list, flags, description)
|
ConfigVariableBase(name, VT_list, description, flags)
|
||||||
{
|
{
|
||||||
// A list variable implicitly defines a default value of the empty
|
// A list variable implicitly defines a default value of the empty
|
||||||
// string. This is just to prevent the core variable from
|
// string. This is just to prevent the core variable from
|
||||||
|
@ -38,8 +38,8 @@
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
class EXPCL_DTOOLCONFIG ConfigVariableList : public ConfigVariableBase {
|
class EXPCL_DTOOLCONFIG ConfigVariableList : public ConfigVariableBase {
|
||||||
PUBLISHED:
|
PUBLISHED:
|
||||||
ConfigVariableList(const string &name, int flags = 0,
|
ConfigVariableList(const string &name,
|
||||||
const string &description = string());
|
const string &description = string(), int flags = 0);
|
||||||
INLINE ~ConfigVariableList();
|
INLINE ~ConfigVariableList();
|
||||||
|
|
||||||
INLINE int get_num_values() const;
|
INLINE int get_num_values() const;
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
ConfigVariableSearchPath::
|
ConfigVariableSearchPath::
|
||||||
ConfigVariableSearchPath(const string &name,
|
ConfigVariableSearchPath(const string &name,
|
||||||
int flags, const string &description) :
|
const string &description, int flags) :
|
||||||
ConfigVariableBase(name, VT_search_path, flags, description),
|
ConfigVariableBase(name, VT_search_path, description, flags),
|
||||||
_value_seq(-1),
|
_value_seq(-1),
|
||||||
_value_stale(true)
|
_value_stale(true)
|
||||||
{
|
{
|
||||||
@ -63,9 +63,9 @@ reload_search_path() {
|
|||||||
_value.clear();
|
_value.clear();
|
||||||
|
|
||||||
_value.append_path(_prefix);
|
_value.append_path(_prefix);
|
||||||
int num_declarations = _core->get_num_declarations();
|
int num_unique_references = _core->get_num_unique_references();
|
||||||
for (int i = 0; i < num_declarations; i++) {
|
for (int i = 0; i < num_unique_references; i++) {
|
||||||
_value.append_directory(_core->get_declaration(i)->get_string_value());
|
_value.append_directory(_core->get_unique_reference(i)->get_string_value());
|
||||||
}
|
}
|
||||||
_value.append_path(_postfix);
|
_value.append_path(_postfix);
|
||||||
|
|
||||||
|
@ -45,8 +45,8 @@
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
class EXPCL_DTOOLCONFIG ConfigVariableSearchPath : public ConfigVariableBase {
|
class EXPCL_DTOOLCONFIG ConfigVariableSearchPath : public ConfigVariableBase {
|
||||||
PUBLISHED:
|
PUBLISHED:
|
||||||
ConfigVariableSearchPath(const string &name, int flags = 0,
|
ConfigVariableSearchPath(const string &name,
|
||||||
const string &description = string());
|
const string &description = string(), int flags = 0);
|
||||||
INLINE ~ConfigVariableSearchPath();
|
INLINE ~ConfigVariableSearchPath();
|
||||||
|
|
||||||
INLINE operator const DSearchPath & () const;
|
INLINE operator const DSearchPath & () const;
|
||||||
|
@ -35,9 +35,9 @@ ConfigVariableString(const string &name) :
|
|||||||
// Description:
|
// Description:
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE ConfigVariableString::
|
INLINE ConfigVariableString::
|
||||||
ConfigVariableString(const string &name, string default_value, int flags,
|
ConfigVariableString(const string &name, string default_value,
|
||||||
const string &description) :
|
const string &description, int flags) :
|
||||||
ConfigVariable(name, VT_string, flags, description)
|
ConfigVariable(name, VT_string, description, flags)
|
||||||
{
|
{
|
||||||
_core->set_default_value(default_value);
|
_core->set_default_value(default_value);
|
||||||
_core->set_used();
|
_core->set_used();
|
||||||
|
@ -32,8 +32,7 @@ class EXPCL_DTOOLCONFIG ConfigVariableString : public ConfigVariable {
|
|||||||
PUBLISHED:
|
PUBLISHED:
|
||||||
INLINE ConfigVariableString(const string &name);
|
INLINE ConfigVariableString(const string &name);
|
||||||
INLINE ConfigVariableString(const string &name, string default_value,
|
INLINE ConfigVariableString(const string &name, string default_value,
|
||||||
int flags = 0,
|
const string &description = string(), int flags = 0);
|
||||||
const string &description = string());
|
|
||||||
|
|
||||||
INLINE void operator = (const string &value);
|
INLINE void operator = (const string &value);
|
||||||
INLINE operator string () const;
|
INLINE operator string () const;
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
Notify *Notify::_global_ptr = (Notify *)NULL;
|
Notify *Notify::_global_ptr = (Notify *)NULL;
|
||||||
|
|
||||||
static ConfigVariableBool assert_abort
|
static ConfigVariableBool assert_abort
|
||||||
("assert-abort", false, 0,
|
("assert-abort", false,
|
||||||
"Set this true to trigger a core dump and/or stack trace when the first assertion fails");
|
"Set this true to trigger a core dump and/or stack trace when the first assertion fails");
|
||||||
|
|
||||||
|
|
||||||
@ -528,7 +528,7 @@ config_initialized() {
|
|||||||
|
|
||||||
if (_ostream_ptr == &cerr) {
|
if (_ostream_ptr == &cerr) {
|
||||||
ConfigVariableString notify_output
|
ConfigVariableString notify_output
|
||||||
("notify-output", "", 0,
|
("notify-output", "",
|
||||||
"The filename to which to write all the output of notify");
|
"The filename to which to write all the output of notify");
|
||||||
|
|
||||||
if (!notify_output.empty()) {
|
if (!notify_output.empty()) {
|
||||||
|
@ -207,3 +207,8 @@ INLINE ostream &NotifyCategory::
|
|||||||
fatal(bool prefix) const {
|
fatal(bool prefix) const {
|
||||||
return out(NS_fatal, prefix);
|
return out(NS_fatal, prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
INLINE ostream &
|
||||||
|
operator << (ostream &out, const NotifyCategory &cat) {
|
||||||
|
return out << cat.get_fullname();
|
||||||
|
}
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
time_t NotifyCategory::_server_delta = 0;
|
time_t NotifyCategory::_server_delta = 0;
|
||||||
|
|
||||||
static ConfigVariableBool notify_timestamp
|
static ConfigVariableBool notify_timestamp
|
||||||
("notify-timestamp", false, 0,
|
("notify-timestamp", false,
|
||||||
"Set true to output the date & time with each notify message.");
|
"Set true to output the date & time with each notify message.");
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -42,7 +42,8 @@ NotifyCategory(const string &fullname, const string &basename,
|
|||||||
_fullname(fullname),
|
_fullname(fullname),
|
||||||
_basename(basename),
|
_basename(basename),
|
||||||
_parent(parent),
|
_parent(parent),
|
||||||
_severity(get_config_name(), Notify::string_severity, NS_unspecified,
|
_severity(get_config_name(), NS_unspecified,
|
||||||
|
"Default severity of this notify category",
|
||||||
ConfigVariable::F_dynamic)
|
ConfigVariable::F_dynamic)
|
||||||
{
|
{
|
||||||
if (_parent != (NotifyCategory *)NULL) {
|
if (_parent != (NotifyCategory *)NULL) {
|
||||||
|
@ -93,9 +93,7 @@ private:
|
|||||||
friend class Notify;
|
friend class Notify;
|
||||||
};
|
};
|
||||||
|
|
||||||
INLINE ostream &operator << (ostream &out, const NotifyCategory &cat) {
|
INLINE ostream &operator << (ostream &out, const NotifyCategory &cat);
|
||||||
return out << cat.get_fullname();
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "notifyCategory.I"
|
#include "notifyCategory.I"
|
||||||
|
|
||||||
|
@ -17,8 +17,10 @@
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "notifySeverity.h"
|
#include "notifySeverity.h"
|
||||||
|
#include "notify.h"
|
||||||
|
|
||||||
ostream &operator << (ostream &out, NotifySeverity severity) {
|
ostream &
|
||||||
|
operator << (ostream &out, NotifySeverity severity) {
|
||||||
switch (severity) {
|
switch (severity) {
|
||||||
case NS_spam:
|
case NS_spam:
|
||||||
return out << "spam";
|
return out << "spam";
|
||||||
@ -44,3 +46,11 @@ ostream &operator << (ostream &out, NotifySeverity severity) {
|
|||||||
|
|
||||||
return out << "**invalid severity**";
|
return out << "**invalid severity**";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
istream &
|
||||||
|
operator >> (istream &in, NotifySeverity &severity) {
|
||||||
|
string word;
|
||||||
|
in >> word;
|
||||||
|
severity = Notify::string_severity(word);
|
||||||
|
return in;
|
||||||
|
}
|
||||||
|
@ -34,5 +34,7 @@ enum NotifySeverity {
|
|||||||
END_PUBLISH
|
END_PUBLISH
|
||||||
|
|
||||||
EXPCL_DTOOLCONFIG ostream &operator << (ostream &out, NotifySeverity severity);
|
EXPCL_DTOOLCONFIG ostream &operator << (ostream &out, NotifySeverity severity);
|
||||||
|
EXPCL_DTOOLCONFIG istream &operator >> (istream &in, NotifySeverity &severity);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user