|
|
|
The internal definition of a ConfigVariable.
More...
#include "configVariableCore.h"
List of all members.
Public Member Functions |
| bool | clear_local_value () |
| | Removes the local value defined for this variable, and allows its value to be once again retrieved from the .prc files.
|
| const ConfigDeclaration * | get_declaration (int n) const |
| | Returns the nth declarations that contributes to this variable's value.
|
| const ConfigDeclaration * | get_default_value () const |
| | Returns the default variable specified for this variable.
|
| const string & | get_description () const |
| | Returns the brief description of this variable, if it has been defined.
|
| int | get_flags () const |
| | Returns the flags value as set by set_flags().
|
| const string & | get_name () const |
| | Returns the name of the variable.
|
| int | get_num_declarations () const |
| | Returns the number of declarations that contribute to this variable's value.
|
| int | get_num_references () const |
| | Returns the number of prc files that reference this variable.
|
| int | get_num_trusted_references () const |
| | Returns the number of trusted prc files that reference this variable.
|
| int | get_num_unique_references () const |
| | Returns the number of trusted, unique (by string value) values there exist for this variable.
|
| const ConfigDeclaration * | get_reference (int n) const |
| | Returns the nth declaration in a prc file that references this variable.
|
| int | get_trust_level () const |
| | Returns the minimum trust_level a prc file must demonstrate in order to redefine the value for this variable.
|
| const ConfigDeclaration * | get_trusted_reference (int n) const |
| | Returns the nth declaration in a trusted prc file that references this variable.
|
| const ConfigDeclaration * | get_unique_reference (int n) const |
| | Returns the nth trusted, unique value for this variable.
|
| ValueType | get_value_type () const |
| | Returns the stated type of this variable.
|
| bool | has_local_value () const |
| | Returns true if this variable's value has been shadowed by a local assignment (as created via make_local_value()), or false otherwise.
|
| bool | has_value () const |
| | Returns true if this variable has an explicit value, either from a prc file or locally set, or false if variable has its default value.
|
| bool | is_closed () const |
| | Returns true if the variable is not trusted by any prc file (and hence cannot be modified from its compiled-in default value), or false for the normal case, in which the variable can be modified by any prc file at or above its trust level (see get_trust_level()).
|
| bool | is_dynamic () const |
| | Returns true if the variable was indicated as "dynamic" by its constructor, indicating that its name was dynamically generated, possibly from a large pool, and it should not be listed along with the other variables.
|
| bool | is_used () const |
| | Returns true if the variable has been referenced by a ConfigVariable somewhere in code, false otherwise.
|
| ConfigDeclaration * | make_local_value () |
| | Creates a new local value for this variable, if there is not already one specified.
|
|
void | output (ostream &out) const |
| void | set_default_value (const string &default_value) |
| | Specifies the default value for this variable if it is not defined in any prc file.
|
| void | set_description (const string &description) |
| | Specifies the one-line description of this variable.
|
| void | set_flags (int flags) |
| | Specifies the trust level of this variable.
|
| void | set_used () |
| | Marks that the variable has been "declared" by a ConfigVariable.
|
| void | set_value_type (ValueType value_type) |
| | Specifies the type of this variable.
|
|
void | write (ostream &out) const |
Friends |
|
class | ConfigDeclaration |
|
class | ConfigVariableManager |
Detailed Description
The internal definition of a ConfigVariable.
This object is shared between all instances of a ConfigVariable that use the same variable name.
You cannot create a ConfigVariableCore instance directly; instead, use the make() method, which may return a shared instance. Once created, these objects are never destructed.
Definition at line 38 of file configVariableCore.h.
Member Function Documentation
| bool ConfigVariableCore::clear_local_value |
( |
| ) |
|
Returns the nth declarations that contributes to this variable's value.
The declarations are arranged in order such that earlier declarations shadow later declarations; thus, get_declaration(0) is always defined and always returns the current value of the variable.
Definition at line 346 of file configVariableCore.cxx.
References get_name(), and has_local_value().
Referenced by ConfigVariable::get_bool_word(), ConfigVariable::get_double_word(), ConfigVariable::get_int64_word(), ConfigVariable::get_int_word(), ConfigVariable::get_num_words(), ConfigVariable::get_string_value(), ConfigVariable::get_string_word(), ConfigVariable::has_bool_word(), ConfigVariable::has_double_word(), ConfigVariable::has_int64_word(), ConfigVariable::has_int_word(), ConfigVariable::has_string_word(), and make_local_value().
| const string & ConfigVariableCore::get_description |
( |
| ) |
const [inline] |
| int ConfigVariableCore::get_flags |
( |
| ) |
const [inline] |
| const string & ConfigVariableCore::get_name |
( |
| ) |
const [inline] |
| int ConfigVariableCore::get_num_declarations |
( |
| ) |
const |
Returns the number of declarations that contribute to this variable's value.
If the variable has been defined, this will always be at least 1 (for the default value, at least).
Definition at line 322 of file configVariableCore.cxx.
References has_local_value().
| int ConfigVariableCore::get_num_references |
( |
| ) |
const [inline] |
| int ConfigVariableCore::get_num_trusted_references |
( |
| ) |
const [inline] |
| int ConfigVariableCore::get_num_unique_references |
( |
| ) |
const [inline] |
| int ConfigVariableCore::get_trust_level |
( |
| ) |
const [inline] |
Returns the minimum trust_level a prc file must demonstrate in order to redefine the value for this variable.
Arguably, this should be called the "mistrust level", since the larger the value, the more suspicious we are of prc files. This value is not used if is_closed() returns true, which indicates no file may be trusted.
This value only has effect in a release build (specifically, when PRC_RESPECT_TRUST_LEVEL is defined true in Config.pp).
Definition at line 109 of file configVariableCore.I.
Referenced by ConfigVariableBase::get_trust_level().
| const ConfigDeclaration * ConfigVariableCore::get_trusted_reference |
( |
int |
n | ) |
const [inline] |
| const ConfigDeclaration * ConfigVariableCore::get_unique_reference |
( |
int |
n | ) |
const [inline] |
| ConfigVariableCore::ValueType ConfigVariableCore::get_value_type |
( |
| ) |
const [inline] |
| bool ConfigVariableCore::has_local_value |
( |
| ) |
const [inline] |
| bool ConfigVariableCore::has_value |
( |
| ) |
const |
| bool ConfigVariableCore::is_closed |
( |
| ) |
const [inline] |
Returns true if the variable is not trusted by any prc file (and hence cannot be modified from its compiled-in default value), or false for the normal case, in which the variable can be modified by any prc file at or above its trust level (see get_trust_level()).
This value only has effect in a release build (specifically, when PRC_RESPECT_TRUST_LEVEL is defined true in Config.pp).
Definition at line 89 of file configVariableCore.I.
Referenced by ConfigVariableBase::is_closed(), and make_local_value().
| bool ConfigVariableCore::is_dynamic |
( |
| ) |
const [inline] |
| bool ConfigVariableCore::is_used |
( |
| ) |
const [inline] |
Creates a new local value for this variable, if there is not already one specified.
This will shadow any values defined in the various .prc files.
If there is already a local value defined for this variable, simply returns that one.
Use clear_local_value() to remove the local value definition.
Definition at line 258 of file configVariableCore.cxx.
References get_declaration(), ConfigPage::get_local_page(), ConfigDeclaration::get_string_value(), is_closed(), and ConfigPage::make_declaration().
Referenced by ConfigVariable::set_bool_word(), ConfigVariable::set_double_word(), ConfigVariable::set_int64_word(), ConfigVariable::set_int_word(), ConfigVariable::set_string_value(), and ConfigVariable::set_string_word().
| void ConfigVariableCore::set_default_value |
( |
const string & |
default_value | ) |
|
| void ConfigVariableCore::set_description |
( |
const string & |
description | ) |
|
| void ConfigVariableCore::set_flags |
( |
int |
flags | ) |
|
| void ConfigVariableCore::set_used |
( |
| ) |
[inline] |
| void ConfigVariableCore::set_value_type |
( |
ValueType |
value_type | ) |
|
The documentation for this class was generated from the following files:
| | |