DatabaseEntry: Write more detailed documentation
I transfer everything from my DESIGN file into doxygen, and then remove the section from DESIGN. Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
f25fa7bebc
commit
c3dc601f72
37
DESIGN
37
DESIGN
|
@ -66,43 +66,6 @@ Callbacks:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Database Entry:
|
|
||||||
The database entry class is a base class used for storing data inside
|
|
||||||
a database (below). The valid flag and id counter will be managed by
|
|
||||||
the database itself, and should be initialized to false and 0.
|
|
||||||
|
|
||||||
- DatabaseEntry:
|
|
||||||
class DatabaseEntry {
|
|
||||||
public:
|
|
||||||
unsigned int id;
|
|
||||||
|
|
||||||
DatabaseEntry();
|
|
||||||
virtual void ~DatabaseEntry() = 0;
|
|
||||||
virtual const std::string primary_key() const = 0;
|
|
||||||
|
|
||||||
virtual void write(File &) = 0;
|
|
||||||
virtual void read(File &) = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
- API:
|
|
||||||
DatabaseEntry :: DatabaseEntry():
|
|
||||||
Set id = 0.
|
|
||||||
|
|
||||||
const std::string DatabaseEntry :: primary_key() const;
|
|
||||||
This function should return a unique string representing this
|
|
||||||
DatabaseEntry instance, which will be used to prevent
|
|
||||||
duplicates in a database. This string is not expected to
|
|
||||||
change once a DatabaseEntry has been initialized.
|
|
||||||
|
|
||||||
void DatabaseEntry :: write(File &);
|
|
||||||
This function is called to write a specific DatabaseEntry to
|
|
||||||
file.
|
|
||||||
|
|
||||||
void DatabaseEntry :: read(File &);
|
|
||||||
This function is called to read a DatabaseEntry from a file.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Database:
|
Database:
|
||||||
Databases are a generic store for information used by Ocarina. Users
|
Databases are a generic store for information used by Ocarina. Users
|
||||||
need to inherit from a DatabaseEntry class (above) to properly use a
|
need to inherit from a DatabaseEntry class (above) to properly use a
|
||||||
|
|
|
@ -12,37 +12,38 @@
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class representing a single item in a Database.
|
* The DatabaseEntry class is the base class for storing
|
||||||
|
* generic data inside a Database.
|
||||||
*/
|
*/
|
||||||
class DatabaseEntry {
|
class DatabaseEntry {
|
||||||
public:
|
public:
|
||||||
/** The index of this item */
|
unsigned int id; /**< The location of this item in the Database */
|
||||||
unsigned int id;
|
|
||||||
|
DatabaseEntry(); /** Initialize id to 0. */
|
||||||
|
virtual ~DatabaseEntry() = 0; /**< Virtual destructor */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* The primary key of a DatabaseEntry is a unique string representing
|
||||||
*/
|
* a single DatabaseEntry instance. This is used for preventing
|
||||||
DatabaseEntry();
|
* duplicate entries in a Database. The primary key is not expected
|
||||||
|
* to change once a DatabaseEntry has been initialized.
|
||||||
/**
|
*
|
||||||
* Destructor
|
* @return A unique string identifying a DatabaseEntry instance.
|
||||||
*/
|
|
||||||
virtual ~DatabaseEntry() = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to find the primary key of a database item.
|
|
||||||
* @return A uniqueue string identifying a single item in the database.
|
|
||||||
*/
|
*/
|
||||||
virtual const std::string primary_key() const = 0;
|
virtual const std::string primary_key() const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called to write a DatabaseItem to disk.
|
* This function is called by the Database to write a specific
|
||||||
|
* DatabaseEntry instance to disk.
|
||||||
|
*
|
||||||
* @param file File to use when writing data.
|
* @param file File to use when writing data.
|
||||||
*/
|
*/
|
||||||
virtual void write(File &) = 0;
|
virtual void write(File &) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called to read a DatabaseItem from disk.
|
* This function is called by the Database to read a single
|
||||||
|
* DatabaseEntry instance from disk.
|
||||||
|
*
|
||||||
* @param file File to use when reading data.
|
* @param file File to use when reading data.
|
||||||
*/
|
*/
|
||||||
virtual void read(File &) = 0;
|
virtual void read(File &) = 0;
|
||||||
|
|
Loading…
Reference in New Issue