[Scummvm-cvs-logs] SF.net SVN: scummvm:[46410] tools/branches/gsoc2009-gui/common

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Thu Dec 17 22:42:43 CET 2009


Revision: 46410
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46410&view=rev
Author:   fingolfin
Date:     2009-12-17 21:42:42 +0000 (Thu, 17 Dec 2009)

Log Message:
-----------
TOOLS: Make File instances non-copyable

Modified Paths:
--------------
    tools/branches/gsoc2009-gui/common/file.h

Added Paths:
-----------
    tools/branches/gsoc2009-gui/common/noncopyable.h

Modified: tools/branches/gsoc2009-gui/common/file.h
===================================================================
--- tools/branches/gsoc2009-gui/common/file.h	2009-12-17 21:40:26 UTC (rev 46409)
+++ tools/branches/gsoc2009-gui/common/file.h	2009-12-17 21:42:42 UTC (rev 46410)
@@ -24,6 +24,7 @@
 #define COMMON_FILE_H
 
 #include "common/scummsys.h"
+#include "common/noncopyable.h"
 
 #include "tool_exception.h"
 
@@ -157,7 +158,7 @@
  * Offers functionality to write words easily, and deallocates the FILE
  * automatically on destruction.
  */
-class File {
+class File : public Common::NonCopyable {
 public:
 	/**
 	 * Opens the given file path as an in/out stream, depending on the

Added: tools/branches/gsoc2009-gui/common/noncopyable.h
===================================================================
--- tools/branches/gsoc2009-gui/common/noncopyable.h	                        (rev 0)
+++ tools/branches/gsoc2009-gui/common/noncopyable.h	2009-12-17 21:42:42 UTC (rev 46410)
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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: tools/branches/gsoc2009-gui/common/noncopyable.h
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native


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