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;
};

View File

@ -42,6 +42,9 @@ public:
ConfigParser();
~ConfigParser();
ConfigParser(const ConfigParser& other) = delete;
ConfigParser& operator=(ConfigParser other) = delete;
void Initialize(const std::wstring& filename, MeterWindow* meterWindow = nullptr, LPCTSTR skinSection = nullptr, const std::wstring* resourcePath = nullptr);
void AddMeasure(Measure* pMeasure);

View File

@ -29,6 +29,9 @@ class ContextMenu
public:
ContextMenu();
ContextMenu(const ContextMenu& other) = delete;
ContextMenu& operator=(ContextMenu other) = delete;
bool IsMenuActive() { return m_MenuActive; }
void ShowMenu(POINT pos, MeterWindow* meterWindow);

View File

@ -29,6 +29,9 @@ public:
DialogAbout();
virtual ~DialogAbout();
DialogAbout(const DialogAbout& other) = delete;
DialogAbout& operator=(DialogAbout other) = delete;
static Dialog* GetDialog() { return c_Dialog; }
static void Open(int tab = 0);

View File

@ -28,6 +28,9 @@ public:
DialogManage();
virtual ~DialogManage();
DialogManage(const DialogManage& other) = delete;
DialogManage& operator=(DialogManage other) = delete;
static Dialog* GetDialog() { return c_Dialog; }
static void Open(const WCHAR* tabName, const WCHAR* param1, const WCHAR* param2);

View File

@ -27,6 +27,9 @@ class __declspec(novtable) Group
public:
virtual ~Group() {}
Group(const Group& other) = delete;
Group& operator=(Group other) = delete;
bool BelongsToGroup(const std::wstring& group) const;
protected:

View File

@ -63,6 +63,9 @@ public:
IfActions();
~IfActions();
IfActions(const IfActions& other) = delete;
IfActions& operator=(IfActions other) = delete;
void ReadOptions(ConfigParser& parser, const WCHAR* section);
void ReadConditionOptions(ConfigParser& parser, const WCHAR* section);
void DoIfActions(Measure& measure, double value);

View File

@ -77,6 +77,9 @@ private:
Logger();
~Logger();
Logger(const Logger& other) = delete;
Logger& operator=(Logger other) = delete;
bool m_LogToFile;
std::wstring m_LogFilePath;

View File

@ -58,6 +58,8 @@ class __declspec(novtable) Measure : public Section
public:
virtual ~Measure();
Measure(const Measure& other) = delete;
void ReadOptions(ConfigParser& parser) { ReadOptions(parser, GetName()); }
virtual void Initialize();

View File

@ -29,6 +29,9 @@ public:
MeasureCPU(MeterWindow* meterWindow, const WCHAR* name);
virtual ~MeasureCPU();
MeasureCPU(const MeasureCPU& other) = delete;
MeasureCPU& operator=(MeasureCPU other) = delete;
virtual UINT GetTypeID() { return TypeID<MeasureCPU>(); }
static void InitializeStatic();

View File

@ -27,6 +27,9 @@ public:
MeasureCalc(MeterWindow* meterWindow, const WCHAR* name);
virtual ~MeasureCalc();
MeasureCalc(const MeasureCalc& other) = delete;
MeasureCalc& operator=(MeasureCalc other) = delete;
virtual UINT GetTypeID() { return TypeID<MeasureCalc>(); }
protected:

View File

@ -27,6 +27,9 @@ public:
MeasureDiskSpace(MeterWindow* meterWindow, const WCHAR* name);
virtual ~MeasureDiskSpace();
MeasureDiskSpace(const MeasureDiskSpace& other) = delete;
MeasureDiskSpace& operator=(MeasureDiskSpace other) = delete;
virtual UINT GetTypeID() { return TypeID<MeasureDiskSpace>(); }
virtual const WCHAR* GetStringValue();

View File

