summaryrefslogtreecommitdiff
path: root/vendor/bandit/bandit/assertion_exception.h
blob: 9abc9867d0654b7732338e67d1afe0683e63c63f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef BANDIT_ASSERTION_EXCEPTION_H
#define BANDIT_ASSERTION_EXCEPTION_H

namespace bandit { namespace detail {

  struct assertion_exception : public std::runtime_error
  {
    assertion_exception(const std::string& message,
        const std::string& filename, const unsigned int linenumber)
      : std::runtime_error(message), file_name_(filename), line_number_(linenumber)
    {}

    assertion_exception(const std::string& message)
      : std::runtime_error(message), line_number_(0)
    {}

    //
    // To make gcc < 4.7 happy.
    //
    assertion_exception(const assertion_exception&) = default;
    assertion_exception(assertion_exception&&) = default;
    virtual ~assertion_exception() noexcept
    {}

    const std::string& file_name() const
    {
      return file_name_;
    }

    unsigned int line_number() const
    {
      return line_number_;
    }

    private:
    std::string file_name_;
    unsigned int line_number_;
  };
}}

#endif