Mercurial > public > cpp-enigma
diff enigma/enigma_types.h @ 0:74ebb2150658
Initial commit. Working on the rotor class.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Thu, 21 Jun 2012 21:05:26 -0500 |
parents | |
children | 1459e74fda3f |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/enigma/enigma_types.h Thu Jun 21 21:05:26 2012 -0500 @@ -0,0 +1,33 @@ +#ifndef CPP_ENIGMA_ENIGMA_TYPES_H +#define CPP_ENIGMA_ENIGMA_TYPES_H +// Copyright (C) 2012 by Brian Neal. +// This file is part of Cpp-Enigma, the Enigma Machine simulation. +// Cpp-Enigma is released under the MIT License (see License.txt). +// +// enigma_types.h - This file contains common types used throughout Cpp-Enigma. + +#include <exception> +#include <string> + +namespace enigma +{ + class enigma_error : public std::exception + { + public: + explicit enigma_error(const std::string& what_arg) + : what_arg(what_arg) + {} + + virtual ~enigma_error() throw() {} + + virtual const char* what() const throw() + { + return what_arg.c_str(); + } + + private: + std::string what_arg; + }; +} + +#endif