Skip to content

Commit

Permalink
override to_string method
Browse files Browse the repository at this point in the history
  • Loading branch information
gammasoft71 committed Oct 15, 2024
1 parent 71a5e3d commit 9af7d6b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/xtd.core/include/xtd/source_location.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ namespace xtd {
xtd::size line() const noexcept;
/// @}

/// @name Public Methods

/// @{
xtd::string to_string() const noexcept override;
/// @}

/// @name Public Static Methods

/// @{
Expand Down
4 changes: 4 additions & 0 deletions src/xtd.core/src/xtd/source_location.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ size source_location::line() const noexcept {
return data_->line;
}

xtd::string source_location::to_string() const noexcept {
return string::format("{} in file:line:column {}:{}:{}", function_name(), file_name(), line(), column());
}

source_location source_location::current(const __xtd_source_location__& value) noexcept {
return source_location {value.file_name(), static_cast<xtd::size>(value.line()), value.function_name(), static_cast<xtd::size>(value.column())};
}

0 comments on commit 9af7d6b

Please sign in to comment.