index: Add doxygen documentation

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
Anna Schumaker 2014-10-17 10:37:13 -04:00
parent 59ffd5cbdf
commit 03e190149e
2 changed files with 60 additions and 3 deletions

View File

@ -1,4 +1,5 @@
/*
/**
* @file
* Copyright 2014 (c) Anna Schumaker.
*/
#include <core/index.h>

View File

@ -1,4 +1,5 @@
/*
/**
* @file
* Copyright 2014 (c) Anna Schumaker.
*/
#ifndef OCARINA_CORE_INDEX_H
@ -10,28 +11,83 @@
#include <string>
/**
* Class for storing index information in a Database.
*/
class IndexEntry : public DatabaseEntry {
public:
std::string key;
std::set<unsigned int> values;
/**
* Default IndexEntry constructor.
*/
IndexEntry();
/**
* IndexEntry constructor.
* @param key The key associated with this IndexEntry.
*/
IndexEntry(const std::string &);
/**
* Access this IndexEntry's key.
* @return This IndexEntry's key.
*/
const std::string primary_key() const;
/**
* Add a new value to this entry.
* @param value The new value to add.
*/
void insert(unsigned int);
/**
* Remove a value from this entry.
* @param value The value to remove.
*/
void remove(unsigned int);
/**
* Write an IndexEntry to file
* @param file The file to use when writing data.
*/
void write(File &);
/**
* Read an IndexEntry from file
* @param file The file read from.
*/
void read(File &);
};
/**
* A special Database for index access.
*/
class Index : public Database<IndexEntry> {
public:
/**
* Index constructor.
* @param filepath Where to store the file on disk.
* @param autosave True if changes should automatically be saved.
*/
Index(const std::string &, bool);
/**
* Add a new (key, value) pair to the index.
* @param key String to store in the index.
* @param value Integer value associated with the key.
*/
void insert(const std::string &, unsigned int);
/**
* Remove a (key, value) pair from the index.
* @param key Key associated with the value to be removed.
* @param value Value to remove from the index.
*/
void remove(const std::string &, unsigned int);
};