@ -27,6 +27,9 @@ public:
MeasureMemory(MeterWindow* meterWindow, const WCHAR* name);
virtual ~MeasureMemory();
MeasureMemory(const MeasureMemory& other) = delete;
MeasureMemory& operator=(MeasureMemory other) = delete;
virtual UINT GetTypeID() { return TypeID<MeasureMemory>(); }
protected:

View File

@ -53,6 +53,9 @@ protected:
MeasureNet(MeterWindow* meterWindow, const WCHAR* name, NET type);
virtual ~MeasureNet();
MeasureNet(const MeasureNet& other) = delete;
MeasureNet& operator=(MeasureNet other) = delete;
virtual void ReadOptions(ConfigParser& parser, const WCHAR* section);
virtual void UpdateValue();

View File

@ -26,6 +26,9 @@ class MeasureNetIn : public MeasureNet
public:
MeasureNetIn(MeterWindow* meterWindow, const WCHAR* name);
virtual ~MeasureNetIn();
MeasureNetIn(const MeasureNetIn& other) = delete;
MeasureNetIn& operator=(MeasureNetIn other) = delete;
};
#endif

View File

@ -26,6 +26,9 @@ class MeasureNetOut : public MeasureNet
public:
MeasureNetOut(MeterWindow* meterWindow, const WCHAR* name);
virtual ~MeasureNetOut();
MeasureNetOut(const MeasureNetOut& other) = delete;
MeasureNetOut& operator=(MeasureNetOut other) = delete;
};
#endif

View File

@ -26,6 +26,9 @@ class MeasureNetTotal : public MeasureNet
public:
MeasureNetTotal(MeterWindow* meterWindow, const WCHAR* name);
virtual ~MeasureNetTotal();
MeasureNetTotal(const MeasureNetTotal& other) = delete;
MeasureNetTotal& operator=(MeasureNetTotal other) = delete;
};
#endif

View File

@ -27,6 +27,9 @@ public:
MeasurePhysicalMemory(MeterWindow* meterWindow, const WCHAR* name);
virtual ~MeasurePhysicalMemory();
MeasurePhysicalMemory(const MeasurePhysicalMemory& other) = delete;
MeasurePhysicalMemory& operator=(MeasurePhysicalMemory other) = delete;
virtual UINT GetTypeID() { return TypeID<MeasurePhysicalMemory>(); }
protected:

View File

@ -42,6 +42,9 @@ public:
MeasurePlugin(MeterWindow* meterWindow, const WCHAR* name);
virtual ~MeasurePlugin();
MeasurePlugin(const MeasurePlugin& other) = delete;
MeasurePlugin& operator=(MeasurePlugin other) = delete;
virtual UINT GetTypeID() { return TypeID<MeasurePlugin>(); }
virtual const WCHAR* GetStringValue();

View File

@ -27,6 +27,9 @@ public:
MeasureRegistry(MeterWindow* meterWindow, const WCHAR* name);
virtual ~MeasureRegistry();
MeasureRegistry(const MeasureRegistry& other) = delete;
MeasureRegistry& operator=(MeasureRegistry other) = delete;
virtual UINT GetTypeID() { return TypeID<MeasureRegistry>(); }
virtual const WCHAR* GetStringValue();

View File

@ -27,6 +27,9 @@ public:
MeasureScript(MeterWindow* meterWindow, const WCHAR* name);
virtual ~MeasureScript();
MeasureScript(const MeasureScript& other) = delete;
MeasureScript& operator=(MeasureScript other) = delete;
virtual UINT GetTypeID() { return TypeID<MeasureScript>(); }
virtual const WCHAR* GetStringValue();

View File

@ -27,6 +27,9 @@ public:
MeasureString(MeterWindow* meterWindow, const WCHAR* name);
virtual ~MeasureString();
MeasureString(const MeasureString& other) = delete;
MeasureString& operator=(MeasureString other) = delete;
virtual const WCHAR* GetStringValue();
virtual UINT GetTypeID() { return TypeID<MeasureString>(); }

