/* */ #ifndef D_GROUP_ID_H #define D_GROUP_ID_H #include "common.h" #include #include #include namespace aria2 { typedef uint64_t a2_gid_t; class GroupId { public: static std::shared_ptr create(); static std::shared_ptr import(a2_gid_t n); static void clear(); enum { ERR_NOT_UNIQUE = -1, ERR_NOT_FOUND = -2, ERR_INVALID = -3 }; static int expandUnique(a2_gid_t& n, const char* hex); static int toNumericId(a2_gid_t& n, const char* hex); static std::string toHex(a2_gid_t n); static std::string toAbbrevHex(a2_gid_t n); ~GroupId(); a2_gid_t getNumericId() const { return gid_; } std::string toHex() const; std::string toAbbrevHex() const; private: static std::set set_; GroupId(a2_gid_t gid); a2_gid_t gid_; }; } // namespace aria2 #endif // D_GROUP_ID_H