xtd 0.2.0
Loading...
Searching...
No Matches
stack_trace.hpp
Go to the documentation of this file.
1
4#pragma once
5#include <exception>
6#include <memory>
7#include "stack_frame.hpp"
8#define __XTD_CORE_INTERNAL__
9#include "../internal/__array_definition.hpp"
10#undef __XTD_CORE_INTERNAL__
11
13namespace xtd {
15 class exception;
17
19 namespace diagnostics {
41 public:
43
48
50
125 explicit stack_trace(bool need_file_info);
141 explicit stack_trace(const std::exception& exception);
146 explicit stack_trace(size_t skip_frames);
153 stack_trace(const std::exception& exception, size_t skip_frames);
191 stack_trace(size_t skip_frames, bool need_file_info);
198 stack_trace(const std::exception& exception, size_t skip_frames, bool need_file_info);
203 stack_trace(const std::exception& exception, bool need_file_info);
205 stack_trace(const stack_trace&) = default;
206 stack_trace& operator =(const stack_trace&) = default;
209
211
215 static constexpr size_t METHODS_TO_SKIP = 0;
217
219
256 size_t frame_count() const noexcept;
258
260
299 const xtd::diagnostics::stack_frame& get_frame(size_t index) noexcept;
300
316 const stack_frame_collection& get_frames() const noexcept;
317
327 xtd::string to_string() const noexcept override;
329
330 private:
331 friend class xtd::exception;
332 stack_trace(const xtd::string& str, size_t skip_frames, bool need_file_info);
333 xtd::string to_string(size_t skip_frames, const xtd::diagnostics::stack_frame& stack_frame = xtd::null) const noexcept;
334
335 struct data;
336 ptr<data> data_;
337 };
338 }
339}
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:58
Provides information about a xtd::diagnostics::stack_frame, which represents a function call on the c...
Definition stack_frame.hpp:47
Represents a stack trace, which is an ordered collection of one or more stack frames.
Definition stack_trace.hpp:40
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,...
size_t frame_count() const noexcept
Gets the number of frames in the 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 t...
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 o...
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(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 ob...
stack_trace(size_t skip_frames)
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,...
stack_trace(const std::exception &exception)
Initializes a new instance of the xtd::diagnostics::stack_trace class using the provided exception ob...
stack_trace()
Initializes a new instance of the xtd::diagnostics::stack_trace class from the caller's frame.
Defines the base class for predefined exceptions in the xtd namespace.
Definition exception.hpp:28
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:42
#define core_export_
Define shared library export.
Definition core_export.hpp:13
xtd::sptr< type_t > ptr
The xtd::ptr object is a shared pointer.
Definition ptr.hpp:27
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10
Contains xtd::diagnostics::stack_frame class.