Mercurial > public > cpp-enigma
annotate 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 |
rev | line source |
---|---|
bgneal@0 | 1 #ifndef CPP_ENIGMA_ENIGMA_TYPES_H |
bgneal@0 | 2 #define CPP_ENIGMA_ENIGMA_TYPES_H |
bgneal@0 | 3 // Copyright (C) 2012 by Brian Neal. |
bgneal@0 | 4 // This file is part of Cpp-Enigma, the Enigma Machine simulation. |
bgneal@0 | 5 // Cpp-Enigma is released under the MIT License (see License.txt). |
bgneal@0 | 6 // |
bgneal@0 | 7 // enigma_types.h - This file contains common types used throughout Cpp-Enigma. |
bgneal@0 | 8 |
bgneal@0 | 9 #include <exception> |
bgneal@0 | 10 #include <string> |
bgneal@0 | 11 |
bgneal@0 | 12 namespace enigma |
bgneal@0 | 13 { |
bgneal@0 | 14 class enigma_error : public std::exception |
bgneal@0 | 15 { |
bgneal@0 | 16 public: |
bgneal@0 | 17 explicit enigma_error(const std::string& what_arg) |
bgneal@0 | 18 : what_arg(what_arg) |
bgneal@0 | 19 {} |
bgneal@0 | 20 |
bgneal@0 | 21 virtual ~enigma_error() throw() {} |
bgneal@0 | 22 |
bgneal@0 | 23 virtual const char* what() const throw() |
bgneal@0 | 24 { |
bgneal@0 | 25 return what_arg.c_str(); |
bgneal@0 | 26 } |
bgneal@0 | 27 |
bgneal@0 | 28 private: |
bgneal@0 | 29 std::string what_arg; |
bgneal@0 | 30 }; |
bgneal@0 | 31 } |
bgneal@0 | 32 |
bgneal@0 | 33 #endif |