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 "../core_export.h"
9#include "../iequatable.h"
10#include "../object.h"
11#include "../ptr.h"
12#include "../source_location.h"
13#include "../size.h"
14#define __XTD_CORE_INTERNAL__
15#include "../internal/__string_definitions.h"
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_offset() const noexcept;
216
219 xtd::string to_string() const noexcept override;
221
223
232 static stack_frame current(const xtd::source_location& value = xtd::source_location::current()) noexcept;
234
235 private:
236 friend class stack_trace;
237 // Do not use xtd::collections::generic::list because xtd::diagnostics::stack_frame is use by xtd::exception and
238 // xtd::collections::generic::list use xtd::argument_exception.
239 static std::vector<stack_frame> get_stack_frames(const xtd::string& str, xtd::size skip_frames, bool need_file_info) noexcept;
240
241 struct data;
242 ptr<data> data_;
243 };
244 }
245}
Represents text as a sequence of character units.
Definition basic_string.h:79
Provides information about a xtd::diagnostics::stack_frame, which represents a function call on the c...
Definition stack_frame.h: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.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
The xtd::source_location class represents certain information about the source code,...
Definition source_location.h:30
#define core_export_
Define shared library export.
Definition core_export.h:13
xtd::sptr< type_t > ptr
The xtd::ptr object is a shared pointer.
Definition ptr.h:27
size_t size
Represents a size of any object in bytes.
Definition size.h:23
std::nullptr_t null_ptr
Represents the null_opt alias on std::nullptr_t.
Definition null_ptr.h:19
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10