[Scummvm-cvs-logs] SF.net SVN: scummvm:[33427] scummvm/trunk/common/func.h

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Tue Jul 29 22:21:54 CEST 2008


Revision: 33427
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33427&view=rev
Author:   lordhoto
Date:     2008-07-29 20:21:54 +0000 (Tue, 29 Jul 2008)

Log Message:
-----------
- Formatting
- Improved Functor#Mem::isValid implementations.

Modified Paths:
--------------
    scummvm/trunk/common/func.h

Modified: scummvm/trunk/common/func.h
===================================================================
--- scummvm/trunk/common/func.h	2008-07-29 20:15:29 UTC (rev 33426)
+++ scummvm/trunk/common/func.h	2008-07-29 20:21:54 UTC (rev 33427)
@@ -172,7 +172,7 @@
 };
 
 template<class Result, class T>
-class ConstMemFunc0 : public UnaryFunction<T*, Result> {
+class ConstMemFunc0 : public UnaryFunction<T *, Result> {
 private:
 	Result (T::*_func)() const;
 public:
@@ -185,7 +185,7 @@
 };
 
 template<class Result, class Arg, class T>
-class MemFunc1 : public BinaryFunction<T*, Arg, Result> {
+class MemFunc1 : public BinaryFunction<T *, Arg, Result> {
 private:
 	Result (T::*_func)(Arg);
 public:
@@ -198,7 +198,7 @@
 };
 
 template<class Result, class Arg, class T>
-class ConstMemFunc1 : public BinaryFunction<T*, Arg, Result> {
+class ConstMemFunc1 : public BinaryFunction<T *, Arg, Result> {
 private:
 	Result (T::*_func)(Arg) const;
 public:
@@ -286,7 +286,7 @@
 
 	Functor0Mem(T *t, const FuncType &func) : _t(t), _func(func) {}
 
-	bool isValid() const { return _func != 0; }
+	bool isValid() const { return _func != 0 && _t != 0; }
 	Res operator()() const {
 		return (_t->*_func)();
 	}
@@ -349,7 +349,7 @@
 
 	Functor1Mem(T *t, const FuncType &func) : _t(t), _func(func) {}
 
-	bool isValid() const { return _func != 0; }
+	bool isValid() const { return _func != 0 && _t != 0; }
 	Res operator()(Arg v1) const {
 		return (_t->*_func)(v1);
 	}
@@ -385,7 +385,7 @@
 
 	Functor2Mem(T *t, const FuncType &func) : _t(t), _func(func) {}
 
-	bool isValid() const { return _func != 0; }
+	bool isValid() const { return _func != 0 && _t != 0; }
 	Res operator()(Arg1 v1, Arg2 v2) const {
 		return (_t->*_func)(v1, v2);
 	}


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