25 lines
483 B
C
25 lines
483 B
C
![]() |
#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_*/
|