]> git.mxchange.org Git - flightgear.git/blobdiff - src/Airports/simple.hxx
Added a property output feature to ControlMap that allows arbitrary binding
[flightgear.git] / src / Airports / simple.hxx
index eee9737c97a88a3eb2f8cb7ed9883de8285777b1..05d11101f1b0b762f88793b6d14b60fa332c3158 100644 (file)
@@ -1,4 +1,3 @@
-//
 // simple.hxx -- a really simplistic class to manage airport ID,
 //                 lat, lon of the center of one of it's runways, and 
 //                 elevation in feet.
@@ -24,8 +23,8 @@
 // $Id$
 
 
-#ifndef _AIRPORTS_HXX
-#define _AIRPORTS_HXX
+#ifndef _SIMPLE_HXX
+#define _SIMPLE_HXX
 
 
 #ifndef __cplusplus                                                          
 #endif                                   
 
 
-#include <Include/compiler.h>
-#ifdef FG_HAVE_STD_INCLUDES
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <simgear/compiler.h>
+
+#ifdef SG_HAVE_STD_INCLUDES
 #  include <istream>
-#elif defined( FG_HAVE_NATIVE_SGI_COMPILERS )
+#elif defined( SG_HAVE_NATIVE_SGI_COMPILERS )
 #  include <iostream.h>
 #elif defined( __BORLANDC__ )
 #  include <iostream>
 #include STL_STRING
 #include <set>
 
-FG_USING_STD(string);
-FG_USING_STD(set);
+#ifndef _MSC_VER
+#   define NDEBUG                      // she don't work without it.
+#endif
+#include <mk4.h>
+#include <mk4str.h>
+#ifndef _MSC_VER
+#  undef NDEBUG
+#endif
 
-#if ! defined( FG_HAVE_NATIVE_SGI_COMPILERS )
-FG_USING_STD(istream);
+SG_USING_STD(string);
+SG_USING_STD(set);
+
+#if ! defined( SG_HAVE_NATIVE_SGI_COMPILERS )
+SG_USING_STD(istream);
 #endif
 
 
-class fgAIRPORT {
+class FGAirport {
+
 public:
-    fgAIRPORT( const string& name = "",
+
+    FGAirport( const string& name = "",
               double lon = 0.0,
               double lat = 0.0,
               double ele = 0.0 )
        : id(name), longitude(lon), latitude(lat), elevation(ele) {}
 
-    bool operator < ( const fgAIRPORT& a ) const {
+    bool operator < ( const FGAirport& a ) const {
        return id < a.id;
     }
 
 public:
+
     string id;
     double longitude;
     double latitude;
     double elevation;
+
 };
 
 inline istream&
-operator >> ( istream& in, fgAIRPORT& a )
+operator >> ( istream& in, FGAirport& a )
 {
-    return in >> a.id >> a.longitude >> a.latitude >> a.elevation;
+    return in >> a.id >> a.latitude >> a.longitude >> a.elevation;
 }
 
-class fgAIRPORTS {
+
+class FGAirports {
+
+private:
+
+    c4_Storage *storage;
+    c4_View *vAirport;
+
+public:
+
+    // Constructor
+    FGAirports( const string& file );
+
+    // Destructor
+    ~FGAirports();
+
+    // search for the specified id.
+    // Returns true if successful, otherwise returns false.
+    // On success, airport data is returned thru "airport" pointer.
+    // "airport" is not changed if "apt" is not found.
+    bool search( const string& id, FGAirport* airport ) const;
+    FGAirport search( const string& id ) const;
+};
+
+
+class FGAirportsUtil {
 public:
-#ifdef FG_NO_DEFAULT_TEMPLATE_ARGS
-    typedef set< fgAIRPORT, less< fgAIRPORT > > container;
+#ifdef SG_NO_DEFAULT_TEMPLATE_ARGS
+    typedef set< FGAirport, less< FGAirport > > container;
 #else
-    typedef set< fgAIRPORT > container;
+    typedef set< FGAirport > container;
 #endif
     typedef container::iterator iterator;
     typedef container::const_iterator const_iterator;
@@ -96,23 +138,26 @@ private:
 public:
 
     // Constructor
-    fgAIRPORTS();
+    FGAirportsUtil();
 
     // Destructor
-    ~fgAIRPORTS();
+    ~FGAirportsUtil();
 
     // load the data
     int load( const string& file );
 
+    // save the data in metakit format
+    bool dump_mk4( const string& file );
+
     // search for the specified id.
     // Returns true if successful, otherwise returns false.
     // On success, airport data is returned thru "airport" pointer.
     // "airport" is not changed if "id" is not found.
-    bool search( const string& id, fgAIRPORT* airport ) const;
-    fgAIRPORT search( const string& id ) const;
+    bool search( const string& id, FGAirport* airport ) const;
+    FGAirport search( const string& id ) const;
 };
 
 
-#endif /* _AIRPORTS_HXX */
+#endif // _SIMPLE_HXX