Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

DB.hpp

Go to the documentation of this file.
00001 #ifndef DB_H
00002 #define DB_H
00003 
00004 #include "Node.hpp"
00005 #include "Bookmark.hpp"
00006 #include "Folder.hpp"
00007 
00008 #include <string>
00009 #include <vector>
00010 
00011 /*
00012  * Abstract class to represent a database connection.
00013  * Provides the methods so that the calling classes don't need to bother
00014  * what kind of database works behind the scenes.
00015  */
00016 class DB {
00017  public:
00021         virtual ~DB() {}
00022 
00029         virtual Folder* getRoot() =0;
00030 
00037         virtual vector<Node*>& getChildren(Folder& parent) =0;
00038 
00044         virtual Node* getNode(const string& path) =0;
00045 
00046         /*
00047          * Return a folder by path.
00048          * The path must start with a slash.
00049          * \return returns null if no folder with that path is found. This will
00050          *         also happen if the item at the path is a bookmark instead of
00051          *         a folder.
00052          */
00053         virtual Folder* getFolder(const string& path) =0;
00054 
00062         virtual Bookmark* getBookmark(const string& path) =0;
00063 
00070         virtual void remove(Node* node, bool recurse=false) =0;
00071 
00077         virtual void save(Node* node) =0;
00078 
00086         virtual void connect(const string& database, const string& user_name,
00087                         const string& password) =0;
00088 
00094         virtual void disconnect() =0;
00095 
00096  protected:
00101         string _database;
00102 
00106         string _username;
00107 
00111         string _password;
00112 };
00113 
00114 #endif

Generated on Sun Jan 20 20:59:59 2002 for bkmd by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001