jaula_exception.h
/*
* jaula_exception.h : JSON Analysis User Library Acronym
* Error handling definitions
*
* Copyright (C) 2007, 2008, 2009 Kombo Morongo <morongo666@gmail.com>
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or (at
* your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
* svn info:
* $Author: morongo $
* $HeadURL: https://jaula.svn.sourceforge.net/svnroot/jaula/tags/jaula-1.4.0/jaula/jaula_exception.h $
* $Id: jaula_exception.h 45 2009-01-11 16:17:03Z morongo $
* $Revision: 45 $
*/
#ifndef _JAULA_EXCEPTION_H_
#define _JAULA_EXCEPTION_H_
#include <ostream>
#include <string>
namespace JAULA
{ // namespace JAULA
class Exception
{ // class Exception
public:
enum ExCode
{ // enum ExCode
NO_ERROR
, BAD_DATA_TYPE
, NAME_DUPLICATED
, LEXAN_ERROR
, SYNTAX_ERROR
}; // enum ExCode
Exception(ExCode code = NO_ERROR
, std::string const &detail = ""
, std::string const &action = ""
, std::string const &origin = "");
Exception(Exception const &orig);
virtual ~Exception();
ExCode getCode(void) const;
virtual std::string const &getDetail(void) const;
std::string const &getAction(void) const;
std::string const &getOrigin(void) const;
void display(std::ostream &ostr) const;
void setDetail(std::string const &detail);
void setAction(std::string const &action);
void setOrigin(std::string const &origin);
void addOrigin(std::string const &origin);
Exception &operator=(Exception const &orig);
protected:
void setCode(ExCode code);
private:
ExCode code_;
std::string detail_;
std::string action_;
std::string origin_;
}; // class Exception
} // namespace JAULA
std::ostream &operator<<(std::ostream &ostr, JAULA::Exception const &ex);
#endif
// EOF $Id: jaula_exception.h 45 2009-01-11 16:17:03Z morongo $
JAULA::Exception
Base class for error handling exceptions.
Definition jaula_exception.h:54
JAULA::Exception::setCode
void setCode(ExCode code)
Establishes the error code for the exception.
Definition jaula_exception.cc:124
JAULA::Exception::operator=
Exception & operator=(Exception const &orig)
Assignment operator.
Definition jaula_exception.cc:155
JAULA::Exception::origin_
std::string origin_
Container for where the exception was detected.
Definition jaula_exception.h:230
JAULA::Exception::getOrigin
std::string const & getOrigin(void) const
Retrieves the method being run when the exception arose.
Definition jaula_exception.cc:77
JAULA::Exception::setDetail
void setDetail(std::string const &detail)
Establishes the description for the exception.
Definition jaula_exception.cc:129
JAULA::Exception::action_
std::string action_
Container action causing the exception.
Definition jaula_exception.h:225
JAULA::Exception::getAction
std::string const & getAction(void) const
Retrieves the action that caused the exception.
Definition jaula_exception.cc:72
JAULA::Exception::detail_
std::string detail_
Container for exception textual detail.
Definition jaula_exception.h:220
JAULA::Exception::addOrigin
void addOrigin(std::string const &origin)
Attachs a new origin after the existing ones.
Definition jaula_exception.cc:144
JAULA::Exception::Exception
Exception(ExCode code=NO_ERROR, std::string const &detail="", std::string const &action="", std::string const &origin="")
Constructor.
Definition jaula_exception.cc:42
JAULA::Exception::setAction
void setAction(std::string const &action)
Establishes the action that caused the exception.
Definition jaula_exception.cc:134
JAULA::Exception::~Exception
virtual ~Exception()
Destructor.
Definition jaula_exception.cc:59
JAULA::Exception::getDetail
virtual std::string const & getDetail(void) const
Retrieves the detailed description for the exception.
Definition jaula_exception.cc:67
JAULA::Exception::setOrigin
void setOrigin(std::string const &origin)
Establishes the method being run when the exception arose.
Definition jaula_exception.cc:139
JAULA::Exception::ExCode
ExCode
Enumeration of available error codes.
Definition jaula_exception.h:61
JAULA::Exception::BAD_DATA_TYPE
@ BAD_DATA_TYPE
Definition jaula_exception.h:65
JAULA::Exception::NAME_DUPLICATED
@ NAME_DUPLICATED
Definition jaula_exception.h:67
JAULA::Exception::LEXAN_ERROR
@ LEXAN_ERROR
Definition jaula_exception.h:69
JAULA::Exception::NO_ERROR
@ NO_ERROR
Definition jaula_exception.h:63
JAULA::Exception::display
void display(std::ostream &ostr) const
Represents the instance in a stream.
Definition jaula_exception.cc:82
JAULA::Exception::code_
ExCode code_
Container for error code.
Definition jaula_exception.h:215
JAULA::Exception::getCode
ExCode getCode(void) const
Retrieves the error code for the exception.
Definition jaula_exception.cc:62
operator<<
std::ostream & operator<<(std::ostream &ostr, JAULA::Exception const &ex)
Insertion operator extension for Exceptions.
Definition jaula_exception.cc:171
JAULA
Namespace for all library definitions.
Definition jaula.h:439

Back to JAULA Project Documentation Page.

Go to JAULA Project Home Page.

Copyright (c) 2007, 2008, 2009 Kombo Morongo.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".

SourceForge.net