Suppressed or defaulted constructors/assignment operators

This commit is contained in:
Andrea Blankenstijn 2021-08-12 15:29:25 +02:00
parent 31763a4563
commit 0642d89803
6 changed files with 26 additions and 11 deletions

View file

@ -54,8 +54,11 @@ namespace bwidgets
Font(TTF_Font*);
Font(const std::string&, int);
Font(const Font&) = delete;
Font(Font&&) = delete;
~Font() noexcept = default;
auto operator=(const Font&) -> Font& = delete;
auto operator=(Font&&) -> Font& = delete;
[[nodiscard]] auto hinting() const noexcept -> Hinting;
auto hinting(Hinting) noexcept -> Font*;

View file

@ -35,8 +35,11 @@ namespace bwidgets
Renderer(SDL_Renderer*);
Renderer(SDL_Window*, int, uint32_t);
Renderer(const Renderer&) = delete;
Renderer(Renderer&&) = delete;
~Renderer() noexcept = default;
auto operator=(const Renderer&) = delete;
auto operator=(Renderer&&) = delete;
[[nodiscard]] auto blend_mode() -> SDL_BlendMode;
auto blend_mode(SDL_BlendMode) -> Renderer*;

View file

@ -33,9 +33,11 @@ namespace bwidgets
int, int);
Texture(const std::shared_ptr<Renderer>&, SDL_Surface*);
Texture(const Texture&) = delete;
Texture(Texture&&) = delete;
~Texture() noexcept;
auto operator=(const Texture&) = delete;
auto operator=(Texture&&) -> Texture& = delete;
[[nodiscard]] auto alpha_mode() -> uint8_t;
auto alpha_mode(uint8_t) -> Texture*;

View file

@ -68,6 +68,8 @@ namespace bwidgets
: _operate_on_alpha(op_on_alpha), _operate_on_colors(op_on_colors), sdl_type(c)
{}
inline Color(const Color&) noexcept = default;
inline Color(Color&&) noexcept = default;
~Color() = default;
[[nodiscard]] inline auto alpha() const noexcept -> Color
{
@ -104,13 +106,8 @@ namespace bwidgets
return _operate<N>(operand, [](const N& a, const N& b) { return a / b; });
}
inline auto& operator=(const Color& c) noexcept
{
if (this != &c) {
sdl_type = c.sdl_type;
}
return *this;
}
inline auto operator=(const Color& c) noexcept -> Color& = default;
inline auto operator=(Color&&) noexcept -> Color& = default;
inline auto& operator=(const SDL_Color& c) noexcept
{

View file

@ -15,10 +15,11 @@ namespace bwidgets
T* _c_pod;
public:
OpaqueStruct(T* ptr, const Deleter& d) : _deleter(d), _c_pod(ptr)
{
/* static_assert(noexcept(d(_c_pod))); */
}
OpaqueStruct(T* ptr, const Deleter& d) : _deleter(d), _c_pod(ptr) {}
OpaqueStruct(const OpaqueStruct&) = delete;
OpaqueStruct(OpaqueStruct&&) = delete;
virtual ~OpaqueStruct() noexcept
{
_deleter(_c_pod);
@ -29,6 +30,9 @@ namespace bwidgets
return _c_pod;
}
auto operator=(const OpaqueStruct&) -> OpaqueStruct& = delete;
auto operator=(OpaqueStruct&&) -> OpaqueStruct& = delete;
struct Wrapper
{
OpaqueStruct _data;

View file

@ -14,8 +14,14 @@ namespace bwidgets
virtual void _handle_focus_change(bool) = 0;
public:
FocusHandler() = default;
FocusHandler(const FocusHandler&) = delete;
FocusHandler(FocusHandler&&) = delete;
virtual ~FocusHandler() = default;
auto operator=(FocusHandler&&) -> FocusHandler& = delete;
auto operator=(const FocusHandler&) -> FocusHandler& = delete;
virtual inline void focus(bool focus) final
{
_handle_focus_change(focus);