The xtd::diagnostics::source_location class represents certain information about the source code, such as file names, line numbers, and function names. Previously, functions that desire to obtain this information about the call site (for logging, testing, or debugging purposes) must use macros so that predefined macros like __LINE__ and __FILE__ are expanded in the context of the caller. The xtd::diagnostics::source_location class provides a better alternative.
Public Constructors | |
| source_location () | |
| Initializes a new instance of the xtd::diagnostics::source_location class. | |
Public Properties | |
| auto | column () const noexcept -> xtd::usize |
| Gets the column number represented by this object. | |
| auto | file_name () const noexcept -> const xtd::string & |
| Gets the name of the current source file represented by this object, represented as a null-terminated byte string. | |
| auto | function_name () const noexcept -> const xtd::string & |
| Gets the name of the function associated with the position represented by this object, if any. | |
| auto | line () const noexcept -> xtd::usize |
| Gets the line number represented by this object. | |
Public Methods | |
| auto | to_string () const noexcept -> xtd::string override |
| Returns a xtd::string that represents the current object. | |
Public Static Methods | |
| static auto | current (const __xtd_source_location__ &value=__xtd_source_location__::current()) noexcept -> xtd::diagnostics::source_location |
| Crates a new xtd::diagnostics::source_location object corresponding to the location of the call site. | |
Additional Inherited Members | |
| object ()=default | |
| Create a new instance of the ultimate base class object. | |
| virtual auto | equals (const object &obj) const noexcept -> bool |
| Determines whether the specified object is equal to the current object. | |
| virtual auto | get_hash_code () const noexcept -> xtd::usize |
| Serves as a hash function for a particular type. | |
| virtual auto | get_type () const noexcept -> type_object |
| Gets the type of the current instance. | |
| template<typename object_t> | |
| auto | memberwise_clone () const -> xtd::unique_ptr_object< object_t > |
| Creates a shallow copy of the current object. | |
| template<typename object_a_t, typename object_b_t> | |
| static auto | equals (const object_a_t &object_a, const object_b_t &object_b) noexcept -> bool |
| Determines whether the specified object instances are considered equal. | |
| template<typename object_a_t, typename object_b_t> | |
| static auto | reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept -> bool |
| Determines whether the specified object instances are the same instance. | |
| xtd::diagnostics::source_location::source_location | ( | ) |
Initializes a new instance of the xtd::diagnostics::source_location class.
|
nodiscardnoexcept |
Gets the column number represented by this object.
|
nodiscardnoexcept |
Gets the name of the current source file represented by this object, represented as a null-terminated byte string.
|
nodiscardnoexcept |
Gets the name of the function associated with the position represented by this object, if any.
|
nodiscardnoexcept |
Gets the line number represented by this object.
|
nodiscardoverridevirtualnoexcept |
Returns a xtd::string that represents the current object.
Reimplemented from xtd::object.
|
staticnodiscardnoexcept |
Crates a new xtd::diagnostics::source_location object corresponding to the location of the call site.