xtd 0.2.0
Loading...
Searching...
No Matches
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);
95 stack_frame(const xtd::source_location& source_location); // Not explicit by design.
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
126 using object::equals;
130 bool equals(const stack_frame& sf) const noexcept override;
131
147 virtual xtd::size get_file_column_number() const noexcept;
148
164 virtual xtd::size get_file_line_number() const noexcept;
165
181 virtual const xtd::string& get_file_name() const noexcept;
182
198 virtual const xtd::string& get_method() const noexcept;
199
215 virtual xtd::size get_native_offset() const noexcept;
216
232 virtual xtd::size get_offset() const noexcept;
233
236 xtd::string to_string() const noexcept override;
238
240
249 static stack_frame current(const xtd::source_location& value = xtd::source_location::current()) noexcept;
251
252 private:
253 friend class stack_trace;
254 // Do not use xtd::collections::generic::list because xtd::diagnostics::stack_frame is use by xtd::exception and
255 // xtd::collections::generic::list use xtd::argument_exception.
256 static std::vector<stack_frame> get_stack_frames(const xtd::string& str, xtd::size skip_frames, bool need_file_info) noexcept;
257
258 struct data;
259 ptr<data> data_;
260 };
261 }
262}
Represents text as a sequence of character units.
Definition basic_string.hpp:79
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::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::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(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...
stack_frame(const xtd::source_location &source_location)
Initializes a new instance of the xtd::diagnostics::stack_frame class that contains only the given so...
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:42
The xtd::source_location class represents certain information about the source code,...
Definition source_location.hpp:30
#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::source_location method.