From 03e190149ea788513404ca07d6570436e9413f0c Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Fri, 17 Oct 2014 10:37:13 -0400 Subject: [PATCH] index: Add doxygen documentation Signed-off-by: Anna Schumaker --- core/index.cpp | 3 ++- include/core/index.h | 60 ++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 60 insertions(+), 3 deletions(-) diff --git a/core/index.cpp b/core/index.cpp index d1495391..bcca6868 100644 --- a/core/index.cpp +++ b/core/index.cpp @@ -1,4 +1,5 @@ -/* +/** + * @file * Copyright 2014 (c) Anna Schumaker. */ #include diff --git a/include/core/index.h b/include/core/index.h index a952938b..d604096e 100644 --- a/include/core/index.h +++ b/include/core/index.h @@ -1,4 +1,5 @@ -/* +/** + * @file * Copyright 2014 (c) Anna Schumaker. */ #ifndef OCARINA_CORE_INDEX_H @@ -10,28 +11,83 @@ #include +/** + * Class for storing index information in a Database. + */ class IndexEntry : public DatabaseEntry { public: std::string key; std::set 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 { 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); };