Skip to content

Commit

Permalink
REview uri_template_match_exception exception
Browse files Browse the repository at this point in the history
  • Loading branch information
gammasoft71 committed Nov 5, 2024
1 parent e10f83d commit 057a767
Show file tree
Hide file tree
Showing 5 changed files with 280 additions and 45 deletions.
1 change: 1 addition & 0 deletions src/xtd.core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1076,6 +1076,7 @@ add_sources(
src/xtd/type_object.cpp
src/xtd/uri.cpp
src/xtd/uri_format_exception.cpp
src/xtd/uri_template_match_exception.cpp
src/xtd/string.cpp
src/xtd/version.cpp
src/xtd/collections/key_not_found_exception.cpp
Expand Down
49 changes: 4 additions & 45 deletions src/xtd.core/include/xtd/uri_template_match_exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,63 +20,22 @@ namespace xtd {
/// @brief Create a new instance of class uri_template_match_exception
/// @param stack_frame (optional) Contains current stack frame about member name, file path and line number in the file where the exception is occurred. Typically xtd::diagnostics::stack_frame::current().
/// @remarks Message is set with the default message associate to the exception.
explicit uri_template_match_exception(const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) : system_exception(default_message(), stack_frame) {}
explicit uri_template_match_exception(const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
/// @brief Create a new instance of class uri_template_match_exception
/// @param message Message string associate to the exception.
/// @param stack_frame (optional) Contains current stack frame about member name, file path and line number in the file where the exception is occurred. Typically xtd::diagnostics::stack_frame::current().
explicit uri_template_match_exception(const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) : system_exception(message, stack_frame) {}
explicit uri_template_match_exception(const std::optional<xtd::string>& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
/// @brief Create a new instance of class uri_template_match_exception
/// @param message Message string associate to the exception.
/// @param error Error code associate to the exception.
/// @param stack_frame (optional) Contains current stack frame about member name, file path and line number in the file where the exception is occurred. Typically xtd::diagnostics::stack_frame::current().
explicit uri_template_match_exception(const xtd::string& message, const std::error_code& error, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) : system_exception(message, error, stack_frame) {}
/// @brief Create a new instance of class uri_template_match_exception
/// @param message Message string associate to the exception.
/// @param help_link Help link string associate to the exception.
/// @param stack_frame (optional) Contains current stack frame about member name, file path and line number in the file where the exception is occurred. Typically xtd::diagnostics::stack_frame::current().
explicit uri_template_match_exception(const xtd::string& message, const xtd::string& help_link, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) : system_exception(message, help_link, stack_frame) {}
/// @brief Create a new instance of class uri_template_match_exception
/// @param message Message string associate to the exception.
/// @param error Error code associate to the exception.
/// @param help_link Help link string associate to the exception.
explicit uri_template_match_exception(const xtd::string& message, const std::error_code& error, const xtd::string& help_link, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) : system_exception(message, error, help_link, stack_frame) {}
/// @brief Create a new instance of class uri_template_match_exception
/// @param inner_exception The exception that is the cause of the current exception.
/// @param stack_frame (optional) Contains current stack frame about member name, file path and line number in the file where the exception is occurred. Typically xtd::diagnostics::stack_frame::current().
/// @remarks Message is set with the default message associate to the exception.
explicit uri_template_match_exception(const std::exception& inner_exception, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) : system_exception(default_message(), inner_exception, stack_frame) {}
/// @brief Create a new instance of class uri_template_match_exception
/// @param message Message string associate to the exception.
/// @param inner_exception The exception that is the cause of the current exception.
/// @param stack_frame (optional) Contains current stack frame about member name, file path and line number in the file where the exception is occurred. Typically xtd::diagnostics::stack_frame::current().
explicit uri_template_match_exception(const xtd::string& message, const std::exception& inner_exception, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) : system_exception(message, inner_exception, stack_frame) {}
/// @brief Create a new instance of class uri_template_match_exception
/// @param message Message string associate to the exception.
/// @param inner_exception The exception that is the cause of the current exception.
/// @param error Error code associate to the exception.
/// @param stack_frame (optional) Contains current stack frame about member name, file path and line number in the file where the exception is occurred. Typically xtd::diagnostics::stack_frame::current().
explicit uri_template_match_exception(const xtd::string& message, const std::exception& inner_exception, const std::error_code& error, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) : system_exception(message, inner_exception, error, stack_frame) {}
/// @brief Create a new instance of class uri_template_match_exception
/// @param message Message string associate to the exception.
/// @param inner_exception The exception that is the cause of the current exception.
/// @param help_link Help link string associate to the exception.
/// @param stack_frame (optional) Contains current stack frame about member name, file path and line number in the file where the exception is occurred. Typically xtd::diagnostics::stack_frame::current().
explicit uri_template_match_exception(const xtd::string& message, const std::exception& inner_exception, const xtd::string& help_link, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) : system_exception(message, inner_exception, help_link, stack_frame) {}
/// @brief Create a new instance of class uri_template_match_exception
/// @param message Message string associate to the exception.
/// @param inner_exception The exception that is the cause of the current exception.
/// @param error Error code associate to the exception.
/// @param help_link Help link string associate to the exception.
/// @param stack_frame (optional) Contains current stack frame about member name, file path and line number in the file where the exception is occurred. Typically xtd::diagnostics::stack_frame::current().
explicit uri_template_match_exception(const xtd::string& message, const std::exception& inner_exception, const std::error_code& error, const xtd::string& help_link, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) : system_exception(message, inner_exception, error, help_link, stack_frame) {}
template<typename exception_t>
uri_template_match_exception(const std::optional<xtd::string>& message, const exception_t& inner_exception, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) : xtd::system_exception(message, inner_exception, stack_frame) {}
/// @}

/// @cond
uri_template_match_exception(const uri_template_match_exception&) = default;
uri_template_match_exception& operator =(const uri_template_match_exception&) = default;
/// @endcond

private:
const char* default_message() const noexcept {return "System error."_t;}
};
}
11 changes: 11 additions & 0 deletions src/xtd.core/src/xtd/uri_template_match_exception.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "../../include/xtd/uri_template_match_exception.h"
#include "../../include/xtd/literals.h"

using namespace xtd;
using namespace xtd::diagnostics;

uri_template_match_exception::uri_template_match_exception(const stack_frame& stack_frame) : system_exception(std::nullopt, stack_frame) {
}

uri_template_match_exception::uri_template_match_exception(const std::optional<xtd::string>& message, const xtd::diagnostics::stack_frame& stack_frame) : system_exception(message, stack_frame) {
}
1 change: 1 addition & 0 deletions tests/xtd.core.unit_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ add_sources(
src/xtd/tests/uri_host_name_type_tests.cpp
src/xtd/tests/uri_kind_tests.cpp
src/xtd/tests/uri_partial_tests.cpp
src/xtd/tests/uri_template_match_exception_tests.cpp
src/xtd/tests/uri_tests.cpp
src/xtd/tests/ustring_tests.cpp
src/xtd/tests/version_tests.cpp
Expand Down
Loading

0 comments on commit 057a767

Please sign in to comment.