summaryrefslogtreecommitdiffstats
path: root/IdManager.h
diff options
context:
space:
mode:
authorneoraider <devnull@localhost>2007-09-28 23:41:00 +0200
committerneoraider <devnull@localhost>2007-09-28 23:41:00 +0200
commit38b318a57f0a713eb2aa8407893eea142e57427e (patch)
tree34d7b79874d6bab2c06f413270666da0d624e5cf /IdManager.h
parent50b65f72c02382d826802fa7c76ebc7bf53611fc (diff)
downloadzoomedit-38b318a57f0a713eb2aa8407893eea142e57427e.tar
zoomedit-38b318a57f0a713eb2aa8407893eea142e57427e.zip
zoomedit: IdManager implementiert.
Diffstat (limited to 'IdManager.h')
-rw-r--r--IdManager.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/IdManager.h b/IdManager.h
new file mode 100644
index 0000000..bc3efb7
--- /dev/null
+++ b/IdManager.h
@@ -0,0 +1,24 @@
+#ifndef IDMANAGER_H_
+#define IDMANAGER_H_
+
+#include <string>
+#include <set>
+#include <map>
+
+
+class IdManager {
+ private:
+ std::set<std::string> usedIds;
+ std::map<std::string, unsigned long> prefixMap;
+
+ public:
+ bool add(const std::string &id);
+ bool remove(const std::string &id);
+
+ bool valid(const std::string &id) const;
+ bool unique(const std::string &id) const;
+
+ std::string generate(const std::string &prefix);
+};
+
+#endif /*IDMANAGER_H_*/