View File

@ -27,6 +27,9 @@ public:
MeasureTime(MeterWindow* meterWindow, const WCHAR* name);
virtual ~MeasureTime();
MeasureTime(const MeasureTime& other) = delete;
MeasureTime& operator=(MeasureTime other) = delete;
virtual UINT GetTypeID() { return TypeID<MeasureTime>(); }
virtual const WCHAR* GetStringValue();

View File

@ -27,6 +27,9 @@ public:
MeasureUptime(MeterWindow* meterWindow, const WCHAR* name);
virtual ~MeasureUptime();
MeasureUptime(const MeasureUptime& other) = delete;
MeasureUptime& operator=(MeasureUptime other) = delete;
virtual UINT GetTypeID() { return TypeID<MeasureUptime>(); }
virtual const WCHAR* GetStringValue();

View File

@ -27,6 +27,9 @@ public:
MeasureVirtualMemory(MeterWindow* meterWindow, const WCHAR* name);
virtual ~MeasureVirtualMemory();
MeasureVirtualMemory(const MeasureVirtualMemory& other) = delete;
MeasureVirtualMemory& operator=(MeasureVirtualMemory other) = delete;
virtual UINT GetTypeID() { return TypeID<MeasureVirtualMemory>(); }
protected:

View File

@ -37,6 +37,8 @@ class __declspec(novtable) Meter : public Section
public:
virtual ~Meter();
Meter(const Meter& other) = delete;
void ReadOptions(ConfigParser& parser) { ReadOptions(parser, GetName()); parser.ClearStyleTemplate(); }
virtual void Initialize();

View File

@ -28,6 +28,9 @@ public:
MeterBar(MeterWindow* meterWindow, const WCHAR* name);
virtual ~MeterBar();
MeterBar(const MeterBar& other) = delete;
MeterBar& operator=(MeterBar other) = delete;
virtual UINT GetTypeID() { return TypeID<MeterBar>(); }
virtual void Initialize();

View File

@ -28,6 +28,9 @@ public:
MeterBitmap(MeterWindow* meterWindow, const WCHAR* name);
virtual ~MeterBitmap();
MeterBitmap(const MeterBitmap& other) = delete;
MeterBitmap& operator=(MeterBitmap other) = delete;
virtual UINT GetTypeID() { return TypeID<MeterBitmap>(); }
virtual bool HitTest(int x, int y);

View File

@ -30,6 +30,9 @@ public:
MeterButton(MeterWindow* meterWindow, const WCHAR* name);
virtual ~MeterButton();
MeterButton(const MeterButton& other) = delete;
MeterButton& operator=(MeterButton other) = delete;
virtual UINT GetTypeID() { return TypeID<MeterButton>(); }
virtual void Initialize();

View File

@ -28,6 +28,9 @@ public:
MeterHistogram(MeterWindow* meterWindow, const WCHAR* name);
virtual ~MeterHistogram();
MeterHistogram(const MeterHistogram& other) = delete;
MeterHistogram& operator=(MeterHistogram other) = delete;
virtual UINT GetTypeID() { return TypeID<MeterHistogram>(); }
virtual void Initialize();

View File

@ -28,6 +28,9 @@ public:
MeterImage(MeterWindow* meterWindow, const WCHAR* name);
virtual ~MeterImage();
MeterImage(const MeterImage& other) = delete;
MeterImage& operator=(MeterImage other) = delete;
virtual UINT GetTypeID() { return TypeID<MeterImage>(); }
virtual void Initialize();

View File

@ -27,6 +27,9 @@ public:
MeterLine(MeterWindow* meterWindow, const WCHAR* name);
virtual ~MeterLine();
MeterLine(const MeterLine& other) = delete;
MeterLine& operator=(MeterLine other) = delete;
virtual UINT GetTypeID() { return TypeID<MeterLine>(); }
virtual void Initialize();

