mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 16:58:40 -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)
|
||||
{
|
||||
Init();
|
||||
ConfigVariableList var(sym, 0, "DConfig");
|
||||
ConfigVariableList var(sym, "DConfig");
|
||||
|
||||
int num_values = var.get_num_values();
|
||||
for (int i = 0; i < num_values; i++) {
|
||||
@ -172,7 +172,7 @@ template<class GetConfig>
|
||||
bool Config<GetConfig>::GetBool(const ConfigString sym, bool def)
|
||||
{
|
||||
Init();
|
||||
ConfigVariableBool var(sym, def, 0, "DConfig");
|
||||
ConfigVariableBool var(sym, def, "DConfig");
|
||||
return var.get_value();
|
||||
}
|
||||
|
||||
@ -180,7 +180,7 @@ template<class GetConfig>
|
||||
int Config<GetConfig>::GetInt(const ConfigString sym, int def)
|
||||
{
|
||||
Init();
|
||||
ConfigVariableInt var(sym, def, 0, "DConfig");
|
||||
ConfigVariableInt var(sym, def, "DConfig");
|
||||
return var.get_value();
|
||||
}
|
||||
|
||||
@ -188,7 +188,7 @@ template<class GetConfig>
|
||||
float Config<GetConfig>::GetFloat(const ConfigString sym, float def)
|
||||
{
|
||||
Init();
|
||||
ConfigVariableDouble var(sym, def, 0, "DConfig");
|
||||
ConfigVariableDouble var(sym, def, "DConfig");
|
||||
return var.get_value();
|
||||
}
|
||||
|
||||
@ -196,7 +196,7 @@ template<class GetConfig>
|
||||
double Config<GetConfig>::GetDouble(const ConfigString sym, double def)
|
||||
{
|
||||
Init();
|
||||
ConfigVariableDouble var(sym, def, 0, "DConfig");
|
||||
ConfigVariableDouble var(sym, def, "DConfig");
|
||||
return var.get_value();
|
||||
}
|
||||
|
||||
@ -205,7 +205,7 @@ ConfigString Config<GetConfig>::GetString(const ConfigString sym,
|
||||
const ConfigString def)
|
||||
{
|
||||
Init();
|
||||
ConfigVariableString var(sym, def, 0, "DConfig");
|
||||
ConfigVariableString var(sym, def, "DConfig");
|
||||
return var.get_value();
|
||||
}
|
||||
|
||||
|
@ -283,19 +283,28 @@ get_directory(int n) const {
|
||||
Filename DSearchPath::
|
||||
find_file(const Filename &filename) const {
|
||||
if (filename.is_local()) {
|
||||
Directories::const_iterator di;
|
||||
for (di = _directories.begin(); di != _directories.end(); ++di) {
|
||||
Filename match((*di), filename);
|
||||
if (match.exists()) {
|
||||
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;
|
||||
if (_directories.empty()) {
|
||||
// Let's say an empty search path is the same as a search path
|
||||
// containing just ".".
|
||||
if (filename.exists()) {
|
||||
return filename;
|
||||
}
|
||||
|
||||
} else {
|
||||
Directories::const_iterator di;
|
||||
for (di = _directories.begin(); di != _directories.end(); ++di) {
|
||||
Filename match((*di), filename);
|
||||
if (match.exists()) {
|
||||
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;
|
||||
|
||||
if (filename.is_local()) {
|
||||
Directories::const_iterator di;
|
||||
for (di = _directories.begin(); di != _directories.end(); ++di) {
|
||||
Filename match((*di), filename);
|
||||
if (match.exists()) {
|
||||
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);
|
||||
if (_directories.empty()) {
|
||||
// Let's say an empty search path is the same as a search path
|
||||
// containing just ".".
|
||||
if (filename.exists()) {
|
||||
results.add_file(filename);
|
||||
}
|
||||
|
||||
} else {
|
||||
Directories::const_iterator di;
|
||||
for (di = _directories.begin(); di != _directories.end(); ++di) {
|
||||
Filename match((*di), filename);
|
||||
if (match.exists()) {
|
||||
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);
|
||||
}
|
||||
|
@ -70,6 +70,5 @@ ConfigureFn(config_interrogatedb) {
|
||||
}
|
||||
|
||||
ConfigVariableSearchPath interrogatedb_path
|
||||
("interrogatedb-path", 0,
|
||||
"The search path for interrogate's *.in files.");
|
||||
("interrogatedb-path", "The search path for interrogate's *.in files.");
|
||||
|
||||
|
@ -37,8 +37,8 @@ ConfigVariable(const string &name, ConfigVariable::ValueType value_type) :
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE ConfigVariable::
|
||||
ConfigVariable(const string &name, ConfigVariable::ValueType value_type,
|
||||
int flags, const string &description) :
|
||||
ConfigVariableBase(name, value_type, flags, description)
|
||||
const string &description, int flags) :
|
||||
ConfigVariableBase(name, value_type, description, flags)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ class EXPCL_DTOOLCONFIG ConfigVariable : public ConfigVariableBase {
|
||||
protected:
|
||||
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:
|
||||
INLINE ConfigVariable(const string &name);
|
||||
|
@ -62,6 +62,17 @@ get_value_type() const {
|
||||
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
|
||||
// Access: Public
|
||||
@ -129,18 +140,6 @@ is_dynamic() const {
|
||||
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
|
||||
// Access: Published
|
||||
|
@ -27,7 +27,7 @@
|
||||
ConfigVariableBase::
|
||||
ConfigVariableBase(const string &name,
|
||||
ConfigVariableBase::ValueType value_type,
|
||||
int flags, const string &description) :
|
||||
const string &description, int flags) :
|
||||
_core(ConfigVariableManager::get_global_ptr()->make_variable(name))
|
||||
{
|
||||
_core->set_value_type(value_type);
|
||||
|
@ -42,18 +42,18 @@ class EXPCL_DTOOLCONFIG ConfigVariableBase : public ConfigFlags {
|
||||
protected:
|
||||
INLINE ConfigVariableBase(const string &name, ValueType type);
|
||||
ConfigVariableBase(const string &name, ValueType type,
|
||||
int flags, const string &description);
|
||||
const string &description, int flags);
|
||||
INLINE ~ConfigVariableBase();
|
||||
|
||||
PUBLISHED:
|
||||
INLINE const string &get_name() const;
|
||||
|
||||
INLINE ValueType get_value_type() const;
|
||||
INLINE const string &get_description() const;
|
||||
INLINE int get_flags() const;
|
||||
INLINE bool is_closed() const;
|
||||
INLINE int get_trust_level() const;
|
||||
INLINE bool is_dynamic() const;
|
||||
INLINE const string &get_description() const;
|
||||
|
||||
INLINE bool clear_local_value();
|
||||
INLINE bool has_local_value() const;
|
||||
|
@ -35,9 +35,9 @@ ConfigVariableBool(const string &name) :
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE ConfigVariableBool::
|
||||
ConfigVariableBool(const string &name, bool default_value, int flags,
|
||||
const string &description) :
|
||||
ConfigVariable(name, VT_bool, flags, description)
|
||||
ConfigVariableBool(const string &name, bool default_value,
|
||||
const string &description, int flags) :
|
||||
ConfigVariable(name, VT_bool, description, flags)
|
||||
{
|
||||
_core->set_default_value(default_value ? "1" : "0");
|
||||
_core->set_used();
|
||||
|
@ -31,8 +31,7 @@ class EXPCL_DTOOLCONFIG ConfigVariableBool : public ConfigVariable {
|
||||
PUBLISHED:
|
||||
INLINE ConfigVariableBool(const string &name);
|
||||
INLINE ConfigVariableBool(const string &name, bool default_value,
|
||||
int flags = 0,
|
||||
const string &description = string());
|
||||
const string &description = string(), int flags = 0);
|
||||
|
||||
INLINE void operator = (bool value);
|
||||
INLINE operator bool () const;
|
||||
|
@ -50,6 +50,17 @@ get_value_type() const {
|
||||
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
|
||||
// Access: Public
|
||||
@ -117,18 +128,6 @@ is_dynamic() const {
|
||||
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
|
||||
// Access: Public
|
||||
|
@ -49,11 +49,11 @@ public:
|
||||
INLINE bool is_used() const;
|
||||
|
||||
INLINE ValueType get_value_type() const;
|
||||
INLINE const string &get_description() const;
|
||||
INLINE int get_flags() const;
|
||||
INLINE bool is_closed() const;
|
||||
INLINE int get_trust_level() const;
|
||||
INLINE bool is_dynamic() const;
|
||||
INLINE const string &get_description() const;
|
||||
INLINE const ConfigDeclaration *get_default_value() const;
|
||||
|
||||
void set_value_type(ValueType value_type);
|
||||
@ -95,8 +95,8 @@ private:
|
||||
string _name;
|
||||
bool _is_used;
|
||||
ValueType _value_type;
|
||||
int _flags;
|
||||
string _description;
|
||||
int _flags;
|
||||
ConfigDeclaration *_default_value;
|
||||
ConfigDeclaration *_local_value;
|
||||
|
||||
|
@ -24,9 +24,9 @@
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
ConfigVariableDouble::
|
||||
ConfigVariableDouble(const string &name, double default_value, int flags,
|
||||
const string &description) :
|
||||
ConfigVariable(name, ConfigVariableCore::VT_double, flags, description)
|
||||
ConfigVariableDouble(const string &name, double default_value,
|
||||
const string &description, int flags) :
|
||||
ConfigVariable(name, ConfigVariableCore::VT_double, description, flags)
|
||||
{
|
||||
ostringstream strm;
|
||||
strm << default_value;
|
||||
|
@ -31,8 +31,7 @@ class EXPCL_DTOOLCONFIG ConfigVariableDouble : public ConfigVariable {
|
||||
PUBLISHED:
|
||||
INLINE ConfigVariableDouble(const string &name);
|
||||
ConfigVariableDouble(const string &name, double default_value,
|
||||
int flags = 0,
|
||||
const string &description = string());
|
||||
const string &description = string(), int flags = 0);
|
||||
|
||||
INLINE void operator = (double value);
|
||||
INLINE operator double () const;
|
||||
|
@ -24,11 +24,9 @@
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class EnumType>
|
||||
INLINE ConfigVariableEnum<EnumType>::
|
||||
ConfigVariableEnum(const string &name, ParseFunc *func,
|
||||
EnumType default_value, int flags,
|
||||
const string &description) :
|
||||
ConfigVariable(name, ConfigVariableCore::VT_enum, flags, description),
|
||||
_func(func),
|
||||
ConfigVariableEnum(const string &name, EnumType default_value,
|
||||
const string &description, int flags) :
|
||||
ConfigVariable(name, ConfigVariableCore::VT_enum, description, flags),
|
||||
_value_seq(-1),
|
||||
_value(default_value),
|
||||
_got_default_value(true),
|
||||
@ -163,12 +161,16 @@ set_word(int n, EnumType value) {
|
||||
// Function: ConfigVariableEnum::parse_string
|
||||
// Access: Public, Virtual
|
||||
// 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>
|
||||
INLINE EnumType ConfigVariableEnum<EnumType>::
|
||||
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
|
||||
// Description: The format_enum() method assumes the enumerated type
|
||||
// has a valid operator << (ostream) defined, which
|
||||
// balances against the parse function passed to the
|
||||
// constructor.
|
||||
// balances against the operator >> (istream) operator.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class EnumType>
|
||||
INLINE string ConfigVariableEnum<EnumType>::
|
||||
|
@ -30,21 +30,16 @@
|
||||
// outside of C++ anyway.
|
||||
//
|
||||
// This variable assumes that the enumerated type in
|
||||
// question has an output operator defined that does the
|
||||
// right thing (outputting a sensible string for the
|
||||
// type). It also requires a function that converts
|
||||
// from the strings written by the output operator back
|
||||
// to the type; this function pointer should be passed
|
||||
// to the constructor.
|
||||
// question has input and output stream operators
|
||||
// defined that do the right thing (outputting a
|
||||
// sensible string for the type, and converting a string
|
||||
// to the correct value).
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class EnumType>
|
||||
class ConfigVariableEnum : public ConfigVariable {
|
||||
public:
|
||||
typedef EnumType ParseFunc(const string &value);
|
||||
|
||||
ConfigVariableEnum(const string &name, ParseFunc *func,
|
||||
EnumType default_value, int flags = 0,
|
||||
const string &description = string());
|
||||
ConfigVariableEnum(const string &name, EnumType default_value,
|
||||
const string &description = string(), int flags = 0);
|
||||
INLINE ~ConfigVariableEnum();
|
||||
|
||||
INLINE void operator = (EnumType value);
|
||||
@ -64,8 +59,6 @@ private:
|
||||
INLINE EnumType parse_string(const string &value) const;
|
||||
INLINE string format_enum(EnumType value) const;
|
||||
|
||||
ParseFunc *_func;
|
||||
|
||||
int _value_seq;
|
||||
EnumType _value;
|
||||
|
||||
|
@ -24,9 +24,9 @@
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
ConfigVariableInt::
|
||||
ConfigVariableInt(const string &name, int default_value, int flags,
|
||||
const string &description) :
|
||||
ConfigVariable(name, ConfigVariableCore::VT_int, flags, description)
|
||||
ConfigVariableInt(const string &name, int default_value,
|
||||
const string &description, int flags) :
|
||||
ConfigVariable(name, ConfigVariableCore::VT_int, description, flags)
|
||||
{
|
||||
ostringstream strm;
|
||||
strm << default_value;
|
||||
|
@ -31,8 +31,7 @@ class EXPCL_DTOOLCONFIG ConfigVariableInt : public ConfigVariable {
|
||||
PUBLISHED:
|
||||
INLINE ConfigVariableInt(const string &name);
|
||||
ConfigVariableInt(const string &name, int default_value,
|
||||
int flags = 0,
|
||||
const string &description = string());
|
||||
const string &description = string(), int flags = 0);
|
||||
|
||||
INLINE void operator = (int value);
|
||||
INLINE operator int () const;
|
||||
|
@ -25,8 +25,8 @@
|
||||
////////////////////////////////////////////////////////////////////
|
||||
ConfigVariableList::
|
||||
ConfigVariableList(const string &name,
|
||||
int flags, const string &description) :
|
||||
ConfigVariableBase(name, VT_list, flags, description)
|
||||
const string &description, int flags) :
|
||||
ConfigVariableBase(name, VT_list, description, flags)
|
||||
{
|
||||
// A list variable implicitly defines a default value of the empty
|
||||
// string. This is just to prevent the core variable from
|
||||
|
@ -38,8 +38,8 @@
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_DTOOLCONFIG ConfigVariableList : public ConfigVariableBase {
|
||||
PUBLISHED:
|
||||
ConfigVariableList(const string &name, int flags = 0,
|
||||
const string &description = string());
|
||||
ConfigVariableList(const string &name,
|
||||
const string &description = string(), int flags = 0);
|
||||
INLINE ~ConfigVariableList();
|
||||
|
||||
INLINE int get_num_values() const;
|
||||
|
@ -25,8 +25,8 @@
|
||||
////////////////////////////////////////////////////////////////////
|
||||
ConfigVariableSearchPath::
|
||||
ConfigVariableSearchPath(const string &name,
|
||||
int flags, const string &description) :
|
||||
ConfigVariableBase(name, VT_search_path, flags, description),
|
||||
const string &description, int flags) :
|
||||
ConfigVariableBase(name, VT_search_path, description, flags),
|
||||
_value_seq(-1),
|
||||
_value_stale(true)
|
||||
{
|
||||
@ -63,9 +63,9 @@ reload_search_path() {
|
||||
_value.clear();
|
||||
|
||||
_value.append_path(_prefix);
|
||||
int num_declarations = _core->get_num_declarations();
|
||||
for (int i = 0; i < num_declarations; i++) {
|
||||
_value.append_directory(_core->get_declaration(i)->get_string_value());
|
||||
int num_unique_references = _core->get_num_unique_references();
|
||||
for (int i = 0; i < num_unique_references; i++) {
|
||||
_value.append_directory(_core->get_unique_reference(i)->get_string_value());
|
||||
}
|
||||
_value.append_path(_postfix);
|
||||
|
||||
|
@ -45,8 +45,8 @@
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_DTOOLCONFIG ConfigVariableSearchPath : public ConfigVariableBase {
|
||||
PUBLISHED:
|
||||
ConfigVariableSearchPath(const string &name, int flags = 0,
|
||||
const string &description = string());
|
||||
ConfigVariableSearchPath(const string &name,
|
||||
const string &description = string(), int flags = 0);
|
||||
INLINE ~ConfigVariableSearchPath();
|
||||
|
||||
INLINE operator const DSearchPath & () const;
|
||||
|
@ -35,9 +35,9 @@ ConfigVariableString(const string &name) :
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE ConfigVariableString::
|
||||
ConfigVariableString(const string &name, string default_value, int flags,
|
||||
const string &description) :
|
||||
ConfigVariable(name, VT_string, flags, description)
|
||||
ConfigVariableString(const string &name, string default_value,
|
||||
const string &description, int flags) :
|
||||
ConfigVariable(name, VT_string, description, flags)
|
||||
{
|
||||
_core->set_default_value(default_value);
|
||||
_core->set_used();
|
||||
|
@ -32,8 +32,7 @@ class EXPCL_DTOOLCONFIG ConfigVariableString : public ConfigVariable {
|
||||
PUBLISHED:
|
||||
INLINE ConfigVariableString(const string &name);
|
||||
INLINE ConfigVariableString(const string &name, string default_value,
|
||||
int flags = 0,
|
||||
const string &description = string());
|
||||
const string &description = string(), int flags = 0);
|
||||
|
||||
INLINE void operator = (const string &value);
|
||||
INLINE operator string () const;
|
||||
|
@ -28,7 +28,7 @@
|
||||
Notify *Notify::_global_ptr = (Notify *)NULL;
|
||||
|
||||
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");
|
||||
|
||||
|
||||
@ -528,7 +528,7 @@ config_initialized() {
|
||||
|
||||
if (_ostream_ptr == &cerr) {
|
||||
ConfigVariableString notify_output
|
||||
("notify-output", "", 0,
|
||||
("notify-output", "",
|
||||
"The filename to which to write all the output of notify");
|
||||
|
||||
if (!notify_output.empty()) {
|
||||
|
@ -207,3 +207,8 @@ INLINE ostream &NotifyCategory::
|
||||
fatal(bool prefix) const {
|
||||
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;
|
||||
|
||||
static ConfigVariableBool notify_timestamp
|
||||
("notify-timestamp", false, 0,
|
||||
("notify-timestamp", false,
|
||||
"Set true to output the date & time with each notify message.");
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -42,7 +42,8 @@ NotifyCategory(const string &fullname, const string &basename,
|
||||
_fullname(fullname),
|
||||
_basename(basename),
|
||||
_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)
|
||||
{
|
||||
if (_parent != (NotifyCategory *)NULL) {
|
||||
|
@ -93,9 +93,7 @@ private:
|
||||
friend class Notify;
|
||||
};
|
||||
|
||||
INLINE ostream &operator << (ostream &out, const NotifyCategory &cat) {
|
||||
return out << cat.get_fullname();
|
||||
}
|
||||
INLINE ostream &operator << (ostream &out, const NotifyCategory &cat);
|
||||
|
||||
#include "notifyCategory.I"
|
||||
|
||||
|
@ -17,8 +17,10 @@
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "notifySeverity.h"
|
||||
#include "notify.h"
|
||||
|
||||
ostream &operator << (ostream &out, NotifySeverity severity) {
|
||||
ostream &
|
||||
operator << (ostream &out, NotifySeverity severity) {
|
||||
switch (severity) {
|
||||
case NS_spam:
|
||||
return out << "spam";
|
||||
@ -44,3 +46,11 @@ ostream &operator << (ostream &out, NotifySeverity 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
|
||||
|
||||
EXPCL_DTOOLCONFIG ostream &operator << (ostream &out, NotifySeverity severity);
|
||||
EXPCL_DTOOLCONFIG istream &operator >> (istream &in, NotifySeverity &severity);
|
||||
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user