|
From: <ag...@us...> - 2012-01-26 17:22:20
|
Revision: 2689
http://zoolib.svn.sourceforge.net/zoolib/?rev=2689&view=rev
Author: agreen
Date: 2012-01-26 17:22:14 +0000 (Thu, 26 Jan 2012)
Log Message:
-----------
Correct a mistake in ZCallableUtil's definitions of Field and Param types.
Some cleanup.
Modified Paths:
--------------
trunk/zoolib/source/cxx/zoolib/ZCallable.h
trunk/zoolib/source/cxx/zoolib/ZCallable_Bool.cpp
trunk/zoolib/source/cxx/zoolib/ZCallable_Bool.h
trunk/zoolib/source/cxx/zoolib/ZCallable_Compound.h
Modified: trunk/zoolib/source/cxx/zoolib/ZCallable.h
===================================================================
--- trunk/zoolib/source/cxx/zoolib/ZCallable.h 2012-01-26 17:20:55 UTC (rev 2688)
+++ trunk/zoolib/source/cxx/zoolib/ZCallable.h 2012-01-26 17:22:14 UTC (rev 2689)
@@ -37,29 +37,29 @@
template <class T> struct VT
{
- typedef const T F;
- typedef const T& P;
+ typedef const T Field;
+ typedef const T& Param;
- typedef F Field;
- typedef F Param;
+ typedef Field F;
+ typedef Param P;
};
template <class T> struct VT<const T&>
{
- typedef const T F;
- typedef const T& P;
+ typedef const T Field;
+ typedef const T& Param;
- typedef F Field;
- typedef F Param;
+ typedef Field F;
+ typedef Param P;
};
template <class T> struct VT<T&>
{
- typedef T& F;
- typedef T& P;
+ typedef T& Field;
+ typedef T& Param;
- typedef F Field;
- typedef F Param;
+ typedef Field F;
+ typedef Param P;
};
} // namespace ZCallableUtil
Modified: trunk/zoolib/source/cxx/zoolib/ZCallable_Bool.cpp
===================================================================
--- trunk/zoolib/source/cxx/zoolib/ZCallable_Bool.cpp 2012-01-26 17:20:55 UTC (rev 2688)
+++ trunk/zoolib/source/cxx/zoolib/ZCallable_Bool.cpp 2012-01-26 17:22:14 UTC (rev 2689)
@@ -24,94 +24,81 @@
namespace ZooLib {
// =================================================================================================
-// MARK: - anonymous
+// MARK: - Ctors
-namespace { // anonymous
-
-typedef ZCallable_Bool ZCB;
-
-struct Base : public ZCB
- {
- Base(const ZRef<ZCB>& i0, const ZRef<ZCB>& i1) : f0(i0) , f1(i1) {}
- const ZRef<ZCB> f0;
- const ZRef<ZCB> f1;
- };
-
-} // anonymous namespace
-
-// =================================================================================================
-// MARK: - Makers
-
-ZRef<ZCB> sCallable_True()
+ZRef<ZCallable_Bool> sCallable_True()
{ return sCallable_Const(true); }
-ZRef<ZCB> sCallable_False()
+ZRef<ZCallable_Bool> sCallable_False()
{ return sCallable_Const(false); }
-ZRef<ZCB> sCallable_Not(const ZRef<ZCB>& iCallable)
+ZRef<ZCallable_Bool> sCallable_Not(const ZRef<ZCallable_Bool>& iCallable)
{
- struct Callable : public ZCB
+ struct Callable : public ZCallable_Bool
{
- Callable(const ZRef<ZCB>& iCallable) : fCallable(iCallable) {}
+ Callable(const ZRef<ZCallable_Bool>& iCallable) : fCallable(iCallable) {}
virtual ZQ<bool> QCall()
{
- if (ZQ<bool> theQ = sQCall(fCallable))
- return not theQ.Get();
+ if (const ZQ<bool> theQ = sQCall(fCallable))
+ return not *theQ;
return null;
}
- const ZRef<ZCB> fCallable;
+ const ZRef<ZCallable_Bool> fCallable;
};
return new Callable(iCallable);
}
-ZRef<ZCB> sCallable_And(const ZRef<ZCB>& i0, const ZRef<ZCB>& i1)
+ZRef<ZCallable_Bool> sCallable_And(const ZRef<ZCallable_Bool>& i0, const ZRef<ZCallable_Bool>& i1)
{
- struct Callable : public Base
+ struct Callable : public ZCallable_Bool
{
- Callable(const ZRef<ZCB>& i0, const ZRef<ZCB>& i1) : Base(i0, i1) {}
+ Callable(const ZRef<ZCallable_Bool>& i0, const ZRef<ZCallable_Bool>& i1) : f0(i0), f1(i1) {}
virtual ZQ<bool> QCall()
{
- if (ZQ<bool> theQ0 = sQCall(f0))
+ if (const ZQ<bool> theQ0 = sQCall(f0))
{
- if (theQ0.Get())
+ if (*theQ0)
return sQCall(f1);
return false;
}
return null;
}
+ const ZRef<ZCallable_Bool> f0, f1;
};
return new Callable(i0, i1);
}
-ZRef<ZCB> sCallable_Or(const ZRef<ZCB>& i0, const ZRef<ZCB>& i1)
+ZRef<ZCallable_Bool> sCallable_Or(const ZRef<ZCallable_Bool>& i0, const ZRef<ZCallable_Bool>& i1)
{
- struct Callable : public Base
+ struct Callable : public ZCallable_Bool
{
- Callable(const ZRef<ZCB>& i0, const ZRef<ZCB>& i1) : Base(i0, i1) {}
+ Callable(const ZRef<ZCallable_Bool>& i0, const ZRef<ZCallable_Bool>& i1) : f0(i0), f1(i1) {}
virtual ZQ<bool> QCall()
{
- if (ZQ<bool> theQ0 = sQCall(f0) && theQ0.Get())
+ if (const ZQ<bool> theQ0 = sQCall(f0) && *theQ0)
return true;
return sQCall(f1);
}
+ const ZRef<ZCallable_Bool> f0, f1;
};
return new Callable(i0, i1);
}
-ZRef<ZCB> sCallable_Xor(const ZRef<ZCB>& i0, const ZRef<ZCB>& i1)
+ZRef<ZCallable_Bool> sCallable_Xor(const ZRef<ZCallable_Bool>& i0, const ZRef<ZCallable_Bool>& i1)
{
- struct Callable : public Base
+ struct Callable : public ZCallable_Bool
{
- Callable(const ZRef<ZCB>& i0, const ZRef<ZCB>& i1) : Base(i0, i1) {}
+ Callable(const ZRef<ZCallable_Bool>& i0, const ZRef<ZCallable_Bool>& i1) : f0(i0), f1(i1) {}
virtual ZQ<bool> QCall()
{
- if (ZQ<bool> theQ0 = sQCall(f0))
+ if (const ZQ<bool> theQ0 = sQCall(f0))
{
- if (ZQ<bool> theQ1 = sQCall(f1))
- return theQ0.Get() ^ theQ1.Get();
+ if (const ZQ<bool> theQ1 = sQCall(f1))
+ return *theQ0 ^ *theQ1;
}
return null;
}
+ const ZRef<ZCallable_Bool> f0, f1;
};
return new Callable(i0, i1);
}
Modified: trunk/zoolib/source/cxx/zoolib/ZCallable_Bool.h
===================================================================
--- trunk/zoolib/source/cxx/zoolib/ZCallable_Bool.h 2012-01-26 17:20:55 UTC (rev 2688)
+++ trunk/zoolib/source/cxx/zoolib/ZCallable_Bool.h 2012-01-26 17:22:14 UTC (rev 2689)
@@ -27,7 +27,7 @@
namespace ZooLib {
// =================================================================================================
-// MARK: - Makers
+// MARK: - Ctors
ZRef<ZCallable_Bool> sCallable_True();
ZRef<ZCallable_Bool> sCallable_False();
@@ -37,7 +37,7 @@
ZRef<ZCallable_Bool> sCallable_Xor(const ZRef<ZCallable_Bool>& i0, const ZRef<ZCallable_Bool>& i1);
// =================================================================================================
-// MARK: - Concise Makers
+// MARK: - Concise Ctors
inline ZRef<ZCallable_Bool> sNot(const ZRef<ZCallable_Bool>& iCallable)
{ return sCallable_Not(iCallable); }
Modified: trunk/zoolib/source/cxx/zoolib/ZCallable_Compound.h
===================================================================
--- trunk/zoolib/source/cxx/zoolib/ZCallable_Compound.h 2012-01-26 17:20:55 UTC (rev 2688)
+++ trunk/zoolib/source/cxx/zoolib/ZCallable_Compound.h 2012-01-26 17:22:14 UTC (rev 2689)
@@ -42,8 +42,8 @@
// From ZCallable
virtual ZQ<A> QCall(C iC)
{
- if (ZQ<B> theB = sQCall(fCallable, iC))
- return sQCall(fApply, theB.Get());
+ if (const ZQ<B> theB = sQCall(fCallable, iC))
+ return sQCall(fApply, *theB);
return null;
}
@@ -141,9 +141,9 @@
// From ZCallable
virtual ZQ<R> QCall()
{
- if (ZQ<bool> theQ = sQCall(fCondition))
+ if (const ZQ<bool> theQ = sQCall(fCondition))
{
- if (theQ.Get())
+ if (*theQ)
return sQCall(f0);
else
return sQCall(f1);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|