xtd - Reference Guide  0.2.0
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 {
25  class forms_export_ enable_debug : public object {
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 
42  static const enable_debug none;
44  static const enable_debug creation;
46  static const enable_debug events;
48  static const enable_debug key_events;
50  static const enable_debug mouse_events;
52  static const enable_debug layout;
54  static const enable_debug workaround;
56  static const enable_debug all;
57 
59 
63  static xtd::diagnostics::trace_switch& trace_switch() {return trace_switch_;}
65 
67 
71  static bool get(const enable_debug& flags) {return (values_.value_ & flags.value_) == flags.value_;}
74  static void set(const enable_debug& flags, bool on) {values_.value_ = on ? (values_.value_ | flags.value_) : (values_.value_ & ~flags.value_);}
76 
77 
78  private:
79  explicit enable_debug(uint64_t value) : value_(value) {}
80 
81  uint64_t value_ = 0;
82  static xtd::diagnostics::trace_switch trace_switch_;
83  static enable_debug values_;
84  };
85  }
86 }
Contains xtd::static_object class.
Provides a multilevel switch to control tracing and debug output without recompiling your code...
Definition: trace_switch.h:26
static const enable_debug workaround
Represent workaround debug.
Definition: enable_debug.h:54
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
static const enable_debug key_events
Represent key events debug.
Definition: enable_debug.h:48
static const enable_debug layout
Represent layout debug.
Definition: enable_debug.h:52
static const enable_debug events
Represent events debug.
Definition: enable_debug.h:46
static const enable_debug none
Represent none debug.
Definition: enable_debug.h:42
static xtd::diagnostics::trace_switch & trace_switch()
Gets a trace switch to configure debug traces.
Definition: enable_debug.h:63
Contains xtd::object class.
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes...
Definition: object.h:27
Represent enable debug class.
Definition: enable_debug.h:25
static const enable_debug mouse_events
Represent mouse events debug.
Definition: enable_debug.h:50
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
static const enable_debug all
Represent all debug.
Definition: enable_debug.h:56
static const enable_debug creation
Represent creation debug.
Definition: enable_debug.h:44
Contains xtd::diagnostics::trace_switch class.