Vault  4.1
Public Member Functions | Protected Member Functions | Protected Attributes
VAbstractFileStream Class Reference

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>

Inheritance diagram for VAbstractFileStream:
VStream VBufferedFileStream VDirectIOFileStream

List of all members.

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.

Detailed Description

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.

See also:
VBufferedFileStream
VDirectIOFileStream

Definition at line 29 of file vabstractfilestream.h.


Constructor & Destructor Documentation

VAbstractFileStream::VAbstractFileStream ( const VFSNode &  node)

Constructs a stream with a node.

Parameters:
nodethe node representing the file

Definition at line 20 of file vabstractfilestream.cpp.

References VFSNode::getName(), and VStream::mName.


Member Function Documentation

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).

Parameters:
nodethe 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.

Parameters:
failedMethodthe name of the method that was originally called; used to build the error message
pathpath 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().


The documentation for this class was generated from the following files:

Copyright ©1997-2014 Trygve Isaacson. All rights reserved. This documentation was generated with Doxygen.