Skip to content

Commit f088ce1

Browse files
committed
using xtd::helpers::throw_helper class
1 parent fd22096 commit f088ce1

20 files changed

+46
-30
lines changed

src/xtd.forms/src/xtd/forms/checked_list_box.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ forms::create_params checked_list_box::create_params() const noexcept {
407407

408408
xtd::uptr<xtd::object> checked_list_box::clone() const {
409409
auto result = xtd::new_uptr<checked_list_box>(*this);
410-
if (typeof_(*result) != typeof_(*this)) xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::invalid_cast, xtd::string::format("The {} does not implement clone method.", typeof_(*this).full_name()).c_str());
410+
if (typeof_(*result) != typeof_(*this)) throw_helper::throws(exception_case::invalid_cast, xtd::string::format("The {} does not implement clone method.", typeof_(*this).full_name()).c_str());
411411
return result;
412412
}
413413

src/xtd.forms/src/xtd/forms/choice.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ forms::create_params choice::create_params() const noexcept {
311311

312312
xtd::uptr<xtd::object> choice::clone() const {
313313
auto result = xtd::new_uptr<choice>(*this);
314-
if (typeof_(*result) != typeof_(*this)) xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::invalid_cast, xtd::string::format("The {} does not implement clone method.", typeof_(*this).full_name()).c_str());
314+
if (typeof_(*result) != typeof_(*this)) throw_helper::throws(exception_case::invalid_cast, xtd::string::format("The {} does not implement clone method.", typeof_(*this).full_name()).c_str());
315315
return result;
316316
}
317317

src/xtd.forms/src/xtd/forms/color_picker.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
using namespace xtd;
1212
using namespace xtd::forms;
13+
using namespace xtd::helpers;
1314

