Horizon
wx_compat.h
1 #pragma once
2 #include <string>
3 #include <cassert>
4 
5 template <class... Args> void wxLogTrace(const char *mask, const char *formatString, Args &&...args)
6 {
7 }
8 
9 template <class... Args> void wxLogWarning(const char *formatString, Args &&...args)
10 {
11 }
12 
13 class wxString : public std::string {
14 public:
15  wxString() = default;
16 
17  wxString(const std::string &s) : std::string(s)
18  {
19  }
20 
21  wxString(const char *s) : std::string(s)
22  {
23  }
24 
25  std::string ToStdString() const
26  {
27  return *this;
28  }
29 
30  template <class... Args> static wxString Format(const wxString &format, Args &&...args)
31  {
32  return format;
33  }
34 };
35 
36 const wxString wxEmptyString;
37 
38 using wxChar = char;
39 
40 class wxPoint {
41 public:
42  wxPoint() : x(0), y(0)
43  {
44  }
45 
46  wxPoint(int ax, int ay) : x(ax), y(ay)
47  {
48  }
49 
50  int x;
51  int y;
52 };
53 
54 inline wxPoint operator+(const wxPoint &p1, const wxPoint &p2)
55 {
56  return wxPoint(p1.x + p2.x, p1.y + p2.y);
57 }
58 
59 inline wxPoint operator-(const wxPoint &p1, const wxPoint &p2)
60 {
61  return wxPoint(p1.x - p2.x, p1.y - p2.y);
62 }
63 
64 class wxSize {
65 public:
66  wxSize() : x(0), y(0)
67  {
68  }
69 
70  int x;
71  int y;
72 };
73 
74 #define wxASSERT assert
75 #define wxASSERT_MSG(cond, msg) assert((cond))
76 #define dyn_cast dynamic_cast
77 
78 #define wxCHECK2_MSG(cond, op, msg) \
79  do { \
80  if (cond) { \
81  } \
82  else { \
83  op; \
84  } \
85  } while (0)
86 
87 
88 #define wxCHECK_MSG(cond, rc, msg) wxCHECK2_MSG(cond, return rc, msg)
89 #define wxCHECK_RET(cond, msg) wxCHECK2_MSG(cond, return, msg)
90 #define wxCHECK(cond, rc) wxCHECK_MSG(cond, rc, (const char *)NULL)
91 
92 #define wxFAIL_MSG(msg) assert(false)
93 #define wxT(x) x
Definition: wx_compat.h:40
Definition: wx_compat.h:64
Definition: wx_compat.h:13
Point operator-(const Point &a, const Point &b)
Subtract two points_ component-wise.
Definition: shapes.h:244