All pastes #995973 Raw Edit

Someone

public text v1 · immutable
#995973 ·published 2008-04-24 17:05 UTC
rendered paste body
static int qVersionInt()
{
        static int out = -1;

        if(out == -1) {
                QString str = QString::fromLatin1(qVersion());
                QStringList parts = str.split('.', QString::KeepEmptyParts);
                Q_ASSERT(parts.count() == 3);
                out = 0;
                for(int n = 0; n < 3; ++n) {
                        bool ok;
                        int x = parts[n].toInt(&ok);
                        Q_ASSERT(ok);
                        Q_ASSERT(x > 0 && x <= 0xff);
                        out <<= x;
                }
        }

        return out;
}