xtd 0.2.0
Loading...
Searching...
No Matches
stack_frame.h
Go to the documentation of this file.
1
4#pragma once
5
6#include <cstdint>
7#include "../iequatable.h"
8#include "../object.h"
9#include "../ustring.h"
10
12namespace xtd {
14 namespace diagnostics {
16 class stack_trace;
18
37 class core_export_ stack_frame : public xtd::object, public xtd::iequatable<stack_frame> {
38 public:
39
41
47 explicit stack_frame(size_t skip_frame);
50 explicit stack_frame(bool need_file_info);
54 stack_frame(size_t skip_frame, bool need_file_info);
58 stack_frame(const xtd::ustring& file_name, uint32 line_number);
63 stack_frame(const xtd::ustring& file_name, uint32 line_number, const xtd::ustring& method_name);
69 stack_frame(const xtd::ustring& file_name, uint32 line_number, const xtd::ustring& method_name, uint32 column_number);
75 stack_frame(const xtd::ustring& file_name, uint32 line_number, uint32 column_number);
81 stack_frame(const xtd::ustring& file_name, uint32 line_number, const xtd::ustring& method_name, uint32 column_number, uint32 offset);
83 stack_frame(const stack_frame&) = default;
84 stack_frame(stack_frame&&) = default;
85 stack_frame& operator =(const stack_frame&) = default;
88
90
94 static stack_frame empty() noexcept;
95
98 static constexpr uint32 OFFSET_UNKNOWN = 4294967295u;
100
102
104 bool equals(const stack_frame& sf) const noexcept override;
105
121 virtual uint32 get_file_column_number() const noexcept;
122
138 virtual uint32 get_file_line_number() const noexcept;
139
155 virtual const xtd::ustring& get_file_name() const noexcept;
156
172 virtual const xtd::ustring& get_method() const noexcept;
173
189 virtual uint32 get_offset() const noexcept;
190
193 xtd::ustring to_string() const noexcept override;
195
196 private:
197 friend class stack_trace;
198 static std::vector<stack_frame> get_stack_frames(const xtd::ustring& str, size_t skip_frames, bool need_file_info) noexcept;
199
200 xtd::ustring file_name_;
201 uint32 file_line_number_ = 0;
202 xtd::ustring method_name_;
203 uint32 file_column_number_ = 0;
204 uint32 offset_ = OFFSET_UNKNOWN;
205 };
206 }
207}
208
209#include "current_stack_frame.h"
Provides information about a xtd::diagnostics::stack_frame, which represents a function call on the c...
Definition stack_frame.h:37
stack_frame(const xtd::ustring &file_name, uint32 line_number, const xtd::ustring &method_name, uint32 column_number, uint32 offset)
Initializes a new instance of the xtd::diagnostics::stack_frame class that contains only the given fi...
stack_frame(size_t skip_frame)
Initializes a new instance of the xtd::diagnostics::stack_frame class that corresponds to a frame abo...
stack_frame()
Initializes a new instance of the xtd::diagnostics::stack_frame class.
stack_frame(const xtd::ustring &file_name, uint32 line_number, const xtd::ustring &method_name)
Initializes a new instance of the xtd::diagnostics::stack_frame class that contains only the given fi...
stack_frame(const xtd::ustring &file_name, uint32 line_number, uint32 column_number)
Initializes a new instance of the xtd::diagnostics::stack_frame class that contains only the given fi...
static stack_frame empty() noexcept
Return an empty stack frame.
stack_frame(const xtd::ustring &file_name, uint32 line_number, const xtd::ustring &method_name, uint32 column_number)
Initializes a new instance of the xtd::diagnostics::stack_frame class that contains only the given fi...
stack_frame(bool need_file_info)
Initializes a new instance of the xtd::diagnostics::stack_frame class, optionally capturing source in...
stack_frame(size_t skip_frame, bool need_file_info)
Initializes a new instance of the xtd::diagnostics::stack_frame class that corresponds to a frame abo...
stack_frame(const xtd::ustring &file_name, uint32 line_number)
Initializes a new instance of the xtd::diagnostics::stack_frame class that contains only the given fi...
Represents a stack trace, which is an ordered collection of one or more stack frames.
Definition stack_trace.h:39
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.h:18
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.h:32
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
uint_least32_t uint32
Represents a 32-bit unsigned integer.
Definition types.h:241
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10