|
From: <ag...@us...> - 2011-01-12 21:55:26
|
Revision: 1881
http://zoolib.svn.sourceforge.net/zoolib/?rev=1881&view=rev
Author: agreen
Date: 2011-01-12 21:55:19 +0000 (Wed, 12 Jan 2011)
Log Message:
-----------
Use revised operator_bool macros.
Modified Paths:
--------------
trunk/zoolib/source/cxx/more/zoolib/javascriptcore/ZJavaScriptCore.cpp
trunk/zoolib/source/cxx/more/zoolib/javascriptcore/ZJavaScriptCore.h
trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Variant.h
trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.cpp
trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.h
trunk/zoolib/source/cxx/zoolib/ZAny.h
trunk/zoolib/source/cxx/zoolib/ZCompare_String.cpp
trunk/zoolib/source/cxx/zoolib/ZCounted.cpp
trunk/zoolib/source/cxx/zoolib/ZCounted.h
trunk/zoolib/source/cxx/zoolib/ZDCPixmap.h
trunk/zoolib/source/cxx/zoolib/ZDList.h
trunk/zoolib/source/cxx/zoolib/ZData_Any.cpp
trunk/zoolib/source/cxx/zoolib/ZData_Any.h
trunk/zoolib/source/cxx/zoolib/ZDelegate.h
trunk/zoolib/source/cxx/zoolib/ZDelegate.mm
trunk/zoolib/source/cxx/zoolib/ZFile.cpp
trunk/zoolib/source/cxx/zoolib/ZFile.h
trunk/zoolib/source/cxx/zoolib/ZGRgn.h
trunk/zoolib/source/cxx/zoolib/ZGeom.h
trunk/zoolib/source/cxx/zoolib/ZGeometry.h
trunk/zoolib/source/cxx/zoolib/ZLog.cpp
trunk/zoolib/source/cxx/zoolib/ZLog.h
trunk/zoolib/source/cxx/zoolib/ZML.cpp
trunk/zoolib/source/cxx/zoolib/ZML.h
trunk/zoolib/source/cxx/zoolib/ZNet_RFCOMM_OSX.mm
trunk/zoolib/source/cxx/zoolib/ZQ.h
trunk/zoolib/source/cxx/zoolib/ZRef.h
trunk/zoolib/source/cxx/zoolib/ZServer.cpp
trunk/zoolib/source/cxx/zoolib/ZTextCollator.h
trunk/zoolib/source/cxx/zoolib/ZTime.cpp
trunk/zoolib/source/cxx/zoolib/ZTime.h
trunk/zoolib/source/cxx/zoolib/ZTxn.cpp
trunk/zoolib/source/cxx/zoolib/ZVal_Any.cpp
trunk/zoolib/source/cxx/zoolib/ZVal_Any.h
trunk/zoolib/source/cxx/zoolib/ZVal_AppleEvent.cpp
trunk/zoolib/source/cxx/zoolib/ZVal_AppleEvent.h
trunk/zoolib/source/cxx/zoolib/ZVal_CFType.cpp
trunk/zoolib/source/cxx/zoolib/ZWinCOM.cpp
trunk/zoolib/source/cxx/zoolib/ZWinCOM.h
Modified: trunk/zoolib/source/cxx/more/zoolib/javascriptcore/ZJavaScriptCore.cpp
===================================================================
--- trunk/zoolib/source/cxx/more/zoolib/javascriptcore/ZJavaScriptCore.cpp 2011-01-12 21:53:29 UTC (rev 1880)
+++ trunk/zoolib/source/cxx/more/zoolib/javascriptcore/ZJavaScriptCore.cpp 2011-01-12 21:55:19 UTC (rev 1881)
@@ -424,14 +424,14 @@
return ZAny();
}
-Value::operator operator_bool_type() const
+Value::operator operator_bool() const
{
if (JSValueRef theRef = inherited::Get())
{
if (kJSTypeUndefined != ::JSValueGetType(sCurrentContextRef(), theRef))
- return operator_bool_generator_type::translate(true);
+ return operator_bool_gen::translate(true);
}
- return operator_bool_generator_type::translate(false);
+ return operator_bool_gen::translate(false);
}
Value::operator bool() const
Modified: trunk/zoolib/source/cxx/more/zoolib/javascriptcore/ZJavaScriptCore.h
===================================================================
--- trunk/zoolib/source/cxx/more/zoolib/javascriptcore/ZJavaScriptCore.h 2011-01-12 21:53:29 UTC (rev 1880)
+++ trunk/zoolib/source/cxx/more/zoolib/javascriptcore/ZJavaScriptCore.h 2011-01-12 21:55:19 UTC (rev 1881)
@@ -148,10 +148,8 @@
String ToString() const;
- ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES(Value,
- operator_bool_generator_type, operator_bool_type);
+ ZMACRO_operator_bool(Value, operator_bool) const;
- operator operator_bool_type() const;
operator bool() const;
operator JSValueRef() const;
JSValueRef& OParam();
Modified: trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Variant.h
===================================================================
--- trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Variant.h 2011-01-12 21:53:29 UTC (rev 1880)
+++ trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Variant.h 2011-01-12 21:55:19 UTC (rev 1881)
@@ -82,12 +82,9 @@
void pRelease();
public:
- ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES_T(NPVariant_T<T>,
- operator_bool_generator_type, operator_bool_type);
+ ZMACRO_operator_bool_T(NPVariant_T<T>, operator_bool) const
+ { return operator_bool_gen::translate(type != NPVariantType_Void); }
- operator operator_bool_type() const
- { return operator_bool_generator_type::translate(type != NPVariantType_Void); }
-
typedef T Object_t;
ZAny AsAny() const;
Modified: trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.cpp
===================================================================
--- trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.cpp 2011-01-12 21:53:29 UTC (rev 1880)
+++ trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.cpp 2011-01-12 21:55:19 UTC (rev 1881)
@@ -733,8 +733,8 @@
Spec Spec::sProperty(ClassID iClassID, const string8& iName)
{ return Entry::sProperty(iClassID, spAsRuntimeTypeID(iName)); }
-Spec::operator operator_bool_type() const
- { return operator_bool_generator_type::translate(!fEntries.empty()); }
+Spec::operator operator_bool() const
+ { return operator_bool_gen::translate(!fEntries.empty()); }
void Spec::swap(Spec& iOther)
{ fEntries.swap(iOther.fEntries); }
@@ -1114,8 +1114,8 @@
\brief Encapsulates a PIActionList, implementing the ZSeq API.
*/
-Seq::operator operator_bool_type() const
- { return operator_bool_generator_type::translate(this->Count()); }
+Seq::operator operator_bool() const
+ { return operator_bool_gen::translate(this->Count()); }
ZSeq_Any Seq::AsSeq_Any(const ZAny& iDefault) const
{
@@ -1249,8 +1249,8 @@
\brief Encapsulates a PIActionDescriptor, implementing the ZMap API.
*/
-Map::operator operator_bool_type() const
- { return operator_bool_generator_type::translate(this->pCount()); }
+Map::operator operator_bool() const
+ { return operator_bool_gen::translate(this->pCount()); }
ZMap_Any Map::AsMap_Any(const ZAny& iDefault) const
{
Modified: trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.h
===================================================================
--- trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.h 2011-01-12 21:53:29 UTC (rev 1880)
+++ trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.h 2011-01-12 21:55:19 UTC (rev 1881)
@@ -140,11 +140,8 @@
struct Entry;
public:
- ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES(Spec,
- operator_bool_generator_type, operator_bool_type);
+ ZMACRO_operator_bool(Spec, operator_bool) const;
- operator operator_bool_type() const;
-
void swap(Spec& iOther);
static Spec sClass(ClassID iClassID);
@@ -279,11 +276,8 @@
public:
typedef Val Val_t;
- ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES(Seq,
- operator_bool_generator_type, operator_bool_type);
+ ZMACRO_operator_bool(Seq, operator_bool) const;
- operator operator_bool_type() const;
-
ZSeq_Any AsSeq_Any(const ZAny& iDefault) const;
void swap(Seq& iOther);
@@ -353,11 +347,8 @@
typedef ZMapIndex_T<Map> Index_t;
typedef Val Val_t;
- ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES(Map,
- operator_bool_generator_type, operator_bool_type);
+ ZMACRO_operator_bool(Map, operator_bool) const;
- operator operator_bool_type() const;
-
ZMap_Any AsMap_Any(const ZAny& iDefault) const;
void swap(Map& iOther);
Modified: trunk/zoolib/source/cxx/zoolib/ZAny.h
===================================================================
--- trunk/zoolib/source/cxx/zoolib/ZAny.h 2011-01-12 21:53:29 UTC (rev 1880)
+++ trunk/zoolib/source/cxx/zoolib/ZAny.h 2011-01-12 21:55:19 UTC (rev 1881)
@@ -37,12 +37,9 @@
class ZAny
{
public:
- ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES(ZAny,
- operator_bool_generator_type, operator_bool_type);
+ ZMACRO_operator_bool(ZAny, operator_bool) const
+ { return operator_bool_gen::translate(fRep); }
- operator operator_bool_type() const
- { return operator_bool_generator_type::translate(fRep); }
-
ZAny()
: fRep(0)
{}
Modified: trunk/zoolib/source/cxx/zoolib/ZCompare_String.cpp
===================================================================
--- trunk/zoolib/source/cxx/zoolib/ZCompare_String.cpp 2011-01-12 21:53:29 UTC (rev 1880)
+++ trunk/zoolib/source/cxx/zoolib/ZCompare_String.cpp 2011-01-12 21:55:19 UTC (rev 1881)
@@ -23,9 +23,6 @@
namespace ZooLib {
-template <>
-int sCompare_T(const std::string& iL, const std::string& iR);
-
ZMACRO_CompareRegistration_T(std::string)
} // namespace ZooLib
Modified: trunk/zoolib/source/cxx/zoolib/ZCounted.cpp
===================================================================
--- trunk/zoolib/source/cxx/zoolib/ZCounted.cpp 2011-01-12 21:53:29 UTC (rev 1880)
+++ trunk/zoolib/source/cxx/zoolib/ZCounted.cpp 2011-01-12 21:55:19 UTC (rev 1881)
@@ -33,7 +33,7 @@
ZCountedBase::~ZCountedBase()
{
- ZAssert(!fWRP);
+ ZAssertStop(1, !fWeakRefProxy);
ZAssertStopf(1, 0 == ZAtomic_Get(&fRefCount),
("Non-zero refcount at destruction, it is %d", ZAtomic_Get(&fRefCount)));
}
@@ -55,10 +55,10 @@
if (!ZAtomic_DecAndTest(&fRefCount))
return false;
- if (fWRP)
+ if (fWeakRefProxy)
{
- fWRP->Clear();
- fWRP.Clear();
+ fWeakRefProxy->Clear();
+ fWeakRefProxy.Clear();
}
return true;
@@ -74,17 +74,12 @@
{
for (;;)
{
- int oldRefCount = ZAtomic_Get(&fRefCount);
+ const int oldRefCount = ZAtomic_Get(&fRefCount);
if (oldRefCount == 1)
- {
this->Finalize();
- break;
- }
- else
- {
- if (ZAtomic_CompareAndSwap(&fRefCount, oldRefCount, oldRefCount - 1))
- break;
- }
+ else if (!ZAtomic_CompareAndSwap(&fRefCount, oldRefCount, oldRefCount - 1))
+ continue;
+ return;
}
}
@@ -94,24 +89,24 @@
bool ZCountedBase::IsReferenced() const
{ return 0 != ZAtomic_Get(&fRefCount); }
-ZRef<ZCountedBase::WRP> ZCountedBase::GetWRP()
+ZRef<ZCountedBase::WeakRefProxy> ZCountedBase::GetWeakRefProxy()
{
- if (!fWRP)
+ if (!fWeakRefProxy)
{
- ZRef<WRP> theWRP = new WRP(this);
- if (!fWRP.AtomicSetIfNull(theWRP.Get()))
+ ZRef<WeakRefProxy> theWeakRefProxy = new WeakRefProxy(this);
+ if (!fWeakRefProxy.AtomicSetIfNull(theWeakRefProxy.Get()))
{
- // We lost the race, so (efficiently) clear theWRP's reference
- // to us, or we'll trip an asssertion in WRP::~WRP.
- theWRP->Clear();
+ // We lost the race, so (efficiently) clear theWeakRefProxy's reference
+ // to us, or we'll trip an asssertion in WeakRefProxy::~WeakRefProxy.
+ theWeakRefProxy->Clear();
}
}
- return fWRP;
+ return fWeakRefProxy;
}
int ZCountedBase::pCOMAddRef()
{
- int oldRefCount = ZAtomic_Add(&fRefCount, 1);
+ const int oldRefCount = ZAtomic_Add(&fRefCount, 1);
if (oldRefCount == 0)
this->Initialize();
return oldRefCount + 1;
@@ -121,7 +116,7 @@
{
for (;;)
{
- int oldRefCount = ZAtomic_Get(&fRefCount);
+ const int oldRefCount = ZAtomic_Get(&fRefCount);
if (oldRefCount == 1)
{
this->Finalize();
@@ -129,32 +124,31 @@
// Return zero as a sensible value.
return 0;
}
- else
+ else if (ZAtomic_CompareAndSwap(&fRefCount, oldRefCount, oldRefCount - 1))
{
- if (ZAtomic_CompareAndSwap(&fRefCount, oldRefCount, oldRefCount - 1))
- return oldRefCount - 1;
+ return oldRefCount - 1;
}
}
}
// =================================================================================================
#pragma mark -
-#pragma mark * ZCountedBase::WRP
+#pragma mark * ZCountedBase::WeakRefProxy
-ZCountedBase::WRP::WRP(ZCountedBase* iCountedBase)
+ZCountedBase::WeakRefProxy::WeakRefProxy(ZCountedBase* iCountedBase)
: fCountedBase(iCountedBase)
{}
-ZCountedBase::WRP::~WRP()
- { ZAssert(!fCountedBase); }
+ZCountedBase::WeakRefProxy::~WeakRefProxy()
+ { ZAssertStop(1, !fCountedBase); }
-ZRef<ZCountedBase> ZCountedBase::WRP::GetCountedBase()
+ZRef<ZCountedBase> ZCountedBase::WeakRefProxy::GetCountedBase()
{
ZAcqMtx acq(fMtx);
return fCountedBase;
}
-void ZCountedBase::WRP::Clear()
+void ZCountedBase::WeakRefProxy::Clear()
{
ZAcqMtx acq(fMtx);
fCountedBase = nullptr;
Modified: trunk/zoolib/source/cxx/zoolib/ZCounted.h
===================================================================
--- trunk/zoolib/source/cxx/zoolib/ZCounted.h 2011-01-12 21:53:29 UTC (rev 1880)
+++ trunk/zoolib/source/cxx/zoolib/ZCounted.h 2011-01-12 21:55:19 UTC (rev 1881)
@@ -48,8 +48,8 @@
bool IsShared() const;
bool IsReferenced() const;
- class WRP;
- ZRef<WRP> GetWRP();
+ class WeakRefProxy;
+ ZRef<WeakRefProxy> GetWeakRefProxy();
protected:
int pCOMAddRef();
@@ -57,7 +57,7 @@
private:
ZAtomic_t fRefCount;
- ZRef<WRP> fWRP;
+ ZRef<WeakRefProxy> fWeakRefProxy;
};
// =================================================================================================
@@ -79,13 +79,13 @@
// =================================================================================================
#pragma mark -
-#pragma mark * ZCountedBase::WRP
+#pragma mark * ZCountedBase::WeakRefProxy
-class ZCountedBase::WRP : public ZCountedWithoutFinalize
+class ZCountedBase::WeakRefProxy : public ZCountedWithoutFinalize
{
public:
- WRP(ZCountedBase* iCountedBase);
- virtual ~WRP();
+ WeakRefProxy(ZCountedBase* iCountedBase);
+ virtual ~WeakRefProxy();
ZRef<ZCountedBase> GetCountedBase();
@@ -111,18 +111,18 @@
{}
ZWeakRef(const ZWeakRef& iOther)
- : fWRP(iOther.fWRP)
+ : fWeakRefProxy(iOther.fWeakRefProxy)
{}
ZWeakRef& operator=(const ZWeakRef& iOther)
{
- fWRP = iOther.fWRP;
+ fWeakRefProxy = iOther.fWeakRefProxy;
return *this;
}
template <class O>
ZWeakRef(const ZWeakRef<O>& iOther)
- : fWRP(iOther.fWRP)
+ : fWeakRefProxy(iOther.fWeakRefProxy)
{
// Ensure that T is a supertype of O
static_cast<T*>(static_cast<O*>(0));
@@ -131,42 +131,42 @@
template <class O>
ZWeakRef& operator=(const ZWeakRef<O>& iOther)
{
- fWRP = iOther.fWRP;
+ fWeakRefProxy = iOther.fWeakRefProxy;
return *this;
}
ZWeakRef(const null_t&)
{}
- ZWeakRef(const ZRef<ZCountedBase::WRP>& iWRP)
- : fWRP(iWRP)
+ ZWeakRef(const ZRef<ZCountedBase::WeakRefProxy>& iWeakRefProxy)
+ : fWeakRefProxy(iWeakRefProxy)
{}
template <class O>
ZWeakRef(const ZRef<O>& iRef)
{
if (iRef)
- fWRP = iRef->GetWRP();
+ fWeakRefProxy = iRef->GetWeakRefProxy();
}
template <class O>
ZWeakRef& operator=(const ZRef<O>& iRef)
{
if (iRef)
- fWRP = iRef->GetWRP();
+ fWeakRefProxy = iRef->GetWeakRefProxy();
else
- fWRP.Clear();
+ fWeakRefProxy.Clear();
return *this;
}
void Clear()
- { fWRP.Clear(); }
+ { fWeakRefProxy.Clear(); }
ZRef<T> Get() const
{
- if (fWRP)
+ if (fWeakRefProxy)
{
- if (ZRef<ZCountedBase> theCB = fWRP->GetCountedBase())
+ if (ZRef<ZCountedBase> theCB = fWeakRefProxy->GetCountedBase())
return theCB.DynamicCast<T>();
}
return null;
@@ -175,23 +175,23 @@
template <class O>
operator ZRef<O>() const
{
- if (fWRP)
+ if (fWeakRefProxy)
{
- if (ZRef<ZCountedBase> theCB = fWRP->GetCountedBase())
+ if (ZRef<ZCountedBase> theCB = fWeakRefProxy->GetCountedBase())
return theCB.DynamicCast<O>();
}
return null;
}
private:
- ZRef<ZCountedBase::WRP> fWRP;
+ ZRef<ZCountedBase::WeakRefProxy> fWeakRefProxy;
};
template <class T>
ZWeakRef<T> MakeWeakRef(T* iP)
{
if (iP)
- return ZWeakRef<T>(iP->GetWRP());
+ return ZWeakRef<T>(iP->GetWeakRefProxy());
return null;
}
Modified: trunk/zoolib/source/cxx/zoolib/ZDCPixmap.h
===================================================================
--- trunk/zoolib/source/cxx/zoolib/ZDCPixmap.h 2011-01-12 21:53:29 UTC (rev 1880)
+++ trunk/zoolib/source/cxx/zoolib/ZDCPixmap.h 2011-01-12 21:55:19 UTC (rev 1881)
@@ -43,8 +43,6 @@
class ZDCPixmap
{
- ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES(ZDCPixmap, operator_bool_generator_type, operator_bool_type);
-
public:
// The usual mantra: constructor, copy constructor, destructor, assignment
ZDCPixmap();
@@ -102,8 +100,8 @@
bool operator==(const ZDCPixmap& other) const;
/** Are we valid, i.e. do we have any pixels at all? */
- operator operator_bool_type() const
- { return operator_bool_generator_type::translate(fRep && true); }
+ ZMACRO_operator_bool(ZDCPixmap, operator_bool) const
+ { return operator_bool_gen::translate(!!fRep); }
/** \name Dimensions
The number of pixels horizontally and vertically.
Modified: trunk/zoolib/source/cxx/zoolib/ZDList.h
===================================================================
--- trunk/zoolib/source/cxx/zoolib/ZDList.h 2011-01-12 21:53:29 UTC (rev 1880)
+++ trunk/zoolib/source/cxx/zoolib/ZDList.h 2011-01-12 21:55:19 UTC (rev 1881)
@@ -54,11 +54,9 @@
~DListHead()
{ ZAssertStop(L::kDebug, !fHeadL && !fSize); }
- ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES_T(
- DListHead, operator_bool_generator_type, operator_bool_type);
+ ZMACRO_operator_bool_T(DListHead, operator_bool) const
+ { return operator_bool_gen::translate(fHeadL); }
- operator operator_bool_type() const { return operator_bool_generator_type::translate(fHeadL); }
-
size_t Size() const { return fSize; }
bool Empty() const
@@ -227,10 +225,8 @@
, fCurrent(iDListHead.fHeadL)
{}
- ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES_T(
- DListIterator, operator_bool_generator_type, operator_bool_type);
- operator operator_bool_type() const
- { return operator_bool_generator_type::translate(fCurrent); }
+ ZMACRO_operator_bool_T(DListIterator, operator_bool) const
+ { return operator_bool_gen::translate(fCurrent); }
P* Current() const
{ return static_cast<P*>(fCurrent); }
@@ -303,12 +299,10 @@
}
}
- ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES_T(
- DListEraser, operator_bool_generator_type, operator_bool_type);
- operator operator_bool_type() const
+ ZMACRO_operator_bool_T(DListEraser, operator_bool) const
{
ZAssertStop(L::kDebug, fCurrent || !fCurrent && !fNext);
- return operator_bool_generator_type::translate(fCurrent);
+ return operator_bool_gen::translate(fCurrent);
}
P* Current() const
Modified: trunk/zoolib/source/cxx/zoolib/ZData_Any.cpp
===================================================================
--- trunk/zoolib/source/cxx/zoolib/ZData_Any.cpp 2011-01-12 21:53:29 UTC (rev 1880)
+++ trunk/zoolib/source/cxx/zoolib/ZData_Any.cpp 2011-01-12 21:55:19 UTC (rev 1881)
@@ -64,8 +64,8 @@
ZAny ZData_Any::AsAny() const
{ return ZAny(*this); }
-ZData_Any::operator operator_bool_type() const
- { return operator_bool_generator_type::translate(fRep->fVector.size()); }
+ZData_Any::operator operator_bool() const
+ { return operator_bool_gen::translate(fRep->fVector.size()); }
ZData_Any::ZData_Any()
: fRep(new Rep)
Modified: trunk/zoolib/source/cxx/zoolib/ZData_Any.h
===================================================================
--- trunk/zoolib/source/cxx/zoolib/ZData_Any.h 2011-01-12 21:53:29 UTC (rev 1880)
+++ trunk/zoolib/source/cxx/zoolib/ZData_Any.h 2011-01-12 21:55:19 UTC (rev 1881)
@@ -40,11 +40,8 @@
public:
ZAny AsAny() const;
- ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES(ZData_Any,
- operator_bool_generator_type, operator_bool_type);
+ ZMACRO_operator_bool(ZData_Any, operator_bool) const;
- operator operator_bool_type() const;
-
ZData_Any();
ZData_Any(const ZData_Any& iOther);
~ZData_Any();
Modified: trunk/zoolib/source/cxx/zoolib/ZDelegate.h
===================================================================
--- trunk/zoolib/source/cxx/zoolib/ZDelegate.h 2011-01-12 21:53:29 UTC (rev 1880)
+++ trunk/zoolib/source/cxx/zoolib/ZDelegate.h 2011-01-12 21:55:19 UTC (rev 1881)
@@ -30,7 +30,6 @@
#include "zoolib/ZRef_NSObject.h"
#include <map>
-#include <string>
#ifdef __OBJC__
#import <Foundation/NSInvocation.h>
Modified: trunk/zoolib/source/cxx/zoolib/ZDelegate.mm
===================================================================
--- trunk/zoolib/source/cxx/zoolib/ZDelegate.mm 2011-01-12 21:53:29 UTC (rev 1880)
+++ trunk/zoolib/source/cxx/zoolib/ZDelegate.mm 2011-01-12 21:55:19 UTC (rev 1881)
@@ -19,7 +19,10 @@
------------------------------------------------------------------------------------------------- */
#include "zoolib/ZDelegate.h"
+#include "zoolib/ZUtil_STL_map.h"
+#include <string>
+
#if ZCONFIG_SPI_Enabled(Cocoa)
#import <Foundation/NSMethodSignature.h>
@@ -80,7 +83,7 @@
namespace ZooLib {
-using std::map;
+//using std::map;
// =================================================================================================
#pragma mark -
@@ -102,21 +105,27 @@
{ return fProxy; }
BOOL ZDelegate::pRespondsToSelector(SEL aSelector)
- { return fWrappers.end() != fWrappers.find(aSelector); }
+ { return ZUtil_STL::sContains(fWrappers, aSelector); }
+// { return fWrappers.end() != fWrappers.find(aSelector); }
void ZDelegate::pForwardInvocation(NSInvocation* anInvocation)
{
- map<SEL, ZRef<Wrapper> >::iterator i = fWrappers.find([anInvocation selector]);
- if (fWrappers.end() != i)
- i->second->ForwardInvocation(anInvocation);
+ if (ZQ<ZRef<Wrapper> > theQ = ZUtil_STL::sGetIfContains(fWrappers, [anInvocation selector]))
+ theQ.Get()->ForwardInvocation(anInvocation);
+// map<SEL, ZRef<Wrapper> >::iterator i = fWrappers.find([anInvocation selector]);
+// if (fWrappers.end() != i)
+// i->second->ForwardInvocation(anInvocation);
}
NSMethodSignature* ZDelegate::pMethodSignatureForSelector(SEL aSelector)
{
- map<SEL, ZRef<Wrapper> >::iterator i = fWrappers.find(aSelector);
- if (fWrappers.end() != i)
- return i->second->fNSMethodSignature;
+ if (ZQ<ZRef<Wrapper> > theQ = ZUtil_STL::sGetIfContains(fWrappers, aSelector))
+ return theQ.Get()->fNSMethodSignature;
return nil;
+// map<SEL, ZRef<Wrapper> >::iterator i = fWrappers.find(aSelector);
+// if (fWrappers.end() != i)
+// return i->second->fNSMethodSignature;
+// return nil;
}
// =================================================================================================
Modified: trunk/zoolib/source/cxx/zoolib/ZFile.cpp
===================================================================
--- trunk/zoolib/source/cxx/zoolib/ZFile.cpp 2011-01-12 21:53:29 UTC (rev 1880)
+++ trunk/zoolib/source/cxx/zoolib/ZFile.cpp 2011-01-12 21:55:19 UTC (rev 1881)
@@ -97,8 +97,8 @@
/** \brief Returns true if the file spec is valid, that is if it represents
an extant or potentially extant node in the file system. */
-ZFileSpec::operator operator_bool_type() const
- { return operator_bool_generator_type::translate(fLoc && true); }
+ZFileSpec::operator operator_bool() const
+ { return operator_bool_gen::translate(!!fLoc); }
/// Returns a file spec representing the current working directory.
/**
@@ -792,8 +792,8 @@
that is not an extant directory, or if the iterator has
run off the end of the directory.
*/
-ZFileIter::operator operator_bool_type() const
- { return operator_bool_generator_type::translate(fRep && fRep->HasValue()); }
+ZFileIter::operator operator_bool() const
+ { return operator_bool_gen::translate(fRep && fRep->HasValue()); }
/**
Updates the iterator to point to the next child of the directory.
@@ -864,8 +864,8 @@
return *this;
}
-ZFileTreeIter::operator operator_bool_type() const
- { return operator_bool_generator_type::translate(fCurrent && true); }
+ZFileTreeIter::operator operator_bool() const
+ { return operator_bool_gen::translate(!!fCurrent); }
ZFileTreeIter& ZFileTreeIter::Advance()
{
Modified: trunk/zoolib/source/cxx/zoolib/ZFile.h
===================================================================
--- trunk/zoolib/source/cxx/zoolib/ZFile.h 2011-01-12 21:53:29 UTC (rev 1880)
+++ trunk/zoolib/source/cxx/zoolib/ZFile.h 2011-01-12 21:55:19 UTC (rev 1881)
@@ -100,8 +100,7 @@
ZFileSpec(const std::string& iPath);
- ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES(ZFileSpec, operator_bool_generator_type, operator_bool_type);
- operator operator_bool_type() const;
+ ZMACRO_operator_bool(ZFileSpec, operator_bool) const;
static ZFileSpec sCWD();
static ZFileSpec sRoot();
@@ -187,8 +186,7 @@
~ZFileIter();
ZFileIter& operator=(const ZFileIter& iOther);
- ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES(ZFileIter, operator_bool_generator_type, operator_bool_type);
- operator operator_bool_type() const;
+ ZMACRO_operator_bool(ZFileIter, operator_bool) const;
ZFileIter& Advance();
ZFileSpec Current() const;
std::string CurrentName() const;
@@ -212,9 +210,7 @@
~ZFileTreeIter();
ZFileTreeIter& operator=(const ZFileTreeIter& iOther);
- ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES(
- ZFileTreeIter, operator_bool_generator_type, operator_bool_type);
- operator operator_bool_type() const;
+ ZMACRO_operator_bool(ZFileTreeIter, operator_bool) const;
ZFileTreeIter& Advance();
ZFileSpec Current() const;
std::string CurrentName() const;
Modified: trunk/zoolib/source/cxx/zoolib/ZGRgn.h
===================================================================
--- trunk/zoolib/source/cxx/zoolib/ZGRgn.h 2011-01-12 21:53:29 UTC (rev 1880)
+++ trunk/zoolib/source/cxx/zoolib/ZGRgn.h 2011-01-12 21:55:19 UTC (rev 1881)
@@ -97,9 +97,8 @@
class ZGRgn
{
public:
- ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES(ZGRgn, operator_bool_generator_type, operator_bool_type);
- operator operator_bool_type() const
- { return operator_bool_generator_type::translate(fRep && !fRep->IsEmpty()); }
+ ZMACRO_operator_bool(ZGRgn, operator_bool) const
+ { return operator_bool_gen::translate(fRep && !fRep->IsEmpty()); }
template <typename Native>
static ZGRgn sFromNative(Native iNative, bool iAdopt)
Modified: trunk/zoolib/source/cxx/zoolib/ZGeom.h
===================================================================
--- trunk/zoolib/source/cxx/zoolib/ZGeom.h 2011-01-12 21:53:29 UTC (rev 1880)
+++ trunk/zoolib/source/cxx/zoolib/ZGeom.h 2011-01-12 21:55:19 UTC (rev 1881)
@@ -23,6 +23,7 @@
#include "zconfig.h"
#include "zoolib/ZCONFIG_SPI.h"
+#include "zoolib/ZCompat_operator_bool.h"
#include "zoolib/ZGeometry.h" // Pulls in platform types and ZGeomPOD
#if ZCONFIG_SPI_Enabled(BeOS)
@@ -44,10 +45,8 @@
class ZPoint_T
{
public:
- ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES_T(ZPoint_T<T>,
- operator_bool_generator_type, operator_bool_type);
- operator operator_bool_type() const
- { return operator_bool_generator_type::translate(h || v); }
+ ZMACRO_operator_bool_T(ZPoint_T<T>, operator_bool) const
+ { return operator_bool_gen::translate(h || v); }
static const ZPoint_T sZero;
@@ -213,10 +212,8 @@
class ZRect_T
{
public:
- ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES_T(ZRect_T<T>,
- operator_bool_generator_type, operator_bool_type);
- operator operator_bool_type() const
- { return operator_bool_generator_type::translate(left < right && top < bottom); }
+ ZMACRO_operator_bool_T(ZRect_T<T>, operator_bool) const
+ { return operator_bool_gen::translate(left < right && top < bottom); }
static const ZRect_T sZero;
Modified: trunk/zoolib/source/cxx/zoolib/ZGeometry.h
===================================================================
--- trunk/zoolib/source/cxx/zoolib/ZGeometry.h 2011-01-12 21:53:29 UTC (rev 1880)
+++ trunk/zoolib/source/cxx/zoolib/ZGeometry.h 2011-01-12 21:55:19 UTC (rev 1881)
@@ -73,7 +73,6 @@
// Include these after the platform files -- cmath causes problems
// for Mac headers ('relation' is undefined) when building with CW.
#include "zoolib/ZCompat_algorithm.h" // For min and max
-#include "zoolib/ZCompat_operator_bool.h"
namespace ZooLib {
@@ -85,12 +84,6 @@
class ZGPointPOD_T
{
public:
- ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES_T(ZGPointPOD_T<T>,
- operator_bool_generator_type, operator_bool_type);
-
- operator operator_bool_type() const
- { return operator_bool_generator_type::translate(x || y); }
-
T x;
T y;
@@ -220,12 +213,6 @@
class ZGExtentPOD_T
{
public:
- ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES_T(ZGExtentPOD_T<T>,
- operator_bool_generator_type, operator_bool_type);
-
- operator operator_bool_type() const
- { return operator_bool_generator_type::translate(h || v); }
-
union { T h; T width; };
union { T v; T height; };
@@ -358,12 +345,6 @@
class ZGRectPOD_T
{
public:
- ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES_T(ZGRectPOD_T<Ord>,
- operator_bool_generator_type, operator_bool_type);
-
- operator operator_bool_type() const
- { return operator_bool_generator_type::translate(extent); }
-
ZGPointPOD_T<Ord> origin;
union { ZGExtentPOD_T<Ord> extent; ZGExtentPOD_T<Ord> size; };
@@ -416,6 +397,8 @@
Ord Width() const;
Ord Height() const;
+ bool IsEmpty() const;
+
Ord L() const; // aka MinX
Ord R() const; // aka MaxX
@@ -541,6 +524,10 @@
{ return extent.v; }
template <class Ord>
+bool ZGRectPOD_T<Ord>::IsEmpty() const
+ { return extent.h && extent.v; }
+
+template <class Ord>
Ord ZGRectPOD_T<Ord>::L() const
{ return extent.h >= 0 ? origin.x : origin.x + extent.h; }
Modified: trunk/zoolib/source/cxx/zoolib/ZLog.cpp
===================================================================
--- trunk/zoolib/source/cxx/zoolib/ZLog.cpp 2011-01-12 21:53:29 UTC (rev 1880)
+++ trunk/zoolib/source/cxx/zoolib/ZLog.cpp 2011-01-12 21:55:19 UTC (rev 1881)
@@ -128,10 +128,9 @@
}
}
-StrimW::operator operator_bool_type() const
+StrimW::operator operator_bool() const
{
- return operator_bool_generator_type::translate(spLogMeister
- && spLogMeister->Enabled(fPriority, fName));
+ return operator_bool_gen::translate(spLogMeister && spLogMeister->Enabled(fPriority, fName));
}
void StrimW::Emit() const
Modified: trunk/zoolib/source/cxx/zoolib/ZLog.h
===================================================================
--- trunk/zoolib/source/cxx/zoolib/ZLog.h 2011-01-12 21:53:29 UTC (rev 1880)
+++ trunk/zoolib/source/cxx/zoolib/ZLog.h 2011-01-12 21:55:19 UTC (rev 1881)
@@ -101,8 +101,8 @@
virtual void Imp_WriteUTF8(const UTF8* iSource, size_t iCountCU, size_t* oCountCU);
// Our protocol
- ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES(StrimW, operator_bool_generator_type, operator_bool_type);
- operator operator_bool_type() const;
+ ZMACRO_operator_bool(StrimW, operator_bool) const;
+
void Emit() const;
private:
Modified: trunk/zoolib/source/cxx/zoolib/ZML.cpp
===================================================================
--- trunk/zoolib/source/cxx/zoolib/ZML.cpp 2011-01-12 21:53:29 UTC (rev 1880)
+++ trunk/zoolib/source/cxx/zoolib/ZML.cpp 2011-01-12 21:55:19 UTC (rev 1881)
@@ -383,8 +383,8 @@
size_t StrimU::Imp_UnreadableLimit()
{ return size_t(-1); }
-StrimU::operator operator_bool_type() const
- { return operator_bool_generator_type::translate(fToken != eToken_Exhausted); }
+StrimU::operator operator_bool() const
+ { return operator_bool_gen::translate(fToken != eToken_Exhausted); }
EToken StrimU::Current() const
{
Modified: trunk/zoolib/source/cxx/zoolib/ZML.h
===================================================================
--- trunk/zoolib/source/cxx/zoolib/ZML.h 2011-01-12 21:53:29 UTC (rev 1880)
+++ trunk/zoolib/source/cxx/zoolib/ZML.h 2011-01-12 21:55:19 UTC (rev 1881)
@@ -80,8 +80,7 @@
virtual size_t Imp_UnreadableLimit();
// Our protocol
- ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES(StrimU, operator_bool_generator_type, operator_bool_type);
- operator operator_bool_type() const;
+ ZMACRO_operator_bool(StrimU, operator_bool) const;
EToken Current() const;
ZML::StrimU& Advance();
Modified: trunk/zoolib/source/cxx/zoolib/ZNet_RFCOMM_OSX.mm
===================================================================
--- trunk/zoolib/source/cxx/zoolib/ZNet_RFCOMM_OSX.mm 2011-01-12 21:53:29 UTC (rev 1880)
+++ trunk/zoolib/source/cxx/zoolib/ZNet_RFCOMM_OSX.mm 2011-01-12 21:55:19 UTC (rev 1881)
@@ -134,9 +134,7 @@
}
ZNetEndpoint_RFCOMM_OSX::~ZNetEndpoint_RFCOMM_OSX()
- {
- DESTROY(fChannel);
- }
+ { [fChannel release]; }
const ZStreamRCon& ZNetEndpoint_RFCOMM_OSX::GetStreamRCon()
{ return *this; }
Modified: trunk/zoolib/source/cxx/zoolib/ZQ.h
===================================================================
--- trunk/zoolib/source/cxx/zoolib/ZQ.h 2011-01-12 21:53:29 UTC (rev 1880)
+++ trunk/zoolib/source/cxx/zoolib/ZQ.h 2011-01-12 21:55:19 UTC (rev 1881)
@@ -178,12 +178,9 @@
return *this;
}
- ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES_T(ZQ,
- operator_bool_generator_type, operator_bool_type);
+ ZMACRO_operator_bool_T(ZQ, operator_bool) const
+ { return operator_bool_gen::translate(fHasValue == Sense); }
- operator operator_bool_type() const
- { return operator_bool_generator_type::translate(fHasValue == Sense); }
-
const T& Get() const
{
ZAssert(fHasValue);
Modified: trunk/zoolib/source/cxx/zoolib/ZRef.h
===================================================================
--- trunk/zoolib/source/cxx/zoolib/ZRef.h 2011-01-12 21:53:29 UTC (rev 1880)
+++ trunk/zoolib/source/cxx/zoolib/ZRef.h 2011-01-12 21:55:19 UTC (rev 1881)
@@ -56,18 +56,15 @@
public:
#ifdef __OBJC__
- operator bool() const { return Sense == (fP && true); }
+ operator bool() const { return Sense == !!fP; }
operator T*() const { return fP; }
#else
- ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES_T(ZRef,
- operator_bool_generator_type, operator_bool_type);
+ ZMACRO_operator_bool_T(ZRef, operator_bool) const
+ { return operator_bool_gen::translate(Sense == !!fP); }
- operator operator_bool_type() const
- { return operator_bool_generator_type::translate(Sense == (fP && true)); }
-
#endif
void swap(ZRef& ioOther)
@@ -387,16 +384,16 @@
const struct MakeRef_t
{
template <class T>
- ZRef<T> operator()(T* iT) const { return ZRef<T>(iT); }
+ ZRef<T> operator()(T* iP) const { return ZRef<T>(iP); }
} MakeRef = {};
const struct TempRef_t
{
template <class T>
- ZRef<T> operator&(T* iT) const { return ZRef<T>(Adopt_T<T>(iT)); }
+ ZRef<T> operator&(T* iP) const { return ZRef<T>(Adopt_T<T>(iP)); }
template <class T>
- ZRef<T> operator()(T* iT) const { return ZRef<T>(Adopt_T<T>(iT)); }
+ ZRef<T> operator()(T* iP) const { return ZRef<T>(Adopt_T<T>(iP)); }
} TempRef = {};
// =================================================================================================
Modified: trunk/zoolib/source/cxx/zoolib/ZServer.cpp
===================================================================
--- trunk/zoolib/source/cxx/zoolib/ZServer.cpp 2011-01-12 21:53:29 UTC (rev 1880)
+++ trunk/zoolib/source/cxx/zoolib/ZServer.cpp 2011-01-12 21:55:19 UTC (rev 1881)
@@ -87,7 +87,8 @@
ZAssert(iFactory);
fStreamerListener = new StreamerListener(this, iFactory);
- fStreamerListener->GetSetCallable_Detached(MakeCallable(MakeWeakRef(this), &ZServer::pListenerFinished));
+ fStreamerListener->GetSetCallable_Detached(
+ MakeCallable(MakeWeakRef(this), &ZServer::pListenerFinished));
sStartWorkerRunner(fStreamerListener);
}
Modified: trunk/zoolib/source/cxx/zoolib/ZTextCollator.h
===================================================================
--- trunk/zoolib/source/cxx/zoolib/ZTextCollator.h 2011-01-12 21:53:29 UTC (rev 1880)
+++ trunk/zoolib/source/cxx/zoolib/ZTextCollator.h 2011-01-12 21:55:19 UTC (rev 1881)
@@ -48,12 +48,9 @@
ZTextCollator(const string8& iLocaleName, int iStrength);
ZTextCollator(const char* iLocaleName, int iStrength);
- ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES(ZTextCollator,
- operator_bool_generator_type, operator_bool_type);
+ ZMACRO_operator_bool(ZTextCollator, operator_bool) const
+ { return operator_bool_gen::translate(!!fRep); }
- operator operator_bool_type() const
- { return operator_bool_generator_type::translate(fRep && true); }
-
bool Equals(const string8& iLeft, const string8& iRight) const;
bool Equals(const string16& iLeft, const string16& iRight) const;
bool Equals(const string32& iLeft, const string32& iRight) const;
@@ -120,12 +117,9 @@
ZTextCollationKey(const ZTextCollator& iCollator, const UTF16* iPattern, size_t iPatternLength);
ZTextCollationKey(const ZTextCollator& iCollator, const UTF32* iPattern, size_t iPatternLength);
- ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES(ZTextCollationKey,
- operator_bool_generator_type, operator_bool_type);
+ ZMACRO_operator_bool(ZTextCollationKey, operator_bool) const
+ { return operator_bool_gen::translate(!!fRep); }
- operator operator_bool_type() const
- { return operator_bool_generator_type::translate(fRep && true); }
-
// bool Equals(const ZTextCollationKey& iRight) const;
bool Equals(const string8& iRight) const;
bool Equals(const string16& iRight) const;
Modified: trunk/zoolib/source/cxx/zoolib/ZTime.cpp
===================================================================
--- trunk/zoolib/source/cxx/zoolib/ZTime.cpp 2011-01-12 21:53:29 UTC (rev 1880)
+++ trunk/zoolib/source/cxx/zoolib/ZTime.cpp 2011-01-12 21:55:19 UTC (rev 1881)
@@ -64,8 +64,8 @@
: fVal(NAN)
{}
-ZTime::operator operator_bool_type() const
- { return operator_bool_generator_type::translate(!isnan(fVal)); }
+ZTime::operator operator_bool() const
+ { return operator_bool_gen::translate(!isnan(fVal)); }
bool ZTime::operator<(const ZTime& iOther) const
{
Modified: trunk/zoolib/source/cxx/zoolib/ZTime.h
===================================================================
--- trunk/zoolib/source/cxx/zoolib/ZTime.h 2011-01-12 21:53:29 UTC (rev 1880)
+++ trunk/zoolib/source/cxx/zoolib/ZTime.h 2011-01-12 21:55:19 UTC (rev 1881)
@@ -47,10 +47,8 @@
double GetVal() const
{ return fVal; }
- ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES(ZTime, operator_bool_generator_type, operator_bool_type);
+ ZMACRO_operator_bool(ZTime, operator_bool) const;
- operator operator_bool_type() const;
-
bool operator<(const ZTime& iOther) const;
bool operator<=(const ZTime& iOther) const
Modified: trunk/zoolib/source/cxx/zoolib/ZTxn.cpp
===================================================================
--- trunk/zoolib/source/cxx/zoolib/ZTxn.cpp 2011-01-12 21:53:29 UTC (rev 1880)
+++ trunk/zoolib/source/cxx/zoolib/ZTxn.cpp 2011-01-12 21:55:19 UTC (rev 1881)
@@ -21,7 +21,7 @@
#include "zoolib/ZCompat_algorithm.h"
#include "zoolib/ZThreadSafe.h"
#include "zoolib/ZTxn.h"
-#include "zoolib/ZUtil_STL.h"
+#include "zoolib/ZUtil_STL_vector.h"
using std::vector;
Modified: trunk/zoolib/source/cxx/zoolib/ZVal_Any.cpp
===================================================================
--- trunk/zoolib/source/cxx/zoolib/ZVal_Any.cpp 2011-01-12 21:53:29 UTC (rev 1880)
+++ trunk/zoolib/source/cxx/zoolib/ZVal_Any.cpp 2011-01-12 21:55:19 UTC (rev 1881)
@@ -134,8 +134,8 @@
#pragma mark -
#pragma mark * ZSeq_Any
-ZSeq_Any::operator operator_bool_type() const
- { return operator_bool_generator_type::translate(fRep && !fRep->fVector.empty()); }
+ZSeq_Any::operator operator_bool() const
+ { return operator_bool_gen::translate(fRep && !fRep->fVector.empty()); }
ZSeq_Any::ZSeq_Any()
{}
@@ -305,8 +305,8 @@
static ZMap_Any::Map_t spEmptyMap;
-ZMap_Any::operator operator_bool_type() const
- { return operator_bool_generator_type::translate(fRep && !fRep->fMap.empty()); }
+ZMap_Any::operator operator_bool() const
+ { return operator_bool_gen::translate(fRep && !fRep->fMap.empty()); }
ZMap_Any::ZMap_Any()
{}
Modified: trunk/zoolib/source/cxx/zoolib/ZVal_Any.h
===================================================================
--- trunk/zoolib/source/cxx/zoolib/ZVal_Any.h 2011-01-12 21:53:29 UTC (rev 1880)
+++ trunk/zoolib/source/cxx/zoolib/ZVal_Any.h 2011-01-12 21:55:19 UTC (rev 1881)
@@ -229,11 +229,8 @@
typedef std::vector<ZVal_Any> Vector_t;
typedef ZVal_Any Val_t;
- ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES(ZSeq_Any,
- operator_bool_generator_type, operator_bool_type);
+ ZMACRO_operator_bool(ZSeq_Any, operator_bool) const;
- operator operator_bool_type() const;
-
ZSeq_Any();
ZSeq_Any(const ZSeq_Any& iOther);
~ZSeq_Any();
@@ -368,11 +365,8 @@
typedef Map_t::iterator Index_t;
typedef ZVal_Any Val_t;
- ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES(ZMap_Any,
- operator_bool_generator_type, operator_bool_type);
+ ZMACRO_operator_bool(ZMap_Any, operator_bool) const;
- operator operator_bool_type() const;
-
ZMap_Any();
ZMap_Any(const ZMap_Any& iOther);
~ZMap_Any();
Modified: trunk/zoolib/source/cxx/zoolib/ZVal_AppleEvent.cpp
===================================================================
--- trunk/zoolib/source/cxx/zoolib/ZVal_AppleEvent.cpp 2011-01-12 21:53:29 UTC (rev 1880)
+++ trunk/zoolib/source/cxx/zoolib/ZVal_AppleEvent.cpp 2011-01-12 21:55:19 UTC (rev 1881)
@@ -256,8 +256,8 @@
ZAny ZVal_AppleEvent::DAsAny(const ZAny& iDefault) const
{ return spDAsAny(iDefault, *this); }
-ZVal_AppleEvent::operator operator_bool_type() const
- { return operator_bool_generator_type::translate(descriptorType != typeNull); }
+ZVal_AppleEvent::operator operator_bool() const
+ { return operator_bool_gen::translate(descriptorType != typeNull); }
void ZVal_AppleEvent::swap(ZVal_AppleEvent& iOther)
{ std::swap(static_cast<AEDesc&>(*this), static_cast<AEDesc&>(iOther)); }
@@ -484,8 +484,8 @@
ZSeq_Any ZSeq_AppleEvent::AsSeq_Any(const ZAny& iDefault) const
{ return spAsSeq_Any(iDefault, *this); }
-ZSeq_AppleEvent::operator operator_bool_type() const
- { return operator_bool_generator_type::translate(this->Count()); }
+ZSeq_AppleEvent::operator operator_bool() const
+ { return operator_bool_gen::translate(this->Count()); }
void ZSeq_AppleEvent::swap(ZSeq_AppleEvent& iOther)
{ std::swap(static_cast<AEDesc&>(*this), static_cast<AEDesc&>(iOther)); }
@@ -616,8 +616,8 @@
ZMap_Any ZMap_AppleEvent::AsMap_Any(const ZAny& iDefault) const
{ return spAsMap_Any(iDefault, *this); }
-ZMap_AppleEvent::operator operator_bool_type() const
- { return operator_bool_generator_type::translate(this->pCount()); }
+ZMap_AppleEvent::operator operator_bool() const
+ { return operator_bool_gen::translate(this->pCount()); }
void ZMap_AppleEvent::swap(ZMap_AppleEvent& iOther)
{ std::swap(static_cast<AEDesc&>(*this), static_cast<AEDesc&>(iOther)); }
Modified: trunk/zoolib/source/cxx/zoolib/ZVal_AppleEvent.h
===================================================================
--- trunk/zoolib/source/cxx/zoolib/ZVal_AppleEvent.h 2011-01-12 21:53:29 UTC (rev 1880)
+++ trunk/zoolib/source/cxx/zoolib/ZVal_AppleEvent.h 2011-01-12 21:55:19 UTC (rev 1881)
@@ -55,11 +55,8 @@
ZAny AsAny() const;
ZAny DAsAny(const ZAny& iDefault) const;
- ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES(ZVal_AppleEvent,
- operator_bool_generator_type, operator_bool_type);
+ ZMACRO_operator_bool(ZVal_AppleEvent, operator_bool) const;
- operator operator_bool_type() const;
-
void swap(ZVal_AppleEvent& iOther);
ZVal_AppleEvent();
@@ -154,11 +151,8 @@
ZSeq_Any AsSeq_Any(const ZAny& iDefault) const;
- ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES(ZSeq_AppleEvent,
- operator_bool_generator_type, operator_bool_type);
+ ZMACRO_operator_bool(ZSeq_AppleEvent, operator_bool) const;
- operator operator_bool_type() const;
-
void swap(ZSeq_AppleEvent& iOther);
ZSeq_AppleEvent();
@@ -204,11 +198,8 @@
ZMap_Any AsMap_Any(const ZAny& iDefault) const;
- ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES(ZMap_AppleEvent,
- operator_bool_generator_type, operator_bool_type);
+ ZMACRO_operator_bool(ZMap_AppleEvent, operator_bool) const;
- operator operator_bool_type() const;
-
void swap(ZMap_AppleEvent& iOther);
ZMap_AppleEvent();
Modified: trunk/zoolib/source/cxx/zoolib/ZVal_CFType.cpp
===================================================================
--- trunk/zoolib/source/cxx/zoolib/ZVal_CFType.cpp 2011-01-12 21:53:29 UTC (rev 1880)
+++ trunk/zoolib/source/cxx/zoolib/ZVal_CFType.cpp 2011-01-12 21:55:19 UTC (rev 1881)
@@ -252,7 +252,7 @@
ZQ<bool> ZVal_CFType::QGet<bool>() const
{
if (*this && ::CFGetTypeID(*this) == ::CFBooleanGetTypeID())
- return true &&::CFBooleanGetValue(this->StaticCast<CFBooleanRef>());
+ return !!::CFBooleanGetValue(this->StaticCast<CFBooleanRef>());
return null;
}
Modified: trunk/zoolib/source/cxx/zoolib/ZWinCOM.cpp
===================================================================
--- trunk/zoolib/source/cxx/zoolib/ZWinCOM.cpp 2011-01-12 21:53:29 UTC (rev 1880)
+++ trunk/zoolib/source/cxx/zoolib/ZWinCOM.cpp 2011-01-12 21:55:19 UTC (rev 1881)
@@ -42,8 +42,8 @@
\brief Compatible with ZVal & VARIANT
*/
-Variant::operator operator_bool_type() const
- { return operator_bool_generator_type::translate(VT_NULL != vt); }
+Variant::operator operator_bool() const
+ { return operator_bool_gen::translate(VT_NULL != vt); }
void Variant::swap(Variant& iOther)
{ std::swap(static_cast<Variant&>(*this), static_cast<Variant&>(iOther)); }
Modified: trunk/zoolib/source/cxx/zoolib/ZWinCOM.h
===================================================================
--- trunk/zoolib/source/cxx/zoolib/ZWinCOM.h 2011-01-12 21:53:29 UTC (rev 1880)
+++ trunk/zoolib/source/cxx/zoolib/ZWinCOM.h 2011-01-12 21:55:19 UTC (rev 1881)
@@ -75,13 +75,9 @@
class Variant
: public VARIANT
{
-
public:
- ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES(Variant,
- operator_bool_generator_type, operator_bool_type);
+ ZMACRO_operator_bool(Variant, operator_bool) const;
- operator operator_bool_type() const;
-
void swap(Variant& iOther);
Variant();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|