Logo Search packages:      
Sourcecode: qt4-x11 version File versions

QString QTextStream::readAll (  ) 

Reads the entire content of the stream, and returns it as a QString. Avoid this function when working on large files, as it will consume a significant amount of memory.

Calling readLine() is better if you do not know how much data is available.

See also:
readLine()

Definition at line 1550 of file qtextstream.cpp.

Referenced by MainWindow::loadFile(), and TextFinder::loadTextFile().

{
    Q_D(QTextStream);
    CHECK_VALID_STREAM(QString());

    const QChar *readPtr;
    int length;
    if (!d->scan(&readPtr, &length, /* maxlen = */ 0, QTextStreamPrivate::EndOfFile))
        return QString();

    QString tmp = QString(readPtr, length);
    d->consumeLastToken();
    return tmp;
}


Generated by  Doxygen 1.6.0   Back to index