From: <dhu...@us...> - 2007-01-12 18:35:31
|
Revision: 157 http://svn.sourceforge.net/qcell/?rev=157&view=rev Author: dhubleizh Date: 2007-01-12 10:35:18 -0800 (Fri, 12 Jan 2007) Log Message: ----------- - removed QDebug include - all toLong changed to toInt - proper parsing values > 9 Modified Paths: -------------- trunk/qcell/parsers/FQT/FQTParserPlugin.cpp Modified: trunk/qcell/parsers/FQT/FQTParserPlugin.cpp =================================================================== --- trunk/qcell/parsers/FQT/FQTParserPlugin.cpp 2007-01-12 18:32:47 UTC (rev 156) +++ trunk/qcell/parsers/FQT/FQTParserPlugin.cpp 2007-01-12 18:35:18 UTC (rev 157) @@ -6,7 +6,6 @@ * Last Update: czw lis 30 14:19:22 CET 2006 */ #include "FQTParserPlugin.h" -#include <QDebug> FQTParserPlugin::FQTParserPlugin() { @@ -92,7 +91,7 @@ return QString(); } - int max_value = 'Z' - '0'; + int max_value = ('9' - '0') + ('z' - 'A'); if((arguments_nr > max_value) || (values_nr > max_value) || (return_values_nr) > max_value) { qDebug(tr("None of the numbers in line %1 cannot exceed the maximum possible value of %2") @@ -131,7 +130,6 @@ } } if(format.exactMatch(lines[0])) - /// @todo Absolutely change that!!!! { int arg_index, arg_nr; arg_nr = 0; @@ -139,7 +137,7 @@ foreach(QString argument, lines[0].split(',')) { arg_nr++; - arg_index = argument.toLong(); + arg_index = argument.toInt(); // Sanity check if(arg_index > arguments_nr) @@ -178,7 +176,7 @@ // Main function parsing lines[0] = lines[0].trimmed(); - format = QRegExp("^(\\d)+: [0-9a-Z]{" + QString::number(free_args_columns-1) + "}[0-9a-Z]$"); + format = QRegExp("^(\\d)+: [0-9A-z]{" + QString::number(free_args_columns-1) + "}[0-9A-z]$"); QStringList tmp; int tmp_sum,value_index; QVector<int> tmp_values; @@ -196,7 +194,7 @@ // First splitting by ':' and parsing the left side tmp = line.split(':'); - tmp_sum = tmp[0].toLong(); + tmp_sum = tmp[0].toInt(); // Sanity check if(tmp_sum > max_sum) { @@ -223,6 +221,7 @@ // First clearing tmp values tmp_values.clear(); value_index = 0; + int tmp_sign; // Remove space after seperator ':' tmp[1].remove(0, 1); foreach(QChar value, tmp[1]) @@ -230,7 +229,7 @@ // Keep track of current parsed value value_index++; // Sanity check for value - if((int)value.toAscii() >= ((int)'0'+return_values_nr)) + if((int)value.toAscii() >= ((int)'A' + (return_values_nr-10))) { qDebug(tr("The value number %1 in line %2 is larger then the maximum declared in the header.") .arg(value_index) @@ -242,8 +241,16 @@ } // Collecting this lines values - tmp_values.append(value.toAscii() - '0'); + tmp_sign = (int)value.toAscii(); + if(tmp_sign >= (int)'A') + { + tmp_values.append(tmp_sign - (int)'A' + 10); + } + else + { + tmp_values.append(tmp_sign - (int)'0'); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |