![]() |
Vault
4.1
|
VAbstractFileStream is a VStream subclass that implements the common part of the buffered and unbuffered file concrete subclasses, and defines the pure virtual API that they must implement. More...
#include <vabstractfilestream.h>
Public Member Functions | |
VAbstractFileStream () | |
Constructs an undefined stream (you will have to set it up with a subsequent call to setNode() or a method specific to the subclass). | |
VAbstractFileStream (const VFSNode &node) | |
Constructs a stream with a node. | |
virtual | ~VAbstractFileStream () |
Destructor. | |
void | setNode (const VFSNode &node) |
Sets the file node, so that you can use the empty constructor, and call this method after construction (but before opening the file). | |
const VFSNode & | getNode () const |
Returns the file node. | |
virtual void | openReadOnly ()=0 |
Opens the file read-only. | |
virtual void | openReadWrite ()=0 |
Opens the file read-write, creating the file if it does not exist. | |
virtual void | openWrite ()=0 |
Opens the file for writing, creating the file if it does not exist. | |
virtual bool | isOpen () const =0 |
Returns true if the file stream is open. | |
virtual void | close ()=0 |
Closes the file stream. | |
Protected Member Functions | |
void | _throwIfOpenFailed (const VString &failedMethod, const VString &path) |
Called by the open methods after they attempt to open the stream; throws a VException if the stream is not open. | |
Protected Attributes | |
VFSNode | mNode |
The node representing the file. |
VAbstractFileStream is a VStream subclass that implements the common part of the buffered and unbuffered file concrete subclasses, and defines the pure virtual API that they must implement.
Definition at line 29 of file vabstractfilestream.h.
VAbstractFileStream::VAbstractFileStream | ( | const VFSNode & | node | ) |
Constructs a stream with a node.
node | the node representing the file |
Definition at line 20 of file vabstractfilestream.cpp.
References VFSNode::getName(), and VStream::mName.
void VAbstractFileStream::setNode | ( | const VFSNode & | node | ) |
Sets the file node, so that you can use the empty constructor, and call this method after construction (but before opening the file).
node | the node representing the file |
Definition at line 26 of file vabstractfilestream.cpp.
References VFSNode::getName(), VStream::mName, and mNode.
virtual void VAbstractFileStream::openReadOnly | ( | ) | [pure virtual] |
Opens the file read-only.
Throws a VException if it cannot be opened.
Implemented in VBufferedFileStream, and VDirectIOFileStream.
virtual void VAbstractFileStream::openReadWrite | ( | ) | [pure virtual] |
Opens the file read-write, creating the file if it does not exist.
Throws a VException if it cannot be opened.
Implemented in VBufferedFileStream, and VDirectIOFileStream.
virtual void VAbstractFileStream::openWrite | ( | ) | [pure virtual] |
Opens the file for writing, creating the file if it does not exist.
Throws a VException if it cannot be opened.
Implemented in VBufferedFileStream, and VDirectIOFileStream.
void VAbstractFileStream::_throwIfOpenFailed | ( | const VString & | failedMethod, |
const VString & | path | ||
) | [protected] |
Called by the open methods after they attempt to open the stream; throws a VException if the stream is not open.
failedMethod | the name of the method that was originally called; used to build the error message |
path | path of file we failed to open; used to build the error message |
Definition at line 35 of file vabstractfilestream.cpp.
References VString::chars(), and isOpen().