xtd 0.2.0
stack_frame.hpp
Go to the documentation of this file.
1
4#pragma once
5
6#include <cstdint>
7#include <vector>
8#include "source_location.hpp"
9#include "../core_export.hpp"
10#include "../iequatable.hpp"
11#include "../null_ptr.hpp"
12#include "../object.hpp"
13#include "../ptr.hpp"
14#include "../size.hpp"
15#define __XTD_CORE_INTERNAL__
16#include "../internal/__string_definitions.hpp"
17#undef __XTD_CORE_INTERNAL__
18#include <limits>
19
21namespace xtd {
23 namespace diagnostics {
25 class stack_trace;
27
48 class core_export_ stack_frame : public xtd::object, public xtd::iequatable<stack_frame> {
49 public:
50
52
58 explicit stack_frame(xtd::size skip_frame);
61 explicit stack_frame(bool need_file_info);
65 stack_frame(xtd::size skip_frame, bool need_file_info);
69 stack_frame(const xtd::string& file_name, xtd::size line_number);
74 stack_frame(const xtd::string& file_name, xtd::size line_number, const xtd::string& method_name);
80 stack_frame(const xtd::string& file_name, xtd::size line_number, const xtd::string& method_name, xtd::size column_number);
86 stack_frame(const xtd::string& file_name, xtd::size line_number, xtd::size column_number);
93 stack_frame(const xtd::string& file_name, xtd::size line_number, const xtd::string& method_name, xtd::size column_number, xtd::size offset);
103 stack_frame(xtd::null_ptr frame); // Not explicit by design.
105 stack_frame(const stack_frame&) = default;
106 stack_frame(stack_frame&&) = default;
107 stack_frame& operator =(const stack_frame&) = default;
108 stack_frame& operator =(stack_frame&&) = default;
111
113
117 static stack_frame empty() noexcept;
118
121 static constexpr xtd::size OFFSET_UNKNOWN = std::numeric_limits<xtd::size>::max();
123
125
130 bool equals(const xtd::object& obj) const noexcept override;
134 bool equals(const stack_frame& other) const noexcept override;
135
138 xtd::size get_hash_code() const noexcept override;
139
155 virtual xtd::size get_file_column_number() const noexcept;
156
172 virtual xtd::size get_file_line_number() const noexcept;
173
189 virtual const xtd::string& get_file_name() const noexcept;
190
206 virtual const xtd::string& get_method() const noexcept;
207
223 virtual xtd::size get_native_offset() const noexcept;
224
240 virtual xtd::size get_offset() const noexcept;
241
244 xtd::string to_string() const noexcept override;
246
248
257 static stack_frame current(const xtd::diagnostics::source_location& value = xtd::diagnostics::source_location::current()) noexcept;
259
260 private:
261 friend class stack_trace;
262 static auto get_stack_frames(const xtd::string& str, xtd::size skip_frames, bool need_file_info) noexcept;
263
264 struct data;
265 ptr<data> data_;
266 };
267 }
268}
Represents text as a sequence of character units.
Definition basic_string.hpp:71
The xtd::diagnostics::source_location class represents certain information about the source code,...
Definition source_location.hpp:33
Provides information about a xtd::diagnostics::stack_frame, which represents a function call on the c...
Definition stack_frame.hpp:48
stack_frame(const xtd::string &file_name, xtd::size line_number)
Initializes a new instance of the xtd::diagnostics::stack_frame class that contains only the given fi...
stack_frame()
Initializes a new instance of the xtd::diagnostics::stack_frame class.
stack_frame(xtd::size skip_frame)
Initializes a new instance of the xtd::diagnostics::stack_frame class that corresponds to a frame abo...
stack_frame(const xtd::diagnostics::source_location &source_location, xtd::size offset)
Initializes a new instance of the xtd::diagnostics::stack_frame class that contains only the given gi...
stack_frame(const xtd::string &file_name, xtd::size 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(xtd::null_ptr frame)
Initializes a new empty instance of the xtd::diagnostics::stack_frame.
static stack_frame empty() noexcept
Return an empty stack frame.
stack_frame(xtd::size 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::string &file_name, xtd::size line_number, xtd::size column_number)
Initializes a new instance of the xtd::diagnostics::stack_frame class that contains only the given fi...
stack_frame(const xtd::diagnostics::source_location &source_location)
Initializes a new instance of the xtd::diagnostics::stack_frame class that contains only the given so...
stack_frame(bool need_file_info)
Initializes a new instance of the xtd::diagnostics::stack_frame class, optionally capturing source in...
stack_frame(const xtd::string &file_name, xtd::size line_number, const xtd::string &method_name, xtd::size column_number, xtd::size 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, xtd::size line_number, const xtd::string &method_name, xtd::size column_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.hpp:40
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:22
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:43
The xtd::shared_ptr_object is a shared pointer as std::shared_ptr.
Definition shared_ptr_object.hpp:30
#define core_export_
Define shared library export.
Definition core_export.hpp:13
size_t size
Represents a size of any object in bytes.
Definition size.hpp:23
std::nullptr_t null_ptr
Represents the null_opt alias on std::nullptr_t.
Definition null_ptr.hpp:19
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10
Contains xtd::diagnostics::source_location method.