Disable copy constructors and copy assignment operators

This commit is contained in:
Birunthan Mohanathas
2014-01-05 12:07:22 +02:00
parent 4b6a1d31ea
commit 7164dddefd
54 changed files with 157 additions and 18 deletions

View File

@ -42,6 +42,8 @@ class __declspec(novtable) Canvas
public:
virtual ~Canvas();
Canvas(const Canvas& other) = delete;
// Creates the canvas using the specified rendering engine. May return nullptr.
static Canvas* Create(Renderer renderer);
@ -108,9 +110,6 @@ protected:
// the default DirectWrite output. Otherwise, the expected result should be similar to that of
// non-typographic GDI+.
bool m_AccurateText;
private:
Canvas(const Canvas& other) {}
};
} // namespace Gfx

View File

@ -82,7 +82,9 @@ private:
CanvasD2D();
~CanvasD2D();
CanvasD2D(const CanvasD2D& other) {}
CanvasD2D(const CanvasD2D& other) = delete;
CanvasD2D& operator=(CanvasD2D other) = delete;
bool BeginTargetDraw();
void EndTargetDraw();

View File

@ -71,7 +71,9 @@ private:
CanvasGDIP();
~CanvasGDIP();
CanvasGDIP(const CanvasGDIP& other) {}
CanvasGDIP(const CanvasGDIP& other) = delete;
CanvasGDIP& operator=(CanvasGDIP other) = delete;
void Dispose();

View File

@ -29,14 +29,13 @@ class __declspec(novtable) FontCollection
public:
virtual ~FontCollection();
FontCollection(const FontCollection& other) = delete;
// Adds a file to the collection. Returns true if the file was successfully added.
virtual bool AddFile(const WCHAR* file) = 0;
protected:
FontCollection();
private:
FontCollection(const FontCollection& other) {}
};
} // namespace Gfx

View File

@ -31,6 +31,9 @@ class FontCollectionD2D final : public FontCollection
public:
virtual ~FontCollectionD2D();
FontCollectionD2D(const FontCollectionD2D& other) = delete;
FontCollectionD2D& operator=(FontCollectionD2D other) = delete;
virtual bool AddFile(const WCHAR* file) override;
protected:
@ -40,8 +43,6 @@ private:
friend class CanvasD2D;
friend class TextFormatD2D;
FontCollectionD2D(const FontCollectionD2D& other) {}
void Dispose();
bool InitializeCollection();

View File

@ -33,6 +33,9 @@ class FontCollectionGDIP final : public FontCollection
public:
virtual ~FontCollectionGDIP();
FontCollectionGDIP(const FontCollectionGDIP& other) = delete;
FontCollectionGDIP& operator=(FontCollectionGDIP other) = delete;
virtual bool AddFile(const WCHAR* file) override;
protected:
@ -42,8 +45,6 @@ private:
friend class CanvasGDIP;
friend class TextFormatGDIP;
FontCollectionGDIP(const FontCollectionGDIP& other) {}
void Dispose();
Gdiplus::PrivateFontCollection* m_PrivateCollection;

View File

@ -45,6 +45,8 @@ class __declspec(novtable) TextFormat
public:
virtual ~TextFormat();
TextFormat(const TextFormat& other) = delete;
// Returns true if this TextFormat object is valid for use in draw operations.
virtual bool IsInitialized() const = 0;
@ -69,8 +71,6 @@ protected:
TextFormat();
private:
TextFormat(const TextFormat& other) {}
HorizontalAlignment m_HorizontalAlignment;
VerticalAlignment m_VerticalAlignment;
};

View File

@ -33,6 +33,9 @@ public:
TextFormatD2D();
virtual ~TextFormatD2D();
TextFormatD2D(const TextFormatD2D& other) = delete;
TextFormatD2D& operator=(TextFormatD2D other) = delete;
virtual bool IsInitialized() const override { return m_TextFormat != nullptr; }
virtual void SetProperties(
@ -49,8 +52,6 @@ private:
friend class Common_Gfx_TextFormatD2D_Test;
TextFormatD2D(const TextFormatD2D& other) {}
void Dispose();
// Creates a new DirectWrite text layout if |str| has changed since last call. Since creating

View File

@ -33,6 +33,9 @@ public:
TextFormatGDIP();
virtual ~TextFormatGDIP();
TextFormatGDIP(const TextFormatGDIP& other) = delete;
TextFormatGDIP& operator=(TextFormatGDIP other) = delete;
virtual bool IsInitialized() const override { return m_Font != nullptr; }
virtual void SetProperties(
@ -47,8 +50,6 @@ public:
private:
friend class CanvasGDIP;
TextFormatGDIP(const TextFormatGDIP& other) {}
std::unique_ptr<Gdiplus::Font> m_Font;
std::unique_ptr<Gdiplus::FontFamily> m_FontFamily;
Gdiplus::StringFormat m_StringFormat;

View File

@ -36,6 +36,9 @@ public:
WICBitmapDIB();
~WICBitmapDIB();
WICBitmapDIB(const WICBitmapDIB& other) = delete;
WICBitmapDIB& operator=(WICBitmapDIB other) = delete;
void Resize(UINT w, UINT h);
HBITMAP GetHandle() const { return m_DIBSectionBuffer; }

View File

@ -48,6 +48,9 @@ public:
IFACEMETHOD(GetPixelFormat)(WICPixelFormatGUID* pPixelFormat);
private:
WICBitmapLockDIB(const WICBitmapLockDIB& other) = delete;
WICBitmapLockDIB& operator=(WICBitmapLockDIB other) = delete;
WICBitmapDIB* m_Bitmap;
const WICRect* m_Rect;
UINT m_RefCount;

View File

@ -48,6 +48,9 @@ public:
IFACEMETHOD(GetPixelFormat)(WICPixelFormatGUID* pPixelFormat);
private:
WICBitmapLockGDIP(const WICBitmapLockGDIP& other) = delete;
WICBitmapLockGDIP& operator=(WICBitmapLockGDIP other) = delete;
Gdiplus::BitmapData m_BitmapData;
UINT m_RefCount;
};