src/foundation/ZTuple.h

00001 /* @(#) $Id: ZTuple.h,v 1.49 2007/01/10 01:18:27 agreen Exp $ */
00002 
00003 /* ------------------------------------------------------------
00004 Copyright (c) 2000 Andrew Green and Learning in Motion, Inc.
00005 http://www.zoolib.org
00006 
00007 Permission is hereby granted, free of charge, to any person obtaining a copy
00008 of this software and associated documentation files (the "Software"), to deal
00009 in the Software without restriction, including without limitation the rights
00010 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00011 copies of the Software, and to permit persons to whom the Software is
00012 furnished to do so, subject to the following conditions:
00013 
00014 The above copyright notice and this permission notice shall be included in
00015 all copies or substantial portions of the Software.
00016 
00017 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00018 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00019 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00020 COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
00021 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00022 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00023 ------------------------------------------------------------ */
00024 
00025 #ifndef __ZTuple__
00026 #define __ZTuple__ 1
00027 #include "zconfig.h"
00028 
00029 #include "ZCompare.h"
00030 #include "ZMemory.h" // For ZBlockCopy
00031 #include "ZRefCount.h"
00032 #include "ZTime.h"
00033 #include "ZTypes.h"
00034 
00035 #include <string>
00036 #include <vector>
00037 
00038 #ifndef ZCONFIG_Tuple_PackedTVs
00039 #       define ZCONFIG_Tuple_PackedTVs 1
00040 #endif
00041 
00042 // =================================================================================================
00043 #pragma mark -
00044 #pragma mark * Forward and external declarations
00045 
00046 class ZTuple;
00047 class ZTupleRep;
00048 class ZTupleValue;
00049 
00050 class ZMemoryBlock;
00051 
00052 class ZStreamR;
00053 class ZStreamW;
00054 
00055 // =================================================================================================
00056 #pragma mark -
00057 #pragma mark * ZTuplePropName
00058 
00059 class ZTuplePropName
00060         {
00061         // The pointer references a PNRep if the low bit is set.
00062         static bool sIsPNRep(const void* iData);
00063 
00064 public:
00066         static int sPreRegister(const char* const* iNames, size_t iCount);
00067 
00068         ZTuplePropName();
00069 
00070         ~ZTuplePropName();
00071 
00072         ZTuplePropName(const ZTuplePropName& iOther);
00073 
00074         ZTuplePropName& operator=(const ZTuplePropName& iOther);
00075 
00076         explicit ZTuplePropName(const ZStreamR& iStreamR);
00077 
00078         ZTuplePropName(const char* iString, size_t iLength);
00079         ZTuplePropName(const std::string& iString);
00080         ZTuplePropName(const char* iString);
00081 
00082         bool operator==(const ZTuplePropName& iOther) const;
00083         bool operator!=(const ZTuplePropName& iOther) const;
00084 
00085         bool operator<(const ZTuplePropName& iOther) const;
00086         bool operator<=(const ZTuplePropName& iOther) const;
00087         bool operator>(const ZTuplePropName& iOther) const;
00088         bool operator>=(const ZTuplePropName& iOther) const;
00089 
00090         int Compare(const ZTuplePropName& iOther) const;
00091 
00092         bool Equals(const ZTuplePropName& iOther) const;
00093         bool Equals(const std::string& iString) const;
00094         bool Equals(const char* iString, size_t iLength) const;
00095 
00096         void ToStream(const ZStreamW& iStreamW) const;
00097         void FromStream(const ZStreamR& iStreamR);
00098 
00099         bool Empty() const;
00100 
00101         std::string AsString() const;
00102 
00103 private:
00104         class String
00105                 {
00106         private:
00107                 String(); // Not implemented
00108                 String& operator=(const String&); // Not implemented
00109 
00110         public:
00111                 void* operator new(size_t iObjectSize, size_t iDataSize)
00112                         { return new char[iObjectSize + iDataSize]; }
00113 
00114                 void operator delete(void* iPtr, size_t iObjectSize)
00115                         { delete[] static_cast<char*>(iPtr); }
00116 
00117                 String(const String& iOther)
00118                 :       fSize(iOther.fSize)
00119                         { ZBlockCopy(iOther.fBuffer, fBuffer, fSize); }
00120 
00121                 String(const char* iString, size_t iSize);              
00122 
00123                 int Compare(const String& iOther) const;
00124                 int Compare(const char* iString, size_t iSize) const;
00125                 int Compare(const std::string& iString) const;
00126 
00127                 void ToStream(const ZStreamW& iStreamW) const;
00128 
00129                 std::string AsString() const;
00130 
00131                 const size_t fSize;
00132                 char fBuffer[0];
00133                 };
00134 
00135         union
00136                 {
00137                 const void* fData;
00138                 const String* fString;
00139                 };
00140         };
00141 
00142 inline bool ZTuplePropName::sIsPNRep(const void* iData)
00143         { return reinterpret_cast<intptr_t>(iData) & 1; }
00144 
00145 inline ZTuplePropName::ZTuplePropName()
00146 :       fData(reinterpret_cast<void*>(1))
00147         {}
00148 
00149 inline ZTuplePropName::~ZTuplePropName()
00150         {
00151         if (!sIsPNRep(fData))
00152                 delete fString;
00153         }
00154 
00155 inline ZTuplePropName::ZTuplePropName(const ZTuplePropName& iOther)
00156 :       fData(iOther.fData)
00157         {
00158         if (!sIsPNRep(fData))
00159                 fString = new (fString->fSize) String(*fString);
00160         }
00161 
00162 inline bool ZTuplePropName::operator==(const ZTuplePropName& iOther) const
00163         { return 0 == this->Compare(iOther); }
00164         
00165 inline bool ZTuplePropName::operator!=(const ZTuplePropName& iOther) const
00166         { return !(*this == iOther); }
00167 
00168 inline bool ZTuplePropName::operator<(const ZTuplePropName& iOther) const
00169         { return 0 > this->Compare(iOther); }
00170 
00171 inline bool ZTuplePropName::operator<=(const ZTuplePropName& iOther) const
00172         { return !(iOther < *this); }
00173 
00174 inline bool ZTuplePropName::operator>(const ZTuplePropName& iOther) const
00175         { return iOther < *this; }
00176 
00177 inline bool ZTuplePropName::operator>=(const ZTuplePropName& iOther) const
00178         { return !(*this < iOther); }
00179 
00180 inline bool ZTuplePropName::Equals(const ZTuplePropName& iOther) const
00181         { return 0 == this->Compare(iOther); }
00182 
00183 // =================================================================================================
00184 #pragma mark -
00185 #pragma mark * ZTupleValue
00186 
00188 
00189 #if ZCONFIG_Tuple_PackedTVs
00190 #       pragma pack(4)
00191 #endif
00192 
00193 class ZTupleValue
00194         {
00195         ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES(ZTupleValue,
00196                 operator_bool_generator_type, operator_bool_type);
00197 public:
00198         class Ex_IllegalType;
00199         //@{
00202         ZTupleValue();
00203         ~ZTupleValue();
00204         ZTupleValue(const ZTupleValue& iOther);
00205         ZTupleValue& operator=(const ZTupleValue& iOther);
00207         //@{
00210         ZTupleValue(const ZTupleValue& iVal, bool iAsVector);
00211         ZTupleValue(ZType iVal);
00212         ZTupleValue(uint64 iVal, bool iIsID);
00213         ZTupleValue(uint64 iVal);
00214         ZTupleValue(int8 iVal);
00215         ZTupleValue(int16 iVal);
00216         ZTupleValue(int32 iVal);
00217         ZTupleValue(int64 iVal);
00218         ZTupleValue(bool iVal);
00219         ZTupleValue(float iVal);
00220         ZTupleValue(double iVal);
00221         ZTupleValue(ZTime iVal);
00222         ZTupleValue(void* iVal);
00223         ZTupleValue(const ZRectPOD& iVal);
00224         ZTupleValue(const ZPointPOD& iVal);
00225         ZTupleValue(const char* iVal);
00226         ZTupleValue(const std::string& iVal);
00227         ZTupleValue(const ZTuple& iVal);
00228         ZTupleValue(const ZRef<ZRefCountedWithFinalization>& iVal);
00229         ZTupleValue(const ZMemoryBlock& iVal);
00230         ZTupleValue(const void* iSource, size_t iSize);
00231         ZTupleValue(const ZStreamR& iStreamR, size_t iSize);
00232         ZTupleValue(const std::vector<ZTupleValue>& iVal);
00234         //@{
00237         explicit ZTupleValue(const ZStreamR& iStreamR);
00239         //@{
00242         void swap(ZTupleValue& iOther);
00244         //@{
00247         void ToStream(const ZStreamW& iStreamW) const;
00248         void FromStream(const ZStreamR& iStreamR);
00249 
00250         void ToStreamOld(const ZStreamW& iStreamW) const;
00251         void FromStreamOld(const ZStreamR& iStreamR);
00253         //@{
00256         operator operator_bool_type() const
00257                 { return operator_bool_generator_type::translate(fType.fType != eZType_Null); }
00258 
00259         int Compare(const ZTupleValue& iOther) const;
00260 
00261         bool operator==(const ZTupleValue& iOther) const;
00262         bool operator!=(const ZTupleValue& iOther) const;
00263 
00264         bool operator<(const ZTupleValue& iOther) const;
00265         bool operator<=(const ZTupleValue& iOther) const;
00266         bool operator>(const ZTupleValue& iOther) const;
00267         bool operator>=(const ZTupleValue& iOther) const;
00268 
00269         bool IsSameAs(const ZTupleValue& iOther) const;
00270 
00271         bool IsString(const char* iString) const;
00272         bool IsString(const std::string& iString) const;
00274 
00275         //@{
00278         ZType TypeOf() const { return fType.fType < 0 ? eZType_String : ZType(fType.fType); }
00280         //@{
00283         bool GetType(ZType& oVal) const;
00284         ZType GetType() const;
00285 
00286         bool GetID(uint64& oVal) const;
00287         uint64 GetID() const;
00288 
00289         bool GetInt8(int8& oVal) const;
00290         int8 GetInt8() const;
00291 
00292         bool GetInt16(int16& oVal) const;
00293         int16 GetInt16() const;
00294 
00295         bool GetInt32(int32& oVal) const;
00296         int32 GetInt32() const;
00297 
00298         bool GetInt64(int64& oVal) const;
00299         int64 GetInt64() const;
00300 
00301         bool GetBool(bool& oVal) const;
00302         bool GetBool() const;
00303 
00304         bool GetFloat(float& oVal) const;
00305         float GetFloat() const;
00306 
00307         bool GetDouble(double& oVal) const;
00308         double GetDouble() const;
00309 
00310         bool GetTime(ZTime& oVal) const;
00311         ZTime GetTime() const;
00312 
00313         bool GetPointer(void*& oVal) const;
00314         void* GetPointer() const;
00315 
00316         bool GetRect(ZRectPOD& oVal) const;
00317         const ZRectPOD& GetRect() const;
00318 
00319         bool GetPoint(ZPointPOD& oVal) const;
00320         const ZPointPOD& GetPoint() const;
00321 
00322         bool GetString(std::string& oVal) const;
00323         std::string GetString() const;
00324 
00325         bool GetTuple(ZTuple& oVal) const;
00326         const ZTuple& GetTuple() const;
00327 
00328         bool GetRefCounted(ZRef<ZRefCountedWithFinalization>& oVal) const;
00329         ZRef<ZRefCountedWithFinalization> GetRefCounted() const;
00330 
00331         bool GetRaw(ZMemoryBlock& oVal) const;
00332         ZMemoryBlock GetRaw() const;
00333 
00334         bool GetRaw(void* iDest, size_t iSize) const;
00335 
00336         bool GetRawAttributes(const void** oAddress, size_t* oSize) const;
00337 
00338         bool GetVector(std::vector<ZTupleValue>& oVal) const;
00339         const std::vector<ZTupleValue>& GetVector() const;
00341         //@{
00344         ZType DGetType(ZType iDefault) const;
00345 
00346         uint64 DGetID(uint64 iDefault) const;
00347 
00348         int8 DGetInt8(int8 iDefault) const;
00349 
00350         int16 DGetInt16(int16 iDefault) const;
00351 
00352         int32 DGetInt32(int32 iDefault) const;
00353 
00354         int64 DGetInt64(int64 iDefault) const;
00355 
00356         bool DGetBool(bool iDefault) const;
00357 
00358         float DGetFloat(float iDefault) const;
00359 
00360         double DGetDouble(double iDefault) const;
00361 
00362         ZTime DGetTime(ZTime iDefault) const;
00363 
00364         ZRectPOD DGetRect(const ZRectPOD& iDefault) const;
00365 
00366         ZPointPOD DGetPoint(const ZPointPOD& iDefault) const;
00367 
00368         std::string DGetString(const std::string& iDefault) const;
00370         //@{
00373         void SetNull();
00374         void SetType(ZType iVal);
00375         void SetID(uint64 iVal);
00376         void SetInt8(int8 iVal);
00377         void SetInt16(int16 iVal);
00378         void SetInt32(int32 iVal);
00379         void SetInt64(int64 iVal);
00380         void SetBool(bool iVal);
00381         void SetFloat(float iVal);
00382         void SetDouble(double iVal);
00383         void SetTime(ZTime iVal);
00384         void SetPointer(void* iVal);
00385         void SetRect(const ZRectPOD& iVal);
00386         void SetPoint(const ZPointPOD& iVal);
00387         void SetString(const char* iVal);
00388         void SetString(const std::string& iVal);
00389         void SetTuple(const ZTuple& iVal);
00390         void SetRefCounted(const ZRef<ZRefCountedWithFinalization>& iVal);
00391         void SetRaw(const ZMemoryBlock& iVal);
00392         void SetRaw(const void* iSource, size_t iSize);
00393         void SetRaw(const ZStreamR& iStreamR, size_t iSize);
00394         void SetRaw(const ZStreamR& iStreamR);
00395         void SetVector(const std::vector<ZTupleValue>& iVal);
00397         //@{
00400         void AppendValue(const ZTupleValue& iVal);
00402         //@{
00405         ZTuple& GetMutableTuple();
00406         std::vector<ZTupleValue>& GetMutableVector();
00408         //@{
00411         ZTupleValue& SetMutableNull();
00412         ZTuple& SetMutableTuple();
00413         std::vector<ZTupleValue>& SetMutableVector();
00415         //@{
00418         ZTuple& EnsureMutableTuple();
00419         std::vector<ZTupleValue>& EnsureMutableVector();
00421         //@{
00424         template <typename T> bool Get_T(T& oVal) const;
00425 
00426         template <typename T> T Get_T() const;
00427 
00428         template <typename T> T DGet_T(T iDefault) const;
00429 
00430         template <typename OutputIterator>
00431         void GetVector_T(OutputIterator iIter) const;
00432 
00433         template <typename OutputIterator, typename T>
00434         void GetVector_T(OutputIterator iIter, const T& iDummy) const;
00435 
00436         template <typename InputIterator>
00437         void SetVector_T(InputIterator iBegin, InputIterator iEnd);
00438 
00439         template <typename InputIterator, typename T>
00440         void SetVector_T(InputIterator iBegin, InputIterator iEnd, const T& iDummy);
00442 
00443 private:
00444         int pUncheckedCompare(const ZTupleValue& iOther) const;
00445         bool pUncheckedLess(const ZTupleValue& iOther) const;
00446         bool pUncheckedEqual(const ZTupleValue& iOther) const;
00447 
00448         void pRelease();
00449         void pCopy(const ZTupleValue& iOther);
00450         void pFromStream(const ZStreamR& iStream);
00451 
00452         friend class ZTuple;
00453         
00454         // Data is stored in one of several ways.
00455         // * For POD data <= 8 bytes in length, we simply store the
00456         // data directly, using named fields of fData.
00457         // * For ZRectPOD and vector<ZTupleValue> in fData we store a
00458         // pointer to a heap-allocated object, because they're 16 bytes
00459         // and probably 12 bytes in size, respectively.
00460         // * For ZTuple, ZRef and ZMemoryBlock we use placement-new and
00461         // explicit destructor invocation on fType.fBytes -- they're
00462         // all 4 bytes in size, but have constructors/destructors, so
00463         // we can't declare them in the union.
00464 
00465         // Finally, strings are funky. For short (<= 11 bytes) string
00466         // instances, we put the characters in fType.fBytes, and
00467         // store an encoded length in fType.fType.
00468         // If they're longer, we do placement new of a ZTupleString.
00469 
00470         static const int kBytesSize = 11;
00471 
00472         union Data
00473                 {
00474                 ZType fAs_Type;
00475                 uint64 fAs_ID;
00476                 int8 fAs_Int8;
00477                 int16 fAs_Int16;
00478                 int32 fAs_Int32;
00479                 int64 fAs_Int64;
00480                 bool fAs_Bool;
00481                 float fAs_Float;
00482                 double fAs_Double;
00483                 double fAs_Time;
00484                 void* fAs_Pointer;
00485                 ZPointPOD fAs_Point;
00486 
00487                 ZRectPOD* fAs_Rect;
00488                 vector<ZTupleValue>* fAs_Vector;
00489                 };
00490 
00491         struct Type
00492                 {
00493                 char fBytes[kBytesSize];
00494                 int8 fType;
00495                 };
00496 
00497         struct FastCopy
00498                 {
00499                 char dummy[kBytesSize + 1];
00500                 };
00501 
00502         union
00503                 {
00504                 Data fData;
00505                 Type fType;
00506                 FastCopy fFastCopy;
00507                 };
00508         };
00509 
00510 #if ZCONFIG_Tuple_PackedTVs
00511 #       pragma pack()
00512 #endif
00513 
00514 
00515 inline void ZTupleValue::swap(ZTupleValue& iOther)
00516         { std::swap(fFastCopy, iOther.fFastCopy); }
00517 
00518 namespace std {
00519 inline void swap(ZTupleValue& a, ZTupleValue& b)
00520         { a.swap(b); }
00521 } // namespace std
00522 
00523 
00524 inline bool ZTupleValue::operator!=(const ZTupleValue& iOther) const
00525         { return !(*this == iOther); }
00526 
00527 inline bool ZTupleValue::operator<=(const ZTupleValue& iOther) const
00528         { return !(iOther < *this); }
00529 
00530 inline bool ZTupleValue::operator>(const ZTupleValue& iOther) const
00531         { return iOther < *this; }
00532 
00533 inline bool ZTupleValue::operator>=(const ZTupleValue& iOther) const
00534         { return !(*this < iOther); }
00535         //@{
00538 template <> inline bool ZTupleValue::Get_T<ZTupleValue>(ZTupleValue& oVal) const
00539         { oVal = *this; return true; }
00540 
00541 template <> inline bool ZTupleValue::Get_T<ZType>(ZType& oVal) const
00542         { return this->GetType(oVal); }
00543 
00544 template <> inline bool ZTupleValue::Get_T<uint64>(uint64& oVal) const
00545         { return this->GetID(oVal); }
00546 
00547 template <> inline bool ZTupleValue::Get_T<int8>(int8& oVal) const
00548         { return this->GetInt8(oVal); }
00549 
00550 template <> inline bool ZTupleValue::Get_T<int16>(int16& oVal) const
00551         { return this->GetInt16(oVal); }
00552 
00553 template <> inline bool ZTupleValue::Get_T<int32>(int32& oVal) const
00554         { return this->GetInt32(oVal); }
00555 
00556 template <> inline bool ZTupleValue::Get_T<int64>(int64& oVal) const
00557         { return this->GetInt64(oVal); }
00558 
00559 template <> inline bool ZTupleValue::Get_T<bool>(bool& oVal) const
00560         { return this->GetBool(oVal); }
00561 
00562 template <> inline bool ZTupleValue::Get_T<float>(float& oVal) const
00563         { return this->GetFloat(oVal); }
00564 
00565 template <> inline bool ZTupleValue::Get_T<double>(double& oVal) const
00566         { return this->GetDouble(oVal); }
00567 
00568 template <> inline bool ZTupleValue::Get_T<ZTime>(ZTime& oVal) const
00569         { return this->GetTime(oVal); }
00570 
00571 template <> inline bool ZTupleValue::Get_T<std::string>(std::string& oVal) const
00572         { return this->GetString(oVal); }
00573 
00574 
00575 template <> inline ZTupleValue ZTupleValue::Get_T<ZTupleValue>() const
00576         { return *this; }
00577 
00578 template <> inline ZType ZTupleValue::Get_T<ZType>() const
00579         { return this->GetType(); }
00580 
00581 template <> inline uint64 ZTupleValue::Get_T<uint64>() const
00582         { return this->GetID(); }
00583 
00584 template <> inline int8 ZTupleValue::Get_T<int8>() const
00585         { return this->GetInt8(); }
00586 
00587 template <> inline int16 ZTupleValue::Get_T<int16>() const
00588         { return this->GetInt16(); }
00589 
00590 template <> inline int32 ZTupleValue::Get_T<int32>() const
00591         { return this->GetInt32(); }
00592 
00593 template <> inline int64 ZTupleValue::Get_T<int64>() const
00594         { return this->GetInt64(); }
00595 
00596 template <> inline bool ZTupleValue::Get_T<bool>() const
00597         { return this->GetBool(); }
00598 
00599 template <> inline float ZTupleValue::Get_T<float>() const
00600         { return this->GetFloat(); }
00601 
00602 template <> inline double ZTupleValue::Get_T<double>() const
00603         { return this->GetDouble(); }
00604 
00605 template <> inline ZTime ZTupleValue::Get_T<ZTime>() const
00606         { return this->GetTime(); }
00607 
00608 template <> inline std::string ZTupleValue::Get_T<std::string>() const
00609         { return this->GetString(); }
00610 
00611 
00612 template <> inline ZType ZTupleValue::DGet_T<ZType>(ZType iDefault) const
00613         { return this->DGetType(iDefault); }
00614 
00615 template <> inline uint64 ZTupleValue::DGet_T<uint64>(uint64 iDefault) const
00616         { return this->DGetID(iDefault); }
00617 
00618 template <> inline int8 ZTupleValue::DGet_T<int8>(int8 iDefault) const
00619         { return this->DGetInt8(iDefault); }
00620 
00621 template <> inline int16 ZTupleValue::DGet_T<int16>(int16 iDefault) const
00622         { return this->DGetInt16(iDefault); }
00623 
00624 template <> inline int32 ZTupleValue::DGet_T<int32>(int32 iDefault) const
00625         { return this->DGetInt32(iDefault); }
00626 
00627 template <> inline int64 ZTupleValue::DGet_T<int64>(int64 iDefault) const
00628         { return this->DGetInt64(iDefault); }
00629 
00630 template <> inline bool ZTupleValue::DGet_T<bool>(bool iDefault) const
00631         { return this->DGetBool(iDefault); }
00632 
00633 template <> inline float ZTupleValue::DGet_T<float>(float iDefault) const
00634         { return this->DGetFloat(iDefault); }
00635 
00636 template <> inline double ZTupleValue::DGet_T<double>(double iDefault) const
00637         { return this->DGetDouble(iDefault); }
00638 
00639 template <> inline ZTime ZTupleValue::DGet_T<ZTime>(ZTime iDefault) const
00640         { return this->DGetTime(iDefault); }
00641 
00642 template <> inline std::string ZTupleValue::DGet_T<std::string>(std::string iDefault) const
00643         { return this->DGetString(iDefault); }
00644 
00645 template <typename OutputIterator>
00646 inline void ZTupleValue::GetVector_T(OutputIterator iIter) const
00647         {
00648         const std::vector<ZTupleValue>& theVector = this->GetVector();
00649         for (std::vector<ZTupleValue>::const_iterator i = theVector.begin(), theEnd = theVector.end();
00650                 i != theEnd; ++i)
00651                 {
00652                 (*i).Get_T(*iIter++);
00653                 }
00654         }
00655 
00656 template <typename OutputIterator, typename T>
00657 inline void ZTupleValue::GetVector_T(OutputIterator iIter, const T& iDummy) const
00658         {
00659         const std::vector<ZTupleValue>& theVector = this->GetVector();
00660         for (std::vector<ZTupleValue>::const_iterator i = theVector.begin(), theEnd = theVector.end();
00661                 i != theEnd; ++i)
00662                 {
00663                 *iIter++ = (*i).Get_T<T>();
00664                 }
00665         }
00666 
00667 template <typename InputIterator>
00668 inline void ZTupleValue::SetVector_T(InputIterator iBegin, InputIterator iEnd)
00669         { std::copy(iBegin, iEnd, back_inserter(this->SetMutableVector())); }
00670 
00671 template <typename InputIterator, typename T>
00672 inline void ZTupleValue::SetVector_T(InputIterator iBegin, InputIterator iEnd, const T& iDummy)
00673         {
00674         std::vector<ZTupleValue>& theVector = this->SetMutableVector();
00675         while (iBegin != iEnd)
00676                 theVector.push_back(T(*iBegin++));
00677         }
00679 
00680 class ZTupleValue::Ex_IllegalType : public runtime_error
00681         {
00682 public:
00683         Ex_IllegalType(int iType);
00684         int fType;
00685         };
00686 
00687 // =================================================================================================
00688 #pragma mark -
00689 #pragma mark * ZTuple
00690 
00692 
00693 class ZTuple
00694         {
00695         ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES(ZTuple, operator_bool_generator_type, operator_bool_type);
00696 
00697 public:
00698         struct NameTV
00699                 {
00700                 NameTV();
00701                 NameTV(const NameTV& iOther);
00702 
00703         public:
00704                 NameTV(const char* iName, const ZTupleValue& iTV);
00705                 NameTV(const std::string& iName, const ZTupleValue& iTV);
00706 
00707                 NameTV(const char* iName);
00708                 NameTV(const std::string& iName);
00709 
00710                 ZTupleValue fTV;
00711                 ZTuplePropName fName;
00712                 };
00713 
00715         typedef std::vector<NameTV> PropList;
00716 
00718         typedef PropList::iterator const_iterator;
00719         //@{
00722         ZTuple();
00723         ZTuple(const ZTuple& iOther);
00724         ~ZTuple();
00725         ZTuple& operator=(const ZTuple& iOther);
00727 
00728         //@{
00731         ZTuple(ZRef<ZTupleRep> iRep);
00733         //@{
00736         explicit ZTuple(const ZStreamR& iStreamR);
00738 
00739         //@{
00742         void ToStream(const ZStreamW& iStreamW) const;
00743         void FromStream(const ZStreamR& iStreamR);
00744 
00745         void ToStreamOld(const ZStreamW& iStreamW) const;
00746         void FromStreamOld(const ZStreamR& iStreamR);
00748 
00749         //@{
00752         ZTuple Over(const ZTuple& iUnder) const;
00753         ZTuple Under(const ZTuple& iOver) const;
00755 
00756         //@{
00759         operator operator_bool_type() const;
00760 
00761         int Compare(const ZTuple& iOther) const;
00762 
00763         bool operator==(const ZTuple& iOther) const;
00764         bool operator!=(const ZTuple& iOther) const;
00765 
00766         bool operator<(const ZTuple& iOther) const;
00767         bool operator<=(const ZTuple& iOther) const;
00768         bool operator>(const ZTuple& iOther) const;
00769         bool operator>=(const ZTuple& iOther) const;
00770 
00771         bool IsSameAs(const ZTuple& iOther) const;
00772 
00773         bool Contains(const ZTuple& iOther) const;
00775 
00776         //@{
00779         bool IsString(const_iterator iPropIter, const char* iString) const;
00780         bool IsString(const char* iPropName, const char* iString) const;
00781         bool IsString(const std::string& iPropName, const char* iString) const;
00782 
00783         bool IsString(const_iterator iPropIter, const std::string& iString) const;
00784         bool IsString(const char* iPropName, const std::string& iString) const;
00785         bool IsString(const std::string& iPropName, const std::string& iString) const;
00787 
00788         //@{
00791         const_iterator begin() const;
00792         const_iterator end() const;
00793 
00794         bool Empty() const;
00795         size_t Count() const;
00796 
00797         std::string NameOf(const_iterator iPropIter) const;
00798 
00799         const_iterator IteratorOf(const ZTuplePropName& iPropName) const;
00800         const_iterator IteratorOf(const char* iPropName) const;
00801         const_iterator IteratorOf(const std::string& iPropName) const;
00802 
00803         bool Has(const char* iPropName) const;
00804         bool Has(const std::string& iPropName) const;
00805 
00806         bool TypeOf(const_iterator iPropIter, ZType& oPropertyType) const;
00807         bool TypeOf(const char* iPropName, ZType& oPropertyType) const;
00808         bool TypeOf(const std::string& iPropName, ZType& oPropertyType) const;
00809 
00810         ZType TypeOf(const_iterator iPropIter) const;
00811         ZType TypeOf(const char* iPropName) const;
00812         ZType TypeOf(const std::string& iPropName) const;
00814 
00815         //@{
00818         void Erase(const_iterator iPropIter);
00819         void Erase(const char* iPropName);
00820         void Erase(const std::string& iPropName);
00821 
00822         const_iterator EraseAndReturn(const_iterator iPropIter);
00823 
00824         void Clear();
00826 
00827         //@{
00830         bool GetValue(const_iterator iPropIter, ZTupleValue& oVal) const;
00831         bool GetValue(const char* iPropName, ZTupleValue& oVal) const;
00832         bool GetValue(const std::string& iPropName, ZTupleValue& oVal) const;
00833 
00834         const ZTupleValue& GetValue(const_iterator iPropIter) const;
00835         const ZTupleValue& GetValue(const char* iPropName) const;
00836         const ZTupleValue& GetValue(const std::string& iPropName) const;
00837         const ZTupleValue& GetValue(const ZTuplePropName& iPropName) const;
00838 
00839 
00840         bool GetType(const_iterator iPropIter, ZType& oVal) const;
00841         bool GetType(const char* iPropName, ZType& oVal) const;
00842         bool GetType(const std::string& iPropName, ZType& oVal) const;
00843 
00844         ZType GetType(const_iterator iPropIter) const;
00845         ZType GetType(const char* iPropName) const;
00846         ZType GetType(const std::string& iPropName) const;
00847 
00848 
00849         bool GetID(const_iterator iPropIter, uint64& oVal) const;
00850         bool GetID(const char* iPropName, uint64& oVal) const;
00851         bool GetID(const std::string& iPropName, uint64& oVal) const;
00852 
00853         uint64 GetID(const_iterator iPropIter) const;
00854         uint64 GetID(const char* iPropName) const;
00855         uint64 GetID(const std::string& iPropName) const;
00856 
00857 
00858         bool GetInt8(const_iterator iPropIter, int8& oVal) const;
00859         bool GetInt8(const char* iPropName, int8& oVal) const;
00860         bool GetInt8(const std::string& iPropName, int8& oVal) const;
00861 
00862         int8 GetInt8(const_iterator iPropIter) const;
00863         int8 GetInt8(const char* iPropName) const;
00864         int8 GetInt8(const std::string& iPropName) const;
00865 
00866 
00867         bool GetInt16(const_iterator iPropIter, int16& oVal) const;
00868         bool GetInt16(const char* iPropName, int16& oVal) const;
00869         bool GetInt16(const std::string& iPropName, int16& oVal) const;
00870 
00871         int16 GetInt16(const_iterator iPropIter) const;
00872         int16 GetInt16(const char* iPropName) const;
00873         int16 GetInt16(const std::string& iPropName) const;
00874 
00875 
00876         bool GetInt32(const_iterator iPropIter, int32& oVal) const;
00877         bool GetInt32(const char* iPropName, int32& oVal) const;
00878         bool GetInt32(const std::string& iPropName, int32& oVal) const;
00879 
00880         int32 GetInt32(const_iterator iPropIter) const;
00881         int32 GetInt32(const char* iPropName) const;
00882         int32 GetInt32(const std::string& iPropName) const;
00883 
00884 
00885         bool GetInt64(const_iterator iPropIter, int64& oVal) const;
00886         bool GetInt64(const char* iPropName, int64& oVal) const;
00887         bool GetInt64(const std::string& iPropName, int64& oVal) const;
00888 
00889         int64 GetInt64(const_iterator iPropIter) const;
00890         int64 GetInt64(const char* iPropName) const;
00891         int64 GetInt64(const std::string& iPropName) const;
00892 
00893 
00894         bool GetBool(const_iterator iPropIter, bool& oVal) const;
00895         bool GetBool(const char* iPropName, bool& oVal) const;
00896         bool GetBool(const std::string& iPropName, bool& oVal) const;
00897 
00898         bool GetBool(const_iterator iPropIter) const;
00899         bool GetBool(const char* iPropName) const;
00900         bool GetBool(const std::string& iPropName) const;
00901 
00902 
00903         bool GetFloat(const_iterator iPropIter, float& oVal) const;
00904         bool GetFloat(const char* iPropName, float& oVal) const;
00905         bool GetFloat(const std::string& iPropName, float& oVal) const;
00906 
00907         float GetFloat(const_iterator iPropIter) const;
00908         float GetFloat(const char* iPropName) const;
00909         float GetFloat(const std::string& iPropName) const;
00910 
00911 
00912         bool GetDouble(const_iterator iPropIter, double& oVal) const;
00913         bool GetDouble(const char* iPropName, double& oVal) const;
00914         bool GetDouble(const std::string& iPropName, double& oVal) const;
00915 
00916         double GetDouble(const_iterator iPropIter) const;
00917         double GetDouble(const char* iPropName) const;
00918         double GetDouble(const std::string& iPropName) const;
00919 
00920 
00921         bool GetTime(const_iterator iPropIter, ZTime& oVal) const;
00922         bool GetTime(const char* iPropName, ZTime& oVal) const;
00923         bool GetTime(const std::string& iPropName, ZTime& oVal) const;
00924 
00925         ZTime GetTime(const_iterator iPropIter) const;
00926         ZTime GetTime(const char* iPropName) const;
00927         ZTime GetTime(const std::string& iPropName) const;
00928 
00929 
00930         bool GetPointer(const_iterator iPropIter, void*& oVal) const;
00931         bool GetPointer(const char* iPropName, void*& oVal) const;
00932         bool GetPointer(const std::string& iPropName, void*& oVal) const;
00933 
00934         void* GetPointer(const_iterator iPropIter) const;
00935         void* GetPointer(const char* iPropName) const;
00936         void* GetPointer(const std::string& iPropName) const;
00937 
00938 
00939         bool GetRect(const_iterator iPropIter, ZRectPOD& oVal) const;
00940         bool GetRect(const char* iPropName, ZRectPOD& oVal) const;
00941         bool GetRect(const std::string& iPropName, ZRectPOD& oVal) const;
00942 
00943         const ZRectPOD& GetRect(const_iterator iPropIter) const;
00944         const ZRectPOD& GetRect(const char* iPropName) const;
00945         const ZRectPOD& GetRect(const std::string& iPropName) const;
00946 
00947 
00948         bool GetPoint(const_iterator iPropIter, ZPointPOD& oVal) const;
00949         bool GetPoint(const char* iPropName, ZPointPOD& oVal) const;
00950         bool GetPoint(const std::string& iPropName, ZPointPOD& oVal) const;
00951 
00952         const ZPointPOD& GetPoint(const_iterator iPropIter) const;
00953         const ZPointPOD& GetPoint(const char* iPropName) const;
00954         const ZPointPOD& GetPoint(const std::string& iPropName) const;
00955 
00956 
00957         bool GetString(const_iterator iPropIter, std::string& oVal) const;
00958         bool GetString(const char* iPropName, std::string& oVal) const;
00959         bool GetString(const std::string& iPropName, std::string& oVal) const;
00960 
00961         std::string GetString(const_iterator iPropIter) const;
00962         std::string GetString(const char* iPropName) const;
00963         std::string GetString(const std::string& iPropName) const;
00964 
00965 
00966         bool GetTuple(const_iterator iPropIter, ZTuple& oVal) const;
00967         bool GetTuple(const char* iPropName, ZTuple& oVal) const;
00968         bool GetTuple(const std::string& iPropName, ZTuple& oVal) const;
00969 
00970         const ZTuple& GetTuple(const_iterator iPropIter) const;
00971         const ZTuple& GetTuple(const char* iPropName) const;
00972         const ZTuple& GetTuple(const std::string& iPropName) const;
00973 
00974 
00975         bool GetRefCounted(const_iterator iPropIter, ZRef<ZRefCountedWithFinalization>& oVal) const;
00976         bool GetRefCounted(const char* iPropName, ZRef<ZRefCountedWithFinalization>& oVal) const;
00977         bool GetRefCounted(const std::string& iPropName, ZRef<ZRefCountedWithFinalization>& oVal) const;
00978 
00979         ZRef<ZRefCountedWithFinalization> GetRefCounted(const_iterator iPropIter) const;
00980         ZRef<ZRefCountedWithFinalization> GetRefCounted(const char* iPropName) const;
00981         ZRef<ZRefCountedWithFinalization> GetRefCounted(const std::string& iPropName) const;
00982 
00983 
00984         bool GetRaw(const_iterator iPropIter, ZMemoryBlock& oVal) const;
00985         bool GetRaw(const char* iPropName, ZMemoryBlock& oVal) const;
00986         bool GetRaw(const std::string& iPropName, ZMemoryBlock& oVal) const;
00987 
00988         ZMemoryBlock GetRaw(const_iterator iPropIter) const;
00989         ZMemoryBlock GetRaw(const char* iPropName) const;
00990         ZMemoryBlock GetRaw(const std::string& iPropName) const;
00991 
00992 
00993         bool GetRaw(const_iterator iPropIter, void* iDest, size_t iSize) const;
00994         bool GetRaw(const char* iPropName, void* iDest, size_t iSize) const;
00995         bool GetRaw(const std::string& iPropName, void* iDest, size_t iSize) const;
00996 
00997         bool GetRawAttributes(const_iterator iPropIter, const void** oAddress, size_t* oSize) const;
00998         bool GetRawAttributes(const char* iPropName, const void** oAddress, size_t* oSize) const;
00999         bool GetRawAttributes(const std::string& iPropName, const void** oAddress, size_t* oSize) const;
01000 
01001 
01002         bool GetVector(const_iterator iPropIter, std::vector<ZTupleValue>& oVal) const;
01003         bool GetVector(const char* iPropName, std::vector<ZTupleValue>& oVal) const;
01004         bool GetVector(const std::string& iPropName, std::vector<ZTupleValue>& oVal) const;
01005 
01006         const std::vector<ZTupleValue>& GetVector(const_iterator iPropIter) const;
01007         const std::vector<ZTupleValue>& GetVector(const char* iPropName) const;
01008         const std::vector<ZTupleValue>& GetVector(const std::string& iPropName) const;
01009 
01010         template <typename OutputIterator>
01011         void GetVector_T(const_iterator iPropIter, OutputIterator iIter) const;
01012 
01013         template <typename OutputIterator>
01014         void GetVector_T(const char* iPropName, OutputIterator iIter) const;
01015 
01016         template <typename OutputIterator>
01017         void GetVector_T(const std::string& iPropName, OutputIterator iIter) const;
01018 
01019         template <typename OutputIterator, typename T>
01020         void GetVector_T(const_iterator iPropIter, OutputIterator iIter, const T& iDummy) const;
01021 
01022         template <typename OutputIterator, typename T>
01023         void GetVector_T(const char* iPropName, OutputIterator iIter, const T& iDummy) const;
01024 
01025         template <typename OutputIterator, typename T>
01026         void GetVector_T(const std::string& iPropName, OutputIterator iIter, const T& iDummy) const;
01028 
01029         //@{
01032         template <typename T> bool Get_T(const_iterator iPropIter, T& oVal) const;
01033         template <typename T> bool Get_T(const char* iPropName, T& oVal) const;
01034         template <typename T> bool Get_T(const std::string& iPropName, T& oVal) const;
01035 
01036         template <typename T> T Get_T(const_iterator iPropIter) const;
01037         template <typename T> T Get_T(const char* iPropName) const;
01038         template <typename T> T Get_T(const std::string& iPropName) const;
01040 
01041         //@{
01044         const ZTupleValue DGetValue(const_iterator iPropIter, const ZTupleValue& iDefault) const;
01045         const ZTupleValue DGetValue(const char* iPropName, const ZTupleValue& iDefault) const;
01046         const ZTupleValue DGetValue(const std::string& iPropName, const ZTupleValue& iDefault) const;
01047 
01048 
01049         ZType DGetType(const_iterator iPropIter, ZType iDefault) const;
01050         ZType DGetType(const char* iPropName, ZType iDefault) const;
01051         ZType DGetType(const std::string& iPropName, ZType iDefault) const;
01052 
01053 
01054         uint64 DGetID(const_iterator iPropIter, uint64 iDefault) const;
01055         uint64 DGetID(const char* iPropName, uint64 iDefault) const;
01056         uint64 DGetID(const std::string& iPropName, uint64 iDefault) const;
01057 
01058 
01059         int8 DGetInt8(const_iterator iPropIter, int8 iDefault) const;
01060         int8 DGetInt8(const char* iPropName, int8 iDefault) const;
01061         int8 DGetInt8(const std::string& iPropName, int8 iDefault) const;
01062 
01063 
01064         int16 DGetInt16(const_iterator iPropIter, int16 iDefault) const;
01065         int16 DGetInt16(const char* iPropName, int16 iDefault) const;
01066         int16 DGetInt16(const std::string& iPropName, int16 iDefault) const;
01067 
01068 
01069         int32 DGetInt32(const_iterator iPropIter, int32 iDefault) const;
01070         int32 DGetInt32(const char* iPropName, int32 iDefault) const;
01071         int32 DGetInt32(const std::string& iPropName, int32 iDefault) const;
01072 
01073 
01074         int64 DGetInt64(const_iterator iPropIter, int64 iDefault) const;
01075         int64 DGetInt64(const char* iPropName, int64 iDefault) const;
01076         int64 DGetInt64(const std::string& iPropName, int64 iDefault) const;
01077 
01078 
01079         bool DGetBool(const_iterator iPropIter, bool iDefault) const;
01080         bool DGetBool(const char* iPropName, bool iDefault) const;
01081         bool DGetBool(const std::string& iPropName, bool iDefault) const;
01082 
01083 
01084         float DGetFloat(const_iterator iPropIter, float iDefault) const;
01085         float DGetFloat(const char* iPropName, float iDefault) const;
01086         float DGetFloat(const std::string& iPropName, float iDefault) const;
01087 
01088 
01089         double DGetDouble(const_iterator iPropIter, double iDefault) const;
01090         double DGetDouble(const char* iPropName, double iDefault) const;
01091         double DGetDouble(const std::string& iPropName, double iDefault) const;
01092 
01093 
01094         ZTime DGetTime(const_iterator iPropIter, ZTime iDefault) const;
01095         ZTime DGetTime(const char* iPropName, ZTime iDefault) const;
01096         ZTime DGetTime(const std::string& iPropName, ZTime iDefault) const;
01097 
01098 
01099         ZRectPOD DGetRect(const_iterator iPropIter, const ZRectPOD& iDefault) const;
01100         ZRectPOD DGetRect(const char* iPropName, const ZRectPOD& iDefault) const;
01101         ZRectPOD DGetRect(const std::string& iPropName, const ZRectPOD& iDefault) const;
01102 
01103 
01104         ZPointPOD DGetPoint(const_iterator iPropIter, const ZPointPOD& iDefault) const;
01105         ZPointPOD DGetPoint(const char* iPropName, const ZPointPOD& iDefault) const;
01106         ZPointPOD DGetPoint(const std::string& iPropName, const ZPointPOD& iDefault) const;
01107 
01108 
01109         std::string DGetString(const_iterator iPropIter, const std::string& iDefault) const;
01110         std::string DGetString(const char* iPropName, const std::string& iDefault) const;
01111         std::string DGetString(const std::string& iPropName, const std::string& iDefault) const;
01112 
01113 
01114         template <typename T> T DGet_T(const_iterator iPropIter, T iDefault) const;
01115         template <typename T> T DGet_T(const char* iPropName, T iDefault) const;
01116         template <typename T> T DGet_T(const std::string& iPropName, T iDefault) const;
01118 
01119         //@{
01122         bool SetValue(const_iterator iPropIter, const ZTupleValue& iVal);
01123         ZTuple& SetValue(const char* iPropName, const ZTupleValue& iVal);
01124         ZTuple& SetValue(const std::string& iPropName, const ZTupleValue& iVal);
01125 
01126 
01127         bool SetNull(const_iterator iPropIter);
01128         ZTuple& SetNull(const char* iPropName);
01129         ZTuple& SetNull(const std::string& iPropName);
01130 
01131 
01132         bool SetType(const_iterator iPropIter, ZType iVal);
01133         ZTuple& SetType(const char* iPropName, ZType iVal);
01134         ZTuple& SetType(const std::string& iPropName, ZType iVal);
01135 
01136 
01137         bool SetID(const_iterator iPropIter, uint64 iVal);
01138         ZTuple& SetID(const char* iPropName, uint64 iVal);
01139         ZTuple& SetID(const std::string& iPropName, uint64 iVal);
01140 
01141 
01142         bool SetInt8(const_iterator iPropIter, int8 iVal);
01143         ZTuple& SetInt8(const char* iPropName, int8 iVal);
01144         ZTuple& SetInt8(const std::string& iPropName, int8 iVal);
01145 
01146 
01147         bool SetInt16(const_iterator iPropIter, int16 iVal);
01148         ZTuple& SetInt16(const char* iPropName, int16 iVal);
01149         ZTuple& SetInt16(const std::string& iPropName, int16 iVal);
01150 
01151 
01152         bool SetInt32(const_iterator iPropIter, int32 iVal);
01153         ZTuple& SetInt32(const char* iPropName, int32 iVal);
01154         ZTuple& SetInt32(const std::string& iPropName, int32 iVal);
01155 
01156 
01157         bool SetInt64(const_iterator iPropIter, int64 iVal);
01158         ZTuple& SetInt64(const char* iPropName, int64 iVal);
01159         ZTuple& SetInt64(const std::string& iPropName, int64 iVal);
01160 
01161 
01162         bool SetBool(const_iterator iPropIter, bool iVal);
01163         ZTuple& SetBool(const char* iPropName, bool iVal);
01164         ZTuple& SetBool(const std::string& iPropName, bool iVal);
01165 
01166 
01167         bool SetFloat(const_iterator iPropIter, float iVal);
01168         ZTuple& SetFloat(const char* iPropName, float iVal);
01169         ZTuple& SetFloat(const std::string& iPropName, float iVal);
01170 
01171 
01172         bool SetDouble(const_iterator iPropIter, double iVal);
01173         ZTuple& SetDouble(const char* iPropName, double iVal);
01174         ZTuple& SetDouble(const std::string& iPropName, double iVal);
01175 
01176 
01177         bool SetTime(const_iterator iPropIter, ZTime iVal);
01178         ZTuple& SetTime(const char* iPropName, ZTime iVal);
01179         ZTuple& SetTime(const std::string& iPropName, ZTime iVal);
01180 
01181 
01182         bool SetPointer(const_iterator iPropIter, void* iVal);
01183         ZTuple& SetPointer(const char* iPropName, void* iVal);
01184         ZTuple& SetPointer(const std::string& iPropName, void* iVal);
01185 
01186 
01187         bool SetRect(const_iterator iPropIter, const ZRectPOD& iVal);
01188         ZTuple& SetRect(const char* iPropName, const ZRectPOD& iVal);
01189         ZTuple& SetRect(const std::string& iPropName, const ZRectPOD& iVal);
01190 
01191 
01192         bool SetPoint(const_iterator iPropIter, const ZPointPOD& iVal);
01193         ZTuple& SetPoint(const char* iPropName, const ZPointPOD& iVal);
01194         ZTuple& SetPoint(const std::string& iPropName, const ZPointPOD& iVal);
01195 
01196 
01197         bool SetString(const_iterator iPropIter, const char* iVal);
01198         ZTuple& SetString(const char* iPropName, const char* iVal);
01199         ZTuple& SetString(const std::string& iPropName, const char* iVal);
01200 
01201 
01202         bool SetString(const_iterator iPropIter, const std::string& iVal);
01203         ZTuple& SetString(const char* iPropName, const std::string& iVal);
01204         ZTuple& SetString(const std::string& iPropName, const std::string& iVal);
01205 
01206 
01207         bool SetTuple(const_iterator iPropIter, const ZTuple& iVal);
01208         ZTuple& SetTuple(const char* iPropName, const ZTuple& iVal);
01209         ZTuple& SetTuple(const std::string& iPropName, const ZTuple& iVal);
01210 
01211         bool SetRefCounted(const_iterator iPropIter, const ZRef<ZRefCountedWithFinalization>& iVal);
01212         ZTuple& SetRefCounted(const char* iPropName, const ZRef<ZRefCountedWithFinalization>& iVal);
01213         ZTuple& SetRefCounted(const std::string& iPropName,
01214                 const ZRef<ZRefCountedWithFinalization>& iVal);
01215 
01216 
01217         bool SetRaw(const_iterator iPropIter, const ZMemoryBlock& iVal);
01218         ZTuple& SetRaw(const char* iPropName, const ZMemoryBlock& iVal);
01219         ZTuple& SetRaw(const std::string& iPropName, const ZMemoryBlock& iVal);
01220 
01221 
01222         bool SetRaw(const_iterator iPropIter, const void* iSource, size_t iSize);
01223         ZTuple& SetRaw(const char* iPropName, const void* iSource, size_t iSize);
01224         ZTuple& SetRaw(const std::string& iPropName, const void* iSource, size_t iSize);
01225 
01226 
01227         bool SetRaw(const_iterator iPropIter, const ZStreamR& iStreamR, size_t iSize);
01228         ZTuple& SetRaw(const char* iPropName, const ZStreamR& iStreamR, size_t iSize);
01229         ZTuple& SetRaw(const std::string& iPropName, const ZStreamR& iStreamR, size_t iSize);
01230 
01231 
01232         bool SetRaw(const_iterator iPropIter, const ZStreamR& iStreamR);
01233         ZTuple& SetRaw(const char* iPropName, const ZStreamR& iStreamR);
01234         ZTuple& SetRaw(const std::string& iPropName, const ZStreamR& iStreamR);
01235 
01236 
01237         bool SetVector(const_iterator iPropIter, const std::vector<ZTupleValue>& iVal);
01238         ZTuple& SetVector(const char* iPropName, const std::vector<ZTupleValue>& iVal);
01239         ZTuple& SetVector(const std::string& iPropName, const std::vector<ZTupleValue>& iVal);
01240 
01241         template <typename InputIterator>
01242         void SetVector_T(const_iterator iPropIter, InputIterator iBegin, InputIterator iEnd);
01243 
01244         template <typename InputIterator>
01245         void SetVector_T(const char* iPropName, InputIterator iBegin, InputIterator iEnd);
01246 
01247         template <typename InputIterator>
01248         void SetVector_T(const std::string& iPropName, InputIterator iBegin, InputIterator iEnd);
01249 
01250 
01251         template <typename InputIterator, typename T>
01252         void SetVector_T(const_iterator iPropIter,
01253                 InputIterator iBegin, InputIterator iEnd, const T& iDummy);
01254 
01255         template <typename InputIterator, typename T>
01256         void SetVector_T(const char* iPropName,
01257                 InputIterator iBegin, InputIterator iEnd, const T& iDummy);
01258 
01259         template <typename InputIterator, typename T>
01260         void SetVector_T(const std::string& iPropName,
01261                 InputIterator iBegin, InputIterator iEnd, const T& iDummy);
01263 
01264         //@{
01267         ZTupleValue& GetMutableValue(const_iterator iPropIter);
01268         ZTupleValue& GetMutableValue(const char* iPropName);
01269         ZTupleValue& GetMutableValue(const std::string& iPropName);
01270 
01271 
01272         ZTuple& GetMutableTuple(const_iterator iPropIter);
01273         ZTuple& GetMutableTuple(const char* iPropName);
01274         ZTuple& GetMutableTuple(const std::string& iPropName);
01275 
01276 
01277         std::vector<ZTupleValue>& GetMutableVector(const_iterator iPropIter);
01278         std::vector<ZTupleValue>& GetMutableVector(const char* iPropName);
01279         std::vector<ZTupleValue>& GetMutableVector(const std::string& iPropName);
01281 
01282         //@{
01285         ZTupleValue& SetMutableNull(const_iterator iPropIter);
01286         ZTupleValue& SetMutableNull(const char* iPropName);
01287         ZTupleValue& SetMutableNull(const std::string& iPropName);
01288 
01289 
01290         ZTuple& SetMutableTuple(const_iterator iPropIter);
01291         ZTuple& SetMutableTuple(const char* iPropName);
01292         ZTuple& SetMutableTuple(const std::string& iPropName);
01293 
01294 
01295         std::vector<ZTupleValue>& SetMutableVector(const_iterator iPropIter);
01296         std::vector<ZTupleValue>& SetMutableVector(const char* iPropName);
01297         std::vector<ZTupleValue>& SetMutableVector(const std::string& iPropName);
01299 
01300         //@{
01303         ZTupleValue& EnsureMutableValue(const_iterator iPropIter);
01304         ZTupleValue& EnsureMutableValue(const char* iPropName);
01305         ZTupleValue& EnsureMutableValue(const std::string& iPropName);
01306 
01307 
01308         ZTuple& EnsureMutableTuple(const_iterator iPropIter);
01309         ZTuple& EnsureMutableTuple(const char* iPropName);
01310         ZTuple& EnsureMutableTuple(const std::string& iPropName);
01311 
01312 
01313         std::vector<ZTupleValue>& EnsureMutableVector(const_iterator iPropIter);
01314         std::vector<ZTupleValue>& EnsureMutableVector(const char* iPropName);
01315         std::vector<ZTupleValue>& EnsureMutableVector(const std::string& iPropName);
01317 
01318         //@{
01321         void AppendValue(const char* iPropName, const ZTupleValue& iVal);
01322         void AppendValue(const std::string& iPropName, const ZTupleValue& iVal);
01323 
01324 
01325         void AppendType(const char* iPropName, ZType iVal);
01326         void AppendType(const std::string& iPropName, ZType iVal);
01327 
01328 
01329         void AppendID(const char* iPropName, uint64 iVal);
01330         void AppendID(const std::string& iPropName, uint64 iVal);
01331 
01332 
01333         void AppendInt8(const char* iPropName, int8 iVal);
01334         void AppendInt8(const std::string& iPropName, int8 iVal);
01335 
01336 
01337         void AppendInt16(const char* iPropName, int16 iVal);
01338         void AppendInt16(const std::string& iPropName, int16 iVal);
01339 
01340 
01341         void AppendInt32(const char* iPropName, int32 iVal);
01342         void AppendInt32(const std::string& iPropName, int32 iVal);
01343 
01344 
01345         void AppendInt64(const char* iPropName, int64 iVal);
01346         void AppendInt64(const std::string& iPropName, int64 iVal);
01347 
01348 
01349         void AppendBool(const char* iPropName, bool iVal);
01350         void AppendBool(const std::string& iPropName, bool iVal);
01351 
01352 
01353         void AppendFloat(const char* iPropName, float iVal);
01354         void AppendFloat(const std::string& iPropName, float iVal);
01355 
01356 
01357         void AppendDouble(const char* iPropName, double iVal);
01358         void AppendDouble(const std::string& iPropName, double iVal);
01359 
01360 
01361         void AppendTime(const char* iPropName, ZTime iVal);
01362         void AppendTime(const std::string& iPropName, ZTime iVal);
01363 
01364 
01365         void AppendPointer(const char* iPropName, void* iVal);
01366         void AppendPointer(const std::string& iPropName, void* iVal);
01367 
01368 
01369         void AppendRect(const char* iPropName, const ZRectPOD& iVal);
01370         void AppendRect(const std::string& iPropName, const ZRectPOD& iVal);
01371 
01372 
01373         void AppendPoint(const char* iPropName, const ZPointPOD& iVal);
01374         void AppendPoint(const std::string& iPropName, const ZPointPOD& iVal);
01375 
01376 
01377         void AppendString(const char* iPropName, const char* iVal);
01378         void AppendString(const std::string& iPropName, const char* iVal);
01379 
01380 
01381         void AppendString(const char* iPropName, const std::string& iVal);
01382         void AppendString(const std::string& iPropName, const std::string& iVal);
01383 
01384 
01385         void AppendTuple(const char* iPropName, const ZTuple& iVal);
01386         void AppendTuple(const std::string& iPropName, const ZTuple& iVal);
01387 
01388 
01389         void AppendRefCounted(const char* iPropName, const ZRef<ZRefCountedWithFinalization>& iVal);
01390         void AppendRefCounted(const std::string& iPropName,
01391                 const ZRef<ZRefCountedWithFinalization>& iVal);
01392 
01393 
01394         void AppendRaw(const char* iPropName, const ZMemoryBlock& iVal);
01395         void AppendRaw(const std::string& iPropName, const ZMemoryBlock& iVal);
01396 
01397 
01398         void AppendRaw(const char* iPropName, const void* iSource, size_t iSize);
01399         void AppendRaw(const std::string& iPropName, const void* iSource, size_t iSize);
01401 
01402 
01403         void swap(ZTuple& iOther);
01404 
01405         ZTuple& Minimize();
01406         ZTuple Minimized() const;
01407 
01408 protected:
01409         bool pSet(const_iterator iPropIter, const ZTupleValue& iVal);
01410         ZTuple& pSet(const char* iPropName, const ZTupleValue& iVal);
01411         ZTuple& pSet(const std::string& iPropName, const ZTupleValue& iVal);
01412 
01413         ZTupleValue* pFindOrAllocate(const char* iPropName);
01414         ZTupleValue* pFindOrAllocate(const std::string& iPropName);
01415 
01416         ZTuple& pAppend(const char* iPropName, const ZTupleValue& iVal);
01417         ZTuple& pAppend(const std::string& iPropName, const ZTupleValue& iVal);
01418 
01419         const ZTupleValue* pLookupAddressConst(const_iterator iPropIter) const;
01420         const ZTupleValue* pLookupAddressConst(const char* iPropName) const;
01421         const ZTupleValue* pLookupAddressConst(const std::string& iPropName) const;
01422 
01423         ZTupleValue* pLookupAddress(const_iterator iPropIter);
01424         ZTupleValue* pLookupAddress(const char* iPropName);
01425         ZTupleValue* pLookupAddress(const std::string& iPropName);
01426 
01427         const ZTupleValue& pLookupConst(const_iterator iPropIter) const;
01428         const ZTupleValue& pLookupConst(const char* iPropName) const;
01429         const ZTupleValue& pLookupConst(const std::string& iPropName) const;
01430 
01431         void pErase(const_iterator iPropIter);
01432         void pTouch();
01433         const_iterator pTouch(const_iterator iPropIter);
01434         bool pIsEqual(const ZTuple& iOther) const;
01435         bool pIsSameAs(const ZTuple& iOther) const;
01436 
01437         static ZRef<ZTupleRep> sRepFromStream(const ZStreamR& iStreamR);
01438 
01439         ZRef<ZTupleRep> fRep;
01440         };
01441 
01442 template <typename OutputIterator>
01443 inline void ZTuple::GetVector_T(const_iterator iPropIter, OutputIterator iIter) const
01444         { this->GetValue(iPropIter).GetVector_T(iIter); }
01445 
01446 template <typename OutputIterator>
01447 inline void ZTuple::GetVector_T(const char* iPropName, OutputIterator iIter) const
01448         { this->GetValue(iPropName).GetVector_T(iIter); }
01449 
01450 template <typename OutputIterator>
01451 inline void ZTuple::GetVector_T(const std::string& iPropName, OutputIterator iIter) const
01452         { this->GetValue(iPropName).GetVector_T(iIter); }
01453 
01454 template <typename OutputIterator, typename T>
01455 inline void ZTuple::GetVector_T(const_iterator iPropIter,
01456         OutputIterator iIter, const T& iDummy) const
01457         { this->GetValue(iPropIter).GetVector_T(iIter, iDummy); }
01458 
01459 template <typename OutputIterator, typename T>
01460 inline void ZTuple::GetVector_T(const char* iPropName, OutputIterator iIter, const T& iDummy) const
01461         { this->GetValue(iPropName).GetVector_T(iIter, iDummy); }
01462 
01463 template <typename OutputIterator, typename T>
01464 inline void ZTuple::GetVector_T(const std::string& iPropName,
01465         OutputIterator iIter, const T& iDummy) const
01466         { this->GetValue(iPropName).GetVector_T(iIter, iDummy); }
01467 
01468 template <typename InputIterator>
01469 inline void ZTuple::SetVector_T(const_iterator iPropIter, InputIterator iBegin, InputIterator iEnd)
01470         { this->SetMutableNull(iPropIter).SetVector_T(iBegin, iEnd); }
01471 
01472 template <typename InputIterator>
01473 inline void ZTuple::SetVector_T(const char* iPropName, InputIterator iBegin, InputIterator iEnd)
01474         { this->SetMutableNull(iPropName).SetVector_T(iBegin, iEnd); }
01475 
01476 template <typename InputIterator>
01477 inline void ZTuple::SetVector_T(const std::string& iPropName,
01478         InputIterator iBegin, InputIterator iEnd)
01479         { this->SetMutableNull(iPropName).SetVector_T(iBegin, iEnd); }
01480 
01481 template <typename InputIterator, typename T>
01482 inline void ZTuple::SetVector_T(const_iterator iPropIter,
01483         InputIterator iBegin, InputIterator iEnd, const T& iDummy)
01484         { this->SetMutableNull(iPropIter).SetVector_T(iBegin, iEnd, iDummy); }
01485 
01486 template <typename InputIterator, typename T>
01487 inline void ZTuple::SetVector_T(const char* iPropName,
01488         InputIterator iBegin, InputIterator iEnd, const T& iDummy)
01489         { this->SetMutableNull(iPropName).SetVector_T(iBegin, iEnd, iDummy); }
01490 
01491 template <typename InputIterator, typename T>
01492 inline void ZTuple::SetVector_T(const std::string& iPropName,
01493         InputIterator iBegin, InputIterator iEnd, const T& iDummy)
01494         { this->SetMutableNull(iPropName).SetVector_T(iBegin, iEnd, iDummy); }
01495 
01496 template <>
01497 inline bool ZTuple::Get_T<ZTupleValue>(const_iterator iPropIter, ZTupleValue& oVal) const
01498         { return this->GetValue(iPropIter, oVal); }
01499 
01500 template <>
01501 inline bool ZTuple::Get_T<ZType>(const_iterator iPropIter, ZType& oVal) const
01502         { return this->GetType(iPropIter, oVal); }
01503 
01504 template <>
01505 inline bool ZTuple::Get_T<uint64>(const_iterator iPropIter, uint64& oVal) const
01506         { return this->GetID(iPropIter, oVal); }
01507 
01508 template <>
01509 inline bool ZTuple::Get_T<int8>(const_iterator iPropIter, int8& oVal) const
01510         { return this->GetInt8(iPropIter, oVal); }
01511 
01512 template <>
01513 inline bool ZTuple::Get_T<int16>(const_iterator iPropIter, int16& oVal) const
01514         { return this->GetInt16(iPropIter, oVal); }
01515 
01516 template <>
01517 inline bool ZTuple::Get_T<int32>(const_iterator iPropIter, int32& oVal) const
01518         { return this->GetInt32(iPropIter, oVal); }
01519 
01520 template <>
01521 inline bool ZTuple::Get_T<int64>(const_iterator iPropIter, int64& oVal) const
01522         { return this->GetInt64(iPropIter, oVal); }
01523 
01524 template <>
01525 inline bool ZTuple::Get_T<bool>(const_iterator iPropIter, bool& oVal) const
01526         { return this->GetBool(iPropIter, oVal); }
01527 
01528 template <>
01529 inline bool ZTuple::Get_T<float>(const_iterator iPropIter, float& oVal) const
01530         { return this->GetFloat(iPropIter, oVal); }
01531 
01532 template <>
01533 inline bool ZTuple::Get_T<double>(const_iterator iPropIter, double& oVal) const
01534         { return this->GetDouble(iPropIter, oVal); }
01535 
01536 template <>
01537 inline bool ZTuple::Get_T<ZTime>(const_iterator iPropIter, ZTime& oVal) const
01538         { return this->GetTime(iPropIter, oVal); }
01539 
01540 template <>
01541 inline bool ZTuple::Get_T<std::string>(const_iterator iPropIter, std::string& oVal) const
01542         { return this->GetString(iPropIter, oVal); }
01543 
01544 
01545 template <>
01546 inline bool ZTuple::Get_T<ZTupleValue>(const char* iPropName, ZTupleValue& oVal) const
01547         { return this->GetValue(iPropName, oVal); }
01548 
01549 template <>
01550 inline bool ZTuple::Get_T<ZType>(const char* iPropName, ZType& oVal) const
01551         { return this->GetType(iPropName, oVal); }
01552 
01553 template <>
01554 inline bool ZTuple::Get_T<uint64>(const char* iPropName, uint64& oVal) const
01555         { return this->GetID(iPropName, oVal); }
01556 
01557 template <>
01558 inline bool ZTuple::Get_T<int8>(const char* iPropName, int8& oVal) const
01559         { return this->GetInt8(iPropName, oVal); }
01560 
01561 template <>
01562 inline bool ZTuple::Get_T<int16>(const char* iPropName, int16& oVal) const
01563         { return this->GetInt16(iPropName, oVal); }
01564 
01565 template <>
01566 inline bool ZTuple::Get_T<int32>(const char* iPropName, int32& oVal) const
01567         { return this->GetInt32(iPropName, oVal); }
01568 
01569 template <>
01570 inline bool ZTuple::Get_T<int64>(const char* iPropName, int64& oVal) const
01571         { return this->GetInt64(iPropName, oVal); }
01572 
01573 template <>
01574 inline bool ZTuple::Get_T<bool>(const char* iPropName, bool& oVal) const
01575         { return this->GetBool(iPropName, oVal); }
01576 
01577 template <>
01578 inline bool ZTuple::Get_T<float>(const char* iPropName, float& oVal) const
01579         { return this->GetFloat(iPropName, oVal); }
01580 
01581 template <>
01582 inline bool ZTuple::Get_T<double>(const char* iPropName, double& oVal) const
01583         { return this->GetDouble(iPropName, oVal); }
01584 
01585 template <>
01586 inline bool ZTuple::Get_T<ZTime>(const char* iPropName, ZTime& oVal) const
01587         { return this->GetTime(iPropName, oVal); }
01588 
01589 template <>
01590 inline bool ZTuple::Get_T<std::string>(const char* iPropName, std::string& oVal) const
01591         { return this->GetString(iPropName, oVal); }
01592 
01593 
01594 template <>
01595 inline bool ZTuple::Get_T<ZTupleValue>(const std::string& iPropName, ZTupleValue& oVal) const
01596         { return this->GetValue(iPropName, oVal); }
01597 
01598 template <>
01599 inline bool ZTuple::Get_T<ZType>(const std::string& iPropName, ZType& oVal) const
01600         { return this->GetType(iPropName, oVal); }
01601 
01602 template <>
01603 inline bool ZTuple::Get_T<uint64>(const std::string& iPropName, uint64& oVal) const
01604         { return this->GetID(iPropName, oVal); }
01605 
01606 template <>
01607 inline bool ZTuple::Get_T<int8>(const std::string& iPropName, int8& oVal) const
01608         { return this->GetInt8(iPropName, oVal); }
01609 
01610 template <>
01611 inline bool ZTuple::Get_T<int16>(const std::string& iPropName, int16& oVal) const
01612         { return this->GetInt16(iPropName, oVal); }
01613 
01614 template <>
01615 inline bool ZTuple::Get_T<int32>(const std::string& iPropName, int32& oVal) const
01616         { return this->GetInt32(iPropName, oVal); }
01617 
01618 template <>
01619 inline bool ZTuple::Get_T<int64>(const std::string& iPropName, int64& oVal) const
01620         { return this->GetInt64(iPropName, oVal); }
01621 
01622 template <>
01623 inline bool ZTuple::Get_T<bool>(const std::string& iPropName, bool& oVal) const
01624         { return this->GetBool(iPropName, oVal); }
01625 
01626 template <>
01627 inline bool ZTuple::Get_T<float>(const std::string& iPropName, float& oVal) const
01628         { return this->GetFloat(iPropName, oVal); }
01629 
01630 template <>
01631 inline bool ZTuple::Get_T<double>(const std::string& iPropName, double& oVal) const
01632         { return this->GetDouble(iPropName, oVal); }
01633 
01634 template <>
01635 inline bool ZTuple::Get_T<ZTime>(const std::string& iPropName, ZTime& oVal) const
01636         { return this->GetTime(iPropName, oVal); }
01637 
01638 template <>
01639 inline bool ZTuple::Get_T<std::string>(const std::string& iPropName, std::string& oVal) const
01640         { return this->GetString(iPropName, oVal); }
01641 
01642 
01643 template <>
01644 inline ZTupleValue ZTuple::Get_T<ZTupleValue>(const_iterator iPropIter) const
01645         { return this->GetValue(iPropIter); }
01646 
01647 template <>
01648 inline ZType ZTuple::Get_T<ZType>(const_iterator iPropIter) const
01649         { return this->GetType(iPropIter); }
01650 
01651 template <>
01652 inline uint64 ZTuple::Get_T<uint64>(const_iterator iPropIter) const
01653         { return this->GetID(iPropIter); }
01654 
01655 template <>
01656 inline int8 ZTuple::Get_T<int8>(const_iterator iPropIter) const
01657         { return this->GetInt8(iPropIter); }
01658 
01659 template <>
01660 inline int16 ZTuple::Get_T<int16>(const_iterator iPropIter) const
01661         { return this->GetInt16(iPropIter); }
01662 
01663 template <>
01664 inline int32 ZTuple::Get_T<int32>(const_iterator iPropIter) const
01665         { return this->GetInt32(iPropIter); }
01666 
01667 template <>
01668 inline int64 ZTuple::Get_T<int64>(const_iterator iPropIter) const
01669         { return this->GetInt64(iPropIter); }
01670 
01671 template <>
01672 inline bool ZTuple::Get_T<bool>(const_iterator iPropIter) const
01673         { return this->GetBool(iPropIter); }
01674 
01675 template <>
01676 inline float ZTuple::Get_T<float>(const_iterator iPropIter) const
01677         { return this->GetFloat(iPropIter); }
01678 
01679 template <>
01680 inline double ZTuple::Get_T<double>(const_iterator iPropIter) const
01681         { return this->GetDouble(iPropIter); }
01682 
01683 template <>
01684 inline ZTime ZTuple::Get_T<ZTime>(const_iterator iPropIter) const
01685         { return this->GetTime(iPropIter); }
01686 
01687 template <>
01688 inline std::string ZTuple::Get_T<std::string>(const_iterator iPropIter) const
01689         { return this->GetString(iPropIter); }
01690 
01691 
01692 template <>
01693 inline ZTupleValue ZTuple::Get_T<ZTupleValue>(const char* iPropName) const
01694         { return this->GetValue(iPropName); }
01695 
01696 template <>
01697 inline ZType ZTuple::Get_T<ZType>(const char* iPropName) const
01698         { return this->GetType(iPropName); }
01699 
01700 template <>
01701 inline uint64 ZTuple::Get_T<uint64>(const char* iPropName) const
01702         { return this->GetID(iPropName); }
01703 
01704 template <>
01705 inline int8 ZTuple::Get_T<int8>(const char* iPropName) const
01706         { return this->GetInt8(iPropName); }
01707 
01708 template <>
01709 inline int16 ZTuple::Get_T<int16>(const char* iPropName) const
01710         { return this->GetInt16(iPropName); }
01711 
01712 template <>
01713 inline int32 ZTuple::Get_T<int32>(const char* iPropName) const
01714         { return this->GetInt32(iPropName); }
01715 
01716 template <>
01717 inline int64 ZTuple::Get_T<int64>(const char* iPropName) const
01718         { return this->GetInt64(iPropName); }
01719 
01720 template <>
01721 inline bool ZTuple::Get_T<bool>(const char* iPropName) const
01722         { return this->GetBool(iPropName); }
01723 
01724 template <>
01725 inline float ZTuple::Get_T<float>(const char* iPropName) const
01726         { return this->GetFloat(iPropName); }
01727 
01728 template <>
01729 inline double ZTuple::Get_T<double>(const char* iPropName) const
01730         { return this->GetDouble(iPropName); }
01731 
01732 template <>
01733 inline ZTime ZTuple::Get_T<ZTime>(const char* iPropName) const
01734         { return this->GetTime(iPropName); }
01735 
01736 template <>
01737 inline std::string ZTuple::Get_T<std::string>(const char* iPropName) const
01738         { return this->GetString(iPropName); }
01739 
01740 
01741 template <>
01742 inline ZTupleValue ZTuple::Get_T<ZTupleValue>(const std::string& iPropName) const
01743         { return this->GetValue(iPropName); }
01744 
01745 template <>
01746 inline ZType ZTuple::Get_T<ZType>(const std::string& iPropName) const
01747         { return this->GetType(iPropName); }
01748 
01749 template <>
01750 inline uint64 ZTuple::Get_T<uint64>(const std::string& iPropName) const
01751         { return this->GetID(iPropName); }
01752 
01753 template <>
01754 inline int8 ZTuple::Get_T<int8>(const std::string& iPropName) const
01755         { return this->GetInt8(iPropName); }
01756 
01757 template <>
01758 inline int16 ZTuple::Get_T<int16>(const std::string& iPropName) const
01759         { return this->GetInt16(iPropName); }
01760 
01761 template <>
01762 inline int32 ZTuple::Get_T<int32>(const std::string& iPropName) const
01763         { return this->GetInt32(iPropName); }
01764 
01765 template <>
01766 inline int64 ZTuple::Get_T<int64>(const std::string& iPropName) const
01767         { return this->GetInt64(iPropName); }
01768 
01769 template <>
01770 inline bool ZTuple::Get_T<bool>(const std::string& iPropName) const
01771         { return this->GetBool(iPropName); }
01772 
01773 template <>
01774 inline float ZTuple::Get_T<float>(const std::string& iPropName) const
01775         { return this->GetFloat(iPropName); }
01776 
01777 template <>
01778 inline double ZTuple::Get_T<double>(const std::string& iPropName) const
01779         { return this->GetDouble(iPropName); }
01780 
01781 template <>
01782 inline ZTime ZTuple::Get_T<ZTime>(const std::string& iPropName) const
01783         { return this->GetTime(iPropName); }
01784 
01785 template <>
01786 inline std::string ZTuple::Get_T<std::string>(const std::string& iPropName) const
01787         { return this->GetString(iPropName); }
01788 
01789 
01790 template <>
01791 inline ZType ZTuple::DGet_T<ZType>(const_iterator iPropIter, ZType iDefault) const
01792         { return this->DGetType(iPropIter, iDefault); }
01793 
01794 template <>
01795 inline uint64 ZTuple::DGet_T<uint64>(const_iterator iPropIter, uint64 iDefault) const
01796         { return this->DGetID(iPropIter, iDefault); }
01797 
01798 template <>
01799 inline int8 ZTuple::DGet_T<int8>(const_iterator iPropIter, int8 iDefault) const
01800         { return this->DGetInt8(iPropIter, iDefault); }
01801 
01802 template <>
01803 inline int16 ZTuple::DGet_T<int16>(const_iterator iPropIter, int16 iDefault) const
01804         { return this->DGetInt16(iPropIter, iDefault); }
01805 
01806 template <>
01807 inline int32 ZTuple::DGet_T<int32>(const_iterator iPropIter, int32 iDefault) const
01808         { return this->DGetInt32(iPropIter, iDefault); }
01809 
01810 template <>
01811 inline int64 ZTuple::DGet_T<int64>(const_iterator iPropIter, int64 iDefault) const
01812         { return this->DGetInt64(iPropIter, iDefault); }
01813 
01814 template <>
01815 inline bool ZTuple::DGet_T<bool>(const_iterator iPropIter, bool iDefault) const
01816         { return this->DGetBool(iPropIter, iDefault); }
01817 
01818 template <>
01819 inline float ZTuple::DGet_T<float>(const_iterator iPropIter, float iDefault) const
01820         { return this->DGetFloat(iPropIter, iDefault); }
01821 
01822 template <>
01823 inline double ZTuple::DGet_T<double>(const_iterator iPropIter, double iDefault) const
01824         { return this->DGetDouble(iPropIter, iDefault); }
01825 
01826 template <>
01827 inline ZTime ZTuple::DGet_T<ZTime>(const_iterator iPropIter, ZTime iDefault) const
01828         { return this->DGetTime(iPropIter, iDefault); }
01829 
01830 template <>
01831 inline std::string ZTuple::DGet_T<std::string>(const_iterator iPropIter, std::string iDefault) const
01832         { return this->DGetString(iPropIter, iDefault); }
01833 
01834 
01835 template <>
01836 inline ZType ZTuple::DGet_T<ZType>(const char* iPropName, ZType iDefault) const
01837         { return this->DGetType(iPropName, iDefault); }
01838 
01839 template <>
01840 inline uint64 ZTuple::DGet_T<uint64>(const char* iPropName, uint64 iDefault) const
01841         { return this->DGetID(iPropName, iDefault); }
01842 
01843 template <>
01844 inline int8 ZTuple::DGet_T<int8>(const char* iPropName, int8 iDefault) const
01845         { return this->DGetInt8(iPropName, iDefault); }
01846 
01847 template <>
01848 inline int16 ZTuple::DGet_T<int16>(const char* iPropName, int16 iDefault) const
01849         { return this->DGetInt16(iPropName, iDefault); }
01850 
01851 template <>
01852 inline int32 ZTuple::DGet_T<int32>(const char* iPropName, int32 iDefault) const
01853         { return this->DGetInt32(iPropName, iDefault); }
01854 
01855 template <>
01856 inline int64 ZTuple::DGet_T<int64>(const char* iPropName, int64 iDefault) const
01857         { return this->DGetInt64(iPropName, iDefault); }
01858 
01859 template <>
01860 inline bool ZTuple::DGet_T<bool>(const char* iPropName, bool iDefault) const
01861         { return this->DGetBool(iPropName, iDefault); }
01862 
01863 template <>
01864 inline float ZTuple::DGet_T<float>(const char* iPropName, float iDefault) const
01865         { return this->DGetFloat(iPropName, iDefault); }
01866 
01867 template <>
01868 inline double ZTuple::DGet_T<double>(const char* iPropName, double iDefault) const
01869         { return this->DGetDouble(iPropName, iDefault); }
01870 
01871 template <>
01872 inline ZTime ZTuple::DGet_T<ZTime>(const char* iPropName, ZTime iDefault) const
01873         { return this->DGetTime(iPropName, iDefault); }
01874 
01875 template <>
01876 inline std::string ZTuple::DGet_T<std::string>(const char* iPropName, std::string iDefault) const
01877         { return this->DGetString(iPropName, iDefault); }
01878 
01879 
01880 template <>
01881 inline ZType ZTuple::DGet_T<ZType>(const std::string& iPropName, ZType iDefault) const
01882         { return this->DGetType(iPropName, iDefault); }
01883 
01884 template <>
01885 inline uint64 ZTuple::DGet_T<uint64>(const std::string& iPropName, uint64 iDefault) const
01886         { return this->DGetID(iPropName, iDefault); }
01887 
01888 template <>
01889 inline int8 ZTuple::DGet_T<int8>(const std::string& iPropName, int8 iDefault) const
01890         { return this->DGetInt8(iPropName, iDefault); }
01891 
01892 template <>
01893 inline int16 ZTuple::DGet_T<int16>(const std::string& iPropName, int16 iDefault) const
01894         { return this->DGetInt16(iPropName, iDefault); }
01895 
01896 template <>
01897 inline int32 ZTuple::DGet_T<int32>(const std::string& iPropName, int32 iDefault) const
01898         { return this->DGetInt32(iPropName, iDefault); }
01899 
01900 template <>
01901 inline int64 ZTuple::DGet_T<int64>(const std::string& iPropName, int64 iDefault) const
01902         { return this->DGetInt64(iPropName, iDefault); }
01903 
01904 template <>
01905 inline bool ZTuple::DGet_T<bool>(const std::string& iPropName, bool iDefault) const
01906         { return this->DGetBool(iPropName, iDefault); }
01907 
01908 template <>
01909 inline float ZTuple::DGet_T<float>(const std::string& iPropName, float iDefault) const
01910         { return this->DGetFloat(iPropName, iDefault); }
01911 
01912 template <>
01913 inline double ZTuple::DGet_T<double>(const std::string& iPropName, double iDefault) const
01914         { return this->DGetDouble(iPropName, iDefault); }
01915 
01916 template <>
01917 inline ZTime ZTuple::DGet_T<ZTime>(const std::string& iPropName, ZTime iDefault) const
01918         { return this->DGetTime(iPropName, iDefault); }
01919 
01920 template <>
01921 inline std::string ZTuple::DGet_T<std::string>(const std::string& iPropName,
01922         std::string iDefault) const
01923         { return this->DGetString(iPropName, iDefault); }
01924 
01925 // =================================================================================================
01926 #pragma mark -
01927 #pragma mark * ZTupleRep
01928 
01930 
01931 class ZTupleRep : public ZRefCounted
01932         {
01933 public:
01934         static inline bool sCheckAccessEnabled() { return false; }
01935 
01936         ZTupleRep();
01937         ZTupleRep(const ZTupleRep* iOther);
01938         virtual ~ZTupleRep();
01939 
01942         ZTuple::PropList fProperties;
01943         };
01944 
01945 // =================================================================================================
01946 #pragma mark -
01947 #pragma mark * ZTuple inlines
01948 
01949 inline ZTuple::ZTuple()
01950         {}
01951 
01952 inline ZTuple::ZTuple(const ZTuple& iOther)
01953 :       fRep(iOther.fRep)
01954         {}
01955 
01956 inline ZTuple::~ZTuple()
01957         {}
01958 
01959 inline ZTuple& ZTuple::operator=(const ZTuple& iOther)
01960         {
01961         fRep = iOther.fRep;
01962         return *this;
01963         }
01964 
01965 inline ZTuple::ZTuple(ZRef<ZTupleRep> iRep)
01966 :       fRep(iRep)
01967         {}
01968 
01969 inline ZTuple::operator operator_bool_type() const
01970         { return operator_bool_generator_type::translate(fRep && !fRep->fProperties.empty()); }
01971 
01972 inline ZTuple ZTuple::Under(const ZTuple& iOver) const
01973         { return iOver.Over(*this); }
01974 
01975 inline bool ZTuple::operator==(const ZTuple& iOther) const
01976         { return fRep == iOther.fRep || this->pIsEqual(iOther); }
01977 
01978 inline bool ZTuple::operator!=(const ZTuple& iOther) const
01979         { return !(*this == iOther); }
01980 
01981 inline bool ZTuple::operator<=(const ZTuple& iOther) const
01982         { return !(iOther < *this); }
01983 
01984 inline bool ZTuple::operator>(const ZTuple& iOther) const
01985         { return iOther < *this; }
01986 
01987 inline bool ZTuple::operator>=(const ZTuple& iOther) const
01988         { return !(*this < iOther); }
01989 
01990 inline bool ZTuple::IsSameAs(const ZTuple& iOther) const
01991         { return fRep == iOther.fRep || this->pIsSameAs(iOther); }
01992 
01993 inline void ZTuple::swap(ZTuple& iOther)
01994         { std::swap(fRep, iOther.fRep); }
01995 
01996 namespace std {
01997 inline void swap(ZTuple& a, ZTuple& b)
01998         { a.swap(b); }
01999 } // namespace std
02000 
02001 namespace ZooLib {
02002 template <> inline int sCompare_T(const ZTupleValue& iL, const ZTupleValue& iR)
02003         { return iL.Compare(iR); }
02004 } // namespace ZooLib
02005 
02006 // =================================================================================================
02007 #pragma mark -
02008 #pragma mark * ZTuple::NameTV inlines
02009 
02010 inline ZTuple::NameTV::NameTV()
02011         {}
02012 
02013 inline ZTuple::NameTV::NameTV(const NameTV& iOther)
02014 :       fTV(iOther.fTV),
02015         fName(iOther.fName)
02016         {}
02017 
02018 inline ZTuple::NameTV::NameTV(const char* iName, const ZTupleValue& iTV)
02019 :       fTV(iTV),
02020         fName(iName)
02021         {}
02022 
02023 inline ZTuple::NameTV::NameTV(const string& iName, const ZTupleValue& iTV)
02024 :       fTV(iTV),
02025         fName(iName)
02026         {}
02027 
02028 inline ZTuple::NameTV::NameTV(const char* iName)
02029 :       fName(iName)
02030         {}
02031 
02032 inline ZTuple::NameTV::NameTV(const string& iName)
02033 :       fName(iName)
02034         {}
02035 
02036 #endif // __ZTuple__

Generated on Thu Jul 26 11:21:52 2007 for ZooLib by  doxygen 1.4.7