|
/**************************************************************************\
created: 2001/03/04
created: 4:3:2001 12:17
filename: Parser\prsExceptions.h
file path: .\Parser
file base: prsExceptions
file ext: h
author: Alex Kucherenko
purpose: In file declared all exceptions which can be throwed by Parser
\**************************************************************************/
#ifndef _PARSER_TODO_EXCEPTIONS_H_
#define _PARSER_TODO_EXCEPTIONS_H_
// Disable some warnings while using STL
#pragma warning (disable : 4800 4290 4786 4503 )
// Enable warning level 3 for STL
#pragma warning ( push, 3 )
#include <string>
#include <vector>
#include <map>
#include <fstream>
// Disable warning level 3 and return default level
#pragma warning( pop )
// Set std::string to our namespace like simple string
typedef std::string string;
// -- here defined main types because this header include all
// parser files --
typedef std::map< long, string > TLineMapper;
typedef TLineMapper::iterator TLineMapperIter;
typedef std::vector< string > TStrArray;
typedef TStrArray::iterator TStrArrayIter;
#ifndef MAX_STRING_LENGTH
#define MAX_STRING_LENGTH 8192
#endif
class CToDoException
{
public:
// Constructor which set error message
CToDoException( const string &ErrorMessage ) :
m_strError( ErrorMessage ), m_strMore( " " ) { };
// Constructor which set error ad moreinfo messages
CToDoException( const string &ErrorMessage, const string &MoreInfo ) :
m_strError( ErrorMessage ),
m_strMore( MoreInfo ) { };
// destructor
virtual ~CToDoException( ) { };
// Get More Info message
string GetMoreInfo( void ) const
{
return m_strMore;
};
// Get ErrorInfo message
string GetErrorMessage( void ) const
{
return m_strError;
};
protected:
// Used by classes which inherite this class for modifying MoreInfo var
void SetMoreInfo( const string &MoreInfo )
{
m_strMore = MoreInfo;
};
// Used by classes which inherite this class for modifying ErrorInfo var
void SetErrorMessage( const string &Error )
{
m_strError = Error;
};
private:
// private memberes of Exception class
string m_strError;
string m_strMore;
};
//////////////////////////////////////////////////////////////////////////
// Exception will be created when class have no elements for iterator
class CToDoNoElements : public CToDoException
{
public:
CToDoNoElements() : CToDoException( "ERROR: No elements in class" ) { };
CToDoNoElements( const string &MoreInfo ) :
CToDoException ( "ERROR: No elements in class", MoreInfo ) { };
};
//////////////////////////////////////////////////////////////////////////
// Exception will be created when iterator rich first element
class CToDoFirstRiched : public CToDoException
{
public:
CToDoFirstRiched() : CToDoException( "WARNING: First element riched by iterator" ) { };
CToDoFirstRiched( const string &MoreInfo ) :
CToDoException( "WARNING: First element riched by iterator", MoreInfo ) { };
};
//////////////////////////////////////////////////////////////////////////
// Exception will be created whe iterator rich last element
class CToDoLastRiched : public CToDoException
{
public:
CToDoLastRiched() : CToDoException( "WARNING: Last Element riched by iterator" ) { };
CToDoLastRiched( const string &MoreInfo ) :
CToDoException( "WARNING: Last Element riched by iterator", MoreInfo ) { };
};
//////////////////////////////////////////////////////////////////////////
// Excepttion will be created if error acquired while work with file
class CToDoFileWork : public CToDoException
{
public:
CToDoFileWork() : CToDoException( "ERROR: While work with file acquired error" ) { };
CToDoFileWork( const string &MoreInfo ) :
CToDoException( "ERROR: While work with file acquired error", MoreInfo ) { };
};
#endif /* _PARSER_TODO_EXCEPTIONS_H_ */
//:> End of file
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.