MCPcopy Create free account
hub / github.com/ccMSC/ckb / parseVersionString

Method parseVersionString

src/ckb/kbmanager.cpp:45–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45float KbManager::parseVersionString(QString version){
46 // Remove extraneous info (anything after a +, anything non-numeric)
47 QStringList dots = version.replace(QRegExp("\\+.+"), "").replace(QRegExp("[^\\d\\.]"), "").split(".");
48 float base = 1.f;
49 float res = 0.f;
50 // A number like "1.2.3" will result in 1.0203
51 // NB: will fail if a point version goes over 99 or if using more than two dots. floats can only reliably encode 7 decimal digits.
52 foreach(const QString& dot, dots){
53 res += dot.toFloat() * base;
54 base /= 100.f;
55 }
56 return res;
57}
58
59void KbManager::scanKeyboards(){
60 QString rootdev = devpath.arg(0);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected