Qt 4.8
Functions | Variables
qfile.cpp File Reference
#include "qplatformdefs.h"
#include "qdebug.h"
#include "qfile.h"
#include "qfsfileengine.h"
#include "qtemporaryfile.h"
#include "qlist.h"
#include "qfileinfo.h"
#include "private/qiodevice_p.h"
#include "private/qfile_p.h"
#include "private/qsystemerror_p.h"

Go to the source code of this file.

Functions

static qint64 _qfile_writeData (QAbstractFileEngine *engine, QRingBuffer *buffer)
 
static QString locale_decode (const QByteArray &f)
 
static QByteArray locale_encode (const QString &f)
 

Variables

static const int QFILE_WRITEBUFFER_SIZE = 16384
 

Function Documentation

◆ _qfile_writeData()

static qint64 _qfile_writeData ( QAbstractFileEngine engine,
QRingBuffer buffer 
)
inlinestatic

Definition at line 1631 of file qfile.cpp.

Referenced by QFile::flush().

1632 {
1633  qint64 ret = engine->write(buffer->readPointer(), buffer->nextDataBlockSize());
1634  if (ret > 0)
1635  buffer->free(ret);
1636  return ret;
1637 }
const char * readPointer() const
Definition: qringbuffer_p.h:73
int nextDataBlockSize() const
Definition: qringbuffer_p.h:69
__int64 qint64
Definition: qglobal.h:942
virtual qint64 write(const char *data, qint64 len)
Writes len bytes from data to the file.
void free(int bytes)

◆ locale_decode()

static QString locale_decode ( const QByteArray f)
static

Definition at line 76 of file qfile.cpp.

Referenced by QFile::setDecodingFunction().

77 {
78 #if defined(Q_OS_DARWIN)
79  // Mac always gives us UTF-8 and decomposed, we want that composed...
81 #elif defined(Q_OS_SYMBIAN)
82  return QString::fromUtf8(f);
83 #else
84  return QString::fromLocal8Bit(f);
85 #endif
86 }
static QString fromLocal8Bit(const char *, int size=-1)
Returns a QString initialized with the first size characters of the 8-bit string str.
Definition: qstring.cpp:4245
QString normalized(NormalizationForm mode) const Q_REQUIRED_RESULT
Returns the string in the given Unicode normalization mode.
Definition: qstring.cpp:6635
static QString fromUtf8(const char *, int size=-1)
Returns a QString initialized with the first size bytes of the UTF-8 string str.
Definition: qstring.cpp:4302

◆ locale_encode()

static QByteArray locale_encode ( const QString f)
static

Definition at line 64 of file qfile.cpp.

Referenced by locale_decode(), and QFile::setEncodingFunction().

65 {
66 #if defined(Q_OS_DARWIN)
67  // Mac always expects UTF-8... and decomposed...
69 #elif defined(Q_OS_SYMBIAN)
70  return f.toUtf8();
71 #else
72  return f.toLocal8Bit();
73 #endif
74 }
QByteArray toUtf8() const Q_REQUIRED_RESULT
Returns a UTF-8 representation of the string as a QByteArray.
Definition: qstring.cpp:4074
QString normalized(NormalizationForm mode) const Q_REQUIRED_RESULT
Returns the string in the given Unicode normalization mode.
Definition: qstring.cpp:6635
QByteArray toLocal8Bit() const Q_REQUIRED_RESULT
Returns the local 8-bit representation of the string as a QByteArray.
Definition: qstring.cpp:4049

Variable Documentation

◆ QFILE_WRITEBUFFER_SIZE

const int QFILE_WRITEBUFFER_SIZE = 16384
static

Definition at line 62 of file qfile.cpp.

Referenced by QFilePrivate::putCharHelper(), and QFile::writeData().