FlightGear next
|
#include <iosfwd>
#include <algorithm>
#include <simgear/structure/subsystem_mgr.hxx>
#include <simgear/props/tiedpropertylist.hxx>
#include <Main/globals.hxx>
Go to the source code of this file.
Classes | |
class | FGProperties |
Functions | |
bool | fgSaveFlight (std::ostream &output, bool write_all=false) |
Save a flight to disk. | |
bool | fgLoadFlight (std::istream &input) |
Load a flight from disk. | |
bool | fgLoadProps (const std::string &path, SGPropertyNode *props, bool in_fg_root=true, int default_mode=0) |
Load properties from a file. | |
void | setLoggingClasses (const char *c) |
Set the logging classes. | |
void | setLoggingPriority (const char *p) |
Set the logging priority. | |
SGPropertyNode * | fgGetNode (const char *path, bool create=false) |
Get a property node. | |
SGPropertyNode * | fgGetNode (const std::string &path, bool create=false) |
Get a property node. | |
SGPropertyNode * | fgGetNode (const char *path, int index, bool create=false) |
Get a property node with separate index. | |
SGPropertyNode * | fgGetNode (const std::string &path, int index, bool create=false) |
Get a property node with separate index. | |
bool | fgHasNode (const char *path) |
Test whether a given node exists. | |
bool | fgHasNode (const std::string &path) |
Test whether a given node exists. | |
void | fgAddChangeListener (SGPropertyChangeListener *listener, const char *path) |
Add a listener to a node. | |
void | fgAddChangeListener (SGPropertyChangeListener *listener, const std::string &path) |
Add a listener to a node. | |
void | fgAddChangeListener (SGPropertyChangeListener *listener, const char *path, int index) |
Add a listener to a node. | |
void | fgAddChangeListener (SGPropertyChangeListener *listener, const std::string &path, int index) |
Add a listener to a node. | |
bool | fgGetBool (const char *name, bool defaultValue=false) |
Get a bool value for a property. | |
bool | fgGetBool (const std::string &name, bool defaultValue=false) |
Get a bool value for a property. | |
int | fgGetInt (const char *name, int defaultValue=0) |
Get an int value for a property. | |
int | fgGetInt (const std::string &name, int defaultValue=0) |
Get an int value for a property. | |
long | fgGetLong (const char *name, long defaultValue=0L) |
Get a long value for a property. | |
long | fgGetLong (const std::string &name, long defaultValue=0L) |
Get a long value for a property. | |
float | fgGetFloat (const char *name, float defaultValue=0.0) |
Get a float value for a property. | |
float | fgGetFloat (const std::string &name, float defaultValue=0.0) |
Get a float value for a property. | |
double | fgGetDouble (const char *name, double defaultValue=0.0) |
Get a double value for a property. | |
double | fgGetDouble (const std::string &name, double defaultValue=0.0) |
Get a double value for a property. | |
std::string | fgGetString (const char *name, const char *defaultValue="") |
Get a string value for a property. | |
std::string | fgGetString (const std::string &name, const std::string &defaultValue=std::string("")) |
Get a string value for a property. | |
bool | fgSetBool (const char *name, bool val) |
Set a bool value for a property. | |
bool | fgSetBool (const std::string &name, bool val) |
Set a bool value for a property. | |
bool | fgSetInt (const char *name, int val) |
Set an int value for a property. | |
bool | fgSetInt (const std::string &name, int val) |
Set an int value for a property. | |
bool | fgSetLong (const char *name, long val) |
Set a long value for a property. | |
bool | fgSetLong (const std::string &name, long val) |
Set a long value for a property. | |
bool | fgSetFloat (const char *name, float val) |
Set a float value for a property. | |
bool | fgSetFloat (const std::string &name, float val) |
Set a float value for a property. | |
bool | fgSetDouble (const char *name, double val) |
Set a double value for a property. | |
bool | fgSetDouble (const std::string &name, double val) |
Set a double value for a property. | |
bool | fgSetString (const char *name, const char *val) |
Set a string value for a property. | |
bool | fgSetString (const std::string &name, const std::string &val) |
Set a string value for a property. | |
void | fgSetArchivable (const char *name, bool state=true) |
Set the state of the archive attribute for a property. | |
void | fgSetReadable (const char *name, bool state=true) |
Set the state of the read attribute for a property. | |
void | fgSetWritable (const char *name, bool state=true) |
Set the state of the write attribute for a property. | |
void | fgUntie (const char *name) |
Untie a property from an external data source. | |
void | fgUntieIfDefined (const std::string &name) |
@brfief variant of the above which doesn't warn if the property does not exist | |
template<class V> | |
void | fgTie (const char *name, V(*getter)(), void(*setter)(V)=0, bool useDefault=true) |
Tie a property to a pair of simple functions. | |
template<class V> | |
void | fgTie (const char *name, int index, V(*getter)(int), void(*setter)(int, V)=0, bool useDefault=true) |
Tie a property to a pair of indexed functions. | |
template<class T, class V> | |
void | fgTie (const char *name, T *obj, V(T::*getter)() const, void(T::*setter)(V)=0, bool useDefault=true) |
Tie a property to a pair of object methods. | |
template<class T, class V> | |
void | fgTie (const char *name, T *obj, int index, V(T::*getter)(int) const, void(T::*setter)(int, V)=0, bool useDefault=true) |
Tie a property to a pair of indexed object methods. | |
|
extern |
Add a listener to a node.
listener | The listener to add to the node. |
path | The path of the node, relative to root. |
index | The index for the last member of the path (overrides any given in the string). |
Definition at line 513 of file fg_props.cxx.
|
extern |
Add a listener to a node.
listener | The listener to add to the node. |
path | The path of the node, relative to root. |
index | The index for the last member of the path (overrides any given in the string). |
Definition at line 519 of file fg_props.cxx.
|
inline |
Add a listener to a node.
listener | The listener to add to the node. |
path | The path of the node, relative to root. |
index | The index for the last member of the path (overrides any given in the string). |
Definition at line 211 of file fg_props.hxx.
|
inline |
Add a listener to a node.
listener | The listener to add to the node. |
path | The path of the node, relative to root. |
index | The index for the last member of the path (overrides any given in the string). |
Definition at line 237 of file fg_props.hxx.
|
extern |
Get a bool value for a property.
This method is convenient but inefficient. It should be used infrequently (i.e. for initializing, loading, saving, etc.), not in the main loop. If you need to get a value frequently, it is better to look up the node itself using fgGetNode and then use the node's getBoolValue() method, to avoid the lookup overhead.
name | The property name. |
defaultValue | The default value to return if the property does not exist. |
Definition at line 25 of file proptest.cpp.
|
inline |
Get a bool value for a property.
This method is convenient but inefficient. It should be used infrequently (i.e. for initializing, loading, saving, etc.), not in the main loop. If you need to get a value frequently, it is better to look up the node itself using fgGetNode and then use the node's getBoolValue() method, to avoid the lookup overhead.
name | The property name. |
defaultValue | The default value to return if the property does not exist. |
Definition at line 274 of file fg_props.hxx.
|
extern |
Get a double value for a property.
This method is convenient but inefficient. It should be used infrequently (i.e. for initializing, loading, saving, etc.), not in the main loop. If you need to get a value frequently, it is better to look up the node itself using fgGetNode and then use the node's getDoubleValue() method, to avoid the lookup overhead.
name | The property name. |
defaultValue | The default value to return if the property does not exist. |
Definition at line 30 of file proptest.cpp.
|
inline |
Get a double value for a property.
This method is convenient but inefficient. It should be used infrequently (i.e. for initializing, loading, saving, etc.), not in the main loop. If you need to get a value frequently, it is better to look up the node itself using fgGetNode and then use the node's getDoubleValue() method, to avoid the lookup overhead.
name | The property name. |
defaultValue | The default value to return if the property does not exist. |
Definition at line 418 of file fg_props.hxx.
|
extern |
Get a float value for a property.
This method is convenient but inefficient. It should be used infrequently (i.e. for initializing, loading, saving, etc.), not in the main loop. If you need to get a value frequently, it is better to look up the node itself using fgGetNode and then use the node's getFloatValue() method, to avoid the lookup overhead.
name | The property name. |
defaultValue | The default value to return if the property does not exist. |
Definition at line 29 of file proptest.cpp.
|
inline |
Get a float value for a property.
This method is convenient but inefficient. It should be used infrequently (i.e. for initializing, loading, saving, etc.), not in the main loop. If you need to get a value frequently, it is better to look up the node itself using fgGetNode and then use the node's getFloatValue() method, to avoid the lookup overhead.
name | The property name. |
defaultValue | The default value to return if the property does not exist. |
Definition at line 382 of file fg_props.hxx.
|
extern |
Get an int value for a property.
This method is convenient but inefficient. It should be used infrequently (i.e. for initializing, loading, saving, etc.), not in the main loop. If you need to get a value frequently, it is better to look up the node itself using fgGetNode and then use the node's getIntValue() method, to avoid the lookup overhead.
name | The property name. |
defaultValue | The default value to return if the property does not exist. |
Definition at line 532 of file fg_props.cxx.
|
inline |
Get an int value for a property.
This method is convenient but inefficient. It should be used infrequently (i.e. for initializing, loading, saving, etc.), not in the main loop. If you need to get a value frequently, it is better to look up the node itself using fgGetNode and then use the node's getIntValue() method, to avoid the lookup overhead.
name | The property name. |
defaultValue | The default value to return if the property does not exist. |
Definition at line 310 of file fg_props.hxx.
|
extern |
Get a long value for a property.
This method is convenient but inefficient. It should be used infrequently (i.e. for initializing, loading, saving, etc.), not in the main loop. If you need to get a value frequently, it is better to look up the node itself using fgGetNode and then use the node's getLongValue() method, to avoid the lookup overhead.
name | The property name. |
defaultValue | The default value to return if the property does not exist. |
Definition at line 538 of file fg_props.cxx.
|
inline |
Get a long value for a property.
This method is convenient but inefficient. It should be used infrequently (i.e. for initializing, loading, saving, etc.), not in the main loop. If you need to get a value frequently, it is better to look up the node itself using fgGetNode and then use the node's getLongValue() method, to avoid the lookup overhead.
name | The property name. |
defaultValue | The default value to return if the property does not exist. |
Definition at line 346 of file fg_props.hxx.
|
extern |
Get a property node.
path | The path of the node, relative to root. |
create | true to create the node if it doesn't exist. |
Definition at line 27 of file proptest.cpp.
|
extern |
Get a property node with separate index.
This method separates the index from the path string, to make it easier to iterate through multiple components without using sprintf to add indices. For example, fgGetNode("foo[1]/bar", 3) will return the same result as fgGetNode("foo[1]/bar[3]").
path | The path of the node, relative to root. |
index | The index for the last member of the path (overrides any given in the string). |
create | true to create the node if it doesn't exist. |
Definition at line 28 of file proptest.cpp.
|
inline |
Get a property node.
path | The path of the node, relative to root. |
create | true to create the node if it doesn't exist. |
Definition at line 128 of file fg_props.hxx.
|
inline |
Get a property node with separate index.
This method separates the index from the path string, to make it easier to iterate through multiple components without using sprintf to add indices. For example, fgGetNode("foo[1]/bar", 3) will return the same result as fgGetNode("foo[1]/bar[3]").
path | The path of the node, relative to root. |
index | The index for the last member of the path (overrides any given in the string). |
create | true to create the node if it doesn't exist. |
Definition at line 165 of file fg_props.hxx.
|
extern |
Get a string value for a property.
This method is convenient but inefficient. It should be used infrequently (i.e. for initializing, loading, saving, etc.), not in the main loop. If you need to get a value frequently, it is better to look up the node itself using fgGetNode and then use the node's getStringValue() method, to avoid the lookup overhead.
name | The property name. |
defaultValue | The default value to return if the property does not exist. |
Definition at line 556 of file fg_props.cxx.
|
inline |
Get a string value for a property.
This method is convenient but inefficient. It should be used infrequently (i.e. for initializing, loading, saving, etc.), not in the main loop. If you need to get a value frequently, it is better to look up the node itself using fgGetNode and then use the node's getStringValue() method, to avoid the lookup overhead.
name | The property name. |
defaultValue | The default value to return if the property does not exist. |
Definition at line 455 of file fg_props.hxx.
|
extern |
Test whether a given node exists.
path | The path of the node, relative to root. |
Definition at line 507 of file fg_props.cxx.
|
inline |
Test whether a given node exists.
path | The path of the node, relative to root. |
Definition at line 186 of file fg_props.hxx.
|
extern |
Load a flight from disk.
This function loads an XML save file from a stream to restore a flight.
input | The input stream to read the XML from. |
Load a flight from disk.
Definition at line 448 of file fg_props.cxx.
|
extern |
Load properties from a file.
file | The relative or absolute filename. |
props | The property node to load the properties into. |
in_fg_root | If true, look for the file relative to $FG_ROOT; otherwise, look for the file relative to the current working directory. |
Definition at line 469 of file fg_props.cxx.
|
extern |
Save a flight to disk.
This function saves all of the archivable properties to a stream so that the current flight can be restored later.
output | The output stream to write the XML save file to. |
write_all | If true, write all properties rather than just the ones flagged as archivable. |
Save a flight to disk.
Definition at line 424 of file fg_props.cxx.
|
extern |
Set the state of the archive attribute for a property.
If the archive attribute is true, the property will be written when a flight is saved; if it is false, the property will be skipped.
A warning message will be printed if the property does not exist.
Definition at line 598 of file fg_props.cxx.
|
extern |
Set a bool value for a property.
Assign a bool value to a property. If the property does not yet exist, it will be created and its type will be set to BOOL; if it has a type of UNKNOWN, the type will also be set to BOOL; otherwise, the bool value will be converted to the property's type.
Definition at line 24 of file proptest.cpp.
|
inline |
Set a bool value for a property.
Assign a bool value to a property. If the property does not yet exist, it will be created and its type will be set to BOOL; if it has a type of UNKNOWN, the type will also be set to BOOL; otherwise, the bool value will be converted to the property's type.
Definition at line 490 of file fg_props.hxx.
|
extern |
Set a double value for a property.
Assign a double value to a property. If the property does not yet exist, it will be created and its type will be set to DOUBLE; if it has a type of UNKNOWN, the type will also be set to DOUBLE; otherwise, the double value will be converted to the property's type.
Definition at line 31 of file proptest.cpp.
|
inline |
Set a double value for a property.
Assign a double value to a property. If the property does not yet exist, it will be created and its type will be set to DOUBLE; if it has a type of UNKNOWN, the type will also be set to DOUBLE; otherwise, the double value will be converted to the property's type.
Definition at line 625 of file fg_props.hxx.
|
extern |
Set a float value for a property.
Assign a float value to a property. If the property does not yet exist, it will be created and its type will be set to FLOAT; if it has a type of UNKNOWN, the type will also be set to FLOAT; otherwise, the bool value will be converted to the property's type.
Definition at line 23 of file proptest.cpp.
|
inline |
Set a float value for a property.
Assign a float value to a property. If the property does not yet exist, it will be created and its type will be set to FLOAT; if it has a type of UNKNOWN, the type will also be set to FLOAT; otherwise, the bool value will be converted to the property's type.
Definition at line 591 of file fg_props.hxx.
|
extern |
Set an int value for a property.
Assign an int value to a property. If the property does not yet exist, it will be created and its type will be set to INT; if it has a type of UNKNOWN, the type will also be set to INT; otherwise, the bool value will be converted to the property's type.
Definition at line 568 of file fg_props.cxx.
|
inline |
Set an int value for a property.
Assign an int value to a property. If the property does not yet exist, it will be created and its type will be set to INT; if it has a type of UNKNOWN, the type will also be set to INT; otherwise, the bool value will be converted to the property's type.
Definition at line 524 of file fg_props.hxx.
|
extern |
Set a long value for a property.
Assign a long value to a property. If the property does not yet exist, it will be created and its type will be set to LONG; if it has a type of UNKNOWN, the type will also be set to LONG; otherwise, the bool value will be converted to the property's type.
Definition at line 574 of file fg_props.cxx.
|
inline |
Set a long value for a property.
Assign a long value to a property. If the property does not yet exist, it will be created and its type will be set to LONG; if it has a type of UNKNOWN, the type will also be set to LONG; otherwise, the bool value will be converted to the property's type.
Definition at line 557 of file fg_props.hxx.
|
extern |
Set the state of the read attribute for a property.
If the read attribute is true, the property value will be readable; if it is false, the property value will always be the default value for its type.
A warning message will be printed if the property does not exist.
Definition at line 610 of file fg_props.cxx.
|
extern |
Set a string value for a property.
Assign a string value to a property. If the property does not yet exist, it will be created and its type will be set to STRING; if it has a type of UNKNOWN, the type will also be set to STRING; otherwise, the string value will be converted to the property's type.
Definition at line 26 of file proptest.cpp.
|
inline |
Set a string value for a property.
Assign a string value to a property. If the property does not yet exist, it will be created and its type will be set to STRING; if it has a type of UNKNOWN, the type will also be set to STRING; otherwise, the string value will be converted to the property's type.
Definition at line 659 of file fg_props.hxx.
|
extern |
Set the state of the write attribute for a property.
If the write attribute is true, the property value may be modified (depending on how it is tied); if the write attribute is false, the property value may not be modified.
A warning message will be printed if the property does not exist.
Definition at line 622 of file fg_props.cxx.
|
inline |
Tie a property to a pair of indexed functions.
Every time the property value is queried, the getter (if any) will be invoked with the index provided; every time the property value is modified, the setter (if any) will be invoked with the index provided. The getter can be 0 to make the property unreadable, and the setter can be 0 to make the property unmodifiable.
name | The property name to tie (full path). |
index | The integer argument to pass to the getter and setter functions. |
getter | The getter function, or 0 if the value is unreadable. |
setter | The setter function, or 0 if the value is unmodifiable. |
useDefault | true if the setter should be invoked with any existing property value should be; false if the old value should be discarded; defaults to true. |
Definition at line 781 of file fg_props.hxx.
|
inline |
Tie a property to a pair of indexed object methods.
Every time the property value is queried, the getter (if any) will be invoked with the index provided; every time the property value is modified, the setter (if any) will be invoked with the index provided. The getter can be 0 to make the property unreadable, and the setter can be 0 to make the property unmodifiable.
name | The property name to tie (full path). |
obj | The object whose methods should be invoked. |
index | The integer argument to pass to the getter and setter methods. |
getter | The getter method, or 0 if the value is unreadable. |
setter | The setter method, or 0 if the value is unmodifiable. |
useDefault | true if the setter should be invoked with any existing property value should be; false if the old value should be discarded; defaults to true. |
Definition at line 847 of file fg_props.hxx.
|
inline |
Tie a property to a pair of object methods.
Every time the property value is queried, the getter (if any) will be invoked; every time the property value is modified, the setter (if any) will be invoked. The getter can be 0 to make the property unreadable, and the setter can be 0 to make the property unmodifiable.
name | The property name to tie (full path). |
obj | The object whose methods should be invoked. |
getter | The object's getter method, or 0 if the value is unreadable. |
setter | The object's setter method, or 0 if the value is unmodifiable. |
useDefault | true if the setter should be invoked with any existing property value should be; false if the old value should be discarded; defaults to true. |
Definition at line 815 of file fg_props.hxx.
|
inline |
Tie a property to a pair of simple functions.
Every time the property value is queried, the getter (if any) will be invoked; every time the property value is modified, the setter (if any) will be invoked. The getter can be 0 to make the property unreadable, and the setter can be 0 to make the property unmodifiable.
name | The property name to tie (full path). |
getter | The getter function, or 0 if the value is unreadable. |
setter | The setter function, or 0 if the value is unmodifiable. |
useDefault | true if the setter should be invoked with any existing property value should be; false if the old value should be discarded; defaults to true. |
Definition at line 751 of file fg_props.hxx.
|
extern |
Untie a property from an external data source.
Classes should use this function to release control of any properties they are managing.
Definition at line 634 of file fg_props.cxx.
void fgUntieIfDefined | ( | const std::string & | name | ) |
@brfief variant of the above which doesn't warn if the property does not exist
Definition at line 651 of file fg_props.cxx.
void setLoggingClasses | ( | const char * | c | ) |
Set the logging classes.
Definition at line 65 of file fg_props.cxx.
void setLoggingPriority | ( | const char * | p | ) |
Set the logging priority.
Definition at line 100 of file fg_props.cxx.