Beispiel #1
0
 /** 
  * @brief Get next line of valid data, protected
  *  
  * This method overwrites <b>TextFile</b>'s protected method of 
  * the same name.  It is called by the public overwritten method
  * <b>GetLine()</b>, as in the parent class.
  *
  * @param line String to be rewritten with contents of the
  *             next line read from file
  * @returns <b>bool</b> Indicates whether line was read
  * @throws Isis::iException::Io "Error reading text file" 
  * @see GetLine() 
  */
  bool CisscalFile::p_GetLine(string &line) {
   OpenChk(true);
   // Try to read the next line
   getline(p_stream, line);
   // Check for end of file
   if (p_stream.eof()) {
     line = "";
     return false;
   }
   // See if an error occured
   if (!p_stream.good()) {
     line = "";
     string message = "TextFile:GetLine: -> Error reading text file: ["
                    + p_filename + "]";
     throw Isis::iException::Message(Isis::iException::Io,message,_FILEINFO_);    
   }
   // Search for tag "\begindata" if it was not already found by recursively using this method
     if (!p_begindataFound) {
       if(line.find("\\begindata") == string::npos){
         return p_GetLine(line);
       }
       p_begindataFound = true;
       return p_GetLine(line);
     }
   // We have a good line
   return true;
  }
Beispiel #2
0
  /**
   * @brief Get next line of valid data, protected
   *
   * This method overwrites <b>TextFile</b>'s protected method of
   * the same name.  It is called by the public overwritten method
   * <b>GetLine()</b>, as in the parent class.
   *
   * @param line String to be rewritten with contents of the
   *             next line read from file
   * @returns <b>bool</b> Indicates whether line was read
   * @throws Isis::iException::Io "Error reading text file"
   * @see GetLine()
   */
  bool CisscalFile::p_GetLine(QString &line) {
    OpenChk(true);
    // Try to read the next line
    std::string lineTmp;
    getline(p_stream, lineTmp);
    line = lineTmp.c_str();

    // Check for end of file
    if(p_stream.eof()) {
      line = "";
      return false;
    }
    // See if an error occured
    if(!p_stream.good()) {
      line = "";
      QString message = "TextFile:GetLine: -> Error reading text file: ["
                        + p_filename + "]";
      throw IException(IException::Io, message, _FILEINFO_);
    }
    // Search for tag "\begindata" if it was not already found by recursively using this method
    if(!p_begindataFound) {
      if(!line.contains("\\begindata")) {
        return p_GetLine(line);
      }
      p_begindataFound = true;
      return p_GetLine(line);
    }
    // We have a good line
    return true;
  }
Beispiel #3
0
 /** 
  * @brief Get next line of valid data 
  *  
  * This protected method overrides the base class method from  
  * <b>TextFile</b> of the same name. It finds the next line of 
  * valid data. If the <tt>"\begindata"</tt> tag has not been 
  * already found, it searches for that tag. Once found, every 
  * line beyond that is considered data and the method will 
  * retrieve the next line. Returns True if read a line, False if 
  * End Of File. 
  *
  * @param line String to be rewritten with contents of the
  *             next line read from file
  * @returns <b>bool</b> Indicates whether line was read
  * @throws Isis::iException::Io "Error reading text file" 
  * @see p_GetLine() 
  */
  bool CisscalFile::GetLine(string &line) {
    return p_GetLine(line);
  }