mirror of
https://github.com/aria2/aria2.git
synced 2025-01-08 11:01:38 +00:00
Rename gidToString as gidToHex, add hexToGid and isNull
This commit is contained in:
parent
1df4adefb5
commit
8f659f49ec
@ -109,11 +109,26 @@ int run(Session* session, RUN_MODE mode)
|
||||
return e->run(mode == RUN_ONCE);
|
||||
}
|
||||
|
||||
std::string gidToString(const A2Gid& gid)
|
||||
std::string gidToHex(const A2Gid& gid)
|
||||
{
|
||||
return GroupId::toHex(gid);
|
||||
}
|
||||
|
||||
A2Gid hexToGid(const std::string& hex)
|
||||
{
|
||||
A2Gid gid;
|
||||
if(GroupId::toNumericId(gid, hex.c_str()) == 0) {
|
||||
return gid;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool isNull(const A2Gid& gid)
|
||||
{
|
||||
return gid == 0;
|
||||
}
|
||||
|
||||
namespace {
|
||||
template<typename InputIterator, typename Pred>
|
||||
void apiGatherOption
|
||||
|
@ -107,7 +107,11 @@ enum RUN_MODE {
|
||||
int run(Session* session, RUN_MODE mode);
|
||||
|
||||
// Returns textual representation of the |gid|.
|
||||
std::string gidToString(const A2Gid& gid);
|
||||
std::string gidToHex(const A2Gid& gid);
|
||||
// Returns GID converted from the textual representation |hex|.
|
||||
A2Gid hexToGid(const std::string& hex);
|
||||
// Returns true if the |gid| is invalid.
|
||||
bool isNull(const A2Gid& gid);
|
||||
|
||||
// This method adds new HTTP(S)/FTP/BitTorrent Magnet URI. On
|
||||
// successful return, the |gid| includes the GID of newly added
|
||||
|
Loading…
Reference in New Issue
Block a user