Chatterino
Outcome.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 namespace chatterino {
4 
5 struct SuccessTag {
6 };
7 
8 struct FailureTag {
9 };
10 
13 
14 class Outcome
15 {
16 public:
18  : success_(true)
19  {
20  }
21 
23  : success_(false)
24  {
25  }
26 
27  explicit operator bool() const
28  {
29  return this->success_;
30  }
31 
32  bool operator!() const
33  {
34  return !this->success_;
35  }
36 
37  bool operator==(const Outcome &other) const
38  {
39  return this->success_ == other.success_;
40  }
41 
42  bool operator!=(const Outcome &other) const
43  {
44  return !this->operator==(other);
45  }
46 
47 private:
48  bool success_;
49 };
50 
51 } // namespace chatterino
const SuccessTag Success
Definition: Outcome.hpp:11
bool operator!=(const Outcome &other) const
Definition: Outcome.hpp:42
bool operator!() const
Definition: Outcome.hpp:32
Outcome(SuccessTag)
Definition: Outcome.hpp:17
Definition: Application.cpp:48
Definition: Outcome.hpp:8
const FailureTag Failure
Definition: Outcome.hpp:12
Outcome(FailureTag)
Definition: Outcome.hpp:22
bool operator==(const Emote &a, const Emote &b)
Definition: Emote.cpp:7
Definition: Outcome.hpp:5
bool operator==(const Outcome &other) const
Definition: Outcome.hpp:37
Definition: Outcome.hpp:14