--- a/QTfrontend/util/FileEngine.cpp Fri Nov 23 16:17:06 2012 +0400
+++ b/QTfrontend/util/FileEngine.cpp Fri Nov 23 16:19:01 2012 +0400
@@ -9,8 +9,8 @@
const QString FileEngineHandler::scheme = "physfs:/";
FileEngine::FileEngine(const QString& filename)
- : _handler(NULL)
- , _flags(0)
+ : m_handle(NULL)
+ , m_flags(0)
, m_bufferSet(false)
{
setFileName(filename);
@@ -26,24 +26,24 @@
close();
if (openMode & QIODevice::WriteOnly) {
- _handler = PHYSFS_openWrite(_filename.toUtf8().constData());
- _flags = QAbstractFileEngine::WriteOwnerPerm | QAbstractFileEngine::WriteUserPerm | QAbstractFileEngine::FileType;
+ m_handle = PHYSFS_openWrite(m_fileName.toUtf8().constData());
+ m_flags = QAbstractFileEngine::WriteOwnerPerm | QAbstractFileEngine::WriteUserPerm | QAbstractFileEngine::FileType;
}
else if (openMode & QIODevice::ReadOnly) {
- _handler = PHYSFS_openRead(_filename.toUtf8().constData());
+ m_handle = PHYSFS_openRead(m_fileName.toUtf8().constData());
}
else if (openMode & QIODevice::Append) {
- _handler = PHYSFS_openAppend(_filename.toUtf8().constData());
+ m_handle = PHYSFS_openAppend(m_fileName.toUtf8().constData());
}
else {
qWarning("[PHYSFS] Bad file open mode: %d", (int)openMode);
}
- if (!_handler) {
- qWarning("[PHYSFS] Failed to open %s, reason: %s", _filename.toUtf8().constData(), PHYSFS_getLastError());
+ if (!m_handle) {
+ qWarning("[PHYSFS] Failed to open %s, reason: %s", m_fileName.toUtf8().constData(), PHYSFS_getLastError());
return false;
}
@@ -53,8 +53,8 @@
bool FileEngine::close()
{
if (isOpened()) {
- int result = PHYSFS_close(_handler);
- _handler = NULL;
+ int result = PHYSFS_close(m_handle);
+ m_handle = NULL;
return result != 0;
}
@@ -63,22 +63,22 @@
bool FileEngine::flush()
{
- return PHYSFS_flush(_handler) != 0;
+ return PHYSFS_flush(m_handle) != 0;
}
qint64 FileEngine::size() const
{
- return _size;
+ return m_size;
}
qint64 FileEngine::pos() const
{
- return PHYSFS_tell(_handler);
+ return PHYSFS_tell(m_handle);
}
bool FileEngine::seek(qint64 pos)
{
- return PHYSFS_seek(_handler, pos) != 0;
+ return PHYSFS_seek(m_handle, pos) != 0;
}
bool FileEngine::isSequential() const
@@ -88,7 +88,7 @@
bool FileEngine::remove()
{
- return PHYSFS_delete(_filename.toUtf8().constData()) != 0;
+ return PHYSFS_delete(m_fileName.toUtf8().constData()) != 0;
}
bool FileEngine::mkdir(const QString &dirName, bool createParentDirectories) const
@@ -124,7 +124,7 @@
QString file;
QStringList result;
- char **files = PHYSFS_enumerateFiles(_filename.toUtf8().constData());
+ char **files = PHYSFS_enumerateFiles(m_fileName.toUtf8().constData());
for (char **i = files; *i != NULL; i++) {
file = QString::fromUtf8(*i);
@@ -141,7 +141,7 @@
QAbstractFileEngine::FileFlags FileEngine::fileFlags(FileFlags type) const
{
- return type & _flags;
+ return type & m_flags;
}
QString FileEngine::fileName(FileName file) const
@@ -155,15 +155,15 @@
}
case QAbstractFileEngine::BaseName:
{
- int l = _filename.lastIndexOf('/');
- QString s = _filename.mid(l + 1);
+ int l = m_fileName.lastIndexOf('/');
+ QString s = m_fileName.mid(l + 1);
return s;
}
case QAbstractFileEngine::DefaultName:
case QAbstractFileEngine::AbsoluteName:
default:
{
- QString s = "physfs:/" + _filename;
+ QString s = "physfs:/" + m_fileName;
return s;
}
}
@@ -176,7 +176,7 @@
{
case QAbstractFileEngine::ModificationTime:
default:
- return _datetime;
+ return m_date;
break;
};
}
@@ -184,29 +184,29 @@
void FileEngine::setFileName(const QString &file)
{
if(file.startsWith(FileEngineHandler::scheme))
- _filename = file.mid(FileEngineHandler::scheme.size());
+ m_fileName = file.mid(FileEngineHandler::scheme.size());
else
- _filename = file;
+ m_fileName = file;
PHYSFS_Stat stat;
- if (PHYSFS_stat(_filename.toUtf8().constData(), &stat) != 0) {
- _size = stat.filesize;
- _datetime = QDateTime::fromTime_t(stat.modtime);
+ if (PHYSFS_stat(m_fileName.toUtf8().constData(), &stat) != 0) {
+ m_size = stat.filesize;
+ m_date = QDateTime::fromTime_t(stat.modtime);
// _flags |= QAbstractFileEngine::WriteUserPerm;
- _flags |= QAbstractFileEngine::ReadUserPerm;
- _flags |= QAbstractFileEngine::ExistsFlag;
+ m_flags |= QAbstractFileEngine::ReadUserPerm;
+ m_flags |= QAbstractFileEngine::ExistsFlag;
switch (stat.filetype)
{
case PHYSFS_FILETYPE_REGULAR:
- _flags |= QAbstractFileEngine::FileType;
+ m_flags |= QAbstractFileEngine::FileType;
break;
case PHYSFS_FILETYPE_DIRECTORY:
- _flags |= QAbstractFileEngine::DirectoryType;
+ m_flags |= QAbstractFileEngine::DirectoryType;
break;
case PHYSFS_FILETYPE_SYMLINK:
- _flags |= QAbstractFileEngine::LinkType;
+ m_flags |= QAbstractFileEngine::LinkType;
break;
default: ;
}
@@ -215,24 +215,24 @@
bool FileEngine::atEnd() const
{
- return PHYSFS_eof(_handler) != 0;
+ return PHYSFS_eof(m_handle) != 0;
}
qint64 FileEngine::read(char *data, qint64 maxlen)
{
- return PHYSFS_readBytes(_handler, data, maxlen);
+ return PHYSFS_readBytes(m_handle, data, maxlen);
}
qint64 FileEngine::readLine(char *data, qint64 maxlen)
{
if(!m_bufferSet)
{
- PHYSFS_setBuffer(_handler, 4096);
+ PHYSFS_setBuffer(m_handle, 4096);
m_bufferSet = true;
}
qint64 bytesRead = 0;
- while(PHYSFS_readBytes(_handler, data, 1)
+ while(PHYSFS_readBytes(m_handle, data, 1)
&& maxlen
&& (*data == '\n'))
{
@@ -246,12 +246,12 @@
qint64 FileEngine::write(const char *data, qint64 len)
{
- return PHYSFS_writeBytes(_handler, data, len);
+ return PHYSFS_writeBytes(m_handle, data, len);
}
bool FileEngine::isOpened() const
{
- return _handler != NULL;
+ return m_handle != NULL;
}
QFile::FileError FileEngine::error() const