version.cpp
author insilmaril
Wed, 11 Apr 2007 09:21:15 +0000
changeset 453 23dba6527a7d
parent 404 53efc2562a7d
child 565 e7f6bcdf5f6c
permissions -rw-r--r--
Updated documentation about macros
insilmaril@402
     1
#include "version.h"
insilmaril@402
     2
insilmaril@402
     3
bool checkVersion (const QString &v)
insilmaril@402
     4
{
insilmaril@402
     5
	// returns true, if vym is able to read file regarding 
insilmaril@402
     6
	// the version set with setVersion
insilmaril@402
     7
	QString s1=v.section (".",0,0);
insilmaril@402
     8
	QString s2=v.section (".",1,1);
insilmaril@402
     9
	QString s3=v.section (".",2,2);
insilmaril@402
    10
	bool ok;
insilmaril@402
    11
	int vv1 =QString(__VYM_VERSION).section (".",0,0).toInt(&ok,10);
insilmaril@402
    12
	int vv2 =QString(__VYM_VERSION).section (".",1,1).toInt(&ok,10);
insilmaril@402
    13
	int vv3 =QString(__VYM_VERSION).section (".",2,2).toInt(&ok,10);
insilmaril@402
    14
	int mv1=0;
insilmaril@402
    15
	int mv2=0;
insilmaril@402
    16
	int mv3=0;
insilmaril@402
    17
	if (!s1.isEmpty() ) mv1=s1.toInt(&ok,10);
insilmaril@402
    18
	if (!s2.isEmpty() ) mv2=s2.toInt(&ok,10);
insilmaril@402
    19
	if (!s3.isEmpty() ) mv3=s3.toInt(&ok,10);
insilmaril@402
    20
	
insilmaril@402
    21
	if (vv1 > mv1)
insilmaril@402
    22
		return true;
insilmaril@402
    23
	if (vv1 < mv1)
insilmaril@402
    24
		return false;
insilmaril@402
    25
	if (vv2 > mv2)
insilmaril@402
    26
		return true;
insilmaril@402
    27
	if (vv2 < mv2)
insilmaril@402
    28
		return false;
insilmaril@402
    29
	if (vv3 > mv3)
insilmaril@402
    30
		return true;
insilmaril@402
    31
	if (vv3 < mv3)
insilmaril@402
    32
		return false;
insilmaril@402
    33
	return true;	
insilmaril@402
    34
insilmaril@404
    35
}