From 0e73f75322959a766a89c74bbbb9d8b580747d7d Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 11 Dec 2021 19:15:09 -0600 Subject: [PATCH] [nostalgia/common] Make models noexcept --- src/nostalgia/common/CMakeLists.txt | 9 ++++++++- src/nostalgia/common/bounds.cpp | 4 ++-- src/nostalgia/common/bounds.hpp | 2 +- src/nostalgia/common/point.hpp | 2 +- src/nostalgia/common/size.hpp | 2 +- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/nostalgia/common/CMakeLists.txt b/src/nostalgia/common/CMakeLists.txt index b579602b..4b4818c2 100644 --- a/src/nostalgia/common/CMakeLists.txt +++ b/src/nostalgia/common/CMakeLists.txt @@ -4,7 +4,14 @@ add_library( bounds.cpp ) -#install(TARGETS NostalgiaCommon DESTINATION lib) +install( + TARGETS + NostalgiaCommon + DESTINATION + LIBRARY DESTINATION lib/nostalgia + ARCHIVE DESTINATION lib/nostalgia +) + install( FILES bounds.hpp diff --git a/src/nostalgia/common/bounds.cpp b/src/nostalgia/common/bounds.cpp index 87b71315..1d9539f2 100644 --- a/src/nostalgia/common/bounds.cpp +++ b/src/nostalgia/common/bounds.cpp @@ -33,11 +33,11 @@ int Bounds::y2() const noexcept { } Point Bounds::pt1() const noexcept { - return Point(x, y); + return {x, y}; } Point Bounds::pt2() const noexcept { - return Point(x2(), y2()); + return {x2(), y2()}; } } diff --git a/src/nostalgia/common/bounds.hpp b/src/nostalgia/common/bounds.hpp index bc5255da..65aa5feb 100644 --- a/src/nostalgia/common/bounds.hpp +++ b/src/nostalgia/common/bounds.hpp @@ -48,7 +48,7 @@ class Bounds { }; template -constexpr ox::Error model(T *io, Bounds *obj) { +constexpr ox::Error model(T *io, Bounds *obj) noexcept { io->template setTypeInfo(); oxReturnError(io->field("x", &obj->x)); oxReturnError(io->field("y", &obj->y)); diff --git a/src/nostalgia/common/point.hpp b/src/nostalgia/common/point.hpp index 04233a13..fac91d66 100644 --- a/src/nostalgia/common/point.hpp +++ b/src/nostalgia/common/point.hpp @@ -187,7 +187,7 @@ constexpr bool Point::operator!=(const Point &p) const noexcept { template -constexpr ox::Error model(T *io, Point *obj) { +constexpr ox::Error model(T *io, Point *obj) noexcept { io->template setTypeInfo(); oxReturnError(io->field("x", &obj->x)); oxReturnError(io->field("y", &obj->y)); diff --git a/src/nostalgia/common/size.hpp b/src/nostalgia/common/size.hpp index 89af0712..deb00685 100644 --- a/src/nostalgia/common/size.hpp +++ b/src/nostalgia/common/size.hpp @@ -185,7 +185,7 @@ constexpr bool Size::operator!=(const Size &p) const noexcept { template -constexpr ox::Error model(T *io, Size *obj) { +constexpr ox::Error model(T *io, Size *obj) noexcept { io->template setTypeInfo(); oxReturnError(io->field("width", &obj->width)); oxReturnError(io->field("height", &obj->height));