_________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          T H E   W A R   B E G I N S
                   Stratagus - A free fantasy real time strategy game engine

Public Member Functions | Protected Attributes | List of all members
gcn::Exception Class Reference

#include <exception.h>

Public Member Functions

 Exception ()
 
 Exception (const std::string &message)
 
 Exception (const std::string &message, const std::string &function, const std::string &filename, int line)
 
const std::string & getFunction () const
 
const std::string & getMessage () const
 
const std::string & getFilename () const
 
int getLine () const
 

Protected Attributes

std::string mFunction
 
std::string mMessage
 
std::string mFilename
 
int mLine
 

Detailed Description

An exception containing a message, a file and a line number. Guichan will only throw exceptions of this class. You can use this class for your own exceptions. A nifty feature of the excpetion class is that it can tell you from which line and file it was thrown. To make things easier when throwing exceptions there exists a macro for creating exceptions which automatically sets the filename and line number.

EXAMPLE:

throw GCN_EXCEPTION("my error message");

Constructor & Destructor Documentation

◆ Exception() [1/3]

gcn::Exception::Exception ( )

Constructor.

◆ Exception() [2/3]

gcn::Exception::Exception ( const std::string &  message)

Constructor.

Parameters
messagethe error message.

◆ Exception() [3/3]

gcn::Exception::Exception ( const std::string &  message,
const std::string &  function,
const std::string &  filename,
int  line 
)

Constructor.

NOTE: Don't use this constructor. Use the GCN_EXCEPTION macro instead.

Parameters
messagethe error message.
functionthe function name.
filenamethe name of the file.
linethe line number.

Member Function Documentation

◆ getFilename()

const std::string & gcn::Exception::getFilename ( ) const

Gets the filename in which the exceptions was thrown.

Returns
the filename in which the exception was thrown.

◆ getFunction()

const std::string & gcn::Exception::getFunction ( ) const

Gets the function name in which the exception was thrown.

Returns
the function name in which the exception was thrown.

◆ getLine()

int gcn::Exception::getLine ( ) const

Gets the line number of the line where the exception was thrown.

Returns
the line number of the line where the exception was thrown.

◆ getMessage()

const std::string & gcn::Exception::getMessage ( ) const

Gets the error message of the exception.

Returns
the error message.

Member Data Documentation

◆ mFilename

std::string gcn::Exception::mFilename
protected

◆ mFunction

std::string gcn::Exception::mFunction
protected

◆ mLine

int gcn::Exception::mLine
protected

◆ mMessage

std::string gcn::Exception::mMessage
protected

The documentation for this class was generated from the following files:
GCN_EXCEPTION
#define GCN_EXCEPTION(mess)
Definition: exception.h:73
(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.