8#include <simgear/debug/logstream.hxx>
32 if (!(strcmp(
name,
"wind"))) {
34 for (
int i = 0;
i < atts.size();
i++) {
37 if (atts.getName(
i) ==
string(
"tail")) {
39 currTimes.setTailWind(
atof(atts.getValue(
i)));
41 if (atts.getName(
i) ==
string(
"cross")) {
43 currTimes.setCrossWind(
atof(atts.getValue(
i)));
47 if (!(strcmp(
name,
"time"))) {
49 for (
int i = 0;
i < atts.size();
i++) {
50 if (atts.getName(
i) ==
string(
"start")) {
54 if (atts.getName(
i) ==
string(
"end")) {
58 if (atts.getName(
i) ==
string(
"schedule")) {
60 currTimes.addScheduleName(atts.getValue(
i));
64 if (!(strcmp(
name,
"takeoff"))) {
67 if (!(strcmp(
name,
"landing"))) {
70 if (!(strcmp(
name,
"schedule"))) {
71 for (
int i = 0;
i < atts.size();
i++) {
74 if (atts.getName(
i) ==
string(
"name")) {
76 scheduleName = atts.getValue(
i);
85 string hour = tme.substr(0, tme.find(
":", 0));
86 string minute = tme.substr(tme.find(
":", 0) + 1, tme.length());
89 return (
atoi(hour.c_str()) * 3600 +
atoi(minute.c_str()) * 60);
95 if (!(strcmp(
name,
"rwyuse"))) {
96 _pref->setInitialized(
true);
98 if (!(strcmp(
name,
"com"))) {
100 _pref->setComTimes(currTimes);
103 if (!(strcmp(
name,
"gen"))) {
105 _pref->setGenTimes(currTimes);
108 if (!(strcmp(
name,
"mil"))) {
110 _pref->setMilTimes(currTimes);
113 if (!(strcmp(
name,
"ul"))) {
115 _pref->setULTimes(currTimes);
120 if (!(strcmp(
name,
"takeoff"))) {
122 rwyList.set(
name, value);
123 rwyGroup.add(rwyList);
125 if (!(strcmp(
name,
"landing"))) {
127 rwyList.set(
name, value);
128 rwyGroup.add(rwyList);
130 if (!(strcmp(
name,
"schedule"))) {
132 rwyGroup.setName(scheduleName);
134 _pref->addRunwayGroup(rwyGroup);
142 string token = string(s, len);
158 SG_LOG(SG_IO, SG_WARN,
"Warning: " << message <<
" (" << line <<
',' << column <<
')');
163 SG_LOG(SG_IO, SG_ALERT,
"Error: " << message <<
" (" << line <<
',' << column <<
')');
FGRunwayPreferenceXMLLoader(FGRunwayPreference *p)
virtual void endElement(const char *name)
virtual void pi(const char *target, const char *data)
virtual void error(const char *message, int line, int column)
virtual void startElement(const char *name, const XMLAttributes &atts)
virtual void data(const char *s, int len)
time_t processTime(const std::string &tme)
virtual void warning(const char *message, int line, int column)
static double atof(const string &str)
static int atoi(const string &str)