View File

@ -28,6 +28,9 @@ public:
MeterRotator(MeterWindow* meterWindow, const WCHAR* name);
virtual ~MeterRotator();
MeterRotator(const MeterRotator& other) = delete;
MeterRotator& operator=(MeterRotator other) = delete;
virtual UINT GetTypeID() { return TypeID<MeterRotator>(); }
virtual void Initialize();

View File

@ -27,6 +27,9 @@ public:
MeterRoundLine(MeterWindow* meterWindow, const WCHAR* name);
virtual ~MeterRoundLine();
MeterRoundLine(const MeterRoundLine& other) = delete;
MeterRoundLine& operator=(MeterRoundLine other) = delete;
virtual UINT GetTypeID() { return TypeID<MeterRoundLine>(); }
virtual bool Update();

View File

@ -29,6 +29,9 @@ public:
MeterString(MeterWindow* meterWindow, const WCHAR* name);
virtual ~MeterString();
MeterString(const MeterString& other) = delete;
MeterString& operator=(MeterString other) = delete;
virtual UINT GetTypeID() { return TypeID<MeterString>(); }
virtual int GetX(bool abs = false);

View File

@ -115,6 +115,9 @@ public:
MeterWindow(const std::wstring& folderPath, const std::wstring& file);
~MeterWindow();
MeterWindow(const MeterWindow& other) = delete;
MeterWindow& operator=(MeterWindow other) = delete;
void Initialize();
void DoBang(Bang bang, const std::vector<std::wstring>& args);

View File

@ -66,6 +66,9 @@ public:
Mouse(MeterWindow* meterWindow, Meter* meter = nullptr);
~Mouse();
Mouse(const Mouse& other) = delete;
Mouse& operator=(Mouse other) = delete;
void ReadOptions(ConfigParser& parser, const WCHAR* section);
MOUSECURSOR GetCursorType() const { return m_CursorType; }

View File

@ -189,6 +189,9 @@ private:
Rainmeter();
~Rainmeter();
Rainmeter(const Rainmeter& other) = delete;
Rainmeter& operator=(Rainmeter other) = delete;
static LRESULT CALLBACK MainWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
void ActivateActiveSkins();

View File

@ -31,6 +31,8 @@ class __declspec(novtable) Section : public Group
public:
virtual ~Section();
Section(const Section& other) = delete;
virtual UINT GetTypeID() = 0;
const WCHAR* GetName() const { return m_Name.c_str(); }

View File

@ -29,6 +29,10 @@
class SkinRegistry
{
public:
SkinRegistry() = default;
SkinRegistry(const SkinRegistry& other) = delete;
SkinRegistry& operator=(SkinRegistry other) = delete;
struct Folder
{
std::wstring name;

View File

@ -46,6 +46,9 @@ struct MultiMonitorInfo
class System
{
public:
System(const System& other) = delete;
System& operator=(System other) = delete;
static void Initialize(HINSTANCE instance);
static void Finalize();

View File

@ -73,6 +73,9 @@ public:
TintedImage(const WCHAR* name = L"ImageName", const WCHAR** optionArray = c_DefaultOptionArray, bool disableTransform = false, MeterWindow* meterWindow = nullptr);
~TintedImage();
TintedImage(const TintedImage& other) = delete;
TintedImage& operator=(TintedImage other) = delete;
void ReadOptions(ConfigParser& parser, const WCHAR* section, const WCHAR* imagePath = L"");
bool IsLoaded() { return (m_Bitmap != nullptr); }

View File

@ -43,6 +43,9 @@ public:
TrayWindow();
~TrayWindow();
TrayWindow(const TrayWindow& other) = delete;
TrayWindow& operator=(TrayWindow other) = delete;
void Initialize();
void ReadOptions(ConfigParser& parser);