xtd
1.0.0
Toggle main menu visibility
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
xtd::console::out
static std::ostream out
Gets the standard output stream. A std::basic_ostream<char_t> that represents the standard output str...
Definition
console.hpp:52
xtd::diagnostics::stack_frame
Provides information about a xtd::diagnostics::stack_frame, which represents a function call on the c...
Definition
stack_frame.hpp:46
xtd::diagnostics::stack_frame::current
static auto current(const xtd::diagnostics::source_location &value=xtd::diagnostics::source_location::current()) noexcept -> xtd::diagnostics::stack_frame
Crates a new xtd::diagnostics::stack_frame object corresponding to the location of the call site.
xtd::environment::new_line
static auto new_line() noexcept -> xtd::string
Gets the newline string defined for this environment.
xtd::diagnostics
The xtd::diagnostics namespace provides classes that allow you to interact with system processes,...
Definition
assert_dialog_result.hpp:10
xtd::tunit
The tunit namespace contains a unit test library.
Definition
abort_error.hpp:10
xtd
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition
abstract_object.hpp:8
Generated on
for xtd by
Gammasoft
. All rights reserved.