399
edits
m (adding propertytree tag) |
(Formatting to h4/5 and printable) |
||
Line 6: | Line 6: | ||
This article is meant to introduce you to the C++ API that is used by FlightGear to work with the Property Tree. | This article is meant to introduce you to the C++ API that is used by FlightGear to work with the Property Tree. | ||
Most of the high level API can be found in the $FG_SRC/Main folder, specifically the files fg_props.cxx and the corresponding fg_props.hxx header are relevant (this is the one, that you'll want to include when working with the property tree). | Most of the high level API can be found in the [[$FG_SRC]]/Main folder, specifically the files fg_props.cxx and the corresponding fg_props.hxx header are relevant (this is the one, that you'll want to include when working with the property tree). | ||
The property tree implementation itself is to be found in the SimGear sources ([http://simgear.org/doxygen/props_8cxx-source.html] see specifically [http://simgear.org/doxygen/classSGPropertyNode.html SGPropertyNode]). | The property tree implementation itself is to be found in the SimGear sources ([http://simgear.org/doxygen/props_8cxx-source.html] see specifically [http://simgear.org/doxygen/classSGPropertyNode.html SGPropertyNode]). | ||
Line 12: | Line 12: | ||
Note: Accessing property manager values via static propertynode pointers is more efficient because you only have to do the expensive string name hash lookup once the first time the routine runs. | Note: Accessing property manager values via static propertynode pointers is more efficient because you only have to do the expensive string name hash lookup once the first time the routine runs. | ||
= Checking for Property Existence = | ====Checking for Property Existence==== | ||
bool fgHasNode (const char * path); | bool fgHasNode (const char * path); | ||
= Getters = | ====Getters==== | ||
SGPropertyNode * fgGetNode (const char * path, bool create); | SGPropertyNode * fgGetNode (const char * path, bool create); | ||
SGPropertyNode * fgGetNode (const char * path, int index, bool create); | SGPropertyNode * fgGetNode (const char * path, int index, bool create); | ||
= Boolean Values = | ====Boolean Values==== | ||
bool fgSetBool (const char * name, bool val); | bool fgSetBool (const char * name, bool val); | ||
bool fgGetBool (const char * name, bool defaultValue); | bool fgGetBool (const char * name, bool defaultValue); | ||
= Integers = | ====Integers==== | ||
bool fgSetInt (const char * name, int val); | bool fgSetInt (const char * name, int val); | ||
int fgGetInt (const char * name, int defaultValue); | int fgGetInt (const char * name, int defaultValue); | ||
= Floats = | ====Floats==== | ||
bool fgSetFloat (const char * name, float val); | bool fgSetFloat (const char * name, float val); | ||
float fgGetFloat (const char * name, float defaultValue); | float fgGetFloat (const char * name, float defaultValue); | ||
= Doubles = | ====Doubles==== | ||
bool fgSetDouble (const char * name, double val); | bool fgSetDouble (const char * name, double val); | ||
double fgGetDouble (const char * name, double defaultValue); | double fgGetDouble (const char * name, double defaultValue); | ||
= Longs = | ====Longs==== | ||
long fgGetLong (const char * name, long defaultValue); | long fgGetLong (const char * name, long defaultValue); | ||
fgSetLong (const char * name, long val); | fgSetLong (const char * name, long val); | ||
= Strings = | ====Strings==== | ||
bool fgSetString (const char * name, const char * val); | bool fgSetString (const char * name, const char * val); | ||
const char * fgGetString (const char * name, const char * defaultValue); | const char * fgGetString (const char * name, const char * defaultValue); | ||
= Using Listeners = | ====Using Listeners==== | ||
void fgAddChangeListener (SGPropertyChangeListener * listener, const char * path); | void fgAddChangeListener (SGPropertyChangeListener * listener, const char * path); | ||
void fgAddChangeListener (SGPropertyChangeListener * listener, const char * path, int index); | void fgAddChangeListener (SGPropertyChangeListener * listener, const char * path, int index); | ||
= Attributes = | ====Attributes==== | ||
== Persistance == | =====Persistance===== | ||
void fgSetArchivable (const char * name, bool state); | void fgSetArchivable (const char * name, bool state); | ||
== Access == | =====Access===== | ||
void fgSetReadable (const char * name, bool state); | void fgSetReadable (const char * name, bool state); | ||
void fgSetWritable (const char * name, bool state); | void fgSetWritable (const char * name, bool state); | ||
= Tied Properties = | ====Tied Properties==== | ||
void fgUntie (const char * name); | void fgUntie (const char * name); | ||
[[Category:Core Documentation]] | [[Category:Core Documentation]] |
edits