/usr/include/wreport/options.h is in libwreport-dev 3.6-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | #ifndef WREPORT_OPTIONS_H
#define WREPORT_OPTIONS_H
/** @file
*
* Configuration variables to control configurable aspects of wreport's
* behaviour.
*
* Variables are global and thread_local. They are global because they are
* consulted in performance-critical code like Var::seti, and they are
* thread_local so that a thread that changes its own configuration does not
* affect the others.
*
* LocalOverride can be used to perform configuration changes for the duration
* of a scope. Note that if while the override is active you pass control to an
* unrelated part of the code which also uses wreport, the behaviour of that
* code is also changed.
*/
namespace wreport {
namespace options {
/**
* Whether domain errors on Var assignments raise exceptions.
*
* If true, domain errors on variable assignments are silent, and the target
* variable gets set to undefined. If false (default), error_domain is raised.
*/
extern thread_local bool var_silent_domain_errors;
/**
* Temporarily override a variable while this object is in scope.
*
* Note that if the variable is global, then the override is temporally limited
* to the scope, but it is seen by all the functions that reference the
* variable functions.
*
* Example:
* \code
* {
* auto o = options::local_override(options::var_silent_domain_errors, true);
* var.setd(value)
* }
* \endcode
*/
template<typename T>
struct LocalOverride
{
T old_value;
T& param;
LocalOverride(T& param, const T& new_value)
: old_value(param), param(param)
{
param = new_value;
}
~LocalOverride()
{
param = old_value;
}
};
template<typename T> static inline LocalOverride<T> local_override(T& param, const T& new_value)
{
return LocalOverride<T>(param, new_value);
}
}
}
#endif
|