/* * dbObject.hh * * Created on: July 27, 2014 * Author: Hovanes Egiyan */ #ifndef _DBOBJECT_HH_ #define _DBOBJECT_HH_ #include #include #include #include #include #include #include #include using namespace std; class dbObject { protected: QSqlDatabase db ; // QT SQL database instance to access DBs string dbURI ; // URI for the DB public: static QSqlDatabase openDB( string URI ); // Initialize QT DB dbObject( string uri ); virtual ~dbObject(); void checkDB() ; // Check if the DB is open. Throws an exception if not open }; // A class for exceptions inherited from string struct StringException : public std::exception { std::string s; StringException(std::string ss) : s(ss) {} ~StringException() throw () {} // Updated const char* what() const throw() { return s.c_str(); } }; #endif /* _DBOBJECT_HH_ */