00001 // **************************************************************************** 00002 // copyright (c) 2000-2005 Horst Knorr <hk_classes@knoda.org> 00003 // This file is part of the hk_classes library. 00004 // This file may be distributed and/or modified under the terms of the 00005 // GNU Library Public License version 2 as published by the Free Software 00006 // Foundation and appearing in the file COPYING included in the 00007 // packaging of this file. 00008 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00009 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00010 // **************************************************************************** 00011 #ifndef HK_DRIVERMANAGER_H 00012 #define HK_DRIVERMANAGER_H 00013 #include "hk_definitions.h" 00014 #include <list> 00015 #include <vector> 00016 #include "hk_class.h" 00017 #include "hk_url.h" 00018 #include "hk_definitions.h" 00019 #include "hk_string.h" 00020 using namespace std; 00021 00022 class hk_connection; 00023 class hk_database; 00024 class hk_drivermanagerprivate; 00025 typedef hk_string requestdialogtype(void); 00026 00038 class hk_drivermanager: public hk_class 00039 { 00040 friend class hk_connection; 00041 public: 00045 hk_drivermanager(void); 00046 hk_drivermanager(bool runtime); 00047 virtual ~hk_drivermanager(void); 00056 hk_connection* new_connection(const hk_string& drivername="",enum_interaction i=interactive); 00060 hk_connection* find_existing_connection(const hk_string& drivername,const hk_string& host,unsigned int tcp_port,const hk_string& user); 00061 00062 static vector<hk_string>* driverlist(void); 00066 static void set_path(const hk_string& path); 00067 static hk_string path(void); 00072 static void set_driverselectdialog(requestdialogtype* dialog); 00073 static hk_string show_driverselectdialog(void); 00074 hk_database* open_connectionfile(const hk_url&connectionfile); 00075 protected: 00076 00077 private: 00078 void init(bool runtime); 00079 void load_preferences(void); 00080 void set_preferences(const hk_string& preferences); 00081 00082 void connection_remove(hk_connection* c); 00083 static hk_string p_hk_classespath; 00084 static vector<hk_string> p_driverlist; 00085 static void scan_directory(void); 00086 static requestdialogtype* p_driverselectdialog; 00087 list<hk_connection*> p_connections; 00088 hk_drivermanagerprivate* p_private; 00089 }; 00090 00091 extern "C" 00092 { 00093 //void __attribute__((constructor)) hk_classes_init(void); 00094 // void __attribute__((destructor)) hk_classes_finish(void); 00095 00096 } 00097 #endif