ComSquare
InvalidAddress.hpp
Go to the documentation of this file.
1 //
2 // Created by anonymus-raccoon on 1/27/20.
3 //
4 
5 #ifndef COMSQUARE_INVALIDADDRESS_HPP
6 #define COMSQUARE_INVALIDADDRESS_HPP
7 
8 #include <exception>
9 #include <string>
10 #include <ios>
11 #include <sstream>
12 
13 namespace ComSquare
14 {
16  class InvalidAddress : std::exception {
17  private:
18  std::string _msg;
19  public:
20  InvalidAddress(std::string where, int32_t addr)
21  {
22  std::stringstream stream;
23  stream << "Could not read/write data at address: 0x" << std::hex << addr << " from " << where;
24  this->_msg = stream.str();
25  }
26  const char *what() const noexcept override { return this->_msg.c_str(); }
27  };
28 }
29 
30 #endif //COMSQUARE_INVALIDADDRESS_HPP
ComSquare::InvalidAddress::what
const char * what() const noexcept override
Definition: InvalidAddress.hpp:26
ComSquare::InvalidAddress::_msg
std::string _msg
Definition: InvalidAddress.hpp:18
ComSquare::InvalidAddress::InvalidAddress
InvalidAddress(std::string where, int32_t addr)
Definition: InvalidAddress.hpp:20
ComSquare::InvalidAddress
Exception thrown when trying to read/write to an invalid address.
Definition: InvalidAddress.hpp:16
ComSquare
Definition: APU.cpp:9