]> git.mxchange.org Git - flightgear.git/blob - src/Airports/xmlloader.hxx
Initial framing for reading in-scenery airport data.
[flightgear.git] / src / Airports / xmlloader.hxx
1 // This program is free software; you can redistribute it and/or
2 // modify it under the terms of the GNU General Public License as
3 // published by the Free Software Foundation; either version 2 of the
4 // License, or (at your option) any later version.
5 //
6 // This program is distributed in the hope that it will be useful, but
7 // WITHOUT ANY WARRANTY; without even the implied warranty of
8 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
9 // General Public License for more details.
10 //
11 // You should have received a copy of the GNU General Public License
12 // along with this program; if not, write to the Free Software
13 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
14 //
15
16 #ifndef _XML_LOADER_HXX_
17 #define _XML_LOADER_HXX_
18
19 class FGAirportDynamics;
20 class FGRunwayPreference;
21 class FGSidStar;
22
23 class XMLVisitor; // ffrom easyxml.hxx
24
25 class XMLLoader {
26 public:
27   XMLLoader();
28   ~XMLLoader();
29   static string expandICAODirs(const std::string& in);
30   
31   static void load(FGRunwayPreference* p);
32   static void load(FGAirportDynamics*  d);
33   static void load(FGSidStar*          s);
34   
35   /**
36    * Search the scenery for a file name of the form:
37    *   I/C/A/ICAO.filename.xml
38    * and parse it as an XML property list, passing the data to the supplied
39    * visitor. If no such file could be found, returns false, otherwise returns
40    * true. Other failures (malformed XML, etc) with throw an exception.
41    */
42   static bool loadAirportXMLDataIntoVisitor(const std::string& aICAO, 
43     const std::string& aFileName, XMLVisitor& aVisitor);
44   
45   /**
46    * Search the scenery for a file name of the form:
47    *   I/C/A/ICAO.filename.xml
48    * and return the corresponding SGPath if found (and true),
49    * or false and invalid path if no matching data could be found
50    */
51   static bool findAirportData(const std::string& aICAO, 
52     const std::string& aFileName, SGPath& aPath);
53 };
54
55 #endif