1415
struct color_picker::data {
1516
drawing::color color = drawing::color::white;
@@ -173,7 +174,7 @@ forms::create_params color_picker::create_params() const noexcept {
173174

174175
xtd::uptr<xtd::object> color_picker::clone() const {
175176
auto result = xtd::new_uptr<color_picker>(*this);
176-
if (typeof_(*result) != typeof_(*this)) xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::invalid_cast, xtd::string::format("The {} does not implement clone method.", typeof_(*this).full_name()).c_str());
177+
if (typeof_(*result) != typeof_(*this)) throw_helper::throws(exception_case::invalid_cast, xtd::string::format("The {} does not implement clone method.", typeof_(*this).full_name()).c_str());
177178
return result;
178179
}
179180

src/xtd.forms/src/xtd/forms/combo_box.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ forms::create_params combo_box::create_params() const noexcept {
349349

350350
xtd::uptr<xtd::object> combo_box::clone() const {
351351
auto result = xtd::new_uptr<combo_box>(*this);
352-
if (typeof_(*result) != typeof_(*this)) xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::invalid_cast, xtd::string::format("The {} does not implement clone method.", typeof_(*this).full_name()).c_str());
352+
if (typeof_(*result) != typeof_(*this)) throw_helper::throws(exception_case::invalid_cast, xtd::string::format("The {} does not implement clone method.", typeof_(*this).full_name()).c_str());
353353
return result;
354354
}
355355

src/xtd.forms/src/xtd/forms/command_link_button.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using namespace xtd;
1212
using namespace xtd::drawing;
1313
using namespace xtd::forms;
14+
using namespace xtd::helpers;
1415

1516
struct command_link_button::data {
1617
std::tuple<string, string> texts;
@@ -227,7 +228,7 @@ forms::create_params command_link_button::create_params() const noexcept {
227228

228229
xtd::uptr<xtd::object> command_link_button::clone() const {
229230
auto result = xtd::new_uptr<command_link_button>(*this);
230-
if (typeof_(*result) != typeof_(*this)) xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::invalid_cast, xtd::string::format("The {} does not implement clone method.", typeof_(*this).full_name()).c_str());
231+
if (typeof_(*result) != typeof_(*this)) throw_helper::throws(xtd::helpers::exception_case::invalid_cast, xtd::string::format("The {} does not implement clone method.", typeof_(*this).full_name()).c_str());
231232
return result;
232233
}
233234

src/xtd.forms/src/xtd/forms/context_menu.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
using namespace xtd;
1414
using namespace xtd::forms;
15+
using namespace xtd::helpers;
1516

1617
context_menu::context_menu() {
1718
create_menu();
@@ -38,7 +39,7 @@ void context_menu::show(const xtd::forms::control& control, const xtd::drawing::
3839

3940
xtd::uptr<xtd::object> context_menu::clone() const {
4041
auto result = xtd::new_uptr<context_menu>(*this);
41-
if (typeof_(*result) != typeof_(*this)) xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::invalid_cast, xtd::string::format("The {} does not implement clone method.", typeof_(*this).full_name()).c_str());
42+
if (typeof_(*result) != typeof_(*this)) throw_helper::throws(exception_case::invalid_cast, xtd::string::format("The {} does not implement clone method.", typeof_(*this).full_name()).c_str());
4243
return result;
4344
}
4445

src/xtd.forms/src/xtd/forms/control.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
using namespace xtd;
3838
using namespace xtd::drawing;
3939
using namespace xtd::forms;
40+
using namespace xtd::helpers;
4041

4142
namespace {
4243
class reentrant_layout {
@@ -553,7 +554,7 @@ control& control::fore_color(std::nullptr_t) {
553554

554555
intptr control::handle() const {
555556
if (check_for_illegal_cross_thread_calls() && invoke_required())
556-
xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::invalid_operation, string::format("Cross-thread operation not valid: {}"_t, to_string()).c_str());
557+
throw_helper::throws(exception_case::invalid_operation, string::format("Cross-thread operation not valid: {}"_t, to_string()).c_str());
557558
return data_->handle;
558559
}
559560

@@ -988,7 +989,7 @@ void control::destroy_control() {
988989

989990
graphics control::create_graphics() const {
990991
if (!is_handle_created())
991-
xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::invalid_operation);
992+
throw_helper::throws(exception_case::invalid_operation);
992993
return graphics(native::control::create_graphics(handle()));
993994
}
994995

@@ -1049,7 +1050,7 @@ size_t control::get_child_index(intptr child) const {
10491050
if (child == 0) return control_collection::npos;
10501051
for (size_t index = 0; index < controls().size(); ++index)
10511052
if (controls()[index].get().handle() == child) return index;
1052-
xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::argument);;
1053+
throw_helper::throws(exception_case::argument);;
10531054
}
10541055

10551056
size_t control::get_child_index(intptr child, bool& throw_exception) const {
@@ -1570,7 +1571,7 @@ drawing::point control::point_to_screen(const xtd::drawing::point& p) const {
15701571

15711572
bool control::post_message(intptr hwnd, int32 msg, intptr wparam, intptr lparam) const {
15721573
if (check_for_illegal_cross_thread_calls() && invoke_required())
1573-
xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::invalid_operation, string::format("Cross-thread operation not valid: {}"_t, to_string()).c_str());
1574+
throw_helper::throws(exception_case::invalid_operation, string::format("Cross-thread operation not valid: {}"_t, to_string()).c_str());
15741575
if (!is_handle_created()) return false;
15751576
data_->post_messages.push(message::create(hwnd, msg, wparam, lparam));
15761577
return true;
@@ -1602,7 +1603,7 @@ void control::refresh() const {
16021603

16031604
intptr control::send_message(intptr hwnd, int32 msg, intptr wparam, intptr lparam) const {
16041605
if (check_for_illegal_cross_thread_calls() && invoke_required())
1605-
xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::invalid_operation, string::format("Cross-thread operation not valid: {}"_t, to_string()).c_str());
1606+
throw_helper::throws(exception_case::invalid_operation, string::format("Cross-thread operation not valid: {}"_t, to_string()).c_str());
16061607
return is_handle_created() ? native::control::send_message(handle(), hwnd, msg, wparam, lparam) : static_cast<intptr>(-1);
16071608
}
16081609

@@ -1685,7 +1686,7 @@ void control::show_context_menu(xtd::forms::context_menu& menu, const xtd::drawi
16851686

16861687
xtd::uptr<xtd::object> control::clone() const {
16871688
auto result = xtd::new_uptr<control>(*this);
1688-
if (typeof_(*result) != typeof_(*this)) xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::invalid_cast, xtd::string::format("The {} does not implement clone method.", typeof_(*this).full_name()).c_str());
1689+
if (typeof_(*result) != typeof_(*this)) throw_helper::throws(exception_case::invalid_cast, xtd::string::format("The {} does not implement clone method.", typeof_(*this).full_name()).c_str());
16891690
return result;
16901691
}
16911692

src/xtd.forms/src/xtd/forms/cursors.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
using namespace xtd;
99
using namespace xtd::forms;
10+
using namespace xtd::helpers;
1011

1112
cursor cursors::app_starting() {
1213
return cursor {native::cursors::app_starting(), true, "app_starting"};
@@ -167,7 +168,7 @@ cursor cursors::zoom_out() {
167168
cursor cursors::from_name(const xtd::string& name) {
168169
static auto cursor_names = std::map<string, cursor> {{"app_starting", cursors::app_starting()}, {"arrow", cursors::arrow()}, {"cell", cursors::cell()}, {"cross", cursors::cross()}, {"default_cursor", cursors::default_cursor()}, {"disappearing_item", cursors::disappearing_item()}, {"drag_copy", cursors::drag_copy()}, {"drag_link", cursors::drag_link()}, {"hand", cursors::hand()}, {"help", cursors::help()}, {"hsplit", cursors::hsplit()}, {"ibeam", cursors::ibeam()}, {"no", cursors::no()}, {"no_drag", cursors::no_drag()}, {"no_move_2d", cursors::no_move_2d()}, {"no_move_horiz", cursors::no_move_horiz()}, {"no_move_vert", cursors::no_move_vert()}, {"open_hand", cursors::open_hand()}, {"pan_east", cursors::pan_east()}, {"pan_ne", cursors::pan_ne()}, {"pan_north", cursors::pan_north()}, {"pan_nw", cursors::pan_nw()}, {"pan_se", cursors::pan_se()}, {"pan_south", cursors::pan_south()}, {"pan_sw", cursors::pan_sw()}, {"pan_west", cursors::pan_west()}, {"size_all", cursors::size_all()}, {"size_nesw", cursors::size_nesw()}, {"size_ns", cursors::size_ns()}, {"size_nwse", cursors::size_nwse()}, {"size_we", cursors::size_we()}, {"up_arrow", cursors::up_arrow()}, {"vibeam", cursors::vibeam()}, {"vsplit", cursors::vsplit()}, {"wait_cursor", cursors::wait_cursor()}, {"zoom_in", cursors::zoom_in()}, {"zoom_out", cursors::zoom_out()}};
169170
auto it = cursor_names.find(name);
170-
if (it == cursor_names.end()) xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::argument, string::format("The cursor name \"{}\" is invalid", name).c_str());
171+
if (it == cursor_names.end()) throw_helper::throws(exception_case::argument, string::format("The cursor name \"{}\" is invalid", name).c_str());
171172
return it->second;
172173
}
173174

src/xtd.forms/src/xtd/forms/date_time_picker.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
using namespace xtd;
1212
using namespace xtd::forms;
13+
using namespace xtd::helpers;
1314

1415
struct date_time_picker::data {
1516
date_time_picker_format format = date_time_picker_format::long_format;
@@ -370,7 +371,7 @@ forms::create_params date_time_picker::create_params() const noexcept {
370371

371372
xtd::uptr<xtd::object> date_time_picker::clone() const {
372373
auto result = xtd::new_uptr<date_time_picker>(*this);
373-
if (typeof_(*result) != typeof_(*this)) xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::invalid_cast, xtd::string::format("The {} does not implement clone method.", typeof_(*this).full_name()).c_str());
374+
if (typeof_(*result) != typeof_(*this)) throw_helper::throws(exception_case::invalid_cast, xtd::string::format("The {} does not implement clone method.", typeof_(*this).full_name()).c_str());
374375
return result;
375376
}
376377

src/xtd.forms/src/xtd/forms/debug_form.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using namespace xtd;
44
using namespace xtd::diagnostics;
55
using namespace xtd::forms;
6+
using namespace xtd::helpers;
67

78
debug_form::~debug_form() {
89
debug::listeners().erase(std::find(debug::listeners().begin(), debug::listeners().end(), listener_));
@@ -21,6 +22,6 @@ void debug_form::flush() {
2122

2223
xtd::uptr<xtd::object> debug_form::clone() const {
2324
auto result = xtd::new_uptr<debug_form>(*this);
24-
if (typeof_(*result) != typeof_(*this)) xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::invalid_cast, xtd::string::format("The {} does not implement clone method.", typeof_(*this).full_name()).c_str());
25+
if (typeof_(*result) != typeof_(*this)) throw_helper::throws(exception_case::invalid_cast, xtd::string::format("The {} does not implement clone method.", typeof_(*this).full_name()).c_str());
2526
return result;
2627
}

0 commit comments

Comments
 (0)