xtd 0.2.0
Loading...
Searching...
No Matches
stack_trace.h
Go to the documentation of this file.
1
4#pragma once
5#include <exception>
6#include <memory>
7#include <vector>
8#include "../core_export.h"
9#include "../object.h"
10#include "../ustring.h"
11#include "stack_frame.h"
12
14namespace xtd {
16 class system_exception;
18
20 namespace diagnostics {
40 public:
42
45 using stack_frame_collection = std::vector<xtd::diagnostics::stack_frame>;
47
49
124 explicit stack_trace(bool need_file_info);
140 explicit stack_trace(const std::exception& exception);
145 explicit stack_trace(size_t skip_frames);
152 stack_trace(const std::exception& exception, size_t skip_frames);
190 stack_trace(size_t skip_frames, bool need_file_info);
197 stack_trace(const std::exception& exception, size_t skip_frames, bool need_file_info);
202 stack_trace(const std::exception& exception, bool need_file_info);
204 stack_trace(const stack_trace&) = default;
205 stack_trace& operator =(const stack_trace&) = default;
208
210
214 static constexpr size_t METHODS_TO_SKIP = 0;
216
218
255 size_t frame_count() const noexcept;
257
259
298 const xtd::diagnostics::stack_frame& get_frame(size_t index) noexcept;
299
315 const stack_frame_collection& get_frames() const noexcept;
316
326 xtd::ustring to_string() const noexcept override;
328
329 private:
330 friend class xtd::system_exception;
331 stack_trace(const xtd::ustring& str, size_t skip_frames, bool need_file_info);
332 xtd::ustring to_string(size_t skip_frames, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::empty()) const noexcept;
333
335 };
336 }
337}
Provides information about a xtd::diagnostics::stack_frame, which represents a function call on the c...
Definition stack_frame.h:37
Represents a stack trace, which is an ordered collection of one or more stack frames.
Definition stack_trace.h:39
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.
std::vector< xtd::diagnostics::stack_frame > stack_frame_collection
Represents a stack_frame collection.
Definition stack_trace.h:45
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.
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.h:32
Defines the base class for predefined exceptions in the xtd namespace.
Definition system_exception.h:25
Represents text as a sequence of UTF-8 code units.
Definition ustring.h:47
#define core_export_
Define shared library export.
Definition core_export.h:13
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
Contains xtd::diagnostics::stack_frame class.