mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Allow qualities to be specified as a float for RPC.
This commit is contained in:
@@ -156,6 +156,25 @@ bool parseIpPort(const std::string& strSource, std::string& strIP, int& iPort)
|
||||
return bValid;
|
||||
}
|
||||
|
||||
//
|
||||
// Quality parsing
|
||||
// - integers as is.
|
||||
// - floats multiplied by a billion
|
||||
bool parseQuality(const std::string& strSource, uint32& uQuality)
|
||||
{
|
||||
uQuality = lexical_cast_s<uint32>(strSource);
|
||||
|
||||
if (!uQuality)
|
||||
{
|
||||
float fQuality = lexical_cast_s<float>(strSource);
|
||||
|
||||
if (fQuality)
|
||||
uQuality = QUALITY_ONE*fQuality;
|
||||
}
|
||||
|
||||
return !!uQuality;
|
||||
}
|
||||
|
||||
/*
|
||||
void intIPtoStr(int ip,std::string& retStr)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user