Allow qualities to be specified as a float for RPC.

This commit is contained in:
Arthur Britto
2012-08-20 13:19:43 -07:00
parent 2522c4625f
commit a99f814c20
5 changed files with 35 additions and 4 deletions

View File

@@ -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)
{