xtd 0.2.0
Loading...
Searching...
No Matches

◆ current_stack_frame_

#define current_stack_frame_

#include <xtd.core/include/xtd/diagnostics/current_stack_frame.h>

Provides information about the current stack frame.

Library
xtd.core
Returns
Informations about the current stack frame.
Examples
The following example shows how to use the current_stack_frame_.
#include <xtd/diagnostics/stack_frame>
#include <xtd/console>
using namespace xtd;
void trace_message(const string& message, const xtd::diagnostics::stack_frame& stack_frame) {
console::write_line("stack_frame: {}\n", stack_frame);
console::write_line("Message: {}", message);
console::write_line("Method: {}", stack_frame.get_method());
console::write_line("File name: {}", stack_frame.get_file_name());
console::write_line("File line number: {}", stack_frame.get_file_line_number());
}
auto main() -> int {
trace_message("Something has happened.", current_stack_frame_);
// trace_message("Something has happened.", current_stack_frame_); is same as :
//
// trace_message("Something has happened.", {__FILE__, __LINE__, __func__});
}
// This code can produce the following output :
//
// stack_frame: /!---OMITTED---!/current_stack_frame.cpp:15:0
//
// Message: Something happened.
// Method name: main
// File name: /!---OMITTED---!/current_stack_frame.cpp
// File line number: 15
virtual const xtd::string & get_file_name() const noexcept
Gets the file name that contains the code that is executing. This information is typically extracted ...
virtual xtd::size get_file_line_number() const noexcept
Gets the line number in the file that contains the code that is executing. This information is typica...
virtual const xtd::string & get_method() const noexcept
Gets the method in which the frame is executing.
Provides information about a xtd::diagnostics::stack_frame, which represents a function call on the c...
Definition stack_frame.h:46
#define current_stack_frame_
Provides information about the current stack frame.
Definition current_stack_frame.h:16
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
Remarks
same as csf_
Examples
application_and_exception.cpp, current_stack_frame.cpp, exception_box.cpp, exception_dialog.cpp, format_class_with_specified_formating.cpp, format_class_with_specified_formating_with_to_string.cpp, sprintf_class_with_specified_formating.cpp, and sprintf_class_with_specified_formating_with_to_string.cpp.