diff options
author | Neil <nyamatongwe@gmail.com> | 2021-04-05 20:04:18 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2021-04-05 20:04:18 +1000 |
commit | 00527a74c676076cad767397a2867a4aa4454a19 (patch) | |
tree | 439194ff58f526ac55b87d9a87f6b86c4cc724d6 | |
parent | 0f1f537fd035be38e7f93cba998dc75aaf90763d (diff) | |
download | scintilla-mirror-00527a74c676076cad767397a2867a4aa4454a19.tar.gz |
Mark more destructors as noexcept. Delete unwanted LisboxX standard methods.
-rw-r--r-- | src/Platform.h | 12 | ||||
-rw-r--r-- | win32/PlatWin.cxx | 29 |
2 files changed, 22 insertions, 19 deletions
diff --git a/src/Platform.h b/src/Platform.h index d46f050d6..b77fe3243 100644 --- a/src/Platform.h +++ b/src/Platform.h @@ -129,13 +129,13 @@ struct FontParameters { class Font { public: - Font() noexcept=default; + Font() noexcept = default; // Deleted so Font objects can not be copied Font(const Font &) = delete; Font(Font &&) = delete; Font &operator=(const Font &) = delete; Font &operator=(Font &&) = delete; - virtual ~Font()=default; + virtual ~Font() noexcept = default; static std::shared_ptr<Font> Allocate(const FontParameters &fp); }; @@ -156,7 +156,7 @@ public: class IScreenLineLayout { public: - virtual ~IScreenLineLayout() = default; + virtual ~IScreenLineLayout() noexcept = default; virtual size_t PositionFromX(XYPOSITION xDistance, bool charPosition) = 0; virtual XYPOSITION XFromPosition(size_t caretPosition) = 0; virtual std::vector<Interval> FindRangeIntervals(size_t start, size_t end) = 0; @@ -183,7 +183,7 @@ public: Surface(Surface &&) = delete; Surface &operator=(const Surface &) = delete; Surface &operator=(Surface &&) = delete; - virtual ~Surface() {} + virtual ~Surface() noexcept = default; static std::unique_ptr<Surface> Allocate(int technology); virtual void Init(WindowID wid)=0; @@ -268,7 +268,7 @@ public: } Window &operator=(const Window &) = delete; Window &operator=(Window &&) = delete; - virtual ~Window(); + virtual ~Window() noexcept; WindowID GetID() const noexcept { return wid; } bool Created() const noexcept { return wid != nullptr; } void Destroy() noexcept; @@ -313,7 +313,7 @@ struct ListOptions { class ListBox : public Window { public: ListBox() noexcept; - ~ListBox() override; + virtual ~ListBox() noexcept override; static std::unique_ptr<ListBox> Allocate(); virtual void SetFont(const Font *font)=0; diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index fa4889c9a..9f2d22c4e 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -279,7 +279,7 @@ struct FontGDI : public FontWin { FontGDI(FontGDI &&) = delete; FontGDI &operator=(const FontGDI &) = delete; FontGDI &operator=(FontGDI &&) = delete; - ~FontGDI() { + ~FontGDI() noexcept override { if (hfont) ::DeleteObject(hfont); } @@ -344,7 +344,7 @@ struct FontDirectWrite : public FontWin { FontDirectWrite(FontDirectWrite &&) = delete; FontDirectWrite &operator=(const FontDirectWrite &) = delete; FontDirectWrite &operator=(FontDirectWrite &&) = delete; - ~FontDirectWrite() { + ~FontDirectWrite() noexcept override { ReleaseUnknown(pTextFormat); } HFONT HFont() const noexcept override { @@ -393,7 +393,7 @@ public: VarBuffer &operator=(const VarBuffer &) = delete; VarBuffer &operator=(VarBuffer &&) = delete; - ~VarBuffer() { + ~VarBuffer() noexcept { if (buffer != bufferStandard) { delete []buffer; buffer = nullptr; @@ -1318,7 +1318,7 @@ public: SurfaceD2D(SurfaceD2D &&) = delete; SurfaceD2D &operator=(const SurfaceD2D &) = delete; SurfaceD2D &operator=(SurfaceD2D &&) = delete; - ~SurfaceD2D() override; + ~SurfaceD2D() noexcept override; void SetScale(WindowID wid) noexcept; void Init(WindowID wid) override; @@ -1403,7 +1403,7 @@ SurfaceD2D::SurfaceD2D(ID2D1RenderTarget *pRenderTargetCompatible, int width, in logPixelsY = logPixelsY_; } -SurfaceD2D::~SurfaceD2D() { +SurfaceD2D::~SurfaceD2D() noexcept { Clear(); } @@ -1936,8 +1936,7 @@ public: BlobInline(BlobInline &&) = default; BlobInline &operator=(const BlobInline &) = default; BlobInline &operator=(BlobInline &&) = default; - virtual ~BlobInline() { - } + virtual ~BlobInline() noexcept = default; }; /// Implement IUnknown @@ -2031,7 +2030,7 @@ public: ScreenLineLayout(ScreenLineLayout &&) = delete; ScreenLineLayout &operator=(const ScreenLineLayout &) = delete; ScreenLineLayout &operator=(ScreenLineLayout &&) = delete; - ~ScreenLineLayout() override; + ~ScreenLineLayout() noexcept override; size_t PositionFromX(XYPOSITION xDistance, bool charPosition) override; XYPOSITION XFromPosition(size_t caretPosition) override; std::vector<Interval> FindRangeIntervals(size_t start, size_t end) override; @@ -2158,7 +2157,7 @@ ScreenLineLayout::ScreenLineLayout(const IScreenLine *screenLine) { FillTextLayoutFormats(screenLine, textLayout, blobs); } -ScreenLineLayout::~ScreenLineLayout() { +ScreenLineLayout::~ScreenLineLayout() noexcept { ReleaseUnknown(textLayout); } @@ -2650,7 +2649,7 @@ std::unique_ptr<Surface> Surface::Allocate(int technology) { #endif } -Window::~Window() { +Window::~Window() noexcept { } void Window::Destroy() noexcept { @@ -2891,7 +2890,7 @@ const TCHAR ListBoxX_ClassName[] = TEXT("ListBoxX"); ListBox::ListBox() noexcept { } -ListBox::~ListBox() { +ListBox::~ListBox() noexcept { } class ListBoxX : public ListBox { @@ -2942,13 +2941,17 @@ class ListBoxX : public ListBox { static constexpr Point ImageInset {1, 0}; // Padding around image public: - ListBoxX() : lineHeight(10), fontCopy{}, technology(0), lb{}, unicodeMode(false), + ListBoxX() noexcept : lineHeight(10), fontCopy{}, technology(0), lb{}, unicodeMode(false), desiredVisibleRows(9), maxItemCharacters(0), aveCharWidth(8), parent(nullptr), ctrlID(0), dpi(USER_DEFAULT_SCREEN_DPI), delegate(nullptr), widestItem(nullptr), maxCharWidth(1), resizeHit(0), wheelDelta(0) { } - ~ListBoxX() override { + ListBoxX(const ListBoxX &) = delete; + ListBoxX(ListBoxX &&) = delete; + ListBoxX &operator=(const ListBoxX &) = delete; + ListBoxX &operator=(ListBoxX &&) = delete; + ~ListBoxX() noexcept override { if (fontCopy) { ::DeleteObject(fontCopy); fontCopy = 0; |