00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef HOSTPROFILES_H
00012 #define HOSTPROFILES_H
00013
00014 #include <memory>
00015
00016 #include <qmap.h>
00017 #include <qstringlist.h>
00018 #include "nhostinfo.h"
00019
00027 class HostProfileManager
00028 {
00029 public:
00033 static HostProfileManager& instance() { return *getInstance(); }
00034
00038 static const HostProfileManager& const_instance() { return *getInstance(); }
00039
00045 int loadHostProfiles();
00046
00052 int saveHostProfiles();
00053
00058 const QStringList getHostProfileNames() const;
00059
00066 int insertProfile(const NHostInfo &info);
00067
00074 bool exists(const QString &name) const;
00075
00081 const NHostInfo findProfile(const QString &name) const;
00082
00083 #ifdef QT_DEBUG
00084
00087 void dumpProfiles() const;
00088 #endif
00089
00090 protected:
00092 HostProfileManager();
00094 ~HostProfileManager();
00095
00096 private:
00097 typedef std::auto_ptr<HostProfileManager> HostProfileManagerPtr;
00099 static HostProfileManagerPtr& getInstance();
00101 friend class std::auto_ptr<HostProfileManager>;
00102
00104 HostProfileManager(const HostProfileManager&);
00106 HostProfileManager& operator=(const HostProfileManager&);
00107
00109 QMap<QString, NHostInfo> hp_map;
00110 };
00111
00112 #endif // HOSTPROFILES_H
00113