ocarina/include/index.h
Anna Schumaker 629cbeb2e9 index: Add a print() function
This function is used in debug mode to print the current status of the
index.  I also created a print_keys() function to only list the keys.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:54 -04:00

39 lines
751 B
C++

/*
* Copyright 2013 (c) Anna Schumaker.
*/
#ifndef OCARINA_INDEX_H
#define OCARINA_INDEX_H
#include <file.h>
#include <print.h>
#include <map>
#include <set>
#include <string>
class Index {
private:
std::map<std::string, std::set<unsigned int> > index;
std::set<std::string> keys;
File file;
public:
Index(std::string);
void save();
void load();
#ifdef CONFIG_DEBUG
void print();
void print_keys();
#endif /* CONFIG_DEBUG */
void insert(std::string, unsigned int);
void remove(std::string);
void remove(std::string, unsigned int);
const std::set<std::string>::iterator keys_begin();
const std::set<std::string>::iterator keys_end();
const std::set<unsigned int> &operator[](const std::string &);
};
#endif /* OCARINA_INDEX_H */