STE-Industries: utilities testing
GraphicSpace::FileException Class Reference

#include "FileException.h"

Inheritance diagram for GraphicSpace::FileException:
Inheritance graph
Collaboration diagram for GraphicSpace::FileException:
Collaboration graph

Public Member Functions

 FileException (const FileException &Argument) noexcept=default
 
 FileException (FileException &&Argument) noexcept=default
 
 FileException (FileExceptionType thisExceptionKind, const char *thisFilename) noexcept
 
 ~FileException (void) noexcept=default
 
FileExceptionoperator= (const FileException &Argument) noexcept=default
 
FileExceptionoperator= (FileException &&Argument) noexcept=default
 
void Write (FILE *OutputFile) const noexcept override
 

Private Attributes

FileExceptionType ExceptionKind
 
const char * FileName
 

Static Private Attributes

static const char *const ErrorFormat = "I/O error: %s file %s\n"
 
static const char *const Message []
 

Additional Inherited Members

 Exception (void) noexcept
 
virtual ~Exception (void) noexcept=default
 
- Static Private Member Functions inherited from GraphicSpace::Exception
static void FatalError (void) noexcept
 

Detailed Description

The FileException class represents a graphic exceptions throw during an I/O operation.

Definition at line 60 of file FileException.h.

Constructor & Destructor Documentation

◆ FileException() [1/3]

GraphicSpace::FileException::FileException ( FileExceptionType  thisExceptionKind,
const char *  thisFileName 
)
noexcept
Description:
Constructor.
Parameters
thisExceptionKindKind of the exception.
thisFileNameName of the file that caused the exception.
Exceptions
None.
Returns
Not applicable
Note
If thisFileName is not a valid pointer to a zero terminated string, the behavior is unpredictable.
The file name must be valid at the moment in which the exception is caught and a message is printed, otherwise the behavior is unpredictable.

Definition at line 54 of file FileException.cpp.

◆ FileException() [2/3]

GraphicSpace::FileException::FileException ( const FileException Argument)
defaultnoexcept

◆ FileException() [3/3]

GraphicSpace::FileException::FileException ( FileException &&  Argument)
defaultnoexcept

◆ ~FileException()

GraphicSpace::FileException::~FileException ( void  )
defaultnoexcept

Member Function Documentation

◆ operator=() [1/2]

FileException& GraphicSpace::FileException::operator= ( const FileException Argument)
defaultnoexcept

◆ operator=() [2/2]

FileException& GraphicSpace::FileException::operator= ( FileException &&  Argument)
defaultnoexcept

◆ Write()

void GraphicSpace::FileException::Write ( FILE *  OutputFile) const
overridevirtualnoexcept
Description:
Write an error message.
Parameters
OutputFilePointer to the file on which the message will be written.
Exceptions
None.
Returns
None.
Note
If OutputFile is not a valid file, opened for writing, the behavior is unpredictable.
If an error occurs while writing on OutputFile, the process is terminated.

Reimplemented from GraphicSpace::Exception.

Definition at line 81 of file FileException.cpp.

Member Data Documentation

◆ ErrorFormat

GraphicSpace::FileException::ErrorFormat = "I/O error: %s file %s\n"
staticprivate

Format string used to write error messages.

Definition at line 74 of file FileException.h.

◆ ExceptionKind

GraphicSpace::FileException::ExceptionKind
private

Kind of the exception.

Definition at line 66 of file FileException.h.

◆ FileName

GraphicSpace::FileException::FileName
private

Name of the file that caused the exception;

Definition at line 70 of file FileException.h.

◆ Message

GraphicSpace::FileException::Message
staticprivate
Initial value:
=
{
"cannot open",
"error while reading from",
"error while writing on",
"error while seeking on",
"error while closing"
}

Array of error messages, one for each error.

Note
The sequence of messages must correspond to the sequence of values of the FileExceptionType type.
See also
FileExceptionType

Definition at line 84 of file FileException.h.


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