59 Log::error(
"QtFile::open(): file already open.\n");
63 QIODevice::OpenMode qmode;
66 qmode = QIODevice::ReadOnly;
68 qmode = QIODevice::WriteOnly;
71 mQFile.setFileName(
path().toStdString().c_str() );
72 if ( !
mQFile.open( qmode ) )
93 return QFile(
path().toStdString().c_str() ).size();
98 return !
path().
empty() && QFile::exists(
path().toStdString().c_str() );
105 Log::error(
"QtFile::read_Implementation() called on closed file!\n");
108 return mQFile.read( (
char*)buffer, byte_count );
115 Log::error(
"QtFile::write_Implementation() called on closed file!\n");
118 return mQFile.write( (
char*)buffer, byte_count );
125 Log::error(
"QtFile::position_Implementation() called on closed file!\n");
135 Log::error(
"QtFile::seekSet_Implementation() called on closed file!\n");
145 file->operator=(*this);
virtual long long position_Implementation() const
A simple String formatting class.
bool open(const String &path, EOpenMode mode)
The specified path is relative to the parent directory. See setPhysicalPath().
The String class implements an advanced UTF16 (Unicode BMP) string manipulation engine.
virtual long long read_Implementation(void *buffer, long long byte_count)
virtual bool seekSet_Implementation(long long offset)
static void error(const String &message)
Use this function to provide information about run-time errors: file not found, out of memory...
virtual bool exists() const
Returns true if the file exists.
virtual ref< VirtualFile > clone() const
Creates a clone of this class instance.
const String & path() const
Returns the path of the file.
Visualization Library main namespace.
bool empty() const
Returns true if length() == 0.
QtFile(const QtFile &other)
virtual long long write_Implementation(const void *buffer, long long byte_count)
void setPath(const String &name)
Changes the path bound to a VirtualFile. Use carefully this function, you shouldn't rename a VirtualF...
virtual long long size() const
Returns the file size in bytes or -1 on error.
The ref<> class is used to reference-count an Object.
virtual void close()
Closes the file.
virtual bool isOpen() const
Returns true if the file has been opened.