view enigma/enigma_types.h @ 19:1a5a0a3da1ba

Added tag 0.1 for changeset aa7a4298d609
author Brian Neal <bgneal@gmail.com>
date Wed, 11 Jul 2012 20:19:41 -0500
parents 1459e74fda3f
children
line wrap: on
line source
#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>
#include <array>

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;
   };

   // Arrays of 26 items are very commonly used:
   typedef std::array<int, 26> alpha_int_array;
   typedef std::array<bool, 26> alpha_bool_array;
}

#endif