8#include "../add_last_arg_to_command.h" 
    9#include "../core_export.h" 
   10#include "../environment.h" 
   12#include "../ustring.h" 
   21  namespace diagnostics {
 
  135#if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 
  145#if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 
  146        fail__(message, detail_message);
 
  152#if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 
  164#if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 
  165        write_line_(message);
 
  172      template<
typename ...args_t>
 
  174#if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 
  179      template<
typename ...args_t>
 
  180      static void print(
const char* format, args_t&&... args) {
 
  181#if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 
  191#if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 
  192        trace_event_(trace_event_type::error, message);
 
  199      template<
typename ...objects_t>
 
  201#if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 
  210#if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 
  211        trace_event_(trace_event_type::information, message);
 
  218      template<
typename ...objects_t>
 
  220#if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 
  229#if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 
  230        trace_event_(trace_event_type::warning, message);
 
  237      template<
typename ...objects_t>
 
  239#if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 
  252#if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 
  260      template<
typename object_t>
 
  261      static void write(
const object_t& message) {
 
  262#if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 
  272      template<
typename object_t>
 
  274#if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 
  283      template<
typename ...args_t>
 
  285#if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 
  286        write_(ustring::format(format, args...));
 
  290      template<
typename ...args_t>
 
  291      static void write(
const char* format, args_t&&... args) {
 
  292#if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 
  293        write_(ustring::format(format, args...));
 
  304#if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 
  305        if (condition) write_(message);
 
  308      template<
typename object_t>
 
  314      static void write_if(
bool condition, 
const object_t& message) {
 
  315#if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 
  325      template<
typename object_t>
 
  327#if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 
  337#if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 
  346#if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 
  347        write_line_(message);
 
  354      template<
typename object_t>
 
  356#if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 
  366      template<
typename object_t>
 
  368#if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 
  376      template<
typename ...args_t>
 
  378#if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 
  379        write_line_(ustring::format(format, args...));
 
  383      template<
typename ...args_t>
 
  384      static void write_line(
const char* format, args_t&&... args) {
 
  385#if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 
  386        write_line_(ustring::format(format, args...));
 
  397#if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 
  398        if (condition) write_line_(message);
 
  406      template<
typename object_t>
 
  408#if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 
  409        if (condition) write_line_(message);
 
  418      template<
typename object_t>
 
  420#if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 
  421        if (condition) write_line_(message, category);
 
  426      static inline bool __should_aborted__(
bool condition) {
return __should_aborted__(condition, 
"", 
csf_);}
 
  427      static inline bool __should_aborted__(
bool condition, 
const xtd::ustring& message) {
return __should_aborted__(condition, message, 
csf_);}
 
  428      static inline bool __should_aborted__(
bool condition, 
const xtd::diagnostics::stack_frame& stack_frame) {
return __should_aborted__(condition, 
"", stack_frame);}
 
  430#if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 
  431        auto result = xtd::diagnostics::debug::assert_dialog(condition, message, stack_frame);
 
  444      static void flush_();
 
  445      static void trace_event_(trace_event_type trace_event_type, 
const xtd::ustring& message);
 
  451      inline static bool auto_flush_ = 
false;
 
  452      inline static unsigned int indent_level_ = 0;
 
  453      inline static unsigned int indent_size_ = 4;
 
  454      static listener_collection& listeners_;
 
  455      static bool& show_assert_dialog_;
 
  456      inline static bool use_global_lock_ = 
true;
 
  457      static std::mutex global_lock_;
 
  479#define cassert_(...) \ 
  480  add_last_arg_to_command_(cassert, (csf_), __VA_ARGS__) 
  494#define assert_(...) \ 
  495  if (xtd::diagnostics::debug::add_last_arg_to_command_(__should_aborted__, (csf_), __VA_ARGS__)) debug_break_() 
Contains xtd::diagnostics::assert_dialog_result enum class.
 
Provides a set of methods and properties that help you debug the execution of your code....
Definition: debug.h:45
 
static void write_if(bool condition, const xtd::ustring &message)
Writes a message to the trace listeners in the Listeners collection if a condition is true.
Definition: debug.h:303
 
static bool show_assert_dialog()
Gets a value indicating whether the assert dialog should be show.
 
static void write_line(const object_t &message, const xtd::ustring &category)
Writes a category name and message followed by a line terminator to the trace listeners in the listen...
Definition: debug.h:367
 
static void trace_information(const xtd::ustring &message)
Writes an informational message to the trace listeners in the listeners collection using the specifie...
Definition: debug.h:209
 
static uint32_t indent_level()
Gets the indent level.
 
static void indent()
Increases the current indent_level by one.
 
static void write_line_if(bool condition, const xtd::ustring &message)
Writes a message followed by a line terminator to the trace listeners in the Listeners collection if ...
Definition: debug.h:396
 
static void cassert(bool condition, const xtd::ustring &message)
Checks for a condition; if the condition is false, displays a message box that shows the call stack.
 
static void write_line_if(bool condition, const object_t &message, const xtd::ustring &category)
Writes a category name and message followed by a line terminator to the trace listeners in the Listen...
Definition: debug.h:419
 
static void fail(const xtd::ustring &message)
Emits the specified error message.
Definition: debug.h:134
 
static void print(const xtd::ustring &format, args_t &&... args)
Writes a formatted string followed by a line terminator to the trace listeners in the listeners colle...
Definition: debug.h:173
 
static void write_line()
Writes a line terminator to the trace listeners in the listeners collection.
Definition: debug.h:336
 
static void trace_error(const xtd::ustring &message)
Writes an error message to the trace listeners in the Listeners collection using the specified messag...
Definition: debug.h:190
 
static void listeners(const listener_collection &listeners)
Sets the collection of listeners that is monitoring the trace output. @paral$m listeners A xtd::diagn...
 
static void trace_information(const xtd::ustring &message, const objects_t &... args)
Writes an informational message to the trace listeners in the listeners collection using the specifie...
Definition: debug.h:219
 
static void write(const xtd::ustring &message)
Writes a message to the trace listeners in the listeners collection.
Definition: debug.h:251
 
static void indent_level(uint32_t indent_level)
Sets the indent level.
 
static void write_line_if(bool condition, const object_t &message)
Writes a message followed by a line terminator to the trace listeners in the Listeners collection if ...
Definition: debug.h:407
 
static void write_line(const object_t &message)
Writes a message followed by a line terminator to the trace listeners in the listeners collection.
Definition: debug.h:355
 
static listener_collection & listeners()
Gets the collection of listeners that is monitoring the trace output.
 
static void show_assert_dialog(bool show_assert_dialog)
Sets a value indicating whether the assert dialog should be show.
 
static void write(const xtd::ustring &format, args_t &&... args)
Writes a formatted string to the trace listeners in the listeners collection.
Definition: debug.h:284
 
static void trace_warning(const xtd::ustring &message, const objects_t &... args)
Writes a warning message to the trace listeners in the listeners collection using the specified array...
Definition: debug.h:238
 
static void write_if(bool condition, const object_t &message, const xtd::ustring &category)
Writes a category name and message to the trace listeners in the Listeners collection if a condition ...
Definition: debug.h:326
 
static void auto_flush(bool auto_flush)
Sets whether xtd::diagnostics::debug::flush should be called on the xtd::diagnostics::debug::Listener...
 
static uint32_t indent_size()
Gets the number of spaces in an indent.
 
static bool use_global_lock()
Gets a value indicating whether the global lock should be used.
 
static void trace_warning(const xtd::ustring &message)
Writes a warning message to the trace listeners in the listeners collection using the specified messa...
Definition: debug.h:228
 
static void unindent()
Decreases the current indent_level by one.
 
static void write_if(bool condition, const object_t &message)
Writes a message to the trace listeners in the Listeners collection if a condition is true.
Definition: debug.h:314
 
static void indent_size(uint32_t indent_size)
Sets the number of spaces in an indent.
 
static bool auto_flush()
Gets whether xtd::diagnostics::debug::flush should be called on the xtd::diagnostics::debug::Listener...
 
static void write_line(const xtd::ustring &format, args_t &&... args)
Writes a formatted string followed by a line terminator to the trace listeners in the listeners colle...
Definition: debug.h:377
 
static void write(const object_t &message, const xtd::ustring &category)
Writes a category name and message to the trace listeners in the listeners collection.
Definition: debug.h:273
 
static void write_line(const xtd::ustring &message)
Writes a message followed by a line terminator to the trace listeners in the listeners collection.
Definition: debug.h:345
 
static void cassert(bool condition)
Checks for a condition; if the condition is false, displays a message box that shows the call stack.
 
static void write(const object_t &message)
Writes a message to the trace listeners in the listeners collection.
Definition: debug.h:261
 
static void flush()
Flushes the output buffer and causes buffered data to write to the listeners collection.
Definition: debug.h:151
 
static void trace_error(const xtd::ustring &message, const objects_t &... args)
Writes an error message to the trace listeners in the listeners collection using the specified array ...
Definition: debug.h:200
 
static void cassert(bool condition, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Checks for a condition; if the condition is false, displays a message box that shows the call stack.
 
static void cassert(bool condition, const xtd::diagnostics::stack_frame &stack_frame)
Checks for a condition; if the condition is false, displays a message box that shows the call stack.
 
static void fail(const xtd::ustring &message, const xtd::ustring &detail_message)
Emits an error message and a detailed error message.
Definition: debug.h:144
 
static void print(const xtd::ustring &message)
Writes a message followed by a line terminator to the trace listeners in the listeners collection.
Definition: debug.h:163
 
static void use_global_lock(bool use_global_lock)
Sets a value indicating whether the global lock should be used.
 
Provides information about a xtd::diagnostics::stack_frame, which represents a function call on the c...
Definition: stack_frame.h:29
 
Represents a collection of xtd::diagnostics::trace_listener.
Definition: trace_listener_collection.h:19
 
static void exit(int exit_code)
Terminates this process and returns an exit code to the operating system.
Definition: environment.h:321
 
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
 
Contains xtd::diagnostics::debugger class.
 
#define static_
This keyword is use to represent a static object. A static object can't be instantiated (constructors...
Definition: static.h:38
 
#define core_export_
Define shared library export.
Definition: core_export.h:13
 
#define csf_
Provides information about the current stack frame.
Definition: stack_frame.h:213
 
assert_dialog_result
Specifies identifiers to indicate the return value of an assert dialog box.
Definition: assert_dialog_result.h:18
 
@ retry
The assert dialog return value is Retry (usually sent from a button labeled Retry).
 
@ abort
The assert dialog return value is Abort (usually sent from a button labeled Abort).
 
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17
 
Contains xtd::diagnostics::stack_trace class.
 
Contains xtd::diagnostics::trace_listener_collection class.