Index: /trunk/BNC/rinex/rnxobsfile.cpp
===================================================================
--- /trunk/BNC/rinex/rnxobsfile.cpp	(revision 3717)
+++ /trunk/BNC/rinex/rnxobsfile.cpp	(revision 3718)
@@ -47,5 +47,5 @@
 using namespace std;
 
-const string t_rnxObsFile::t_rnxObsHeader::_emptyStr;
+const QString t_rnxObsFile::t_rnxObsHeader::_emptyStr;
 
 // Constructor
@@ -71,22 +71,21 @@
 // Read Header
 ////////////////////////////////////////////////////////////////////////////
-t_irc t_rnxObsFile::t_rnxObsHeader::read(ifstream* stream, int maxLines) {
+t_irc t_rnxObsFile::t_rnxObsHeader::read(QTextStream* stream, int maxLines) {
   int numLines = 0;
-  while ( stream->good() ) {
-    string line;
-    getline(*stream, line); ++numLines;
-    if (line.empty()) {
+  while ( stream->status() == QTextStream::Ok && !stream->atEnd() ) {
+    QString line = stream->readLine(); ++ numLines;
+    if (line.isEmpty()) {
       continue;
     }
-    if (line.find("END OF FILE") != string::npos) {
+    if (line.indexOf("END OF FILE") != -1) {
       break;
     }
-    string value = line.substr(0,60); stripWhiteSpace(value);
-    string key   = line.substr(60);   stripWhiteSpace(key);
+    QString value = line.mid(0,60).trimmed();
+    QString key   = line.mid(60).trimmed();
     if      (key == "END OF HEADER") {
       break;
     }
     else if (key == "RINEX VERSION / TYPE") {
-      istringstream in(value);
+      QTextStream in(value.toAscii(), QIODevice::ReadOnly);
       in >> _version;
     }
@@ -95,12 +94,12 @@
     }
     else if (key == "ANT # / TYPE") {
-      _antennaName = line.substr(20,20); stripWhiteSpace(_antennaName);
+      _antennaName = line.mid(20,20).trimmed();
     }
     else if (key == "INTERVAL") {
-      istringstream in(value);
+      QTextStream in(value.toAscii(), QIODevice::ReadOnly);
       in >> _interval;
     }
     else if (key == "WAVELENGTH FACT L1/2") {
-      istringstream in(value);
+      QTextStream in(value.toAscii(), QIODevice::ReadOnly);
       int wlFactL1 = 0;
       int wlFactL2 = 0;
@@ -115,5 +114,5 @@
       else {
         for (int ii = 0; ii < numSat; ii++) {
-          string prn; in >> prn;
+          QString prn; in >> prn;
           if (prn[0] == 'G') {
             int iPrn;
@@ -126,26 +125,26 @@
     }
     else if (key == "APPROX POSITION XYZ") {
-      istringstream in(value);
+      QTextStream in(value.toAscii(), QIODevice::ReadOnly);
       in >> _xyz[0] >> _xyz[1] >> _xyz[2];
     }
     else if (key == "ANTENNA: DELTA H/E/N") {
-      istringstream in(value);
+      QTextStream in(value.toAscii(), QIODevice::ReadOnly);
       in >> _antNEU[2] >> _antNEU[1] >> _antNEU[0];
     }
     else if (key == "ANTENNA: DELTA X/Y/Z") {
-      istringstream in(value);
+      QTextStream in(value.toAscii(), QIODevice::ReadOnly);
       in >> _antXYZ[0] >> _antXYZ[1] >> _antXYZ[2];
     }
     else if (key == "ANTENNA: B.SIGHT XYZ") {
-      istringstream in(value);
+      QTextStream in(value.toAscii(), QIODevice::ReadOnly);
       in >> _antBSG[0] >> _antBSG[1] >> _antBSG[2];
     }
     else if (key == "# / TYPES OF OBSERV") {
-      istringstream in(value);
+      QTextStream in(value.toAscii(), QIODevice::ReadOnly);
       int nTypes;
       in >> nTypes;
       _obsTypesV2.clear();
       for (int ii = 0; ii < nTypes; ii++) {
-        string hlp;
+        QString hlp;
         in >> hlp;
         _obsTypesV2.push_back(hlp);
@@ -153,5 +152,5 @@
     }
     else if (key == "SYS / # / OBS TYPES") {
-      istringstream* in = new istringstream(value);
+      QTextStream* in = new QTextStream(value.toAscii(), QIODevice::ReadOnly);
       char sys;
       int nTypes;
@@ -160,9 +159,9 @@
       for (int ii = 0; ii < nTypes; ii++) {
         if (ii > 0 && ii % 13 == 0) {
-          getline(*stream, line);  ++numLines;
+          line = stream->readLine(); ++numLines;
           delete in;
-          in = new istringstream(line);
-        }
-        string hlp;
+          in = new QTextStream(line.toAscii(), QIODevice::ReadOnly);
+        }
+        QString hlp;
         *in >> hlp;
         _obsTypesV3[sys].push_back(hlp);
@@ -185,5 +184,5 @@
   }
   else {
-    map<char, vector<string> >::const_iterator it = _obsTypesV3.find(sys);
+    map<char, vector<QString> >::const_iterator it = _obsTypesV3.find(sys);
     if (it != _obsTypesV3.end()) {
       return it->second.size();
@@ -197,10 +196,10 @@
 // Observation Type (satellite-system specific)
 ////////////////////////////////////////////////////////////////////////////
-const string& t_rnxObsFile::t_rnxObsHeader::obsType(char sys, int index) const {
+const QString& t_rnxObsFile::t_rnxObsHeader::obsType(char sys, int index) const {
   if (_version < 3.0) {
     return _obsTypesV2.at(index);
   }
   else {
-    map<char, vector<string> >::const_iterator it = _obsTypesV3.find(sys);
+    map<char, vector<QString> >::const_iterator it = _obsTypesV3.find(sys);
     if (it != _obsTypesV3.end()) {
       return it->second.at(index);
@@ -214,5 +213,5 @@
 // Constructor
 ////////////////////////////////////////////////////////////////////////////
-t_rnxObsFile::t_rnxObsFile(const string& fileName) {
+t_rnxObsFile::t_rnxObsFile(const QString& fileName) {
   _stream       = 0;
   _flgPowerFail = false;
@@ -222,6 +221,12 @@
 // Open
 ////////////////////////////////////////////////////////////////////////////
-void t_rnxObsFile::open(const string& fileName) {
-  _stream = new ifstream(expandEnvVar(fileName).c_str());
+void t_rnxObsFile::open(const QString& fileName) {
+
+  _fileName = fileName; expandEnvVar(_fileName);
+  _file     = new QFile(_fileName);
+  _file->open(QIODevice::ReadOnly | QIODevice::Text);
+  _stream = new QTextStream();
+  _stream->setDevice(_file);
+
   _header.read(_stream);
 
@@ -233,5 +238,5 @@
       const t_rnxEpo* rnxEpo = nextEpoch();
       if (!rnxEpo) {
-        throw string("t_rnxObsFile: not enough epochs");
+        throw QString("t_rnxObsFile: not enough epochs");
       }
       if (iEpo > 0) {
@@ -259,9 +264,10 @@
 void t_rnxObsFile::close() {
   delete _stream; _stream = 0;
+  delete _file;   _file = 0;
 }
 
 // Handle Special Epoch Flag
 ////////////////////////////////////////////////////////////////////////////
-void t_rnxObsFile::handleEpochFlag(int flag, const string& line) {
+void t_rnxObsFile::handleEpochFlag(int flag, const QString& line) {
 
   // Power Failure
@@ -293,5 +299,5 @@
   // --------------
   else {
-    throw string("t_rnxObsFile: unhandled flag\n" + line);
+    throw QString("t_rnxObsFile: unhandled flag\n" + line);
   }
 }
@@ -315,11 +321,9 @@
 const t_rnxObsFile::t_rnxEpo* t_rnxObsFile::nextEpochV3() {
 
-  while ( _stream->good() ) {
-
-    string line;
-
-    getline(*_stream, line);
-
-    if (line.empty()) {
+  while ( _stream->->status() == QTextStream::Ok && !_stream->atEnd() ) {
+
+    QString line = _stream->readLine();
+
+    if (line.isEmpty()) {
       continue;
     }
@@ -332,5 +336,5 @@
     }
 
-    istringstream in(line.substr(1));
+    QTextStream in(line.mid(1).toAscii(), QIODevice::ReadOnly);
 
     // Epoch Time
@@ -351,5 +355,5 @@
     // ------------
     for (int iSat = 0; iSat < numSat; iSat++) {
-      getline(*_stream, line);
+      line = _stream->readLine();
       _currEpo.rnxSat[iSat].satSys = line[0];
       readInt(line, 1, 2, _currEpo.rnxSat[iSat].satNum);
@@ -386,11 +390,9 @@
 const t_rnxObsFile::t_rnxEpo* t_rnxObsFile::nextEpochV2() {
 
-  while ( _stream->good() ) {
-
-    string line;
-
-    getline(*_stream, line);
-
-    if (line.empty()) {
+  while ( _stream->->status() == QTextStream::Ok && !_stream->atEnd() ) {
+
+    QString line = _stream->readLine();
+
+    if (line.isEmpty()) {
       continue;
     }
@@ -403,5 +405,5 @@
     }
 
-    istringstream in(line);
+    QTextStream in(line.toAscii(), QIODevice::ReadOnly);
 
     // Epoch Time
@@ -430,5 +432,5 @@
     for (int iSat = 0; iSat < numSat; iSat++) {
       if (iSat > 0 && iSat % 12 == 0) {
-        getline(*_stream, line);
+        line = _stream->readLine();
         pos = 32;
       }
@@ -443,9 +445,9 @@
     // ------------------------
     for (int iSat = 0; iSat < numSat; iSat++) {
-      getline(*_stream, line);
+      line = _stream->readLine();
       pos  = 0;
       for (int iType = 0; iType < _header.nTypes(_currEpo.rnxSat[iSat].satSys); iType++) {
         if (iType > 0 && iType % 5 == 0) {
-          getline(*_stream, line);
+          line = _stream->readLine();
           pos  = 0;
         }
Index: /trunk/BNC/rinex/rnxobsfile.h
===================================================================
--- /trunk/BNC/rinex/rnxobsfile.h	(revision 3717)
+++ /trunk/BNC/rinex/rnxobsfile.h	(revision 3718)
@@ -26,5 +26,5 @@
 #define RNXOBSFILE_H
 
-#include <QString>
+#include <QtCore>
 
 #include <fstream>
@@ -92,5 +92,5 @@
     ~t_rnxObsHeader();
 
-    t_irc           read(std::ifstream* stream, int maxLines = 0);
+    t_irc           read(QTextStream* stream, int maxLines = 0);
     int             nTypes(char sys) const;
     const QString&  obsType(char sys, int index) const;
@@ -115,7 +115,8 @@
   void handleEpochFlag(int flag, const QString& line);
 
+  QFile*         _file;
   QString        _fileName;
+  QTextStream*   _stream;
   t_rnxObsHeader _header;
-  std::ifstream* _stream;
   t_rnxEpo       _currEpo;
   bool           _flgPowerFail;
