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

DB Class Reference

#include <DB.hpp>

Inheritance diagram for DB::

DbXML List of all members.

Public Methods

virtual ~DB ()
virtual FoldergetRoot ()=0
virtual vector< Node *> & getChildren (Folder &parent)=0
virtual NodegetNode (const string &path)=0
virtual FoldergetFolder (const string &path)=0
virtual BookmarkgetBookmark (const string &path)=0
virtual void remove (Node *node, bool recurse=false)=0
virtual void save (Node *node)=0
virtual void connect (const string &database, const string &user_name, const string &password)=0
virtual void disconnect ()=0

Protected Attributes

string _database
string _username
string _password

Constructor & Destructor Documentation

virtual DB::~DB   [inline, virtual]
 

Destructor.


Member Function Documentation

virtual void DB::connect const string &    database,
const string &    user_name,
const string &    password
[pure virtual]
 

Connect to the database.

Parameters:
database  The name of the database to connect to. This may for example be a filename for some backends.
user_name  Username required to connect to the database.
password  Password required to connect to the database.

Reimplemented in DbXML.

virtual void DB::disconnect   [pure virtual]
 

Terminate the connection from the database. If you don't disconnect using this method you may not safely assume that the database is in a consistent state.

Reimplemented in DbXML.

virtual Bookmark* DB::getBookmark const string &    path [pure virtual]
 

Return a bookmark by path. The path must start with a slash.

Returns:
returns null if no bookmark with that path is found. This will also happen if the item at the path is a folder instead of a bookmark.

Reimplemented in DbXML.

virtual vector<Node*>& DB::getChildren Folder   parent [pure virtual]
 

Return all direct children of a specified node.

Todo:
Use iterators

This is not really a good approach because a Folder should be expected to have the children stored internally.

Reimplemented in DbXML.

virtual Folder* DB::getFolder const string &    path [pure virtual]
 

Reimplemented in DbXML.

virtual Node* DB::getNode const string &    path [pure virtual]
 

Return a node by path. The path must start with a slash.

Returns:
returns null if no node with that path is found

Reimplemented in DbXML.

virtual Folder* DB::getRoot   [pure virtual]
 

Return the root folder.

Note:
This method may disappear in the future because this approach requires that the whole tree gets extracted from the database and that a tree is constructed in memory.

Reimplemented in DbXML.

virtual void DB::remove Node   node,
bool    recurse = false
[pure virtual]
 

Delete this node physically from the database.

Parameters:
node  The node to remove
recurse  If this parameter is true all children of the node will be removed too.

Reimplemented in DbXML.

virtual void DB::save Node   node [pure virtual]
 

Save the item back to the database.

Todo:
This isn't the best of all approaches. A node should be expected to automatically store its data back.

Reimplemented in DbXML.


Member Data Documentation

string DB::_database [protected]
 

The name of the database to connect to. This may for example be a filename for some backends.

string DB::_password [protected]
 

Password required to connect to the database.

string DB::_username [protected]
 

Username required to connect to the database.


The documentation for this class was generated from the following file:
Generated on Sun Jan 20 20:59:59 2002 for bkmd by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001