[Scummvm-cvs-logs] SF.net SVN: scummvm: [26163] scummvm/trunk/common

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sat Mar 17 11:36:16 CET 2007


Revision: 26163
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26163&view=rev
Author:   fingolfin
Date:     2007-03-17 03:36:14 -0700 (Sat, 17 Mar 2007)

Log Message:
-----------
Added class NonCopyable, and made various things derive from it

Modified Paths:
--------------
    scummvm/trunk/common/events.h
    scummvm/trunk/common/savefile.h
    scummvm/trunk/common/singleton.h
    scummvm/trunk/common/system.h
    scummvm/trunk/common/timer.h

Added Paths:
-----------
    scummvm/trunk/common/noncopyable.h

Modified: scummvm/trunk/common/events.h
===================================================================
--- scummvm/trunk/common/events.h	2007-03-17 09:37:47 UTC (rev 26162)
+++ scummvm/trunk/common/events.h	2007-03-17 10:36:14 UTC (rev 26163)
@@ -25,6 +25,7 @@
 
 #include "common/rect.h"
 #include "common/system.h"
+#include "common/noncopyable.h"
 
 namespace Common {
 
@@ -33,7 +34,7 @@
  * In addition, it keeps track of the state of various input devices,
  * like keys, mouse position and buttons.
  */
-class EventManager {
+class EventManager : NonCopyable {
 public:
 	EventManager() {}
 	virtual ~EventManager() {}
@@ -79,6 +80,6 @@
 	// replacing it by a generic getScreenChangeID method here
 };
 
-}
+} // End of namespace Common
 
 #endif

Added: scummvm/trunk/common/noncopyable.h
===================================================================
--- scummvm/trunk/common/noncopyable.h	                        (rev 0)
+++ scummvm/trunk/common/noncopyable.h	2007-03-17 10:36:14 UTC (rev 26163)
@@ -0,0 +1,43 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2002-2007 The ScummVM project
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef COMMON_NONCOPYABLE_H
+#define COMMON_NONCOPYABLE_H
+
+namespace Common {
+
+/**
+ * Subclass of NonCopyable can not be copied due to the fact that
+ * we made the copy constructor and assigment operator private.
+ */
+class NonCopyable {
+public:
+	NonCopyable() {}
+private:
+	// Prevent copying instances by accident
+	NonCopyable(const NonCopyable&);
+	NonCopyable& operator= (const NonCopyable&);
+};
+
+} // End of namespace Common
+
+#endif


Property changes on: scummvm/trunk/common/noncopyable.h
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Date Rev Author URL Id
Name: svn:eol-style
   + native

Modified: scummvm/trunk/common/savefile.h
===================================================================
--- scummvm/trunk/common/savefile.h	2007-03-17 09:37:47 UTC (rev 26162)
+++ scummvm/trunk/common/savefile.h	2007-03-17 10:36:14 UTC (rev 26163)
@@ -24,6 +24,7 @@
 #define COMMON_SAVEFILE_H
 
 #include "common/stdafx.h"
+#include "common/noncopyable.h"
 #include "common/scummsys.h"
 #include "common/stream.h"
 
@@ -70,7 +71,7 @@
  * it is effectively used as such, with OSystem::getSavefileManager
  * returning the single SaveFileManager instances to be used.
  */
-class SaveFileManager {
+class SaveFileManager : NonCopyable {
 
 public:
 	virtual ~SaveFileManager() {}

Modified: scummvm/trunk/common/singleton.h
===================================================================
--- scummvm/trunk/common/singleton.h	2007-03-17 09:37:47 UTC (rev 26162)
+++ scummvm/trunk/common/singleton.h	2007-03-17 10:36:14 UTC (rev 26163)
@@ -24,14 +24,15 @@
 #ifndef COMMON_SINGLETON_H
 #define COMMON_SINGLETON_H
 
+#include "common/noncopyable.h"
+
 namespace Common {
 
 /**
  * Generic template base class for implementing the singleton design pattern.
  */
 template <class T>
-class Singleton
-{
+class Singleton : NonCopyable {
 private:
 	Singleton<T>(const Singleton<T>&);
 	Singleton<T>& operator= (const Singleton<T>&);

Modified: scummvm/trunk/common/system.h
===================================================================
--- scummvm/trunk/common/system.h	2007-03-17 09:37:47 UTC (rev 26162)
+++ scummvm/trunk/common/system.h	2007-03-17 10:36:14 UTC (rev 26163)
@@ -26,6 +26,7 @@
 
 #include "common/scummsys.h"
 #include "common/mutex.h"
+#include "common/noncopyable.h"
 #include "common/rect.h"
 
 namespace Audio {
@@ -52,12 +53,7 @@
  * methods to create timers, to handle user input events,
  * control audio CD playback, and sound output.
  */
-class OSystem {
-private:
-	// Prevent copying OSystem objects by accident.
-	OSystem(const OSystem&);
-	OSystem& operator= (const OSystem&);
-
+class OSystem : Common::NonCopyable {
 protected:
 	OSystem();
 	virtual ~OSystem();

Modified: scummvm/trunk/common/timer.h
===================================================================
--- scummvm/trunk/common/timer.h	2007-03-17 09:37:47 UTC (rev 26162)
+++ scummvm/trunk/common/timer.h	2007-03-17 10:36:14 UTC (rev 26163)
@@ -23,10 +23,11 @@
 #define COMMON_TIMER_H
 
 #include "common/scummsys.h"
+#include "common/noncopyable.h"
 
 namespace Common {
 
-class TimerManager {
+class TimerManager : NonCopyable {
 public:
 	typedef void (*TimerProc)(void *refCon);
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list