#ifndef DATAMAP_H_
#define DATAMAP_H_
-void datamap_reset();
-void datamap_set_path(const char *path);
+#include <vector>
+#include <map>
+#include <string>
-bool datamap_load_map(const char *fname);
-void datamap_map(const char *re, const char *path);
+class DataMap {
+ std::vector<std::pair<std::string, std::string>> dmap;
+ mutable std::map<std::string, std::string> cache;
+ std::string root;
+ bool strip_paths;
-int datamap_lookup(const char *in, char *buf, int bsz);
-int datamap_path_size(const char *in);
+public:
+ DataMap();
+
+ void clear();
+
+ void set_path(const char *path);
+ void set_strip(bool s);
+
+ bool load_map(const char *fname);
+ void map(const char *match, const char *path);
+
+ int lookup(const char *in, char *buf, int bsz) const;
+ int path_size(const char *in) const;
+};
#endif // DATAMAP_H_