Thomas Foerster:
I refactored the XML loading code out of FGAirportDynamics and FGRunwayPreference. I also added a new class XMLLoader, which serves as a facade to the loader functions. Further I changed FGRunwayPreference to just keep a FGAirport ref, which is more concise and closer to the right(tm) solution than storing the airport data a second time ;-)
This commit is contained in:
parent
7dfae1562b
commit
33486a0308
2 changed files with 68 additions and 0 deletions
26
src/Airports/dynamicloader.hxx
Normal file
26
src/Airports/dynamicloader.hxx
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#ifndef _DYNAMIC_LOADER_HXX_
|
||||||
|
#define _DYNAMIC_LOADER_HXX_
|
||||||
|
|
||||||
|
#include <simgear/xml/easyxml.hxx>
|
||||||
|
|
||||||
|
#include "dynamics.hxx"
|
||||||
|
|
||||||
|
class FGAirportDynamicsXMLLoader : public XMLVisitor {
|
||||||
|
public:
|
||||||
|
FGAirportDynamicsXMLLoader(FGAirportDynamics* dyn);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void startXML ();
|
||||||
|
virtual void endXML ();
|
||||||
|
virtual void startElement (const char * name, const XMLAttributes &atts);
|
||||||
|
virtual void endElement (const char * name);
|
||||||
|
virtual void data (const char * s, int len);
|
||||||
|
virtual void pi (const char * target, const char * data);
|
||||||
|
virtual void warning (const char * message, int line, int column);
|
||||||
|
virtual void error (const char * message, int line, int column);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FGAirportDynamics* _dynamics;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
42
src/Airports/runwayprefloader.hxx
Normal file
42
src/Airports/runwayprefloader.hxx
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
#ifndef _RUNWAY_PREF_LOADER_HXX_
|
||||||
|
#define _RUNWAY_PREF_LOADER_HXX_
|
||||||
|
|
||||||
|
#include <time.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include <simgear/compiler.h>
|
||||||
|
#include <simgear/xml/easyxml.hxx>
|
||||||
|
|
||||||
|
#include "runwayprefs.hxx"
|
||||||
|
|
||||||
|
SG_USING_STD(string);
|
||||||
|
|
||||||
|
class FGRunwayPreferenceXMLLoader : public XMLVisitor {
|
||||||
|
public:
|
||||||
|
FGRunwayPreferenceXMLLoader(FGRunwayPreference* p);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void startXML ();
|
||||||
|
virtual void endXML ();
|
||||||
|
virtual void startElement (const char * name, const XMLAttributes &atts);
|
||||||
|
virtual void endElement (const char * name);
|
||||||
|
virtual void data (const char * s, int len);
|
||||||
|
virtual void pi (const char * target, const char * data);
|
||||||
|
virtual void warning (const char * message, int line, int column);
|
||||||
|
virtual void error (const char * message, int line, int column);
|
||||||
|
|
||||||
|
time_t processTime(const string &tme);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FGRunwayPreference* _pref;
|
||||||
|
|
||||||
|
string value;
|
||||||
|
|
||||||
|
string scheduleName;
|
||||||
|
ScheduleTime currTimes; // Needed for parsing;
|
||||||
|
|
||||||
|
RunwayList rwyList;
|
||||||
|
RunwayGroup rwyGroup;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in a new issue