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 <vector>
8#include "../iequatable.h"
9#include "../object.h"
10#include "../string.h"
11
13namespace xtd {
15 namespace diagnostics {
17 class stack_trace;
19
40 class core_export_ stack_frame : public xtd::object, public xtd::iequatable<stack_frame> {
41 public:
42
44
50 explicit stack_frame(size_t skip_frame);
53 explicit stack_frame(bool need_file_info);
57 stack_frame(size_t skip_frame, bool need_file_info);
61 stack_frame(const xtd::string& file_name, uint32 line_number);
66 stack_frame(const xtd::string& file_name, uint32 line_number, const xtd::string& method_name);
72 stack_frame(const xtd::string& file_name, uint32 line_number, const xtd::string& method_name, uint32 column_number);
78 stack_frame(const xtd::string& file_name, uint32 line_number, uint32 column_number);
84 stack_frame(const xtd::string& file_name, uint32 line_number, const xtd::string& method_name, uint32 column_number, uint32 offset);
86 stack_frame(const stack_frame&) = default;
87 stack_frame(stack_frame&&) = default;
88 stack_frame& operator =(const stack_frame&) = default;
89 stack_frame& operator =(stack_frame&&) = default;
92
94
98 static stack_frame empty() noexcept;
99
102 static constexpr uint32 OFFSET_UNKNOWN = 4294967295u;
104
106
108 using object::equals;
109 bool equals(const stack_frame& sf) const noexcept override;
110
126 virtual uint32 get_file_column_number() const noexcept;
127
143 virtual uint32 get_file_line_number() const noexcept;
144
160 virtual const xtd::string& get_file_name() const noexcept;
161
177 virtual const xtd::string& get_method() const noexcept;
178
194 virtual uint32 get_offset() const noexcept;
195
198 xtd::string to_string() const noexcept override;
200
201 private:
202 friend class stack_trace;
203 // Do not use xtd::collections::generic::list because xtd::diagnostics::stack_frame is use by xtd::system_exception and
204 // xtd::collections::generic::list use xtd::argument_exception.
205 static std::vector<stack_frame> get_stack_frames(const xtd::string& str, size_t skip_frames, bool need_file_info) noexcept;
206
207 xtd::string file_name_;
208 uint32 file_line_number_ = 0;
209 xtd::string method_name_;
210 uint32 file_column_number_ = 0;
211 uint32 offset_ = OFFSET_UNKNOWN;
212 };
213 }
214}
215
216#include "current_stack_frame.h"
Represents text as a sequence of character units.
Definition basic_string.h:79
stack_frame(const xtd::string &file_name, uint32 line_number, const xtd::string &method_name)
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::string &file_name, uint32 line_number)
Initializes a new instance of the xtd::diagnostics::stack_frame class that contains only the given fi...
stack_frame(const xtd::string &file_name, uint32 line_number, const xtd::string &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(const xtd::string &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::string &file_name, uint32 line_number, const xtd::string &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...
Provides information about a xtd::diagnostics::stack_frame, which represents a function call on the c...
Definition stack_frame.h:40
Represents a stack trace, which is an ordered collection of one or more stack frames.
Definition stack_trace.h:40
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.h:22
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.h:42
#define core_export_
Define shared library export.
Definition core_export.h:13
uint32_t uint32
Represents a 32-bit unsigned integer.
Definition uint32.h:23
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10