xtd - Reference Guide  0.1.1
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
enable_debug.h
Go to the documentation of this file.
1 #pragma once
5 #include <cstdint>
6 #include <xtd/object.h>
7 #include <xtd/static.h>
9 #include "../forms_export.h"
10 
12 namespace xtd {
14  namespace forms {
26  public:
28  enable_debug() = default;
29  enable_debug(const enable_debug&) = default;
30  enable_debug& operator=(const enable_debug&) = default;
31 
32  bool operator==(const enable_debug& value) const {return value_ == value.value_;}
33  bool operator!=(const enable_debug& value) const {return !operator==(value);}
34  enable_debug operator|(const enable_debug& value) const {return enable_debug(value_ | value.value_);}
35  enable_debug operator+(const enable_debug& value) const {return enable_debug(value_ + value.value_);}
37 
39  static const enable_debug none;
41  static const enable_debug creation;
43  static const enable_debug events;
45  static const enable_debug key_events;
47  static const enable_debug mouse_events;
49  static const enable_debug layout;
51  static const enable_debug workaround;
53  static const enable_debug all;
54 
57  static bool get(const enable_debug& flags) {return (values_.value_ & flags.value_) == flags.value_;}
60  static void set(const enable_debug& flags, bool on) {values_.value_ = on ? (values_.value_ | flags.value_) : (values_.value_ & ~flags.value_);}
61 
64  static xtd::diagnostics::trace_switch& trace_switch() {return trace_switch_;}
65 
66  private:
67  explicit enable_debug(uint64_t value) : value_(value) {}
68 
69  uint64_t value_ = 0;
70  static xtd::diagnostics::trace_switch trace_switch_;
71  static enable_debug values_;
72  };
73  }
74 }
Provides a multilevel switch to control tracing and debug output without recompiling your code.
Definition: trace_switch.h:21
Represent enable debug class.
Definition: enable_debug.h:25
static const enable_debug mouse_events
Represent mouse events debug.
Definition: enable_debug.h:47
static const enable_debug key_events
Represent key events debug.
Definition: enable_debug.h:45
static const enable_debug creation
Represent creation debug.
Definition: enable_debug.h:41
static const enable_debug events
Represent events debug.
Definition: enable_debug.h:43
static const enable_debug all
Represent all debug.
Definition: enable_debug.h:53
static const enable_debug workaround
Represent workaround debug.
Definition: enable_debug.h:51
static void set(const enable_debug &flags, bool on)
Sets enable_debug flags status.
Definition: enable_debug.h:60
static bool get(const enable_debug &flags)
Gets enable_debug flags status.
Definition: enable_debug.h:57
static const enable_debug none
Represent none debug.
Definition: enable_debug.h:39
static xtd::diagnostics::trace_switch & trace_switch()
Gets a trace switch to configure debug traces.
Definition: enable_debug.h:64
static const enable_debug layout
Represent layout debug.
Definition: enable_debug.h:49
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition: object.h:26
#define forms_export_
Define shared library export.
Definition: forms_export.h:13
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17
Contains xtd::object class.
Contains xtd::static_object class.
Contains xtd::diagnostics::trace_switch class.