xtd 0.2.0
Loading...
Searching...
No Matches
line_info.cpp

Shows how to use xtd::diagnostics::stack_frame class.

#include <xtd/xtd.tunit>
using namespace xtd;
using namespace xtd::diagnostics;
using namespace xtd::tunit;
void trace_message(const string& message, const stack_frame& sf = stack_frame::current()) {
console::out << "message: " << message << environment::new_line;
console::out << "member name: " << sf.get_method() << environment::new_line;
console::out << "source file path: " << sf.get_file_name() << environment::new_line;
console::out << "source line number: " << sf.get_file_line_number() << environment::new_line;
}
auto main() -> int {
trace_message("Something happened.");
}
// This code can produce the following output :
//
// message: Something happened.
// member name: main
// source file path: !---OMITTED---!/line_info/src/line_info.cpp
// source line number: 16
Provides information about a xtd::diagnostics::stack_frame, which represents a function call on the c...
Definition stack_frame.hpp:47
The xtd::diagnostics namespace provides classes that allow you to interact with system processes,...
Definition assert_dialog_result.hpp:10
The tunit namespace contains a unit test library.
Definition abort_error.hpp:10
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10