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 "../object.hpp"
12#include "../ptr.hpp"
13#include "../size.hpp"
14#define __XTD_CORE_INTERNAL__
15#include "../internal/__string_definitions.hpp"
16#undef __XTD_CORE_INTERNAL__
17#include <limits>
18
20namespace xtd {
22 namespace diagnostics {
24 class stack_trace;
26
47 class core_export_ stack_frame : public xtd::object, public xtd::iequatable<stack_frame> {
48 public:
49
51
57 explicit stack_frame(xtd::size skip_frame);
60 explicit stack_frame(bool need_file_info);
64 stack_frame(xtd::size skip_frame, bool need_file_info);
68 stack_frame(const xtd::string& file_name, xtd::size line_number);
73 stack_frame(const xtd::string& file_name, xtd::size line_number, const xtd::string& method_name);
79 stack_frame(const xtd::string& file_name, xtd::size line_number, const xtd::string& method_name, xtd::size column_number);
85 stack_frame(const xtd::string& file_name, xtd::size line_number, xtd::size column_number);
92 stack_frame(const xtd::string& file_name, xtd::size line_number, const xtd::string& method_name, xtd::size column_number, xtd::size offset);
102 stack_frame(xtd::null_ptr frame); // Not explicit by design.
104 stack_frame(const stack_frame&) = default;
105 stack_frame(stack_frame&&) = default;
106 stack_frame& operator =(const stack_frame&) = default;
107 stack_frame& operator =(stack_frame&&) = default;
110
112
116 static stack_frame empty() noexcept;
117
120 static constexpr xtd::size OFFSET_UNKNOWN = std::numeric_limits<xtd::size>::max();
122
124
129 bool equals(const xtd::object& obj) const noexcept override;
133 bool equals(const stack_frame& other) const noexcept override;
134
137 xtd::size get_hash_code() const noexcept override;
138
154 virtual xtd::size get_file_column_number() const noexcept;
155
171 virtual xtd::size get_file_line_number() const noexcept;
172
188 virtual const xtd::string& get_file_name() const noexcept;
189
205 virtual const xtd::string& get_method() const noexcept;
206
222 virtual xtd::size get_native_offset() const noexcept;
223
239 virtual xtd::size get_offset() const noexcept;
240
243 xtd::string to_string() const noexcept override;
245
247
256 static stack_frame current(const xtd::diagnostics::source_location& value = xtd::diagnostics::source_location::current()) noexcept;
258
259 private:
260 friend class stack_trace;
261 // Do not use xtd::collections::generic::list because xtd::diagnostics::stack_frame is use by xtd::exception and
262 // xtd::collections::generic::list use xtd::argument_exception.
263 static std::vector<stack_frame> get_stack_frames(const xtd::string& str, xtd::size skip_frames, bool need_file_info) noexcept;
264
265 struct data;
266 ptr<data> data_;
267 };
268 }
269}
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:47
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:44
#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
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.