xtd - Reference Guide
0.1.2
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
|
#include <stack_trace.h>
Represents a stack trace, which is an ordered collection of one or more stack frames.
Inherits xtd::object.
Public Types | |
using | stack_frame_collection = std::vector< xtd::diagnostics::stack_frame > |
Represents a stack_frame collection. | |
Static Public Attributes | |
static constexpr size_t | METHODS_TO_SKIP |
Defines the default for the number of methods to omit from the stack trace. This field is constant. | |
Public Member Functions | |
stack_trace () | |
Initializes a new instance of the xtd::diagnostics::stack_trace class from the caller's frame. | |
stack_trace (bool need_file_info) | |
Initializes a new instance of the xtd::diagnostics::stack_trace class from the caller's frame, optionally capturing source information. | |
stack_trace (const std::exception &exception) | |
Initializes a new instance of the xtd::diagnostics::stack_trace class using the provided exception object. | |
stack_trace (const std::exception &exception, bool need_file_info) | |
Initializes a new instance of the xtd::diagnostics::stack_trace class, using the provided exception object and optionally capturing source information. | |
stack_trace (const std::exception &exception, size_t skip_frames) | |
Initializes a new instance of the StackTrace class using the provided exception object and skipping the specified number of frames. | |
stack_trace (const std::exception &exception, size_t skip_frames, bool need_file_info) | |
Initializes a new instance of the xtd::diagnostics::stack_trace class using the provided exception object, skipping the specified number of frames and optionally capturing source information. | |
stack_trace (const xtd::diagnostics::stack_frame &frame) | |
Initializes a new instance of the xtd::diagnostics::stack_trace class that contains a single frame. | |
stack_trace (size_t skip_frames) | |
Initializes a new instance of the xtd::diagnostics::stack_trace class from the caller's frame, skipping the specified number of frames. | |
stack_trace (size_t skip_frames, bool need_file_info) | |
Initializes a new instance of the xtd::diagnostics::stack_trace class from the caller's frame, skipping the specified number of frames and optionally capturing source information. | |
size_t | frame_count () const |
Gets the number of frames in the stack trace. | |
const xtd::diagnostics::stack_frame & | get_frame (size_t index) |
Gets the specified stack frame. | |
const stack_frame_collection & | get_frames () const |
Returns a copy of all stack frames in the current stack trace. | |
xtd::ustring | to_string () const noexcept |
Builds a readable representation of the stack trace. | |
Public Member Functions inherited from xtd::object | |
object ()=default | |
Create a new instance of the ultimate base class object. | |
virtual bool | equals (const object &obj) const noexcept |
Determines whether the specified object is equal to the current object. | |
virtual size_t | get_hash_code () const noexcept |
Serves as a hash function for a particular type. | |
template<typename object_t > | |
std::unique_ptr< object_t > | memberwise_clone () const |
Gets the type of the current instance. | |
virtual xtd::ustring | to_string () const noexcept |
Returns a std::string that represents the current object. | |
Additional Inherited Members | |
Static Public Member Functions inherited from xtd::object | |
static bool | equals (const object &object_a, const object &object_b) noexcept |
Determines whether the specified object instances are considered equal. | |
static bool | reference_equals (const object &object_a, const object &object_b) noexcept |
Determines whether the specified object instances are the same instance. | |
using xtd::diagnostics::stack_trace::stack_frame_collection = std::vector<xtd::diagnostics::stack_frame> |
Represents a stack_frame collection.
xtd::diagnostics::stack_trace::stack_trace | ( | ) |
Initializes a new instance of the xtd::diagnostics::stack_trace class from the caller's frame.
|
explicit |
Initializes a new instance of the xtd::diagnostics::stack_trace class from the caller's frame, optionally capturing source information.
need_file_info | true to capture the file name, line number, and column number; otherwise, false. |
|
explicit |
Initializes a new instance of the xtd::diagnostics::stack_trace class that contains a single frame.
frame | The frame that the xtd::diagnostics::stack_trace object should contain. |
xtd::diagnostics::stack_trace::stack_trace | ( | const std::exception & | exception | ) |
Initializes a new instance of the xtd::diagnostics::stack_trace class using the provided exception object.
exception | The exception object from which to construct the stack trace. |
|
explicit |
Initializes a new instance of the xtd::diagnostics::stack_trace class from the caller's frame, skipping the specified number of frames.
skip_frames | The number of frames up the stack from which to start the trace. |
xtd::diagnostics::stack_trace::stack_trace | ( | const std::exception & | exception, |
size_t | skip_frames | ||
) |
Initializes a new instance of the StackTrace class using the provided exception object and skipping the specified number of frames.
exception | The exception object from which to construct the stack trace. |
skip_framed | The number of frames up the stack from which to start the trace. |
xtd::diagnostics::stack_trace::stack_trace | ( | size_t | skip_frames, |
bool | need_file_info | ||
) |
Initializes a new instance of the xtd::diagnostics::stack_trace class from the caller's frame, skipping the specified number of frames and optionally capturing source information.
skip_frames | The number of frames up the stack from which to start the trace. |
need_file_info | true to capture the file name, line number, and column number; otherwise, false. |
xtd::diagnostics::stack_trace::stack_trace | ( | const std::exception & | exception, |
size_t | skip_frames, | ||
bool | need_file_info | ||
) |
Initializes a new instance of the xtd::diagnostics::stack_trace class using the provided exception object, skipping the specified number of frames and optionally capturing source information.
exception | The exception object from which to construct the stack trace. |
skip_frames | The number of frames up the stack from which to start the trace. |
need_file_info | true to capture the file name, line number, and column number; otherwise, false. |
xtd::diagnostics::stack_trace::stack_trace | ( | const std::exception & | exception, |
bool | need_file_info | ||
) |
Initializes a new instance of the xtd::diagnostics::stack_trace class, using the provided exception object and optionally capturing source information.
exception | The exception object from which to construct the stack trace. |
need_file_info | true to capture the file name, line number, and column number; otherwise, false. |
size_t xtd::diagnostics::stack_trace::frame_count | ( | ) | const |
Gets the number of frames in the stack trace.
const xtd::diagnostics::stack_frame & xtd::diagnostics::stack_trace::get_frame | ( | size_t | index | ) |
Gets the specified stack frame.
index | The index of the stack frame requested. |
const stack_frame_collection & xtd::diagnostics::stack_trace::get_frames | ( | ) | const |
Returns a copy of all stack frames in the current stack trace.
|
virtualnoexcept |
Builds a readable representation of the stack trace.
Reimplemented from xtd::object.
|
staticconstexpr |
Defines the default for the number of methods to omit from the stack trace. This field is constant.