index: Add doxygen documentation
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
59ffd5cbdf
commit
03e190149e
|
@ -1,4 +1,5 @@
|
||||||
/*
|
/**
|
||||||
|
* @file
|
||||||
* Copyright 2014 (c) Anna Schumaker.
|
* Copyright 2014 (c) Anna Schumaker.
|
||||||
*/
|
*/
|
||||||
#include <core/index.h>
|
#include <core/index.h>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/*
|
/**
|
||||||
|
* @file
|
||||||
* Copyright 2014 (c) Anna Schumaker.
|
* Copyright 2014 (c) Anna Schumaker.
|
||||||
*/
|
*/
|
||||||
#ifndef OCARINA_CORE_INDEX_H
|
#ifndef OCARINA_CORE_INDEX_H
|
||||||
|
@ -10,28 +11,83 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class for storing index information in a Database.
|
||||||
|
*/
|
||||||
class IndexEntry : public DatabaseEntry {
|
class IndexEntry : public DatabaseEntry {
|
||||||
public:
|
public:
|
||||||
std::string key;
|
std::string key;
|
||||||
std::set<unsigned int> values;
|
std::set<unsigned int> values;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default IndexEntry constructor.
|
||||||
|
*/
|
||||||
IndexEntry();
|
IndexEntry();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IndexEntry constructor.
|
||||||
|
* @param key The key associated with this IndexEntry.
|
||||||
|
*/
|
||||||
IndexEntry(const std::string &);
|
IndexEntry(const std::string &);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Access this IndexEntry's key.
|
||||||
|
* @return This IndexEntry's key.
|
||||||
|
*/
|
||||||
const std::string primary_key() const;
|
const std::string primary_key() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a new value to this entry.
|
||||||
|
* @param value The new value to add.
|
||||||
|
*/
|
||||||
void insert(unsigned int);
|
void insert(unsigned int);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a value from this entry.
|
||||||
|
* @param value The value to remove.
|
||||||
|
*/
|
||||||
void remove(unsigned int);
|
void remove(unsigned int);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write an IndexEntry to file
|
||||||
|
* @param file The file to use when writing data.
|
||||||
|
*/
|
||||||
void write(File &);
|
void write(File &);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read an IndexEntry from file
|
||||||
|
* @param file The file read from.
|
||||||
|
*/
|
||||||
void read(File &);
|
void read(File &);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A special Database for index access.
|
||||||
|
*/
|
||||||
class Index : public Database<IndexEntry> {
|
class Index : public Database<IndexEntry> {
|
||||||
public:
|
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);
|
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);
|
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);
|
void remove(const std::string &, unsigned int);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue