当前位置: 首页>>代码示例>>C++>>正文


C++ QTextStream::eof方法代码示例

本文整理汇总了C++中QTextStream::eof方法的典型用法代码示例。如果您正苦于以下问题:C++ QTextStream::eof方法的具体用法?C++ QTextStream::eof怎么用?C++ QTextStream::eof使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QTextStream的用法示例。


在下文中一共展示了QTextStream::eof方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: readEntry

bool PrinttoolEntry::readEntry(QTextStream &t)
{
    QString line;
    QStringList args;

    m_resolutions.setAutoDelete(true);
    m_depths.setAutoDelete(true);
    m_resolutions.clear();
    m_depths.clear();
    while(!t.eof())
    {
        line = getPrintcapLine(t);
        if(line.isEmpty())
            break;
        if(line == "EndEntry")
            return !m_name.isEmpty();
        QStringList l = splitPrinttoolLine(line);
        if(l.count() > 1)
        {
            if(l[0] == "StartEntry")
                m_name = l[1];
            else if(l[0] == "GSDriver")
                m_gsdriver = l[1];
            else if(l[0] == "About")
                m_about = l[1];
            else if(l[0] == "Description")
                m_description = l[1];
            else if(l[0] == "Resolution" && l.count() > 2)
            {
                Resolution *resol = new Resolution;
                bool ok(false);
                resol->xdpi = l[1].toInt(&ok);
                if(ok)
                    resol->ydpi = l[2].toInt(&ok);
                if(l.count() > 3)
                    resol->comment = l[3];
                if(ok)
                    m_resolutions.append(resol);
                else
                    delete resol;
            }
            else if(l[0] == "BitsPerPixel" && l.count() > 1)
            {
                BitsPerPixel *dpth = new BitsPerPixel;
                dpth->bpp = l[1];
                if(l.count() > 2)
                    dpth->comment = l[2];
                m_depths.append(dpth);
            }
        }
    }
    return false;
}
开发者ID:,项目名称:,代码行数:53,代码来源:

示例2: readMwfile

// Read the element definition file.
void KMolCalc::readMwfile(QFile& f) {
  if (!f.open(IO_ReadOnly))
    return; //ERROR

  QTextStream fs (&f);
  QString line;
  while (!fs.eof()) {
    line = fs.readLine();
    SubUnit* s = SubUnit::makeSubUnit(line);
    elstable->replace(s->getName(), s);
  }
  f.close();
}
开发者ID:opieproject,项目名称:opie,代码行数:14,代码来源:kmolcalc.cpp

示例3: load

void ValueMap::load( QTextStream& ts )
{
   while ( !ts.eof() )
   {                                 // until end of file...	   
      QString s = ts.readLine();         // line of text excluding '\n'
      int pos = s.find('=');
      if( pos > 0 )                     // seems not to have a tag
      {
         QString key = s.left(pos);
         QString val = s.mid(pos+1);
         m_map[key] = val;
      }
   }
}
开发者ID:,项目名称:,代码行数:14,代码来源:

示例4: getPrintcapLine

QString getPrintcapLine(QTextStream& t, QString *lastcomment)
{
	QString	line, buffer, comm;
	while (!t.eof())
	{
		buffer = t.readLine().stripWhiteSpace();
		if (buffer.isEmpty() || buffer[0] == '#')
		{
			comm = buffer;
			continue;
		}
		line.append(buffer);
		if (line.right(1) == "\\")
		{
			line.truncate(line.length()-1);
			line = line.stripWhiteSpace();
		}
		else break;
	}
	if (lastcomment)
		*lastcomment = comm;
	return line;
}
开发者ID:,项目名称:,代码行数:23,代码来源:

示例5: dfDone

/***************************************************************************
  * is called, when the df-command has finished
**/
void KDiskFreeSp::dfDone()
{
    readingDFStdErrOut=true;

    QTextStream t (dfStringErrOut, IO_ReadOnly);
    QString s=t.readLine();
    if ( (s.isEmpty()) || ( s.left(10) != QString::fromLatin1("Filesystem") ) )
        kdError() << "Error running df command... got [" << s << "]" << endl;
    while ( !t.eof() ) {
        QString u,v;
        s=t.readLine();
        s=s.simplifyWhiteSpace();
        if ( !s.isEmpty() ) {
            //kdDebug(kfile_area) << "GOT: [" << s << "]" << endl;

            if (s.find(BLANK)<0)      // devicename was too long, rest in next line
                if ( !t.eof() ) {       // just appends the next line
                    v=t.readLine();
                    s=s.append(v);
                    s=s.simplifyWhiteSpace();
                    //kdDebug(kfile_area) << "SPECIAL GOT: [" << s << "]" << endl;
                }//if silly linefeed

            //kdDebug(kfile_area) << "[" << s << "]" << endl;

            //QString deviceName = s.left(s.find(BLANK));
            s=s.remove(0,s.find(BLANK)+1 );
            //kdDebug(kfile_area) << "    DeviceName:    [" << deviceName << "]" << endl;

            if (!NO_FS_TYPE)
                s=s.remove(0,s.find(BLANK)+1 ); // eat fs type

            u=s.left(s.find(BLANK));
            unsigned long kBSize = u.toULong();
            s=s.remove(0,s.find(BLANK)+1 );
            //kdDebug(kfile_area) << "    Size:       [" << kBSize << "]" << endl;

            u=s.left(s.find(BLANK));
            unsigned long kBUsed = u.toULong();
            s=s.remove(0,s.find(BLANK)+1 );
            //kdDebug(kfile_area) << "    Used:       [" << kBUsed << "]" << endl;

            u=s.left(s.find(BLANK));
            unsigned long kBAvail = u.toULong();
            s=s.remove(0,s.find(BLANK)+1 );
            //kdDebug(kfile_area) << "    Avail:       [" << kBAvail << "]" << endl;


            s=s.remove(0,s.find(BLANK)+1 );  // delete the capacity 94%
            QString mountPoint = s.stripWhiteSpace();
            //kdDebug(kfile_area) << "    MountPoint:       [" << mountPoint << "]" << endl;

            if ( mountPoint == m_mountPoint )
            {
                //kdDebug(kfile_area) << "Found mount point. Emitting" << endl;
                emit foundMountPoint( mountPoint, kBSize, kBUsed, kBAvail );
                emit foundMountPoint( kBSize, kBUsed, kBAvail, mountPoint ); // sic!
            }
        }//if not header
    }//while further lines available

    readingDFStdErrOut=false;
    emit done();
    delete this;
}
开发者ID:,项目名称:,代码行数:68,代码来源:

示例6: processLines

//void modCalcAngDist::processLines( const QFile * fIn ) {
void modCalcAngDist::processLines( QTextStream &istream ) {

	// we open the output file

//	QTextStream istream(&fIn);
	QString outputFileName;
	outputFileName = OutputLineEditBatch->text();
	QFile fOut( outputFileName );
	fOut.open(IO_WriteOnly);
	QTextStream ostream(&fOut);

	QString line;
	QString space = " ";
	int i = 0;
	SkyPoint sp0, sp1;
	dms ra0B, dec0B, ra1B, dec1B, dist;

	while ( ! istream.eof() ) {
		line = istream.readLine();
		line.stripWhiteSpace();

		//Go through the line, looking for parameters

		QStringList fields = QStringList::split( " ", line );

		i = 0;

		// Read RA and write in ostream if corresponds

		if(ra0CheckBatch->isChecked() ) {
			ra0B = dms::fromString( fields[i],FALSE);
			i++;
		} else
			ra0B = ra0BoxBatch->createDms(FALSE);

		if ( allRadioBatch->isChecked() )
			ostream << ra0B.toHMSString() << space;
		else
			if(ra0CheckBatch->isChecked() )
				ostream << ra0B.toHMSString() << space;

		// Read DEC and write in ostream if corresponds

		if(dec0CheckBatch->isChecked() ) {
			dec0B = dms::fromString( fields[i], TRUE);
			i++;
		} else
			dec0B = dec0BoxBatch->createDms();

		if ( allRadioBatch->isChecked() )
			ostream << dec0B.toDMSString() << space;
		else
			if(dec0CheckBatch->isChecked() )
				ostream << dec0B.toDMSString() << space;
		
		// Read RA and write in ostream if corresponds

		if(ra1CheckBatch->isChecked() ) {
			ra1B = dms::fromString( fields[i],FALSE);
			i++;
		} else
			ra1B = ra1BoxBatch->createDms(FALSE);

		if ( allRadioBatch->isChecked() )
			ostream << ra1B.toHMSString() << space;
		else
			if(ra1CheckBatch->isChecked() )
				ostream << ra1B.toHMSString() << space;

		// Read DEC and write in ostream if corresponds

		if(dec1CheckBatch->isChecked() ) {
			dec1B = dms::fromString( fields[i], TRUE);
			i++;
		} else
			dec1B = dec1BoxBatch->createDms();

		if ( allRadioBatch->isChecked() )
			ostream << dec1B.toDMSString() << space;
		else
			if(dec1CheckBatch->isChecked() )
				ostream << dec1B.toDMSString() << space;

		sp0 = SkyPoint (ra0B, dec0B);
		sp1 = SkyPoint (ra1B, dec1B);
		dist = sp0.angularDistanceTo(&sp1);

		ostream << dist.toDMSString() << endl;
	}

	fOut.close();
}
开发者ID:,项目名称:,代码行数:93,代码来源:

示例7: loadFromLex

bool kvoctrainDoc::loadFromLex (QTextStream& is)
{

  langs.clear();
  vocabulary.clear();
  QString version,
          info1,
          s_dummy,
          title,
          f_keys,
          ident,
          orgID,
          transID;

  int     i_dummy,
          type,
          f_grade,
          t_grade,
          lesson;

  int lines = 10000000;

  version = is.readLine();
  info1 = is.readLine();
  ident = extract (info1);

  orgID = extract (info1);
  if (orgID.isEmpty())
    orgID = "original";

  transID = extract (info1);
  if (transID.isEmpty())
    transID = "translation";

  if (ident != "LEX" || version != LEX_IDENT_50) {
    errorLex (1, "invalid file format");
    return false;
  }

  // first two chars usually give language code:
  // english  ==> en
  // Deutsch  ==> de
  // italano  ==> it

  langs.push_back (orgID.left(2).lower());
  langs.push_back (transID.left(2).lower());

  QTextStream params (info1, IO_ReadOnly);
  params >> i_dummy;
  params >> i_dummy;
  params >> i_dummy;
  params >> i_dummy;
  params >> i_dummy;
  params >> i_dummy;
  params >> i_dummy;
  params >> i_dummy;
  params >> i_dummy;
  params >> i_dummy;
  params >> i_dummy;
  params >> i_dummy;
  params >> i_dummy;
  params >> lines;

  s_dummy = is.readLine();  // Font
  s_dummy = is.readLine();  // Font
  title = is.readLine();
  setTitle (title);
  s_dummy = is.readLine();
  s_dummy = is.readLine();
  s_dummy = is.readLine();
  s_dummy = is.readLine();
  s_dummy = is.readLine();
  s_dummy = is.readLine();
  s_dummy = is.readLine();
  s_dummy = is.readLine();
  s_dummy = is.readLine();
  s_dummy = is.readLine();
  s_dummy = is.readLine();

  if (!loadTypeNameLex (is))
    return false;

  if (!loadLessonLex (is))
    return false;

  f_keys = is.readLine();

  int ent_percent = (int) lines / 100;
  float f_ent_percent = (int) lines / 100.0;
  emit progressChanged(this, 0);

  for (int i = 0; !is.eof() && i < lines; i++) {
    if (ent_percent != 0 && (i % ent_percent) == 0 ) {
      emit progressChanged(this, int(i / f_ent_percent));
    }

    is >> type;
    is >> i_dummy;
    is >> i_dummy;
    is >> i_dummy;
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例8: readEntry

ConversionStatus GettextImportPlugin::readEntry(QTextStream& stream)
{
   //kdDebug( KBABEL ) << k_funcinfo << " START" << endl;
   enum {Begin,Comment,Msgctxt,Msgid,Msgstr} part=Begin;

   QString line;
   bool error=false;
   bool recoverableError=false;
   bool seenMsgctxt=false;
   _msgstr.clear();
   _msgstr.append(QString());
   _msgid.clear();
   _msgid.append(QString());
   _msgctxt=QString();
   _comment=QString();
   _gettextPluralForm=false;
   _obsolete=false;
   
   QStringList::Iterator msgstrIt=_msgstr.begin();
   
   while( !stream.eof() )
   {
       const int pos=stream.device()->at();

       line=stream.readLine();

       //kdDebug() << "Parsing line: " << line << endl;

       // ### Qt4: no need of a such a check
       if(line.isNull()) // file end
          break;
       else if ( line.startsWith( "<<<<<<<" ) || line.startsWith( "=======" ) || line.startsWith( ">>>>>>>" ) )
       {
          // We have found a CVS/SVN conflict marker. Abort.
          // (It cannot be any useful data of the PO file, as otherwise the line would start with at least a quote)
          kdError(KBABEL) << "CVS/SVN conflict marker found! Aborting!" << endl << line << endl;
          return PARSE_ERROR;
       }
       
       // remove whitespaces from beginning and end of line
       line=line.stripWhiteSpace();

       if(part==Begin)
       {
           // ignore trailing newlines
           if(line.isEmpty())
              continue;

           if(line.startsWith("#~"))
           {
              _obsolete=true;
	      part=Comment;
	      _comment=line;
           }
           else if(line.startsWith("#"))
           {
               part=Comment;
               _comment=line;
           }
           else if(line.find(QRegExp("^msgctxt\\s*\".*\"$")) != -1)
           {
               part=Msgctxt;

               // remove quotes at beginning and the end of the lines
               line.remove(QRegExp("^msgctxt\\s*\""));
               line.remove(QRegExp("\"$"));
               _msgctxt=line;
               seenMsgctxt=true;
           }
           else if(line.find(QRegExp("^msgid\\s*\".*\"$")) != -1)
           {
               part=Msgid;

               // remove quotes at beginning and the end of the lines
               line.remove(QRegExp("^msgid\\s*\""));
               line.remove(QRegExp("\"$"));

               (*(_msgid).begin())=line;
           }
		     // one of the quotation marks is missing
           else if(line.find(QRegExp("^msgid\\s*\"?.*\"?$")) != -1)
           {
               part=Msgid;

               // remove quotes at beginning and the end of the lines
               line.remove(QRegExp("^msgid\\s*\"?"));
               line.remove(QRegExp("\"$"));

               (*(_msgid).begin())=line;

               if(!line.isEmpty())
                  recoverableError=true;
           }
           else
           {
               kdDebug(KBABEL) << "no comment, msgctxt or msgid found after a comment: " << line << endl;
               error=true;
               break;
           }
       }
//.........这里部分代码省略.........
开发者ID:serghei,项目名称:kde-kdesdk,代码行数:101,代码来源:gettextimport.cpp


注:本文中的QTextStream::eof方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。