docc 0.8.3 (0d44999b)
C++ API Reference
Loading...
Searching...
No Matches
exceptions.h
Go to the documentation of this file.
1#pragma once
2
3#include <exception>
4#include <string>
5
6namespace sdfg {
7
8class InvalidSDFGException : public std::exception {
9private:
10 std::string message_;
11
12public:
13 InvalidSDFGException(const std::string& message) : message_(message) {
14 }
15
16 const char* what() const noexcept override {
17 return message_.c_str();
18 }
19};
20
21class UnstructuredControlFlowException : public std::exception {
22public:
23 const char* what() const noexcept override {
24 return "Unstructured control flow detected";
25 }
26};
27
29public:
30 StringEnum(const std::string& value) : value_(value) {
31 }
32 StringEnum(const StringEnum& other) : value_(other.value_) {
33 }
34 StringEnum(StringEnum&& other) noexcept : value_(std::move(other.value_)) {
35 }
36
38 value_ = other.value_;
39 return *this;
40 }
41
42 StringEnum& operator=(StringEnum&& other) noexcept {
43 value_ = std::move(other.value_);
44 return *this;
45 }
46
47 std::string value() const {
48 return value_;
49 }
50
51 bool operator==(const StringEnum& other) const {
52 return value_ == other.value_;
53 }
54
55 bool operator!=(const StringEnum& other) const {
56 return !(*this == other);
57 }
58
59private:
60 std::string value_;
61};
62
63} // namespace sdfg
InvalidSDFGException(const std::string &message)
Definition exceptions.h:13
const char * what() const noexcept override
Definition exceptions.h:16
StringEnum & operator=(StringEnum &&other) noexcept
Definition exceptions.h:42
StringEnum(StringEnum &&other) noexcept
Definition exceptions.h:34
bool operator!=(const StringEnum &other) const
Definition exceptions.h:55
StringEnum(const StringEnum &other)
Definition exceptions.h:32
bool operator==(const StringEnum &other) const
Definition exceptions.h:51
StringEnum(const std::string &value)
Definition exceptions.h:30
std::string value() const
Definition exceptions.h:47
StringEnum & operator=(const StringEnum &other)
Definition exceptions.h:37
Definition exceptions.h:21
const char * what() const noexcept override
Definition exceptions.h:23
Definition analysis.h:7