OSSP CVS Repository

ossp - Difference in ossp-pkg/as/as-gui/as_dataop.cpp versions 1.38 and 1.39
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/as/as-gui/as_dataop.cpp 1.38 -> 1.39

--- as_dataop.cpp        2003/01/30 18:23:00     1.38
+++ as_dataop.cpp        2003/01/30 20:26:03     1.39
@@ -32,6 +32,7 @@
 // Qt general headers
 #include <qregexp.h>            // Portable regular expressions
 #include <qdatetime.h>
+#include <qmessagebox.h>
 
 // User interface
 #include "as_gui.h"             // Main classes
@@ -149,6 +150,40 @@
     while (Line.isEmpty() && !Tstream.atEnd()) {
         Tstream.skipWhiteSpace();       // Strip and get
         Line = Tstream.readLine();      // the new line
+        if (Line.at(0) == QChar('#'))   // Remove comments
+            Line = QString("");
+    }
+
+    // Ensure that the right data version pattern precedes the data
+    QString Datapattern = QString(TITRAQ_DATAPATTERN);
+    if (!Line.startsWith(Datapattern)) { // Incompatible data format
+        QMessageBox Problema(TITRAQ_APPTITLE,
+            TITRAQ_NOPATTERNFOUND + QString(TITRAQ_DATAPATTERN) + TITRAQ_WASNOTFOUNDIN,
+            QMessageBox::Critical, QMessageBox::Ok | QMessageBox::Escape,
+            QMessageBox::NoButton, QMessageBox::NoButton);
+        Problema.exec(); // Give the user the bad news
+        throw Genexcept(TITRAQ_INVALIDDATA);
+    }
+    else if (Line.section(Datapattern, 1).section('.', 0, 0).toInt() != TITRAQ_DATAVERSIONMAJ) {
+        QMessageBox Problema(TITRAQ_APPTITLE, TITRAQ_BADVERSIONMAJ,
+            QMessageBox::Warning, QMessageBox::Ok | QMessageBox::Escape,
+            QMessageBox::NoButton, QMessageBox::NoButton);
+        Problema.exec(); // Give the user the bad news
+        throw Genexcept(TITRAQ_INCOMPATDATA);
+    }
+    else if (Line.section(Datapattern, 1).section('.', 1, 1).toInt() > TITRAQ_DATAVERSIONMIN) {
+        QMessageBox Problema(TITRAQ_APPTITLE, TITRAQ_BADVERSIONMIN,
+            QMessageBox::Warning, QMessageBox::Ok | QMessageBox::Escape,
+            QMessageBox::NoButton, QMessageBox::NoButton);
+        Problema.exec(); // Give the user the bad news
+        throw Genexcept(TITRAQ_INCOMPATDATA);
+    }
+
+    // Strip out extra line feeds after reading the data symbol
+    Line = QString("");                 // Reset our line
+    while (Line.isEmpty() && !Tstream.atEnd()) {
+        Tstream.skipWhiteSpace();       // Strip and get
+        Line = Tstream.readLine();      // the new line
         if (Line.at(0) == QChar('#'))   // Remove comments
             Line = QString("");
     }

CVSTrac 2.0.1