From: <ag...@us...> - 2009-07-19 17:46:34
|
Revision: 858 http://zoolib.svn.sourceforge.net/zoolib/?rev=858&view=rev Author: agreen Date: 2009-07-19 17:46:29 +0000 (Sun, 19 Jul 2009) Log Message: ----------- Move to cxx_old. Added Paths: ----------- trunk/zoolib/source/cxx_old/zoolib/ZUtil_Asset.cpp trunk/zoolib/source/cxx_old/zoolib/ZUtil_Asset.h trunk/zoolib/source/cxx_old/zoolib/ZUtil_Graphics.cpp trunk/zoolib/source/cxx_old/zoolib/ZUtil_Graphics.h trunk/zoolib/source/cxx_old/zoolib/ZUtil_Mac_HL.cpp trunk/zoolib/source/cxx_old/zoolib/ZUtil_Mac_HL.h trunk/zoolib/source/cxx_old/zoolib/ZUtil_Mac_LL.cpp trunk/zoolib/source/cxx_old/zoolib/ZUtil_Mac_LL.h Removed Paths: ------------- trunk/zoolib/source/cxx/zoolib/ZUtil_Asset.cpp trunk/zoolib/source/cxx/zoolib/ZUtil_Asset.h trunk/zoolib/source/cxx/zoolib/ZUtil_Graphics.cpp trunk/zoolib/source/cxx/zoolib/ZUtil_Graphics.h trunk/zoolib/source/cxx/zoolib/ZUtil_Mac_HL.cpp trunk/zoolib/source/cxx/zoolib/ZUtil_Mac_HL.h trunk/zoolib/source/cxx/zoolib/ZUtil_Mac_LL.cpp trunk/zoolib/source/cxx/zoolib/ZUtil_Mac_LL.h Deleted: trunk/zoolib/source/cxx/zoolib/ZUtil_Asset.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZUtil_Asset.cpp 2009-07-19 17:42:52 UTC (rev 857) +++ trunk/zoolib/source/cxx/zoolib/ZUtil_Asset.cpp 2009-07-19 17:46:29 UTC (rev 858) @@ -1,540 +0,0 @@ -/* ------------------------------------------------------------------------------------------------- -Copyright (c) 2001 Andrew Green and Learning in Motion, Inc. -http://www.zoolib.org - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software -and associated documentation files (the "Software"), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, merge, publish, distribute, -sublicense, and/or sell copies of the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING -BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES -OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------------------------- */ - -#include "zoolib/ZUtil_Asset.h" - -#include "zoolib/ZCONFIG_SPI.h" - -#include "zoolib/ZAsset_MacOS.h" -#include "zoolib/ZAsset_POSIX.h" -#include "zoolib/ZAsset_Std.h" -#include "zoolib/ZAsset_Win.h" -#include "zoolib/ZFile_POSIX.h" -#include "zoolib/ZMacOSX.h" -#include "zoolib/ZStream_Mac.h" -#include "zoolib/ZStream_PageBuffered.h" -#include "zoolib/ZString.h" // For pascal string conversions - -#if ZCONFIG_SPI_Enabled(POSIX) -# include <sys/types.h> // For lseek -# include <fcntl.h> // For open -# include <unistd.h> // For lseek -#endif - -#if ZCONFIG_SPI_Enabled(Win) -# include "zoolib/ZUnicode.h" -# include "zoolib/ZUtil_Win.h" -#endif - -#if ZCONFIG_SPI_Enabled(Carbon) -# include ZMACINCLUDE3(CoreServices,CarbonCore,Resources.h) -#endif - -NAMESPACE_ZOOLIB_BEGIN - -using std::string; -using std::vector; - -/** -\namespace ZUtil_Asset -\brief Functions mainly concerned with instantiating assets from data in the executable -file or in external files. -\ingroup group_Asset -*/ - -// ================================================================================================= - -#if ZCONFIG_SPI_Enabled(POSIX) - -static const char sMagicText[] = "ZooLib Appended Data v1.0"; -static const size_t sMagicTextSize = sizeof(sMagicText); - -static bool sGetAssetTreeInfoFromExecutable(const string& iName, int& oFD, size_t& oStart, size_t& oLength) - { - ZRef<ZFileLoc_POSIX> theFileLoc = ZFileLoc_POSIX::sGet_App(); - if (!theFileLoc) - return false; - - string thePath = theFileLoc->pGetPath(); - - oFD = ::open(thePath.c_str(), O_RDONLY); - - if (oFD < 0) - return false; - - try - { - // We don't want theStream to adopt the file descriptor \a oFD. - ZStreamRPos_File_POSIX theStream(oFD, false); - - size_t theSize = theStream.GetSize(); - const size_t trailerSize = sMagicTextSize + sizeof(int32) + sizeof(int32); - - // Check for there being at least enough room for an empty trailer. - if (theSize >= trailerSize) - { - // There's enough space for our trailer, consisting of the magic text - // and the two 32 bit offsets to asset data and the table of contents. - theStream.SetPosition(theSize - trailerSize); - size_t offsetOfData = theStream.ReadInt32(); - size_t offsetOfTOC = theStream.ReadInt32(); - if (theSize >= trailerSize + offsetOfData) - { - // The data offset is within the file. - char checkedText[sMagicTextSize]; - theStream.Read(checkedText, sMagicTextSize); - if (0 == memcmp(checkedText, sMagicText, sMagicTextSize)) - { - // The magic text matches. - if (theSize >= trailerSize + offsetOfTOC) - { - // The table of contents is also within the file. - theStream.SetPosition(theSize - trailerSize - offsetOfTOC); - size_t countOfChunks = theStream.ReadInt32(); - for (size_t x = 0; x < countOfChunks; ++x) - { - oStart = theStream.ReadInt32() + theSize - trailerSize - offsetOfData; - oLength = theStream.ReadInt32(); - string currentName; - if (size_t nameLength = theStream.ReadInt32()) - { - currentName.resize(nameLength); - theStream.Read(¤tName[0], nameLength); - } - if (iName == currentName) - return true; - } - } - } - } - } - } - catch (...) - {} - ::close(oFD); - return false; - } - -#endif // ZCONFIG_SPI_Enabled(POSIX) - -// ================================================================================================= - -#if ZCONFIG_SPI_Enabled(Win) - -#if defined(__MINGW32__) - -// MinGW screws up its headers -- callback functions for A and W have the same signatures, -// which is okay if you're only building for one or the other. We build for both, so we -// provide faked-out A and W definitions. - -typedef ENUMRESNAMEPROC ENUMRESNAMEPROCA; -typedef ENUMRESNAMEPROC ENUMRESNAMEPROCW; - -#endif // defined(__MINGW32__) - -static BOOL CALLBACK sEnumResNameCallbackW(HMODULE iHMODULE, const UTF16* iType, UTF16* iName, LONG_PTR iParam) - { - if (iName[0]) - reinterpret_cast<vector<string>*>(iParam)->push_back(ZUnicode::sAsUTF8(iName)); - - return TRUE; - } - -static BOOL CALLBACK sEnumResNameCallbackA(HMODULE iHMODULE, const char* iType, char* iName, LONG_PTR iParam) - { - if (iName[0]) - reinterpret_cast<vector<string>*>(iParam)->push_back(iName); - - return TRUE; - } - -#endif // ZCONFIG_SPI_Enabled(Win) - - -// ================================================================================================= - -/** -\fn void ZUtil_Asset::sGetAssetTreeNamesFromExecutable(vector<string>&) - -\brief Puts the names of all assets in the executable into \a oAssetTreeNames. - -As part of the build process multiple zao chunks can be incorporated -into the executable. On Mac and Windows it's done by creating resources of -type 'ZAO_' with whatever names you choose. - -On POSIX zac, the ZooLib Asset Compiler, physically appends the zao chunks -to the executable, followed by a table of contents and then a trailer containing -key offsets and magic text. The file thus looks like this: - -\verbatim -Regular executable data. -(Normal end of file, everything following is simply 'bolted' onto -the end of the file, and thus will get lost when strip is used) -zao chunk 0 -zao chunk 1 -... -zao chunk n -(Table of contents) - Count of chunks - Distance from start of chunk 0 to start of this chunk - Number of bytes in chunk - Length of chunk name - Chunk name -(Trailer) - Distance from trailer start to first chunk - Distance from trailer start to table of contents - Magic text: "ZooLib Appended Data v1.0" -\endverbatim -*/ -void ZUtil_Asset::sGetAssetTreeNamesFromExecutable(vector<string>& oAssetTreeNames) - { - oAssetTreeNames.clear(); - -#if ZCONFIG_SPI_Enabled(Carbon) - - short count = ::CountResources('ZAO_'); - ::SetResLoad(false); - for (short index = 1; index <= count; ++index) - { - if (Handle theResourceHandle = ::GetIndResource('ZAO_', index)) - { - short theResourceID; - ResType theResourceType; - Str255 theResourceName; - ::GetResInfo(theResourceHandle, &theResourceID, &theResourceType, theResourceName); - string resName = ZString::sFromPString(theResourceName); - if (resName.size()) - { - vector<string>::iterator theIter = lower_bound(oAssetTreeNames.begin(), oAssetTreeNames.end(), resName); - if (theIter == oAssetTreeNames.end() || *theIter != resName) - oAssetTreeNames.insert(theIter, resName); - } - } - } - ::SetResLoad(true); - -#elif ZCONFIG_SPI_Enabled(Win) - - if (ZUtil_Win::sUseWAPI()) - { - ::EnumResourceNamesW(::GetModuleHandleW(0), L"ZAO_", - (ENUMRESNAMEPROCW)sEnumResNameCallbackW, reinterpret_cast<LONG_PTR>(&oAssetTreeNames)); - } - else - { - ::EnumResourceNamesA(::GetModuleHandleA(0), "ZAO_", - (ENUMRESNAMEPROCA)sEnumResNameCallbackA, reinterpret_cast<LONG_PTR>(&oAssetTreeNames)); - } - -#elif ZCONFIG_SPI_Enabled(POSIX) - - if (ZRef<ZStreamerRPos> theStreamer = ZFileSpec::sApp().OpenRPos()) - { - const ZStreamRPos& theStream = theStreamer->GetStreamRPos(); - size_t theSize = theStream.GetSize(); - size_t trailerSize = sMagicTextSize + sizeof(int32) + sizeof(int32); - // Check for there being at least enough room for an empty trailer - if (theSize >= trailerSize) - { - // Look for our trailer - theStream.SetPosition(theSize - trailerSize); - size_t offsetOfData = theStream.ReadInt32(); - size_t offsetOfTOC = theStream.ReadInt32(); - if (theSize >= trailerSize + offsetOfData) - { - char checkedText[sMagicTextSize]; - theStream.Read(checkedText, sMagicTextSize); - if (0 == memcmp(checkedText, sMagicText, sMagicTextSize)) - { - theStream.SetPosition(theSize - trailerSize - offsetOfTOC); - size_t countOfChunks = theStream.ReadInt32(); - for (size_t x = 0; x < countOfChunks; ++x) - { - theStream.ReadInt32(); // Skip the data offset - theStream.ReadInt32(); // Skip the data length - size_t nameLength = theStream.ReadInt32(); - string currentName; - currentName.resize(nameLength); - theStream.Read(¤tName[0], nameLength); - oAssetTreeNames.push_back(currentName); - } - } - } - } - } - -#endif - } - -// ================================================================================================= - -/** -\fn ZRef<ZAssetTree> ZUtil_Asset::sGetAssetTreeFromExecutable(const string&) - -\brief Return a new ZAssetTree instance referencing the zao data -named \a iAssetTreeName in the executable. - -It is important to recognize that each invocation of this method creates -a \em new instance of ZAssetTree. It may therefore load or map all the data contained in -the tree. Your application will probably call this method indirectly by calling -ZUtil_Asset::sGetAssetRootFromExecutable, but it should do so only once, keeping the asset -in a global static or in an instance variable of your application object (or equivalent). - -\sa ZUtil_Asset::sGetAssetTreeNamesFromExecutable -*/ -ZRef<ZAssetTree> ZUtil_Asset::sGetAssetTreeFromExecutable(const string& iAssetTreeName) - { -#if ZCONFIG_SPI_Enabled(Carbon) - - Str255 theResourceName; - ZString::sToPString(iAssetTreeName, theResourceName, 255); - - if (ZMacOSX::sIsMacOSX()) - { - // This variant sucks the entire resource into memory, which is what - // MacOS X does anyway even when SetResLoad is false. - if (Handle theResourceHandle = ::GetNamedResource('ZAO_', theResourceName)) - return new ZAssetTree_MacOS_Resource(theResourceHandle, true); - } - else - { - // This variant uses the partial resource API to randomly access the resource - // without pulling the entire contents into memory. We also interpose a - // ZStreamerRPos_PageBuffered with eight 1K buffers to improve the performance - // of small reads. - ::SetResLoad(false); - Handle theResourceHandle = ::GetNamedResource('ZAO_', theResourceName); - ::SetResLoad(true); - if (theResourceHandle) - { - ZRef<ZStreamerRPos> theStreamer = new ZStreamerRPos_Mac_PartialResource(theResourceHandle, true); - theStreamer = new ZStreamerRPos_PageBuffered(8, 1024, theStreamer); - return new ZAssetTree_Std_Streamer(theStreamer); - } - } - -#elif ZCONFIG_SPI_Enabled(Win) - - HINSTANCE theHINSTANCE; - if (ZUtil_Win::sUseWAPI()) - theHINSTANCE = ::GetModuleHandleW(nullptr); - else - theHINSTANCE = ::GetModuleHandleA(nullptr); - - return new ZAssetTree_Win_MultiResource(theHINSTANCE, "ZAO_", iAssetTreeName); - -#elif ZCONFIG_SPI_Enabled(POSIX) - - int theFD; - size_t theStart, theLength; - if (sGetAssetTreeInfoFromExecutable(iAssetTreeName, theFD, theStart, theLength)) - return new ZAssetTree_POSIX_MemoryMapped(theFD, true, theStart, theLength); - -#elif ZCONFIG_SPI_Enabled(BeOS) - - // AG 2000-01-28. I know, I know, this is not thread safe. - static BResources* sBResources = nullptr; - if (!sBResources) - { - app_info info; - if (B_OK == be_roster->GetRunningAppInfo(be_app->Team(), &info)) - { - BFile theBFile(&info.ref, O_RDONLY); - if (B_OK == theBFile.InitCheck()) - sBResources = new BResources(&theBFile); - } - } - - if (sBResources) - { - size_t theSize; - if (const void* theResourceData = sBResources->LoadResource((type_code)'ZAO_', iAssetTreeName.c_str(), &theSize)) - return new ZAssetTree_Std_Memory_StaticData(theResourceData, theSize); - } - -#endif - - return ZRef<ZAssetTree>(); - } - - -/** -\fn ZAsset ZUtil_Asset::sGetAssetRootFromExecutable(const string&) - -\brief Return an asset representing the root asset in the tree in the -executable file named \a iAssetTreeName. - -\sa ZUtil_Asset::sGetAssetTreeFromExecutable. -*/ -ZAsset ZUtil_Asset::sGetAssetRootFromExecutable(const string& iAssetTreeName) - { - if (ZRef<ZAssetTree> theAssetTree = sGetAssetTreeFromExecutable(iAssetTreeName)) - return theAssetTree->GetRoot(); - return ZAsset(); - } - - -/** -\fn ZRef<ZAssetTree> ZUtil_Asset::sGetAssetTreeFromFileSpec(const ZFileSpec&) - -\brief Return a new ZAssetTree instance referencing the zao data in the -file referenced by \a iFileSpec. - -It is important to recognize that each invocation of this method creates -a \em new instance of ZAssetTree. It may therefore load or map all the data contained in -the tree. Your application will probably call this method indirectly by calling -ZUtil_Asset::sGetAssetRootFromFileSpec, but it should do so only once, keeping the asset -in a global static or in an instance variable of your application object (or equivalent). - -\sa ZUtil_Asset::sGetAssetTreeNamesFromExecutable -*/ -ZRef<ZAssetTree> ZUtil_Asset::sGetAssetTreeFromFileSpec(const ZFileSpec& iFileSpec) - { - ZRef<ZAssetTree> theAssetTree; - -#if ZCONFIG_SPI_Enabled(Carbon) - - try - { - if (ZRef<ZStreamerRPos> theStreamer = iFileSpec.OpenRPos()) - theAssetTree = new ZAssetTree_Std_Streamer(new ZStreamerRPos_PageBuffered(8, 1024, theStreamer)); - } - catch (...) - {} - -#elif ZCONFIG_SPI_Enabled(Win) - - try - { - string thePath = iFileSpec.AsString_Native(); - HANDLE theFileHANDLE; - if (ZUtil_Win::sUseWAPI()) - { - theFileHANDLE = ::CreateFileW(ZUnicode::sAsUTF16(thePath).c_str(), // the path - GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, - nullptr, // No security attributes - OPEN_EXISTING, // Open the file only if it exists - FILE_ATTRIBUTE_NORMAL, // No special attributes - nullptr);// No template file - } - else - { - theFileHANDLE = ::CreateFileA(thePath.c_str(), // the path - GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, - nullptr, // No security attributes - OPEN_EXISTING, // Open the file only if it exists - FILE_ATTRIBUTE_NORMAL, // No special attributes - nullptr);// No template file - } - - if (theFileHANDLE != INVALID_HANDLE_VALUE) - { - DWORD sizeHigh; - DWORD sizeLow = ::GetFileSize(theFileHANDLE, &sizeHigh); - theAssetTree = new ZAssetTree_Win_MemoryMapped(theFileHANDLE, true, 0, sizeLow); - } - } - catch (...) - {} - -#elif ZCONFIG_SPI_Enabled(POSIX) - - try - { - int theFD = ::open(iFileSpec.AsString_Native().c_str(), O_RDONLY); - if (theFD >= 0) - { - int theLength = ::lseek(theFD, 0, SEEK_END); - theAssetTree = new ZAssetTree_POSIX_MemoryMapped(theFD, true, 0, theLength); - } - } - catch (...) - {} - -#endif - - if (!theAssetTree) - { - // We failed to get the asset tree instantiated, either because we just fell through - // to here directly (BeOS), or because an exception occurred. - if (ZRef<ZStreamerRPos> theStreamer = iFileSpec.OpenRPos()) - { - try - { - theAssetTree = new ZAssetTree_Std_Streamer(theStreamer); - } - catch (...) - {} - } - } - - return theAssetTree; - } - - -/** -\fn ZAsset ZUtil_Asset::sGetAssetRootFromFileSpec(const ZFileSpec&) - -\brief Return an asset representing the root asset in the tree -in the file referenced by \a iFileSpec. - -\sa ZUtil_Asset::sGetAssetTreeFromFileSpec -*/ -ZAsset ZUtil_Asset::sGetAssetRootFromFileSpec(const ZFileSpec& iFileSpec) - { - if (ZRef<ZAssetTree> theAssetTree = sGetAssetTreeFromFileSpec(iFileSpec)) - return theAssetTree->GetRoot(); - return ZAsset(); - } - -ZAsset ZUtil_Asset::sCreateOverlay(const vector<ZAsset>& iAssets, bool iLowestToHighest) - { - if (iAssets.size() == 0) - return ZAsset(); - - if (iAssets.size() == 1) - return iAssets.front(); - - // ZAssetRep_Overlay requires that we give it a list of asset reps, ordered from - // highest priority to lowest. If \param iLowestToHighest is true then we have to - // build the vector in reverse order. - - vector<ZRef<ZAssetRep> > assetReps; - if (iLowestToHighest) - { - for (vector<ZAsset>::const_reverse_iterator i = iAssets.rbegin(); i != iAssets.rend(); ++i) - { - if (ZRef<ZAssetRep> theRep = (*i).GetRep()) - assetReps.push_back(theRep); - } - } - else - { - for (vector<ZAsset>::const_iterator i = iAssets.begin(); i != iAssets.end(); ++i) - { - if (ZRef<ZAssetRep> theRep = (*i).GetRep()) - assetReps.push_back(theRep); - } - } - - return ZAsset(new ZAssetRep_Overlay(assetReps)); - } - -NAMESPACE_ZOOLIB_END Deleted: trunk/zoolib/source/cxx/zoolib/ZUtil_Asset.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZUtil_Asset.h 2009-07-19 17:42:52 UTC (rev 857) +++ trunk/zoolib/source/cxx/zoolib/ZUtil_Asset.h 2009-07-19 17:46:29 UTC (rev 858) @@ -1,49 +0,0 @@ -/* ------------------------------------------------------------------------------------------------- -Copyright (c) 2001 Andrew Green and Learning in Motion, Inc. -http://www.zoolib.org - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software -and associated documentation files (the "Software"), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, merge, publish, distribute, -sublicense, and/or sell copies of the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING -BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES -OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------------------------- */ - -#ifndef __ZUtil_Asset__ -#define __ZUtil_Asset__ 1 -#include "zconfig.h" - -#include "zoolib/ZAsset.h" -#include "zoolib/ZFile.h" - -#include <string> -#include <vector> - -NAMESPACE_ZOOLIB_BEGIN - -namespace ZUtil_Asset { - -void sGetAssetTreeNamesFromExecutable(std::vector<std::string>& oAssetTreeNames); - -ZRef<ZAssetTree> sGetAssetTreeFromExecutable(const std::string& iAssetTreeName); -ZAsset sGetAssetRootFromExecutable(const std::string& iAssetTreeName); - -ZRef<ZAssetTree> sGetAssetTreeFromFileSpec(const ZFileSpec& iFileSpec); -ZAsset sGetAssetRootFromFileSpec(const ZFileSpec& iFileSpec); - -ZAsset sCreateOverlay(const std::vector<ZAsset>& iAssets, bool iLowestToHighest); - -} // namespace ZUtil_Asset - -NAMESPACE_ZOOLIB_END - -#endif // __ZUtil_Asset__ Deleted: trunk/zoolib/source/cxx/zoolib/ZUtil_Graphics.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZUtil_Graphics.cpp 2009-07-19 17:42:52 UTC (rev 857) +++ trunk/zoolib/source/cxx/zoolib/ZUtil_Graphics.cpp 2009-07-19 17:46:29 UTC (rev 858) @@ -1,334 +0,0 @@ -/* ------------------------------------------------------------------------------------------------- -Copyright (c) 2000 Andrew Green and Learning in Motion, Inc. -http://www.zoolib.org - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software -and associated documentation files (the "Software"), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, merge, publish, distribute, -sublicense, and/or sell copies of the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING -BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES -OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------------------------- */ - -#include "zoolib/ZMacFixup.h" - -#include "zoolib/ZUtil_Graphics.h" -#include "zoolib/ZCONFIG_SPI.h" - -#include "zoolib/ZDebug.h" -#include "zoolib/ZDC.h" -#include "zoolib/ZDC_QD.h" - -#if ZCONFIG_SPI_Enabled(MacClassic) || ZCONFIG_SPI_Enabled(Carbon) -# include ZMACINCLUDE3(Carbon,HIToolbox,Drag.h) // For GetDragHiliteColor -# include ZMACINCLUDE3(CoreServices,CarbonCore,LowMem.h) // For LMGetHiliteRGB -#endif - -using std::vector; - -NAMESPACE_ZOOLIB_BEGIN - -// ================================================== - -void ZUtil_Graphics::sCalculateRgnDifferences(const ZDCRgn& inOldRgn, const ZDCRgn& inNewRgn, - ZDCRgn* outOldRgnToPaint, ZDCRgn* outNewRgnToPaint, ZDCRgn* outDiffRgnToPaint) - { - if (outOldRgnToPaint) - *outOldRgnToPaint = (inOldRgn - inNewRgn); - if (outNewRgnToPaint) - *outNewRgnToPaint = (inNewRgn - inOldRgn); - if (outDiffRgnToPaint) - *outDiffRgnToPaint = (inNewRgn & inOldRgn); - } - -void ZUtil_Graphics::sCalculatePatternDifference(const ZDCPattern& inOldPattern, - const ZDCPattern& inNewPattern, ZDCPattern* outDiffPattern, bool* outPatternChanged) - { - ZDCPattern temp; - ZDCPattern* diffPattern = outDiffPattern; - if (!diffPattern) - diffPattern = &temp; - - bool patternChanged = false; - - for (short x = 0; x < 8; x++) - { - diffPattern->pat[x] = inOldPattern.pat[x] ^ inNewPattern.pat[x]; - if (diffPattern->pat[x] != 0) - patternChanged = true; - } - - if (outPatternChanged) - *outPatternChanged= patternChanged; - } - -// ================================================== - -void ZUtil_Graphics::sMarchAnts(ZDCPattern& ioPattern) - { - uint8 line0 = ioPattern.pat[0]; - ioPattern.pat[0] = ioPattern.pat[1]; - ioPattern.pat[1] = ioPattern.pat[2]; - ioPattern.pat[2] = ioPattern.pat[3]; - ioPattern.pat[3] = ioPattern.pat[4]; - ioPattern.pat[4] = ioPattern.pat[5]; - ioPattern.pat[5] = ioPattern.pat[6]; - ioPattern.pat[6] = ioPattern.pat[7]; - ioPattern.pat[7] = line0; - } - -// ================================================== - -void ZUtil_Graphics::sDrawDragDropHilite(const ZDC& inDC, const ZDCRgn& inRgn) - { - ZDC localDC(inDC); - ZDCRgn realRgn = inRgn - inRgn.Inset(3, 3); - - #if (ZCONFIG_SPI_Enabled(MacClassic) || ZCONFIG_SPI_Enabled(Carbon)) && ZCONFIG_SPI_Enabled(QuickDraw) - - if (localDC.GetDepth() >= 4) - { - RGBColor theDragHiliteColor; - ZDCSetupForQD theSetupForQD(localDC, true); - ZPoint qdOffset = theSetupForQD.GetOffset(); - ::GetDragHiliteColor((WindowPtr)theSetupForQD.GetGrafPtr(), &theDragHiliteColor); - RGBColor oldHiliteColor; - LMGetHiliteRGB(&oldHiliteColor); - ::HiliteColor(&theDragHiliteColor); - ::PenMode(hilite); - ::PaintRgn((realRgn + qdOffset).GetRgnHandle()); - ::HiliteColor(&oldHiliteColor); - } - else - { - localDC.SetInk(ZDCInk::sGray); - localDC.SetMode(ZDC::modeXor); - localDC.Fill(realRgn); - } - - #else - - localDC.SetInk(ZDCInk::sGray); - localDC.SetMode(ZDC::modeXor); - localDC.Fill(realRgn); - - #endif - } - -// ================================================== - -ZDCRgn ZUtil_Graphics::sCalculateRgnStrokedByLine(ZCoord inStartH, ZCoord inStartV, - ZCoord inEndH, ZCoord inEndV, ZCoord inPenWidth) - { return ZDCRgn::sLine(inStartH, inStartV, inEndH, inEndV, inPenWidth); } - -ZDCRgn ZUtil_Graphics::sCalculateRgnStrokedByLine(ZPoint inStart, ZPoint inEnd, ZCoord inPenWidth) - { return ZDCRgn::sLine(inStart.h, inStart.v, inEnd.h, inEnd.v, inPenWidth); } - -// ================================================== - -void ZUtil_Graphics::sBresenham(ZPoint inStartPoint, ZPoint inEndPoint, - BresenhamProc inProc, void* inRefcon) - { - ZCoord x1 = inStartPoint.h; - ZCoord x2 = inEndPoint.h; - ZCoord y1 = inStartPoint.v; - ZCoord y2 = inEndPoint.v; - - - ZCoord dx = x2 - x1; - ZCoord ax = abs(int(dx)) << 1; - ZCoord sx = dx < 0 ? -1 : dx > 0 ? 1 : 0; - ZCoord dy = y2 - y1; - ZCoord ay = abs(int(dy)) << 1; - ZCoord sy = dy < 0 ? -1 : dy > 0 ? 1 : 0; - ZCoord x = x1; - ZCoord y = y1; - - if (ax >= ay) - { - // x dominant - ZCoord d = ay - (ax >> 1); - while (x != x2) - { - inProc(ZPoint(x, y), inRefcon); - if (d >= 0) - { - y += sy; - d -= ax; - } - x += sx; - d += ay; - } - } - else - { - // y dominant - ZCoord d = ax - (ay >> 1); - while (y != y2) - { - inProc(ZPoint(x, y), inRefcon); - if (d >= 0) - { - x += sx; - d -= ay; - } - y += sy; - d += ax; - } - } - } - -// ================================================== - -ZDCRgn ZUtil_Graphics::sCalculateRgnStrokedByFatLine(const ZDCRgn& inPenRgn, - ZPoint inStartPoint, ZPoint inEndPoint) - { - // rvb sept 21 1999: broke down penRgn into rects and then drew line between start and finish - // This is now almost constant for the length of the line so the line does not take - // longer to draw as it gets longer. It is linear in the number of rectangles that - // make up the penRgn. Should implement a callback for decompose but there will normally be - // only 25 rects returned max (one for each vertical line in a penRegion if continuous) - - // AG 1999-10-30. One final change -- build a region formed from all the polys and fill that. - // It avoids the original problem, that of unioning the pen region with the composite region - // once for each point on the line, and now also avoids tiling one poly for each rect in the - // pen region. - int quadrant; - if (inStartPoint.v > inEndPoint.v) - { - if (inStartPoint.h < inEndPoint.h) - quadrant = 1; - else - quadrant = 2; - } - else - { - if (inStartPoint.h < inEndPoint.h) - quadrant = 4; - else - quadrant = 3; - } - - vector<ZRect> rects; - inPenRgn.Decompose(rects); - - ZDCRgnAccumulator theAccumulator; - ZPoint thePoints[6]; - for (size_t x = 0; x < rects.size(); ++x) - { - if (quadrant == 1) - { - thePoints[0] = rects[x].TopLeft() + inStartPoint; - thePoints[1] = rects[x].TopLeft() + inEndPoint; - thePoints[2] = rects[x].TopRight() + inEndPoint; - thePoints[3] = rects[x].BottomRight() + inEndPoint; - thePoints[4] = rects[x].BottomRight() + inStartPoint; - thePoints[5] = rects[x].BottomLeft() + inStartPoint; - } - else if (quadrant == 2) - { - thePoints[0] = rects[x].TopRight() + inStartPoint; - thePoints[1] = rects[x].TopRight() + inEndPoint; - thePoints[2] = rects[x].TopLeft() + inEndPoint; - thePoints[3] = rects[x].BottomLeft() + inEndPoint; - thePoints[4] = rects[x].BottomLeft() + inStartPoint; - thePoints[5] = rects[x].BottomRight() + inStartPoint; - } - else if (quadrant == 3) - { - thePoints[0] = rects[x].TopLeft() + inStartPoint; - thePoints[1] = rects[x].TopLeft() + inEndPoint; - thePoints[2] = rects[x].BottomLeft() + inEndPoint; - thePoints[3] = rects[x].BottomRight() +inEndPoint; - thePoints[4] = rects[x].BottomRight() + inStartPoint; - thePoints[5] = rects[x].TopRight() + inStartPoint; - } - else - { - thePoints[0] = rects[x].TopRight() + inStartPoint; - thePoints[1] = rects[x].TopRight() + inEndPoint; - thePoints[2] = rects[x].BottomRight() + inEndPoint; - thePoints[3] = rects[x].BottomLeft() + inEndPoint; - thePoints[4] = rects[x].BottomLeft() + inStartPoint; - thePoints[5] = rects[x].TopLeft() + inStartPoint; - } - ZDCRgn theRgn = ZDCRgn::sPoly(thePoints, 6); - theAccumulator.Add(theRgn); - } - return theAccumulator.GetResult(); - } - -void ZUtil_Graphics::sDrawFatLine(const ZDC& inDC, const ZDCRgn& inPenRgn, - ZPoint inStartPoint, ZPoint inEndPoint) - { - ZDC localDC(inDC); - if (inPenRgn.IsSimpleRect() && inPenRgn.Bounds().Width() == inPenRgn.Bounds().Height()) - { - // If the pen is square, we can use ZDC::Line - ZRect penBounds = inPenRgn.Bounds(); - localDC.SetPenWidth(penBounds.Width()); - localDC.Line(inStartPoint + penBounds.TopLeft(), inEndPoint + penBounds.TopLeft()); - } - else - { - localDC.Fill(sCalculateRgnStrokedByFatLine(inPenRgn, inStartPoint, inEndPoint)); - } - } - -// ================================================== - -// Handles are numbered 0 - 8, TL TM TR, ML MM MR, BL BM BR. (Top left, top middle etc.). -// Handle 4, which is in the center, gets skipped. -ZRect ZUtil_Graphics::sCalcHandleBounds9(const ZRect& inBounds, - ZCoord inHandleSize, size_t inHandleIndex) - { - ZRect handleBounds = ZRect::sZero; - if (inHandleIndex < 9 && inHandleIndex != 4) - { - // Find the horizontal portion - switch (inHandleIndex % 3) - { - case 0: - handleBounds.left = inBounds.left - inHandleSize; - handleBounds.right = inBounds.left; - break; - case 1: - handleBounds.left = inBounds.left + inBounds.Width() / 2 - (inHandleSize / 2); - handleBounds.right = handleBounds.left + inHandleSize; - break; - case 2: - handleBounds.left = inBounds.right; - handleBounds.right = handleBounds.left + inHandleSize; - break; - } - // Find the vertical portion - switch (inHandleIndex / 3) - { - case 0: - handleBounds.top = inBounds.top - inHandleSize; - handleBounds.bottom = inBounds.top; - break; - case 1: - handleBounds.top = inBounds.top + inBounds.Height() / 2 - (inHandleSize / 2); - handleBounds.bottom = handleBounds.top + inHandleSize; - break; - case 2: - handleBounds.top = inBounds.bottom; - handleBounds.bottom = handleBounds.top + inHandleSize; - break; - } - } - return handleBounds; - } - -// ================================================== - -NAMESPACE_ZOOLIB_END Deleted: trunk/zoolib/source/cxx/zoolib/ZUtil_Graphics.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZUtil_Graphics.h 2009-07-19 17:42:52 UTC (rev 857) +++ trunk/zoolib/source/cxx/zoolib/ZUtil_Graphics.h 2009-07-19 17:46:29 UTC (rev 858) @@ -1,68 +0,0 @@ -/* ------------------------------------------------------------------------------------------------- -Copyright (c) 2000 Andrew Green and Learning in Motion, Inc. -http://www.zoolib.org - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software -and associated documentation files (the "Software"), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, merge, publish, distribute, -sublicense, and/or sell copies of the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING -BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES -OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------------------------- */ - -#ifndef __ZUtil_Graphics__ -#define __ZUtil_Graphics__ 1 -#include "zconfig.h" - -#include "zoolib/ZGeom.h" -#include "zoolib/ZDCRgn.h" - -NAMESPACE_ZOOLIB_BEGIN - -class ZDC; -class ZDCPattern; -class ZDCPixmap; - -class ZStreamNP; - -namespace ZUtil_Graphics { - -void sCalculateRgnDifferences(const ZDCRgn& inOldRgn, const ZDCRgn& inNewRgn, - ZDCRgn* outOldRgnToPaint, ZDCRgn* outNewRgnToPaint, ZDCRgn* outDiffRgnToPaint); - -void sCalculatePatternDifference(const ZDCPattern& inOldPattern, const ZDCPattern& inNewPattern, - ZDCPattern* outDiffPattern, bool* outPatternChanged); - -void sMarchAnts(ZDCPattern& ioPattern); - -void sDrawDragDropHilite(const ZDC& inDC, const ZDCRgn& inRgn); - -ZDCRgn sCalculateRgnStrokedByLine(ZCoord inStartH, ZCoord inStartV, - ZCoord inEndH, ZCoord inEndV, ZCoord inPenWidth); - -ZDCRgn sCalculateRgnStrokedByLine(ZPoint inStart, ZPoint inEnd, ZCoord inPenWidth); - -typedef void (*BresenhamProc)(ZPoint inPoint, void* inRefcon); -void sBresenham(ZPoint inStartPoint, ZPoint inEndPoint, BresenhamProc inProc, void* inRefcon); - -ZDCRgn sCalculateRgnStrokedByFatLine(const ZDCRgn& inPenRgn, - ZPoint inStartPoint, ZPoint inEndPoint); - -void sDrawFatLine(const ZDC& inDC, const ZDCRgn& inPenRgn, - ZPoint inStartPoint, ZPoint inEndPoint); - -ZRect sCalcHandleBounds9(const ZRect& inBounds, ZCoord inHandleSize, size_t inHandleIndex); - -} // namespace ZUtil_Graphics - -NAMESPACE_ZOOLIB_END - -#endif // __ZUtil_Graphics__ Deleted: trunk/zoolib/source/cxx/zoolib/ZUtil_Mac_HL.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZUtil_Mac_HL.cpp 2009-07-19 17:42:52 UTC (rev 857) +++ trunk/zoolib/source/cxx/zoolib/ZUtil_Mac_HL.cpp 2009-07-19 17:46:29 UTC (rev 858) @@ -1,853 +0,0 @@ -/* ------------------------------------------------------------------------------------------------- -Copyright (c) 2000 Andrew Green and Learning in Motion, Inc. -http://www.zoolib.org - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software -and associated documentation files (the "Software"), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, merge, publish, distribute, -sublicense, and/or sell copies of the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING -BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES -OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------------------------- */ - -#include "zoolib/ZMacFixup.h" - -#include "zoolib/ZUtil_Mac_HL.h" - -#if ZCONFIG_SPI_Enabled(Carbon) - -#include "zoolib/ZDC_QD.h" -#include "zoolib/ZMacOSX.h" -#include "zoolib/ZMemory.h" // For ZBlockMove and ZBlockSet -#include "zoolib/ZUtil_Mac_LL.h" - -#include ZMACINCLUDE3(CoreServices,CarbonCore,Gestalt.h) -#include ZMACINCLUDE3(CoreServices,CarbonCore,Resources.h) -#include ZMACINCLUDE3(Carbon,HIToolbox,AEInteraction.h) - -#include <stdexcept> - -using std::max; -using std::runtime_error; -using std::string; - -NAMESPACE_ZOOLIB_BEGIN - -// ================================================================================================= - -void ZUtil_Mac_HL::sPixmapsFromCIconHandle(CIconHandle inHandle, ZDCPixmap* outColorPixmap, ZDCPixmap* outMonoPixmap, ZDCPixmap* outMaskPixmap) - { - ZAssert(inHandle); - - ZUtil_Mac_LL::HandleLocker locker1((Handle)inHandle); - // Do the color pixmap first - if (outColorPixmap) - { - ZUtil_Mac_LL::HandleLocker locker2((Handle)inHandle[0]->iconData); - *outColorPixmap = ZDCPixmap(new ZDCPixmapRep_QD(&inHandle[0]->iconPMap, *inHandle[0]->iconData, inHandle[0]->iconPMap.bounds)); - } - if (outMonoPixmap) - { - long theHeight = inHandle[0]->iconMask.bounds.bottom - inHandle[0]->iconMask.bounds.top; - long theRowBytes = inHandle[0]->iconMask.rowBytes; - *outMonoPixmap = ZDCPixmap(new ZDCPixmapRep_QD(&inHandle[0]->iconBMap, &inHandle[0]->iconMaskData[(theRowBytes*theHeight)/2], inHandle[0]->iconBMap.bounds, false)); - } - // Note that we invert the pixmap -- this is because we use white as the indication that something is opaque - if (outMaskPixmap) - *outMaskPixmap = ZDCPixmap(new ZDCPixmapRep_QD(&inHandle[0]->iconMask, &inHandle[0]->iconMaskData, inHandle[0]->iconMask.bounds, true)); - } - -CIconHandle ZUtil_Mac_HL::sCIconHandleFromPixmapCombo(const ZDCPixmapCombo& inPixmapCombo) - { return sCIconHandleFromPixmaps(inPixmapCombo.GetColor(), inPixmapCombo.GetMono(), inPixmapCombo.GetMask()); } - -static void sInvert(void* iAddress, size_t iCount) - { - uint8* theAddress = static_cast<uint8*>(iAddress); - while (iCount--) - { - *theAddress = *theAddress ^ 0xFF; - ++theAddress; - } - } - -CIconHandle ZUtil_Mac_HL::sCIconHandleFromPixmaps(const ZDCPixmap& inColorPixmap, const ZDCPixmap& inMonoPixmap, const ZDCPixmap& inMaskPixmap) - { - // We insist on a valid color or mono pixmap and a valid mask - ZAssert((inColorPixmap || inMonoPixmap) && inMaskPixmap); - - // We conform to the size of the color pixmap - ZPoint theSize = ZPoint::sZero; - if (inColorPixmap) - theSize = inColorPixmap.Size(); - else - theSize = inMonoPixmap.Size(); - - size_t monoRowBytes = ((1 * theSize.h + 31) / 32) * 4; - - CIconHandle theCIconHandle = (CIconHandle)::NewHandleClear(sizeof(CIcon) - sizeof(short) + 2 * monoRowBytes * theSize.v); - ZUtil_Mac_LL::HandleLocker locker1((Handle)theCIconHandle); - - ZUtil_Mac_LL::sSetupPixMapColor(theSize, 32, theCIconHandle[0]->iconPMap); - - ZDCPixmapNS::RasterDesc theRasterDesc; - theRasterDesc.fPixvalDesc.fDepth = 32; - theRasterDesc.fPixvalDesc.fBigEndian = true; - theRasterDesc.fRowBytes = theCIconHandle[0]->iconPMap.rowBytes & 0x3FFF; - theRasterDesc.fRowCount = theSize.v; - theRasterDesc.fFlipped = false; - - // Figure out how much space we need for the color pixmap's data - theCIconHandle[0]->iconData = ::NewHandleClear(theRasterDesc.fRowBytes * theSize.v); - ZUtil_Mac_LL::HandleLocker locker2(theCIconHandle[0]->iconData); - - ZDCPixmapNS::PixelDesc thePixelDesc(0x00FF0000, 0x0000FF00, 0x000000FF, 0); - if (inColorPixmap) - inColorPixmap.CopyTo(ZPoint(0, 0), theCIconHandle[0]->iconData[0], theRasterDesc, thePixelDesc, ZRect(theSize)); - else - inMonoPixmap.CopyTo(ZPoint(0, 0), theCIconHandle[0]->iconData[0], theRasterDesc, thePixelDesc, ZRect(theSize)); - // Hmm, we're supposed to invert the color pixmap. - - // We have the color portion set up. Now grab the B & W version, either from inMonoPixmap or from inColorPixmap - theRasterDesc.fPixvalDesc.fDepth = 1; - theRasterDesc.fPixvalDesc.fBigEndian = true; - theRasterDesc.fRowBytes = monoRowBytes; - theRasterDesc.fRowCount = theSize.v; - theRasterDesc.fFlipped = false; - thePixelDesc = ZDCPixmapNS::PixelDesc(1, 0); - - theCIconHandle[0]->iconBMap.baseAddr = nullptr; - theCIconHandle[0]->iconBMap.rowBytes = monoRowBytes; - theCIconHandle[0]->iconBMap.bounds.left = 0; - theCIconHandle[0]->iconBMap.bounds.top = 0; - theCIconHandle[0]->iconBMap.bounds.right = theSize.h; - theCIconHandle[0]->iconBMap.bounds.bottom = theSize.v; - - void* tempAddress = ((char*)&theCIconHandle[0]->iconMaskData) + monoRowBytes * theSize.v; - if (inMonoPixmap) - inMonoPixmap.CopyTo(ZPoint(0, 0), tempAddress, theRasterDesc, thePixelDesc, ZRect(theSize)); - else - inColorPixmap.CopyTo(ZPoint(0, 0), tempAddress, theRasterDesc, thePixelDesc, ZRect(theSize)); - - theCIconHandle[0]->iconMask.baseAddr = nullptr; - theCIconHandle[0]->iconMask.rowBytes = monoRowBytes; - theCIconHandle[0]->iconMask.bounds.left = 0; - theCIconHandle[0]->iconMask.bounds.top = 0; - theCIconHandle[0]->iconMask.bounds.right = theSize.h; - theCIconHandle[0]->iconMask.bounds.bottom = theSize.v; - - inMaskPixmap.CopyTo(ZPoint(0, 0), theCIconHandle[0]->iconMaskData, theRasterDesc, thePixelDesc, ZRect(theSize)); - - theCIconHandle[0]->iconMask.baseAddr = nullptr; - - return theCIconHandle; - } - -IconFamilyHandle ZUtil_Mac_HL::sNewIconFamily() - { - IconFamilyHandle theIconFamilyHandle = (IconFamilyHandle)::NewHandle(sizeof(IconFamilyResource) - sizeof(IconFamilyElement)); - if (theIconFamilyHandle) - { - theIconFamilyHandle[0]->resourceType = kIconFamilyType; - int32 theSize = ::GetHandleSize(reinterpret_cast<Handle>(theIconFamilyHandle)); - theIconFamilyHandle[0]->resourceSize = theSize; - } - return theIconFamilyHandle; - } - -void ZUtil_Mac_HL::sDisposeIconFamily(IconFamilyHandle inIconFamilyHandle) - { - if (inIconFamilyHandle) - ::DisposeHandle(reinterpret_cast<Handle>(inIconFamilyHandle)); - } - -namespace ZUtil_Mac_HL { - -static struct _SizeKindResMapping - { - IconSize fIconSize; - IconKind fIconKind; - uint32 fResType; - } -sSizeKindResMapping[] = - { - { eMini, eData1, kMini1BitMask }, - { eMini, eData4, kMini4BitData }, - { eMini, eData8, kMini8BitData }, - { eMini, eMask1, kMini1BitMask }, - - { eSmall, eData1, kSmall1BitMask }, - { eSmall, eData4, kSmall4BitData }, - { eSmall, eData8, kSmall8BitData }, - { eSmall, eData32, kSmall32BitData }, - { eSmall, eMask1, kSmall1BitMask }, - { eSmall, eMask8, kSmall8BitMask }, - - { eLarge, eData1, kLarge1BitMask }, - { eLarge, eData4, kLarge4BitData }, - { eLarge, eData8, kLarge8BitData }, - { eLarge, eData32, kLarge32BitData }, - { eLarge, eMask1, kLarge1BitMask }, - { eLarge, eMask8, kLarge8BitMask }, - - { eHuge, eData1, kHuge1BitMask }, - { eHuge, eData4, kHuge4BitData }, - { eHuge, eData8, kHuge8BitData }, - { eHuge, eData32, kHuge32BitData }, - { eHuge, eMask1, kHuge1BitMask }, - { eHuge, eMask8, kHuge8BitMask } - }; - -static struct _KindDepthCTableMapping - { - IconKind fIconKind; - int16 fDepth; - int16 fCTableID; - bool fHasMask; - bool fIsMask; - bool fNeeds8BitDeepMasks; - bool fNeeds32BitIcons; - } -sKindDepthCTableMapping[] = - { - { eData1, 1, 33, true, false, false, false }, - { eData4, 4, 68, false, false, false, false }, - { eData8, 8, 72, false, false, false, false }, - { eData32, 32, 0, false, false, false, true }, - { eMask1, 1, 33, true, true, false, false }, - { eMask8, 8, 40, false, true, true, false } - }; - -static struct _SizePixelMapping - { - IconSize fIconSize; - ZCoord fPixels; - bool fNeeds48PixelIcons; - } -sSizePixelMapping[] = - { - { eMini, 12, false }, - { eSmall, 16, false }, - { eLarge, 32, false }, - { eHuge, 48, true } - }; - -} // namespace ZUtil_Mac_HL - -static bool sGestalt_IconUtilitiesHas48PixelIcons() - { - long response; - OSErr err = ::Gestalt(gestaltIconUtilitiesAttr, &response); - if (err == noErr) - return 0 != (response & (1 << gestaltIconUtilitiesHas48PixelIcons)); - return false; - } - -static bool sGestalt_IconUtilitiesHas32BitIcons() - { - // AG 2000-07-22. Guess what, the window manager on iMacs (not sure which - // OS version) doesn't like deep icons either, so this is switched off for now, - // same as deep masks below. Fixed bug #152. -#if 1 // ## - long response; - OSErr err = ::Gestalt(gestaltIconUtilitiesAttr, &response); - if (err == noErr) - return 0 != (response & (1 << gestaltIconUtilitiesHas32BitIcons)); -#endif // 0 - return false; - } - -static bool sGestalt_IconUtilitiesHas8BitDeepMasks() - { - // AG 2000-04-01. Window Manager seems to have problems with 8 bit masks, as in - // they don't work. So I'm switching this off for now. -#if 1 // ## - long response; - OSErr err = ::Gestalt(gestaltIconUtilitiesAttr, &response); - if (err == noErr) - return 0 != (response & (1 << gestaltIconUtilitiesHas8BitDeepMasks)); -#endif // 0 - return false; - } - -void ZUtil_Mac_HL::sAddPixmapToIconFamily(const ZDCPixmap& inPixmap, IconKind inAsIconKind, IconFamilyHandle inIconFamilyHandle) - { -// Figure out a bunch of stuff - ZPoint sourceSize = inPixmap.Size(); - ZCoord sourceWidthHeight = max(sourceSize.h, sourceSize.v); - - bool has48PixelIcons = sGestalt_IconUtilitiesHas48PixelIcons(); - - ZCoord theCroppedWidthHeight = 48; - IconSize theIconSize = eHuge; - if (!has48PixelIcons) - { - theCroppedWidthHeight = 32; - theIconSize = eLarge; - } - - for (int x = 0; x < countof(sSizePixelMapping); ++x) - { - if (sSizePixelMapping[x].fPixels >= sourceWidthHeight - && (!sSizePixelMapping[x].fNeeds48PixelIcons || has48PixelIcons)) - { - theIconSize = sSizePixelMapping[x].fIconSize; - theCroppedWidthHeight = sSizePixelMapping[x].fPixels; - break; - } - } - - int16 destDepth = 32; - int16 destCTableID = 0; - bool hasMask = false; - bool isMask = false; - for (int x = 0; x < countof(sKindDepthCTableMapping); ++x) - { - if (sKindDepthCTableMapping[x].fIconKind == inAsIconKind) - { - destDepth = sKindDepthCTableMapping[x].fDepth; - destCTableID = sKindDepthCTableMapping[x].fCTableID; - hasMask = sKindDepthCTableMapping[x].fHasMask; - isMask = sKindDepthCTableMapping[x].fIsMask; - break; - } - } - - bool needsInvert = false; - ZDCPixmapNS::PixelDesc destPixelDesc; - switch (destDepth) - { - case 1: - { - needsInvert = !isMask; - destPixelDesc = ZDCPixmapNS::PixelDesc(1, 0); - break; - } - case 2: - case 4: - case 8: - { - destPixelDesc = ZUtil_Mac_LL::sGetIndexedPixelDesc(destCTableID); - break; - } - case 16: - { - destPixelDesc = ZDCPixmapNS::PixelDesc(0x7C00, 0x03E0, 0x001F, 0x0000); - break; - } - case 24: - { - destPixelDesc = ZDCPixmapNS::PixelDesc(0x00FF0000, 0x0000FF00, 0x000000FF, 0x00000000); - break; - } - default: - case 32: - { - destPixelDesc = ZDCPixmapNS::PixelDesc(0x00FF0000, 0x0000FF00, 0x000000FF, 0x00000000); - break; - } - } - - uint32 theResType = 0; - for (int x = 0; x < countof(sSizeKindResMapping); ++x) - { - if (sSizeKindResMapping[x].fIconSize == theIconSize - && sSizeKindResMapping[x].fIconKind == inAsIconKind) - { - theResType = sSizeKindResMapping[x].fResType; - break; - } - } - - // Note that we *do not* force four byte alignment -- small icons are two bytes wide only, - // the others will naturally have four byte alignment because of depth or size. - int16 destRowBytes = ((destDepth * theCroppedWidthHeight) + 7) / 8; - - // Let's see if we already have data (in case we're adding a mask) - Handle theDataHandle = ::NewHandle(0); - ::GetIconFamilyData(inIconFamilyHandle, theResType, theDataHandle); - int32 theHandleSize = ::GetHandleSize(theDataHandle); - - if (theHandleSize == 0) - { - // There's no extant data in inIconFamilyHandle, so we need to allocate it. - if (hasMask) - { - ::SetHandleSize(theDataHandle, 2 * destRowBytes * theCroppedWidthHeight); - ZBlockSet(*theDataHandle, 2 * destRowBytes * theCroppedWidthHeight, 0); - } - else - { - ::SetHandleSize(theDataHandle, destRowBytes * theCroppedWidthHeight); - ZBlockSet(*theDataHandle, destRowBytes * theCroppedWidthHeight, 0); - } - } - - ZUtil_Mac_LL::HandleLocker theDataHandleLocker(theDataHandle); - - ZDCPixmapNS::RasterDesc destRasterDesc; - destRasterDesc.fPixvalDesc.fDepth = destDepth; - destRasterDesc.fPixvalDesc.fBigEndian = true; - destRasterDesc.fRowBytes = destRowBytes; - destRasterDesc.fRowCount = theCroppedWidthHeight; - destRasterDesc.fFlipped = false; - - Ptr destAddress = theDataHandle[0]; - if (hasMask && isMask) - destAddress += destRowBytes * theCroppedWidthHeight; - - inPixmap.CopyTo(ZPoint(0, 0), - destAddress, - destRasterDesc, - destPixelDesc, - ZRect(theCroppedWidthHeight, theCroppedWidthHeight)); - - if (needsInvert) - sInvert(destAddress, destRowBytes * theCroppedWidthHeight); - - ::SetIconFamilyData(inIconFamilyHandle, theResType, theDataHandle); - theDataHandleLocker.Orphan(); - ::DisposeHandle(theDataHandle); - } - -ZDCPixmap ZUtil_Mac_HL::sPixmapFromIconFamily(IconFamilyHandle inIconFamilyHandle, IconSize inIconSize, IconKind inIconKind) - { - ZDCPixmap theDCPixmap; - -// Figure out what resource we're looking for - uint32 theResType = 0; - for (int x = 0; x < countof(sSizeKindResMapping); ++x) - { - if (sSizeKindResMapping[x].fIconSize == inIconSize && sSizeKindResMapping[x].fIconKind == inIconKind) - { - theResType = sSizeKindResMapping[x].fResType; - break; - } - } - - if (theResType == 0) - return theDCPixmap; - - Handle theIconDataHandle = ::NewHandle(0); - ::GetIconFamilyData(inIconFamilyHandle, theResType, theIconDataHandle); - if (::GetHandleSize(theIconDataHandle) != 0) - { - try - { - theDCPixmap = ZUtil_Mac_HL::sPixmapFromIconDataHandle(theIconDataHandle, inIconSize, inIconKind); - } - catch (...) - { - ::DisposeHandle(theIconDataHandle); - throw; - } - } - - ::DisposeHandle(theIconDataHandle); - return theDCPixmap; - } - -ZDCPixmap ZUtil_Mac_HL::sPixmapFromIconSuite(IconSuiteRef inIconSuite, IconSize inIconSize, IconKind inIconKind) - { - ZDCPixmap theDCPixmap; - -// Figure out what resource we're looking for - uint32 theResType = 0; - for (int x = 0; x < countof(sSizeKindResMapping); ++x) - { - if (sSizeKindResMapping[x].fIconSize == inIconSize && sSizeKindResMapping[x].fIconKind == inIconKind) - { - theResType = sSizeKindResMapping[x].fResType; - break; - } - } - - if (theResType == 0) - return theDCPixmap; - - Handle theIconDataHandle = nullptr; - if (noErr == ::GetIconFromSuite(&theIconDataHandle, inIconSuite, theResType)) - theDCPixmap = sPixmapFromIconDataHandle(theIconDataHandle, inIconSize, inIconKind); - - return theDCPixmap; - } - -ZDCPixmap ZUtil_Mac_HL::sPixmapFromIconDataHandle(Handle inIconDataHandle, IconSize inIconSize, IconKind inIconKind) - { -// Got the data, now to unmunge it. - ZCoord theWidthHeight = 0; - for (int x = 0; x < countof(sSizePixelMapping); ++x) - { - if (sSizePixelMapping[x].fIconSize == inIconSize) - { - theWidthHeight = sSizePixelMapping[x].fPixels; - break; - } - } - - int16 theDepth = 0; - int16 theCTableID = 0; - bool hasMask = false; - bool isMask = false; - for (int x = 0; x < countof(sKindDepthCTableMapping); ++x) - { - if (sKindDepthCTableMapping[x].fIconKind == inIconKind) - { - theDepth = sKindDepthCTableMapping[x].fDepth; - theCTableID = sKindDepthCTableMapping[x].fCTableID; - hasMask = sKindDepthCTableMapping[x].fHasMask; - isMask = sKindDepthCTableMapping[x].fIsMask; - break; - } - } - - int32 theRowBytes = ((theWidthHeight * theDepth + 31) / 32) * 4; - bool needsInvert = false; - ZDCPixmapNS::PixelDesc thePixelDesc; - switch (theDepth) - { - case 1: - { - theRowBytes = (theWidthHeight + 7 ) / 8; - needsInvert = !isMask; - thePixelDesc = ZDCPixmapNS::PixelDesc(1, 0); - break; - } - case 2: - case 4: - case 8: - { - thePixelDesc = ZUtil_Mac_LL::sGetIndexedPixelDesc(theCTableID); - break; - } - case 16: - { - thePixelDesc = ZDCPixmapNS::PixelDesc(0x7C00, 0x03E0, 0x001F, 0x0000); - break; - } - case 24: - { - thePixelDesc = ZDCPixmapNS::PixelDesc(0x00FF0000, 0x0000FF00, 0x000000FF, 0x00000000); - break; - } - default: - case 32: - { - thePixelDesc = ZDCPixmapNS::PixelDesc(0x00FF0000, 0x0000FF00, 0x000000FF, 0x00000000); - break; - } - } - - ZDCPixmapNS::RasterDesc theRasterDesc; - theRasterDesc.fPixvalDesc.fDepth = theDepth; - theRasterDesc.fPixvalDesc.fBigEndian = true; - theRasterDesc.fRowBytes = theRowBytes; - theRasterDesc.fRowCount = theWidthHeight; - theRasterDesc.fFlipped = false; - - ZDCPixmap theDCPixmap(new ZDCPixmapRep(new ZDCPixmapRaster_Simple(theRasterDesc), ZRect(theWidthHeight, theWidthHeight), thePixelDesc)); - - ZUtil_Mac_LL::HandleLocker locker(inIconDataHandle); - - theDCPixmap.CopyFrom(ZPoint(0, 0), - inIconDataHandle[0] + (hasMask && isMask ? (theRowBytes * theWidthHeight) : 0), - theRasterDesc, - thePixelDesc, - ZRect(theWidthHeight, theWidthHeight)); - if (needsInvert) - { - // This step could be avoided if we had separate source and destination - // PixelDescs, and could let the blit take care of the transform. - sInvert(theDCPixmap.GetBaseAddress(), theRowBytes * theWidthHeight); - } - - return theDCPixmap; - } - -IconRef ZUtil_Mac_HL::sIconRefFromPixmaps(const ZDCPixmap& inColorPixmap, const ZDCPixmap& inMonoPixmap, const ZDCPixmap& inMaskPixmap) - { -#if ZCONFIG(Processor, PPC) - // AG 99-01-11. AAArrrrgggghhhhhh. There I was thinking that the new Icon Services stuff was a sweet addition to our - // MacOS capabilities. Wrong! With the current headers and import library there appears to be no way to fabricate an arbitrary - // IconRef -- we can *register* a new icon, but it has to have a creator and type attached to it, which is not what we want. - - // AG 99-05-19. I've since talked with a couple of people, and the recommendation from Apple is to use a fake creator/type combo, - // and manage the lifetime of the registration explicitly. - - ZAssertStop(1, (inColorPixmap || inMonoPixmap) && inMaskPixmap); - IconFamilyHandle theIconFamilyHandle = sNewIconFamily(); - - if (inColorPixmap) - sAddPixmapToIconFamily(inColorPixmap, eData8, theIconFamilyHandle); - -//## if (inColorPixmap) -//## sAddPixmapToIconFamily(inColorPixmap, eData32, theIconFamilyHandle); - - if (inMonoPixmap) - sAddPixmapToIconFamily(inMonoPixmap, eData1, theIconFamilyHandle); - - if (inMaskPixmap) - sAddPixmapToIconFamily(inMaskPixmap, eMask1, theIconFamilyHandle); - - IconRef theIconRef = nullptr; - - static uint32 fakeType = rand(); - if (noErr == ::RegisterIconRefFromIconFamily('ZLIB', ++fakeType, theIconFamilyHandle, &theIconRef)) - { - // Acquire another reference to the iconRef - ::AcquireIconRef(theIconRef); - // And unregister the iconRef -- it should mean that when the IconRef's refcount hits - // zero it will simply disappear from the system. I have checked for leaks and none seem to be occurring. - ::UnregisterIconRef('ZLIB', fakeType); - - UInt16 ownerCount; - ::GetIconRefOwners(theIconRef, &ownerCount); - if (ownerCount == 2) - { - // According to Laurence Harris some versions of the OS do not decrement - // the refcount when UnregisterIconRef is called, so we do it manually. - ::ReleaseIconRef(theIconRef); - } - } - sDisposeIconFamily(theIconFamilyHandle); - - return theIconRef; -#else // ZCONFIG(Processor, PPC) - return nullptr; -#endif // ZCONFIG(Processor, PPC) - } - -// ================================================================================================= - -static pascal Boolean sAppleEventIdleProc(EventRecord* inEventRecord, long* outSleepTime, RgnHandle* outMouseRgn) - { - #if ZCONFIG(Thread_API, Mac) - ZThreadTM_Yield(); - #endif - -/* if (ZApp::sGet()) - { - ZDCRgn theDCRgn; -//## ZApp::sGet()->AppleEventIdleProc(theEventRecord, sleepTime, theDCRgn); - ::MacCopyRgn(theDCRgn, *outMouseRgn); - }*/ - return false; - } - -static AEIdleUPP sAEIdleUPP = NewAEIdleUPP(sAppleEventIdleProc); - -bool ZUtil_Mac_HL::sInteractWithUser() - { - OSErr result = ::AEInteractWithUser(kNoTimeOut, nullptr, sAEIdleUPP); - if (result == noErr) - return true; - return false; - } - -void ZUtil_Mac_HL::sPreDialog() - { - ZUtil_Mac_HL::sInteractWithUser(); - - #if ZCONFIG_SPI_Enabled(MacClassic) - ZOSApp_Mac::sGet()->PreDialog(); - ZOSApp_Mac::sGet()->UpdateAllWindows(); - #endif - } - -void ZUtil_Mac_HL::sPostDialog() - { - #if ZCONFIG_SPI_Enabled(MacClassic) - ZOSApp_Mac::sGet()->PostDialog(); - #endif - } - -static ModalFilterUPP sModalFilterUPP = NewModalFilterUPP(ZUtil_Mac_HL::sModalFilter); -pascal Boolean ZUtil_Mac_HL::sModalFilter(DialogPtr theDialog, EventRecord* inOutEventRecord, short* inOutItemHit) - { -//## if (ZApp::sGet()) -//## return ZApp::sGet()->ModalFilter(theDialog, theEventRecord, itemHit); - return false; - } - -string ZUtil_Mac_HL::sGetVersionString() - { -// Returns the version number as described in the .shortVersion field of the version resource - string version; - - if (Handle theHandle = ::Get1Resource('vers', 1)) - { - ZUtil_Mac_LL::HandleLocker theLocker(theHandle); - StringPtr versStr = ((VersRecHndl)theHandle)[0]->shortVersion; - version = string((char*)&versStr[1], (size_t)versStr[0]); - } - - return version; - } - -NAMESPACE_ZOOLIB_END - -#endif // ZCONFIG_SPI_Enabled(Carbon) - -// ================================================================================================= - -#if ZCONFIG_SPI_Enabled(QuickDraw) - -#include "zoolib/ZDC_QD.h" -#include "zoolib/ZStream.h" - -#include ZMACINCLUDE3(CoreServices,CarbonCore,MacMemory.h) -#include ZMACINCLUDE3(ApplicationServices,QD,QDOffscreen.h) - -NAMESPACE_ZOOLIB_BEGIN - -namespace ZANONYMOUS { -struct PixmapFromStreamPICTInfo - { - PixmapFromStreamPICTInfo* fPrev; - PixmapFromStreamPICTInfo* fNext; - GWorldPtr fGWorldPtr; - const ZStreamR* fStream; - bool fStreamOkay; - }; -} // anonymous namespace - -static PixmapFromStreamPICTInfo* sPixmapFromStreamPICTInfo_Head = nullptr; -static ZMutex sPixmapFromStreamPICT_Mutex; - -static DEFINE_API(void) sPixmapFromStreamPICT_GetPicProc(void* dataPtr, short byteCount) - { - PixmapFromStreamPICTInfo* current = nullptr; - try - { - CGrafPtr currentPort; - GDHandle currentGDHandle; - ::GetGWorld(¤tPort, ¤tGDHandle); - sPixmapFromStreamPICT_Mutex.Acquire(); - current = sPixmapFromStreamPICTInfo_Head; - while (current && current->fGWorldPtr != currentPort) - current = current->fNext; - sPixmapFromStreamPICT_Mutex.Release(); - - ZAssertStop(0, current != nullptr); - - current->fStream->Read(dataPtr, byteCount); - } - catch (...) - { -#if ACCESSOR_CALLS_ARE_FUNCTIONS - SetQDError(noMemForPictPlaybackErr); -#else - *((QDErr*)(0x0D6E)) = noMemForPictPlaybackErr; //## might be a problem under Windows. -ec 01.12.21 - // AG 2002-07-08. Except that ACCESSOR_CALLS_ARE_FUNCTIONS is true when building for windows. -#endif - if (current) - current->fStreamOkay = false; - } - } - -static QDGetPicUPP sPixmapFromStreamPICT_GetPicProcUPP = NewQDGetPicUPP(sPixmapFromStreamPICT_GetPicProc); - -ZDCPixmap ZUtil_Mac_HL::sPixmapFromStreamPICT(const ZStreamR& inStream) - { - ZDCPixmap thePixmap; - PicHandle thePicHandle = nullptr; - try - { - // Create the dummy PicHandle - thePicHandle = (PicHandle)::NewHandleClear(sizeof(Picture)); - ::HLock((Handle)thePicHandle); - - // Read the header - inStream.Read(*thePicHandle, sizeof(Picture)); - ::HUnlock((Handle)thePicHandle); - - // Get the picture's bounds - ZRect theBounds = thePicHandle[0]->picFrame; - theBounds -= theBounds.TopLeft(); - - // Instantiate an offscreen por... [truncated message content] |
From: <ag...@us...> - 2009-07-21 15:28:29
|
Revision: 874 http://zoolib.svn.sourceforge.net/zoolib/?rev=874&view=rev Author: agreen Date: 2009-07-21 15:28:25 +0000 (Tue, 21 Jul 2009) Log Message: ----------- Move non-generic stuff into thematic directories. Modified Paths: -------------- trunk/zoolib/source/cxx/zoolib/ZCompat_npapi.h Added Paths: ----------- trunk/zoolib/source/cxx/more/ trunk/zoolib/source/cxx/more/zoolib/ trunk/zoolib/source/cxx/more/zoolib/blackberry/ trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry.cpp trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry.h trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerryCOM.cpp trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerryCOM.h trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerryServer.cpp trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerryServer.h trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry_BBDevMgr.cpp trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry_BBDevMgr.h trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry_Client.cpp trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry_Client.h trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry_OSXUSB.cpp trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry_OSXUSB.h trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry_Streamer.cpp trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry_Streamer.h trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry_Union.cpp trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry_Union.h trunk/zoolib/source/cxx/more/zoolib/blackberry/ZUtil_BlackBerry.cpp trunk/zoolib/source/cxx/more/zoolib/blackberry/ZUtil_BlackBerry.h trunk/zoolib/source/cxx/more/zoolib/netscape/ trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape.cpp trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape.h trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_API.h trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Guest.cpp trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Guest.h trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_GuestEntry.cpp trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_GuestEntry.def trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_GuestEntry.h trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_GuestEntry_GCC.def trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_GuestFactory.cpp trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_GuestFactory.h trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Guest_Std.cpp trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Guest_Std.h trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host.cpp trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host.h trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host_Mac.cpp trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host_Mac.h trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host_Std.cpp trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host_Std.h trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host_Win.cpp trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host_Win.h trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Macros.h trunk/zoolib/source/cxx/more/zoolib/photoshop/ trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.cpp trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.h trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Yad.cpp trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Yad.h trunk/zoolib/source/cxx/more/zoolib/tql/ trunk/zoolib/source/cxx/more/zoolib/tql/ZTQLEngine.cpp trunk/zoolib/source/cxx/more/zoolib/tql/ZTQLEngine.h trunk/zoolib/source/cxx/more/zoolib/tql/ZTQLTest.cpp trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Condition.cpp trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Condition.h trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_LogOp.cpp trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_LogOp.h trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Node.cpp trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Node.h trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Optimize.cpp trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Optimize.h trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Query.cpp trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Query.h trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_RelHead.cpp trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_RelHead.h trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Spec.cpp trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Spec.h trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL.cpp trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL.h trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL_Spec.cpp trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL_Spec.h trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_TQLConvert.cpp trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_TQLConvert.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTB.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTB.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBQuery.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBQuery.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBRep.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBRep.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBRep_Client.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBRep_Client.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBRep_Client_StreamerRWFactory.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBRep_Client_StreamerRWFactory.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBRep_TS.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBRep_TS.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBServer.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBServer.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBSpec.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBSpec.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTS.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTS.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTSWatcher.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTSWatcher.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTSWatcherDefines.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTSWatcherMUX.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTSWatcherMUX.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTSWatcherServer.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTSWatcherServer.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTSWatcherServerAsync.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTSWatcherServerAsync.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTSWatcher_AutoReconnect.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTSWatcher_AutoReconnect.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTSWatcher_Client.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTSWatcher_Client.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTSWatcher_Latent.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTSWatcher_Latent.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTSWatcher_Reader.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTSWatcher_Reader.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTS_DB.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTS_DB.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTS_RAM.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTS_RAM.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTS_Watchable.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTS_Watchable.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTSoup.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTSoup.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex_General.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex_General.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex_String.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex_String.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex_T.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleQuisitioner.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleQuisitioner.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZUtil_Strim_TBSpec.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZUtil_Strim_TBSpec.h Removed Paths: ------------- trunk/zoolib/source/cxx/zoolib/ZBlackBerry.cpp trunk/zoolib/source/cxx/zoolib/ZBlackBerry.h trunk/zoolib/source/cxx/zoolib/ZBlackBerryCOM.cpp trunk/zoolib/source/cxx/zoolib/ZBlackBerryCOM.h trunk/zoolib/source/cxx/zoolib/ZBlackBerryServer.cpp trunk/zoolib/source/cxx/zoolib/ZBlackBerryServer.h trunk/zoolib/source/cxx/zoolib/ZBlackBerry_BBDevMgr.cpp trunk/zoolib/source/cxx/zoolib/ZBlackBerry_BBDevMgr.h trunk/zoolib/source/cxx/zoolib/ZBlackBerry_Client.cpp trunk/zoolib/source/cxx/zoolib/ZBlackBerry_Client.h trunk/zoolib/source/cxx/zoolib/ZBlackBerry_OSXUSB.cpp trunk/zoolib/source/cxx/zoolib/ZBlackBerry_OSXUSB.h trunk/zoolib/source/cxx/zoolib/ZBlackBerry_Streamer.cpp trunk/zoolib/source/cxx/zoolib/ZBlackBerry_Streamer.h trunk/zoolib/source/cxx/zoolib/ZBlackBerry_Union.cpp trunk/zoolib/source/cxx/zoolib/ZBlackBerry_Union.h trunk/zoolib/source/cxx/zoolib/ZNetscape.cpp trunk/zoolib/source/cxx/zoolib/ZNetscape.h trunk/zoolib/source/cxx/zoolib/ZNetscape_API.h trunk/zoolib/source/cxx/zoolib/ZNetscape_Guest.cpp trunk/zoolib/source/cxx/zoolib/ZNetscape_Guest.h trunk/zoolib/source/cxx/zoolib/ZNetscape_GuestEntry.cpp trunk/zoolib/source/cxx/zoolib/ZNetscape_GuestEntry.def trunk/zoolib/source/cxx/zoolib/ZNetscape_GuestEntry.h trunk/zoolib/source/cxx/zoolib/ZNetscape_GuestEntry_GCC.def trunk/zoolib/source/cxx/zoolib/ZNetscape_GuestFactory.cpp trunk/zoolib/source/cxx/zoolib/ZNetscape_GuestFactory.h trunk/zoolib/source/cxx/zoolib/ZNetscape_Guest_Std.cpp trunk/zoolib/source/cxx/zoolib/ZNetscape_Guest_Std.h trunk/zoolib/source/cxx/zoolib/ZNetscape_Host.cpp trunk/zoolib/source/cxx/zoolib/ZNetscape_Host.h trunk/zoolib/source/cxx/zoolib/ZNetscape_Host_Mac.cpp trunk/zoolib/source/cxx/zoolib/ZNetscape_Host_Mac.h trunk/zoolib/source/cxx/zoolib/ZNetscape_Host_Std.cpp trunk/zoolib/source/cxx/zoolib/ZNetscape_Host_Std.h trunk/zoolib/source/cxx/zoolib/ZNetscape_Host_Win.cpp trunk/zoolib/source/cxx/zoolib/ZNetscape_Host_Win.h trunk/zoolib/source/cxx/zoolib/ZNetscape_Macros.h trunk/zoolib/source/cxx/zoolib/ZPhotoshop_Val.cpp trunk/zoolib/source/cxx/zoolib/ZPhotoshop_Val.h trunk/zoolib/source/cxx/zoolib/ZPhotoshop_Yad.cpp trunk/zoolib/source/cxx/zoolib/ZPhotoshop_Yad.h trunk/zoolib/source/cxx/zoolib/ZTB.cpp trunk/zoolib/source/cxx/zoolib/ZTB.h trunk/zoolib/source/cxx/zoolib/ZTBQuery.cpp trunk/zoolib/source/cxx/zoolib/ZTBQuery.h trunk/zoolib/source/cxx/zoolib/ZTBRep.cpp trunk/zoolib/source/cxx/zoolib/ZTBRep.h trunk/zoolib/source/cxx/zoolib/ZTBRep_Client.cpp trunk/zoolib/source/cxx/zoolib/ZTBRep_Client.h trunk/zoolib/source/cxx/zoolib/ZTBRep_Client_StreamerRWFactory.cpp trunk/zoolib/source/cxx/zoolib/ZTBRep_Client_StreamerRWFactory.h trunk/zoolib/source/cxx/zoolib/ZTBRep_TS.cpp trunk/zoolib/source/cxx/zoolib/ZTBRep_TS.h trunk/zoolib/source/cxx/zoolib/ZTBServer.cpp trunk/zoolib/source/cxx/zoolib/ZTBServer.h trunk/zoolib/source/cxx/zoolib/ZTBSpec.cpp trunk/zoolib/source/cxx/zoolib/ZTBSpec.h trunk/zoolib/source/cxx/zoolib/ZTQLEngine.cpp trunk/zoolib/source/cxx/zoolib/ZTQLEngine.h trunk/zoolib/source/cxx/zoolib/ZTQLTest.cpp trunk/zoolib/source/cxx/zoolib/ZTQL_Condition.cpp trunk/zoolib/source/cxx/zoolib/ZTQL_Condition.h trunk/zoolib/source/cxx/zoolib/ZTQL_LogOp.cpp trunk/zoolib/source/cxx/zoolib/ZTQL_LogOp.h trunk/zoolib/source/cxx/zoolib/ZTQL_Node.cpp trunk/zoolib/source/cxx/zoolib/ZTQL_Node.h trunk/zoolib/source/cxx/zoolib/ZTQL_Optimize.cpp trunk/zoolib/source/cxx/zoolib/ZTQL_Optimize.h trunk/zoolib/source/cxx/zoolib/ZTQL_Query.cpp trunk/zoolib/source/cxx/zoolib/ZTQL_Query.h trunk/zoolib/source/cxx/zoolib/ZTQL_RelHead.cpp trunk/zoolib/source/cxx/zoolib/ZTQL_RelHead.h trunk/zoolib/source/cxx/zoolib/ZTQL_Spec.cpp trunk/zoolib/source/cxx/zoolib/ZTQL_Spec.h trunk/zoolib/source/cxx/zoolib/ZTS.cpp trunk/zoolib/source/cxx/zoolib/ZTS.h trunk/zoolib/source/cxx/zoolib/ZTSWatcher.cpp trunk/zoolib/source/cxx/zoolib/ZTSWatcher.h trunk/zoolib/source/cxx/zoolib/ZTSWatcherDefines.h trunk/zoolib/source/cxx/zoolib/ZTSWatcherMUX.cpp trunk/zoolib/source/cxx/zoolib/ZTSWatcherMUX.h trunk/zoolib/source/cxx/zoolib/ZTSWatcherServer.cpp trunk/zoolib/source/cxx/zoolib/ZTSWatcherServer.h trunk/zoolib/source/cxx/zoolib/ZTSWatcherServerAsync.cpp trunk/zoolib/source/cxx/zoolib/ZTSWatcherServerAsync.h trunk/zoolib/source/cxx/zoolib/ZTSWatcher_AutoReconnect.cpp trunk/zoolib/source/cxx/zoolib/ZTSWatcher_AutoReconnect.h trunk/zoolib/source/cxx/zoolib/ZTSWatcher_Client.cpp trunk/zoolib/source/cxx/zoolib/ZTSWatcher_Client.h trunk/zoolib/source/cxx/zoolib/ZTSWatcher_Latent.cpp trunk/zoolib/source/cxx/zoolib/ZTSWatcher_Latent.h trunk/zoolib/source/cxx/zoolib/ZTSWatcher_Reader.cpp trunk/zoolib/source/cxx/zoolib/ZTSWatcher_Reader.h trunk/zoolib/source/cxx/zoolib/ZTS_DB.cpp trunk/zoolib/source/cxx/zoolib/ZTS_DB.h trunk/zoolib/source/cxx/zoolib/ZTS_RAM.cpp trunk/zoolib/source/cxx/zoolib/ZTS_RAM.h trunk/zoolib/source/cxx/zoolib/ZTS_Watchable.cpp trunk/zoolib/source/cxx/zoolib/ZTS_Watchable.h trunk/zoolib/source/cxx/zoolib/ZTSoup.cpp trunk/zoolib/source/cxx/zoolib/ZTSoup.h trunk/zoolib/source/cxx/zoolib/ZTupleIndex.cpp trunk/zoolib/source/cxx/zoolib/ZTupleIndex.h trunk/zoolib/source/cxx/zoolib/ZTupleIndex_General.cpp trunk/zoolib/source/cxx/zoolib/ZTupleIndex_General.h trunk/zoolib/source/cxx/zoolib/ZTupleIndex_String.cpp trunk/zoolib/source/cxx/zoolib/ZTupleIndex_String.h trunk/zoolib/source/cxx/zoolib/ZTupleIndex_T.h trunk/zoolib/source/cxx/zoolib/ZTupleQuisitioner.cpp trunk/zoolib/source/cxx/zoolib/ZTupleQuisitioner.h trunk/zoolib/source/cxx/zoolib/ZUtil_BlackBerry.cpp trunk/zoolib/source/cxx/zoolib/ZUtil_BlackBerry.h trunk/zoolib/source/cxx/zoolib/ZUtil_Strim_TBSpec.cpp trunk/zoolib/source/cxx/zoolib/ZUtil_Strim_TBSpec.h trunk/zoolib/source/cxx/zoolib/ZUtil_Strim_TQL.cpp trunk/zoolib/source/cxx/zoolib/ZUtil_Strim_TQL.h trunk/zoolib/source/cxx/zoolib/ZUtil_Strim_TQL_Spec.cpp trunk/zoolib/source/cxx/zoolib/ZUtil_Strim_TQL_Spec.h trunk/zoolib/source/cxx/zoolib/ZUtil_TQLConvert.cpp trunk/zoolib/source/cxx/zoolib/ZUtil_TQLConvert.h Added: trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry.cpp (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry.cpp 2009-07-21 15:28:25 UTC (rev 874) @@ -0,0 +1,416 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2008 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#include "zoolib/blackberry/ZBlackBerry.h" + +#include "zoolib/ZLog.h" +#include "zoolib/ZUtil_STL.h" + +using std::set; +using std::string; + +/** +These are some brief notes to get you started. If anything is unclear, drop me a line at ag...@em.... + +The BlackBerry code is all in the namespace ZBlackBerry. + +Most entities in this API suite are ultimately derived from ZRefCountedWithFinalize, and thus +we use refcounted pointers of the form ZRef<XXX> rather than using unadorned XXX*. + +There are three entities with which you'll be working: Manager, Device and Channel. + +An instance of Manager provides access to a roster of BlackBerrys. In the common case that will +be one BlackBerry connected by USB. Registering with the Manager as an Observer will cause your +ManagerChanged method to be invoked whenever the roster has or may have changed. + +Device represents a single connected BlackBerry. Register with the Device as an Observer to +be told when it has been disconnected. Device's other job is to open channels to software +running on the BlackBerry. + +Channel represents the connection to a channel on a BlackBerry. It's a subclass of ZStreamerRWCon, +adding the GetIdealSize_Read and GetIdealSize_Write methods. For detailed information on +ZStreamerRWCon see ZStreamer.cpp. + +You can see an example of real code in ZBlackBerryServer -- it's made more complex by the +details of safely handling multiple connections simultaneously. The sample application +zoolib_samples/BlackBerry/BBDaemon provides access to a ZBlackBerryServer over a TCP +connection, and thus allows multiple apps to talk to multiple BlackBerrys even on OSX. + +The essentials of working with ZBlackBerry are demonstrated in this code: + +void Sample() + { + using namespace ZBlackBerry; + + // Instantiate the Manager. On Windows you would create a Manager_BBDevMgr. + // If you're using BBDaemon you'd create a Manager_Client, passing a ZStreamerRWConFactory + // that will open connections to the appropriate TCP or other address. + ZRef<Manager> theManager = new Manager_OSXUSB; + + // Get the IDs of all BlackBerrys handled by this Manager. + // The ID of a Device is non-zero, opaque and unique within a Manager. + vector<uint64> theDeviceIDs; + theManager->GetDeviceIDs(theDeviceIDs); + + if (theDeviceIDs.size()) + { + // We found at least one. Open the first. + const uint64 theDeviceID = theDeviceIDs[0]; + if (ZRef<Device> theDevice = theManager->Open(theDeviceID)) + { + // The device opened okay. Just because you have the ID for a device + // that is no guarantee that the device is still there -- it can + // get unplugged at any time. When a device is unplugged its ID + // is retired and will never again be used by the Manager that allocated it. + + // Now open a Channel to "MyAppChannel". We're passing nil for the + // password hash parameter, indicating that we do not know the device's + // password. We're passing nil for the oError output parameter, indicating + // that we don't care to know the precise reason for a failure. + if (ZRef<Channel> theChannel = theDevice->Open("MyAppChannel", nullptr, nullptr)) + { + // We can now send and receive data over theChannel. As with any other + // streamer we can take a local reference to the stream(s) it encapsulates. + const ZStreamWCon& w = theChannel->GetStreamWCon(); + const ZStreamRCon& r = theChannel->GetStreamRCon(); + + // Send a string + w.WriteString("Hello MyAppChannel"); + // And a terminating zero byte. + w.WriteUInt8(0); + + // Just in case there's anything funky happening (buffers, filters etc) + // it is advisable to flush a write stream before reading from an + // associated read stream. + w.Flush(); + + // Read the response, whatever it might be. + bool result = r.ReadBool(); + + // Close our send direction. + w.SendDisconnect(); + + // Suck up and discard any outstanding data until the receive direction closes. + r.ReceiveDisconnect(-1); + } + } + } + // And by the magic of refcounting, Channels, Devices and Managers will cleanly + // disconnect and dispose when they are no longer in use. + } +*/ + +NAMESPACE_ZOOLIB_BEGIN + +namespace ZBlackBerry { + +// ================================================================================================= +#pragma mark - +#pragma mark * ZBlackBerry::Manager + +Manager::Manager() +: fMutex("ZBlackBerry::Manager::fMutex"), + fStartCount(0) + {} + +Manager::~Manager() + { + ZAssert(fObservers.empty()); + ZAssert(fStartCount == 0); + } + +void Manager::Initialize() + { + if (ZLOG(s, eDebug + 2, "ZBlackBerry::Manager")) + s << "Initialize, enter"; + + ZMutexLocker locker(fMutex); + if (this->GetRefCount() == 1) + { + if (fStartCount == 0) + { + locker.Release(); + if (ZLOG(s, eDebug + 2, "ZBlackBerry::Manager")) + s << "Initialize, calling Start"; + + this->Start(); + } + } + + if (ZLOG(s, eDebug + 2, "ZBlackBerry::Manager")) + s << "Initialize, exit"; + } + +void Manager::Finalize() + { + if (ZLOG(s, eDebug + 2, "ZBlackBerry::Manager")) + s << "Finalize, enter"; + + ZMutexLocker locker(fMutex); + + ZAssert(fObservers.empty()); + + if (this->GetRefCount() != 1) + { + if (ZLOG(s, eDebug + 2, "ZBlackBerry::Manager")) + s << "Finalize, busy"; + this->FinalizationComplete(); + return; + } + + if (fStartCount) + { + locker.Release(); + + this->Stop(); + + locker.Acquire(); + + while (fStartCount) + fCondition.Wait(fMutex); + } + + if (this->GetRefCount() != 1) + { + if (ZLOG(s, eDebug + 2, "ZBlackBerry::Manager")) + s << "Finalize, post stop, busy"; + this->FinalizationComplete(); + return; + } + + this->FinalizationComplete(); + locker.Release(); + delete this; + + if (ZLOG(s, eDebug + 2, "ZBlackBerry::Manager")) + s << "Finalize, deleted"; + } + +void Manager::Start() + { + this->pStarted(); + } + +void Manager::Stop() + { + this->pStopped(); + } + +void Manager::ObserverAdd(Observer* iObserver) + { + ZMutexLocker locker(fMutex); + ZUtil_STL::sInsertMustNotContain(1, fObservers, iObserver); + } + +void Manager::ObserverRemove(Observer* iObserver) + { + ZMutexLocker locker(fMutex); + ZUtil_STL::sEraseMustContain(1, fObservers, iObserver); + } + +void Manager::pNotifyObservers() + { + ZMutexLocker locker(fMutex); + if (!fObservers.empty()) + { + ZRef<Manager> localThis = this; + + set<Observer*> localObservers = fObservers; + for (set<Observer*>::iterator i = localObservers.begin(); i != localObservers.end(); ++i) + (*i)->ManagerChanged(localThis); + + locker.Release(); + } + } + +void Manager::pStarted() + { + ZMutexLocker locker(fMutex); + ++fStartCount; + fCondition.Broadcast(); + } + +void Manager::pStopped() + { + ZMutexLocker locker(fMutex); + --fStartCount; + fCondition.Broadcast(); + } + +// ================================================================================================= +#pragma mark - +#pragma mark * ZBlackBerry::Device + +Device::Device() +: fMutex("ZBlackBerry::Device::fMutex"), + fStartCount(0) + {} + +Device::~Device() + { + ZAssert(fObservers.empty()); + ZAssert(fStartCount == 0); + } + +void Device::Initialize() + { + if (ZLOG(s, eDebug + 2, "ZBlackBerry::Device")) + s << "Initialize, enter"; + + ZMutexLocker locker(fMutex); + if (this->GetRefCount() == 1) + { + if (fStartCount == 0) + { + locker.Release(); + if (ZLOG(s, eDebug + 2, "ZBlackBerry::Device")) + s << "Initialize, calling Start"; + this->Start(); + } + } + + if (ZLOG(s, eDebug + 2, "ZBlackBerry::Device")) + s << "Initialize, exit"; + } + +void Device::Finalize() + { + if (ZLOG(s, eDebug + 2, "ZBlackBerry::Device")) + s << "Finalize, enter"; + + ZMutexLocker locker(fMutex); + + ZAssert(fObservers.empty()); + + if (this->GetRefCount() != 1) + { + if (ZLOG(s, eDebug + 2, "ZBlackBerry::Device")) + s << "Finalize, busy"; + this->FinalizationComplete(); + return; + } + + if (fStartCount) + { + locker.Release(); + + this->Stop(); + + locker.Acquire(); + + while (fStartCount) + fCondition.Wait(fMutex); + } + + if (this->GetRefCount() != 1) + { + if (ZLOG(s, eDebug + 2, "ZBlackBerry::Device")) + s << "Finalize, post stop, busy"; + this->FinalizationComplete(); + return; + } + + this->FinalizationComplete(); + locker.Release(); + delete this; + + if (ZLOG(s, eDebug + 2, "ZBlackBerry::Device")) + s << "Finalize, deleted"; + } + +void Device::Start() + { + ZMutexLocker locker(fMutex); + ++fStartCount; + fCondition.Broadcast(); + } + +void Device::Stop() + { + this->pFinished(); + } + +ZRef<Channel> Device::Open( + const string& iName, const PasswordHash* iPasswordHash, Error* oError) + { return this->Open(false, iName, iPasswordHash, oError); } + +uint32 Device::GetPIN() + { + return 0; + } + +void Device::ObserverAdd(Observer* iObserver) + { + ZMutexLocker locker(fMutex); + ZUtil_STL::sInsertMustNotContain(1, fObservers, iObserver); + if (fStartCount == 0) + iObserver->Finished(this); + } + +void Device::ObserverRemove(Observer* iObserver) + { + ZMutexLocker locker(fMutex); + ZUtil_STL::sEraseMustContain(1, fObservers, iObserver); + } + +void Device::pFinished() + { + ZMutexLocker locker(fMutex); + + --fStartCount; + fCondition.Broadcast(); + + if (!fObservers.empty()) + { + ZRef<Device> localThis = this; + + set<Observer*> localObservers = fObservers; + for (set<Observer*>::iterator i = localObservers.begin(); i != localObservers.end(); ++i) + (*i)->Finished(localThis); + + // Observers may be the only thing with a reference to us, so release + // the locker now in case we get finalized when localThis goes out of scope. + locker.Release(); + } + } + +// ================================================================================================= +#pragma mark - +#pragma mark * ZBlackBerry::Channel + +Channel::Channel() + {} + +Channel::~Channel() + {} + +size_t Channel::GetIdealSize_Read() + { + return 4096; + } + +size_t Channel::GetIdealSize_Write() + { + return 4096; + } + +} // namespace ZBlackBerry + +NAMESPACE_ZOOLIB_END Added: trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry.h (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry.h 2009-07-21 15:28:25 UTC (rev 874) @@ -0,0 +1,171 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2008 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#ifndef __ZBlackBerry__ +#define __ZBlackBerry__ 1 +#include "zconfig.h" + +#include "zoolib/ZStreamer.h" +#include "zoolib/ZThreadOld.h" +#include "zoolib/ZValData_ZooLib.h" + +#include <set> +#include <vector> + +NAMESPACE_ZOOLIB_BEGIN + +namespace ZBlackBerry { + +typedef ZValData_ZooLib ValData; + +struct PasswordHash + { + uint8 fData[20]; + }; + +class Device; +class Channel; + +// ================================================================================================= +#pragma mark - +#pragma mark * ZBlackBerry::Manager + +class Manager : public ZRefCountedWithFinalize + { +protected: + Manager(); + +public: + virtual ~Manager(); + +// From ZRefCountedWithFinalize + virtual void Initialize(); + virtual void Finalize(); + +// Our protocol + virtual void Start(); + virtual void Stop(); + + virtual void GetDeviceIDs(std::vector<uint64>& oDeviceIDs) = 0; + virtual ZRef<Device> Open(uint64 iDeviceID) = 0; + + class Observer + { + public: + virtual void ManagerChanged(ZRef<Manager> iManager) = 0; + }; + + void ObserverAdd(Observer* iObserver); + void ObserverRemove(Observer* iObserver); + +protected: + void pNotifyObservers(); + + void pStarted(); + void pStopped(); + +private: + ZMutex fMutex; + ZCondition fCondition; + int fStartCount; + std::set<Observer*> fObservers; + }; + +// ================================================================================================= +#pragma mark - +#pragma mark * ZBlackBerry::Device + +class Device : public ZRefCountedWithFinalize + { +protected: + Device(); + +public: + virtual ~Device(); + +// From ZRefCountedWithFinalize + virtual void Initialize(); + virtual void Finalize(); + +// Our protocol + virtual void Start(); + virtual void Stop(); + + enum Error + { + error_None, + error_DeviceClosed, + error_UnknownChannel, + error_PasswordNeeded, + error_PasswordExhausted, + error_PasswordIncorrect, + error_Generic + }; + + virtual ZRef<Channel> Open( + const std::string& iName, const PasswordHash* iPasswordHash, Error* oError); + + virtual ZRef<Channel> Open(bool iPreserveBoundaries, + const std::string& iName, const PasswordHash* iPasswordHash, Error* oError) = 0; + + virtual ValData GetAttribute(uint16 iObject, uint16 iAttribute) = 0; + virtual uint32 GetPIN(); + + class Observer + { + public: + virtual void Finished(ZRef<Device> iDevice) = 0; + }; + + void ObserverAdd(Observer* iObserver); + void ObserverRemove(Observer* iObserver); + +protected: + void pFinished(); + +private: + ZMutex fMutex; + ZCondition fCondition; + int fStartCount; + std::set<Observer*> fObservers; + }; + +// ================================================================================================= +#pragma mark - +#pragma mark * ZBlackBerry::Channel + +class Channel : public ZStreamerRWCon + { +protected: + Channel(); + +public: + virtual ~Channel(); + +// Our protocol + virtual size_t GetIdealSize_Read(); + virtual size_t GetIdealSize_Write(); + }; + +} // namespace ZBlackBerry + +NAMESPACE_ZOOLIB_END + +#endif // __ZBlackBerry__ Added: trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerryCOM.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerryCOM.cpp (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerryCOM.cpp 2009-07-21 15:28:25 UTC (rev 874) @@ -0,0 +1,45 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2008 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#include "zoolib/blackberry/ZBlackBerryCOM.h" + +#if ZCONFIG_SPI_Enabled(Win) + +NAMESPACE_ZOOLIB_BEGIN + +namespace ZBlackBerryCOM { + +ZWinCOM_DEFINITION(IChannelEvents) +ZWinCOM_DEFINITION(IChannel) +ZWinCOM_DEFINITION(IDeviceProperty) +ZWinCOM_DEFINITION(IDeviceProperties) +ZWinCOM_DEFINITION(IDevice) +ZWinCOM_DEFINITION(IDevices) +ZWinCOM_DEFINITION(IDeviceManagerEvents) +ZWinCOM_DEFINITION(IDeviceManagerNotification) +ZWinCOM_DEFINITION(IDeviceManager) +const GUID IDeviceManager::sCLSID = + {0xBA3D0120,0xE617,0x4F66,{0xAD,0xCA,0x58,0x5C,0xC2,0xFB,0x86,0xDB}}; + +} // namespace ZBlackBerryCOM + +NAMESPACE_ZOOLIB_END + +#endif // ZCONFIG_SPI_Enabled(Win) Added: trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerryCOM.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerryCOM.h (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerryCOM.h 2009-07-21 15:28:25 UTC (rev 874) @@ -0,0 +1,174 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2008 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#ifndef __ZBlackBerryCOM__ +#define __ZBlackBerryCOM__ 1 +#include "zconfig.h" +#include "zoolib/ZCONFIG_SPI.h" + +// ================================================================================================= + +#if ZCONFIG_SPI_Enabled(Win) + +#include "zoolib/ZStdInt.h" +#include "zoolib/ZWinCOM.h" + +// winnt.h defines 'STDMETHODIMP' to be 'HRESULT STDMETHODCALLTYPE'. + +// ================================================================================================= + +NAMESPACE_ZOOLIB_BEGIN + +namespace ZBlackBerryCOM { + +// ================================================================================================= +#pragma mark - +#pragma mark * IChannelEvents + +ZWinCOM_CLASS_(IChannelEvents, IUnknown, + C7168312,A0F4,46DF,B8,2A,54,8C,FB,08,75,5E) + + virtual STDMETHODIMP CheckClientStatus(uint16 iRHS) = 0; + virtual STDMETHODIMP OnChallenge(int32 iAttemptsRemaining, uint8 oPasswordHash[20]) = 0; + virtual STDMETHODIMP OnNewData() = 0; + virtual STDMETHODIMP OnClose() = 0; + }; + +// ================================================================================================= +#pragma mark - +#pragma mark * IChannel + +struct ChannelParams + { + uint16 fMaxReceiveUnit; + uint16 fMaxTransmitUnit; + uint16 fDeviceBuffers; + uint16 fHostBuffers; + uint16 fDroppedPacketCount; + }; + +ZWinCOM_CLASS_(IChannel, IUnknown, + C7168311,A0F4,46DF,B8,2A,54,8C,FB,08,75,5E) + + virtual STDMETHODIMP Params(ChannelParams* oParams) = 0; + virtual STDMETHODIMP hostBuffers(uint16 iRHS) = 0; + virtual STDMETHODIMP PacketsAvailable(int32* oPacketsAvailable) = 0; + virtual STDMETHODIMP ReadPacket(void* iDest, int32 iCount, int32* oCount) = 0; + virtual STDMETHODIMP WritePacket(const void* iSource, int32 iLength) = 0; + }; + +// ================================================================================================= +#pragma mark - +#pragma mark * IDeviceProperty + +ZWinCOM_CLASS_(IDeviceProperty, IUnknown, + C7168310,A0F4,46DF,B8,2A,54,8C,FB,08,75,5E) + + virtual STDMETHODIMP Name(BSTR* oName) = 0; + virtual STDMETHODIMP Value(VARIANT* oValue) = 0; + }; + +// ================================================================================================= +#pragma mark - +#pragma mark * IDeviceProperties + +ZWinCOM_CLASS_(IDeviceProperties, IUnknown, + C716830F,A0F4,46DF,B8,2A,54,8C,FB,08,75,5E) + + virtual STDMETHODIMP Count(uint32* oCount) = 0; + virtual STDMETHODIMP Item(VARIANT iVariant, IDeviceProperty** oDeviceProperty) = 0; + }; + +// ================================================================================================= +#pragma mark - +#pragma mark * IDevice + +ZWinCOM_CLASS_(IDevice, IUnknown, + C716830E,A0F4,46DF,B8,2A,54,8C,FB,08,75,5E) + + virtual STDMETHODIMP Properties(IDeviceProperties** oDeviceProperties) = 0; + virtual STDMETHODIMP OpenChannel( + LPCWSTR iChannelName, + IChannelEvents* iChannelEvents, + IChannel** oChannel) = 0; + + virtual STDMETHODIMP Reset() = 0; + virtual STDMETHODIMP Equals(IDevice* iDevice, int32* oResult) = 0; + }; + +// ================================================================================================= +#pragma mark - +#pragma mark * IDevices + +ZWinCOM_CLASS_(IDevices, IUnknown, + C716830D,A0F4,46DF,B8,2A,54,8C,FB,08,75,5E) + + virtual STDMETHODIMP Count(uint32* oCount) = 0; + virtual STDMETHODIMP Item(uint32 iIndex, IDevice** oDevice) = 0; + }; + +// ================================================================================================= +#pragma mark - +#pragma mark * IDeviceManagerEvents + +ZWinCOM_CLASS_(IDeviceManagerEvents, IUnknown, + C716830C,A0F4,46DF,B8,2A,54,8C,FB,08,75,5E) + + virtual STDMETHODIMP DeviceConnect(IDevice* iDevice) = 0; + virtual STDMETHODIMP DeviceDisconnect(IDevice* iDevice) = 0; + }; + +// ================================================================================================= +#pragma mark - +#pragma mark * IDeviceManagerNotification + +ZWinCOM_CLASS_(IDeviceManagerNotification, IDeviceManagerEvents, + 5F67EACC,D387,4B71,96,37,59,69,01,D0,0C,E0) + + virtual STDMETHODIMP SuspendRequest() = 0; + virtual STDMETHODIMP SuspendNotification(int32 iSuspending) = 0; + virtual STDMETHODIMP ResumeNotification() = 0; + }; + +// ================================================================================================= +#pragma mark - +#pragma mark * IDeviceManager + +ZWinCOM_CLASS_(IDeviceManager, IUnknown, + C716830B,A0F4,46DF,B8,2A,54,8C,FB,08,75,5E) + + static const GUID sCLSID; + + virtual STDMETHODIMP Devices(IDevices** oDevices) = 0; + + virtual STDMETHODIMP Advise( + IDeviceManagerEvents* iDeviceManagerEvents, uint32* oCookie) = 0; + + virtual STDMETHODIMP Unadvise(uint32 iCookie) = 0; + }; + +} // namespace ZBlackBerryCOM + +NAMESPACE_ZOOLIB_END + +#endif // ZCONFIG_SPI_Enabled(Win) + + +#endif // __ZBlackBerryCOM__ Added: trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerryServer.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerryServer.cpp (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerryServer.cpp 2009-07-21 15:28:25 UTC (rev 874) @@ -0,0 +1,611 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2008 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#include "zoolib/blackberry/ZBlackBerryServer.h" + +#include "zoolib/ZCommer.h" +#include "zoolib/ZLog.h" +#include "zoolib/ZMemory.h" +#include "zoolib/ZStreamerCopier.h" +#include "zoolib/ZUtil_STL.h" + +using std::string; +using std::vector; + +NAMESPACE_ZOOLIB_BEGIN + +// ================================================================================================= +#pragma mark - +#pragma mark * ZBlackBerryServer::Handler_ManagerChanged + +class ZBlackBerryServer::Handler_ManagerChanged : public ZCommer + { +public: + Handler_ManagerChanged(ZRef<ZStreamerR> iStreamerR, ZRef<ZStreamerW> iStreamerW, + ZBlackBerryServer* iServer); + virtual ~Handler_ManagerChanged(); + +// From ZCommer + virtual bool Read(const ZStreamR& r); + virtual bool Write(const ZStreamW& w); + + virtual void Detached(); + +// Called by ZBlackBerryServer + void TripIt(); + +private: + ZBlackBerryServer* fServer; + ZMutex fMutex; + enum EState + { eState_Quiet, eState_Changed, eState_Waiting, eState_SendChanged, eState_SendClosed}; + EState fState; + }; + +ZBlackBerryServer::Handler_ManagerChanged::Handler_ManagerChanged( + ZRef<ZStreamerR> iStreamerR, ZRef<ZStreamerW> iStreamerW, + ZBlackBerryServer* iServer) +: ZCommer(iStreamerR, iStreamerW), + fServer(iServer), + fMutex("ZBlackBerryServer::Handler_ManagerChanged::fMutex"), + fState(eState_Quiet) + {} + +ZBlackBerryServer::Handler_ManagerChanged::~Handler_ManagerChanged() + { + if (ZLOG(s, eDebug + 2, "ZBlackBerryServer::Handler_ManagerChanged~")) + { + s << "~Handler_ManagerChanged"; + } + } + +bool ZBlackBerryServer::Handler_ManagerChanged::Read(const ZStreamR& r) + { + const bool req = r.ReadBool(); + + ZMutexLocker locker(fMutex); + if (!req) + { + fState = eState_SendClosed; + locker.Release(); + this->Wake(); + return false; + } + + switch (fState) + { + case eState_Quiet: + { + fState = eState_Waiting; + return true; + } + case eState_Changed: + { + fState = eState_SendChanged; + locker.Release(); + this->Wake(); + return true; + } + } + + ZUnimplemented(); + return false; + } + +bool ZBlackBerryServer::Handler_ManagerChanged::Write(const ZStreamW& w) + { + ZMutexLocker locker(fMutex); + + if (fState == eState_SendChanged) + { + fState = eState_Quiet; + locker.Release(); + w.WriteBool(true); + return true; + } + else if (fState == eState_SendClosed) + { + locker.Release(); + w.WriteBool(false); + return false; + } + + return true; + } + +void ZBlackBerryServer::Handler_ManagerChanged::Detached() + { + if (ZLOG(s, eDebug + 2, "ZBlackBerryServer::Handler_ManagerChanged")) + { + s << "Detached"; + } + + fServer->pRemove_ManagerChanged(this); + + delete this; + } + +void ZBlackBerryServer::Handler_ManagerChanged::TripIt() + { + ZMutexLocker locker(fMutex); + + if (fState == eState_Waiting) + fState = eState_SendChanged; + else if (fState == eState_Quiet) + fState = eState_Changed; + + locker.Release(); + + this->Wake(); + } + +// ================================================================================================= +#pragma mark - +#pragma mark * ZBlackBerryServer::Handler_DeviceFinished + +class ZBlackBerryServer::Handler_DeviceFinished +: public ZCommer + { +public: + Handler_DeviceFinished(ZRef<ZStreamerR> iStreamerR, ZRef<ZStreamerW> iStreamerW, + ZBlackBerryServer* iServer); + virtual ~Handler_DeviceFinished(); + +// From ZCommer + virtual bool Read(const ZStreamR& r); + virtual bool Write(const ZStreamW& w); + + virtual void Detached(); + +// Called by ZBlackBerryServer + void TripIt(); + +private: + ZBlackBerryServer* fServer; + bool fClientOpen; + bool fRunning; + }; + +ZBlackBerryServer::Handler_DeviceFinished::Handler_DeviceFinished( + ZRef<ZStreamerR> iStreamerR, ZRef<ZStreamerW> iStreamerW, + ZBlackBerryServer* iServer) +: ZCommer(iStreamerR, iStreamerW), + fServer(iServer), + fClientOpen(true), + fRunning(true) + {} + +ZBlackBerryServer::Handler_DeviceFinished::~Handler_DeviceFinished() + { + if (ZLOG(s, eDebug + 2, "ZBlackBerryServer::Handler_DeviceFinished")) + { + s << "~Handler_DeviceFinished"; + } + } + +bool ZBlackBerryServer::Handler_DeviceFinished::Read(const ZStreamR& r) + { + if (ZLOG(s, eDebug + 2, "ZBlackBerryServer::Handler_DeviceFinished")) + { + s << "Read, entered"; + } + + const bool req = r.ReadBool(); + ZAssert(!req); + + if (ZLOG(s, eDebug + 2, "ZBlackBerryServer::Handler_DeviceFinished")) + { + s << "Read, got false"; + } + + ZAssert(fClientOpen); + fClientOpen = false; + this->Wake(); + return false; + } + +bool ZBlackBerryServer::Handler_DeviceFinished::Write(const ZStreamW& w) + { + if (!fClientOpen || !fRunning) + { + if (ZLOG(s, eDebug + 2, "ZBlackBerryServer::Handler_DeviceFinished")) + { + s << "Write false, return false"; + } + + w.WriteBool(false); + return false; + } + + if (ZLOG(s, eDebug + 2, "ZBlackBerryServer::Handler_DeviceFinished")) + { + s << "Write, Return true"; + } + + return true; + } + +void ZBlackBerryServer::Handler_DeviceFinished::Detached() + { + if (ZLOG(s, eDebug + 2, "ZBlackBerryServer::Handler_DeviceFinished")) + { + s << "Detached"; + } + + fServer->pRemove_DeviceFinished(this); + + delete this; + } + +void ZBlackBerryServer::Handler_DeviceFinished::TripIt() + { + if (ZLOG(s, eDebug + 2, "ZBlackBerryServer::Handler_DeviceFinished")) + { + s << "TripIt"; + } + fRunning = false; + this->Wake(); + } + +// ================================================================================================= +#pragma mark - +#pragma mark * StreamCopier_Chunked + +namespace ZANONYMOUS { + +class StreamerCopier_Chunked : public ZWaiter + { +public: + StreamerCopier_Chunked(ZRef<ZStreamerRCon> iStreamerRCon, ZRef<ZStreamerWCon> iStreamerWCon); + + ~StreamerCopier_Chunked(); + +// From ZWaiter + virtual bool Execute(); + +private: + ZRef<ZStreamerRCon> fStreamerRCon; + ZRef<ZStreamerWCon> fStreamerWCon; + }; + +StreamerCopier_Chunked::StreamerCopier_Chunked( + ZRef<ZStreamerRCon> iStreamerRCon, ZRef<ZStreamerWCon> iStreamerWCon) +: fStreamerRCon(iStreamerRCon), + fStreamerWCon(iStreamerWCon) + {} + +StreamerCopier_Chunked::~StreamerCopier_Chunked() + {} + +bool StreamerCopier_Chunked::Execute() + { + ZWaiter::Wake();//## + const ZStreamRCon& r = fStreamerRCon->GetStreamRCon(); + const ZStreamWCon& w = fStreamerWCon->GetStreamWCon(); + + try + { + const size_t theSize = r.ReadUInt16LE(); + + if (theSize == 0) + { + // End of stream + r.ReceiveDisconnect(-1); + w.SendDisconnect(); + return false; + } + else + { + std::vector<char> buffer(theSize); + + r.Read(&buffer[0], theSize); + w.Write(&buffer[0], theSize); + + return true; + } + } + catch (...) + { + r.Abort(); + w.Abort(); + throw; + } + } + +} // anonymous namespace + +// ================================================================================================= +#pragma mark - +#pragma mark * ZBlackBerryServer + +static string sReadString(const ZStreamR& r) + { + if (size_t theLength = r.ReadCount()) + return r.ReadString(theLength); + return string(); + } + +ZBlackBerryServer::ZBlackBerryServer(ZRef<ZBlackBerry::Manager> iManager) +: fManager(iManager) + { + fManager->ObserverAdd(this); + this->ManagerChanged(fManager); + } + +ZBlackBerryServer::~ZBlackBerryServer() + { + ZAssert(fHandlers_ManagerChanged.empty()); + + for (vector<Entry_t>::iterator i = fEntries.begin(); i != fEntries.end(); ++i) + ZAssert(i->fHandlers.empty()); + + fManager->ObserverRemove(this); + } + +void ZBlackBerryServer::HandleRequest(ZRef<ZStreamerRWCon> iSRWCon) + { + const ZStreamR& r = iSRWCon->GetStreamR(); + const ZStreamW& w = iSRWCon->GetStreamW(); + + const int req = r.ReadUInt8(); + if (req == 0) + { + // Async changed notifications + ZMutexLocker locker(fMutex); + Handler_ManagerChanged* theHandler = new Handler_ManagerChanged(iSRWCon, iSRWCon, this); + fHandlers_ManagerChanged.push_back(theHandler); + locker.Release(); + + sStartCommerRunners(theHandler); + } + else if (req == 1) + { + // Synchronous get device IDs + ZMutexLocker locker(fMutex); + + vector<uint64> theIDs; + for (vector<Entry_t>::iterator i = fEntries.begin(); i != fEntries.end(); ++i) + { + if (i->fLive) + theIDs.push_back(i->fID); + } + locker.Release(); + + w.WriteCount(theIDs.size()); + for (vector<uint64>::iterator i = theIDs.begin(); i != theIDs.end(); ++i) + w.WriteUInt64(*i); + } + else if (req == 2) + { + // Async device finished notifications + const uint64 deviceID = r.ReadUInt64(); + + ZMutexLocker locker(fMutex); + + bool gotIt = false; + for (vector<Entry_t>::iterator i = fEntries.begin(); !gotIt && i != fEntries.end(); ++i) + { + if (i->fLive && i->fID == deviceID) + { + Handler_DeviceFinished* theHandler + = new Handler_DeviceFinished(iSRWCon, iSRWCon, this); + i->fHandlers.push_back(theHandler); + locker.Release(); + + w.WriteBool(true); + sStartCommerRunners(theHandler); + gotIt = true; + } + } + + if (!gotIt) + { + locker.Release(); + w.WriteBool(false); + } + } + else if (req == 4) + { + // Synchronous get attribute + const uint64 deviceID = r.ReadUInt64(); + const uint16 object = r.ReadUInt16(); + const uint16 attribute = r.ReadUInt16(); + if (ZRef<ZBlackBerry::Device> theDevice = this->pGetDevice(deviceID)) + { + const ZBlackBerry::ValData theMB = theDevice->GetAttribute(object, attribute); + w.WriteBool(true); + w.WriteCount(theMB.GetSize()); + w.Write(theMB.GetData(), theMB.GetSize()); + } + else + { + w.WriteBool(false); + } + } + else if (req == 5) + { + // Synchronous get PIN + const uint64 deviceID = r.ReadUInt64(); + if (ZRef<ZBlackBerry::Device> theDevice = this->pGetDevice(deviceID)) + { + uint32 thePIN = theDevice->GetPIN(); + w.WriteBool(true); + w.WriteUInt32(thePIN); + } + else + { + w.WriteBool(false); + } + } + else if (req == 6) + { + // Open channel + const uint64 deviceID = r.ReadUInt64(); + + const bool preserveBoundaries = r.ReadBool(); + + const bool gotHash = r.ReadBool(); + ZBlackBerry::PasswordHash thePasswordHash; + if (gotHash) + r.Read(&thePasswordHash, sizeof(thePasswordHash)); + + const string channelName = sReadString(r); + + ZBlackBerry::Device::Error theError = ZBlackBerry::Device::error_DeviceClosed; + + if (ZRef<ZBlackBerry::Device> theDevice = this->pGetDevice(deviceID)) + { + if (ZRef<ZBlackBerry::Channel> deviceCon = theDevice->Open(preserveBoundaries, + channelName, gotHash ? &thePasswordHash : nullptr, &theError)) + { + const size_t readSize = deviceCon->GetIdealSize_Read(); + const size_t writeSize = deviceCon->GetIdealSize_Write(); + w.WriteUInt32(ZBlackBerry::Device::error_None); + w.WriteUInt32(readSize); + w.WriteUInt32(writeSize); + w.Flush(); + // Use a standard copier for the device-->client direction + ZRef<ZWaiter> deviceToClient + = new ZStreamerCopier(ZRef<ZTaskOwner>(), deviceCon, iSRWCon, readSize); + sStartWaiterRunner(deviceToClient); + + // And our specialized copier for the client-->device direction. + ZRef<ZWaiter> clientToDevice + = new StreamerCopier_Chunked(iSRWCon, deviceCon); + sStartWaiterRunner(clientToDevice); + + return; + } + } + + if (theError == ZBlackBerry::Device::error_None) + { + if (ZLOG(s, eDebug + 1, "ZBlackBerryServer::HandleRequest")) + { + s << "Open failed, but got error_None"; + } + theError = ZBlackBerry::Device::error_Generic; + } + w.WriteUInt32(theError); + } + } + +ZRef<ZBlackBerry::Device> ZBlackBerryServer::pGetDevice(uint64 iDeviceID) + { + ZMutexLocker locker(fMutex); + + for (vector<Entry_t>::iterator i = fEntries.begin(); i != fEntries.end(); ++i) + { + if (i->fLive && i->fID == iDeviceID) + return i->fDevice; + } + return ZRef<ZBlackBerry::Device>(); + } + +void ZBlackBerryServer::ManagerChanged(ZRef<ZBlackBerry::Manager> iManager) + { + // Hmmm. Deadlock? + ZMutexLocker locker(fMutex); + + vector<uint64> theIDs; + fManager->GetDeviceIDs(theIDs); + + for (vector<uint64>::iterator iterID = theIDs.begin(); iterID != theIDs.end(); ++iterID) + { + const uint64 curID = *iterID; + bool foundIt = false; + for (vector<Entry_t>::iterator i = fEntries.begin(); + !foundIt && i != fEntries.end(); ++i) + { + if (i->fID == curID) + foundIt = true; + } + + if (!foundIt) + { + if (ZRef<ZBlackBerry::Device> theDevice = fManager->Open(curID)) + { + Entry_t theEntry; + theEntry.fLive = true; + theEntry.fID = curID; + theEntry.fDevice = theDevice; + fEntries.push_back(theEntry); + theDevice->ObserverAdd(this); + } + } + } + + for (vector<Handler_ManagerChanged*>::iterator i = fHandlers_ManagerChanged.begin(); + i != fHandlers_ManagerChanged.end(); ++i) + { + (*i)->TripIt(); + } + } + +void ZBlackBerryServer::Finished(ZRef<ZBlackBerry::Device> iDevice) + { + ZMutexLocker locker(fMutex); + for (vector<Entry_t>::iterator i = fEntries.begin(); + i != fEntries.end(); ++i) + { + if (i->fDevice == iDevice) + { + i->fLive = false; + iDevice->ObserverRemove(this); + + if (i->fHandlers.empty()) + { + fEntries.erase(i); + } + else + { + for (vector<Handler_DeviceFinished*>::iterator j = i->fHandlers.begin(); + j != i->fHandlers.end(); ++j) + { + (*j)->TripIt(); + } + } + break; + } + } + } + +void ZBlackBerryServer::pRemove_ManagerChanged(Handler_ManagerChanged* iHandler) + { + ZMutexLocker locker(fMutex); + ZUtil_STL::sEraseMustContain(1, fHandlers_ManagerChanged, iHandler); + } + +void ZBlackBerryServer::pRemove_DeviceFinished(Handler_DeviceFinished* iHandler) + { + ZMutexLocker locker(fMutex); + for (vector<Entry_t>::iterator i = fEntries.begin(); + i != fEntries.end(); ++i) + { + if (ZUtil_STL::sEraseIfContains(i->fHandlers, iHandler)) + { + if (i->fHandlers.empty() && !i->fLive) + fEntries.erase(i); + break; + } + } + } + +NAMESPACE_ZOOLIB_END Added: trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerryServer.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerryServer.h (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerryServer.h 2009-07-21 15:28:25 UTC (rev 874) @@ -0,0 +1,81 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2008 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#ifndef __ZBlackBerry_Server__ +#define __ZBlackBerry_Server__ 1 +#include "zconfig.h" + +#include "zoolib/blackberry/ZBlackBerry.h" + +#include <vector> + +NAMESPACE_ZOOLIB_BEGIN + +// ================================================================================================= +#pragma mark - +#pragma mark * ZBlackBerryServer + +class ZBlackBerryServer +: ZBlackBerry::Manager::Observer, + ZBlackBerry::Device::Observer + { +public: + ZBlackBerryServer(ZRef<ZBlackBerry::Manager> iManager); + ~ZBlackBerryServer(); + + void HandleRequest(ZRef<ZStreamerRWCon> iSRWCon); + +private: +// From Manager::Observer + virtual void ManagerChanged(ZRef<ZBlackBerry::Manager> iManager); + +// From Device::Observer + virtual void Finished(ZRef<ZBlackBerry::Device> iDevice); + +private: + ZMutex fMutex; + ZCondition fCondition; + ZRef<ZBlackBerry::Manager> fManager; + + ZRef<ZBlackBerry::Device> pGetDevice(uint64 iDeviceID); + + class Handler_ManagerChanged; + friend class Handler_ManagerChanged; + void pRemove_ManagerChanged(Handler_ManagerChanged*); + std::vector<Handler_ManagerChanged*> fHandlers_ManagerChanged; + + class Handler_DeviceFinished; + friend class Handler_DeviceFinished; + void pRemove_DeviceFinished(Handler_DeviceFinished*); + + struct Entry_t + { + uint64 fID; + bool fLive; + ZRef<ZBlackBerry::Device> fDevice; + std::vector<Handler_DeviceFinished*> fHandlers; + }; + + std::vector<Entry_t> fEntries; + }; + +NAMESPACE_ZOOLIB_END + +#endif // __ZBlackBerry_Server__ Added: trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry_BBDevMgr.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry_BBDevMgr.cpp (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry_BBDevMgr.cpp 2009-07-21 15:28:25 UTC (rev 874) @@ -0,0 +1,773 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2008 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, T... [truncated message content] |
From: <ag...@us...> - 2009-07-21 15:32:52
|
Revision: 875 http://zoolib.svn.sourceforge.net/zoolib/?rev=875&view=rev Author: agreen Date: 2009-07-21 15:32:47 +0000 (Tue, 21 Jul 2009) Log Message: ----------- Move into netscape dir. Modified Paths: -------------- trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape.h Added Paths: ----------- trunk/zoolib/source/cxx/more/zoolib/netscape/ZCompat_npapi.h Removed Paths: ------------- trunk/zoolib/source/cxx/zoolib/ZCompat_npapi.h Copied: trunk/zoolib/source/cxx/more/zoolib/netscape/ZCompat_npapi.h (from rev 874, trunk/zoolib/source/cxx/zoolib/ZCompat_npapi.h) =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/netscape/ZCompat_npapi.h (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/netscape/ZCompat_npapi.h 2009-07-21 15:32:47 UTC (rev 875) @@ -0,0 +1,238 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2008 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#ifndef __ZCompat_npapi__ +#define __ZCompat_npapi__ +#include "zconfig.h" + +#include "zoolib/ZCONFIG_SPI.h" + +// Pull in ZStdInt.h so we see its int32 definition +#include "zoolib/ZStdInt.h" + +#if defined(ZProjectHeader_npapi) + + #include ZProjectHeader_npapi + +#elif defined(__APPLE__) && !defined(__LP64__) + + #include <WebKit/npfunctions.h> + #if !defined(XP_MACOSX) + typedef NPError (*NP_InitializeFuncPtr)(NPNetscapeFuncs*); + typedef NPError (*NP_GetEntryPointsFuncPtr)(NPPluginFuncs*); + #endif + + #ifndef ZCONFIG_NPStringUpperCaseFieldNames + # define ZCONFIG_NPStringUpperCaseFieldNames 1 + #endif + + #define NPEventType_GetFocusEvent getFocusEvent + #define NPEventType_LoseFocusEvent loseFocusEvent + #define NPEventType_AdjustCursorEvent loseFocusEvent + +#else + + #include "zoolib/netscape/ZNetscape_API.h" + +#endif + +#if defined(_NPFUNCTIONS_H_) +# define ZCONFIG_NPAPI_WebKit_10_4 1 +#elif defined(NPFUNCTIONS_H) +# if defined(EXPORTED_CALLBACK) +# define ZCONFIG_NPAPI_WebKit_Recent 1 +# else +# define ZCONFIG_NPAPI_WebKit_10_5 1 +# endif +#elif defined(_NPUPP_H_) +# if defined(_NPUPP_USE_UPP_) +# define ZCONFIG_NPAPI_Mozilla_Old 1 +# else +# define ZCONFIG_NPAPI_Mozilla_New 1 +# endif +#endif + +// ================================================================================================= +// Fixup the NPString field name change + +#ifndef ZCONFIG_NPStringUpperCaseFieldNames +# define ZCONFIG_NPStringUpperCaseFieldNames 0 +#endif + +#if ZCONFIG_NPStringUpperCaseFieldNames + + inline const NPUTF8* const& sNPStringCharsConst(const NPString& iNPString) + { return iNPString.UTF8Characters; } + + inline NPUTF8*& sNPStringChars(NPString& iNPString) + { return const_cast<NPUTF8*&>(iNPString.UTF8Characters); } + + inline uint32_t sNPStringLengthConst(const NPString& iNPString) + { return iNPString.UTF8Length; } + + inline uint32_t& sNPStringLength(NPString& iNPString) + { return iNPString.UTF8Length; } + +#else + + inline const NPUTF8* const& sNPStringCharsConst(const NPString& iNPString) + { return iNPString.utf8characters; } + + inline NPUTF8*& sNPStringChars(NPString& iNPString) + { return const_cast<NPUTF8*&>(iNPString.utf8characters); } + + inline uint32_t sNPStringLengthConst(const NPString& iNPString) + { return iNPString.utf8length; } + + inline uint32_t& sNPStringLength(NPString& iNPString) + { return iNPString.utf8length; } + +#endif + +// ================================================================================================= +#pragma mark - +#pragma mark * npapi and npruntime header and macro fixups + +#ifndef NPVERS_HAS_XPCONNECT_SCRIPTING + #define NPVERS_HAS_XPCONNECT_SCRIPTING 13 +#endif + +#ifndef NPVERS_HAS_NPRUNTIME_SCRIPTING + #define NPVERS_HAS_NPRUNTIME_SCRIPTING 14 +#endif + +#ifndef NPVERS_HAS_FORM_VALUES + #define NPVERS_HAS_FORM_VALUES 15 +#endif + +#ifndef NPVERS_HAS_POPUPS_ENABLED_STATE + #define NPVERS_HAS_POPUPS_ENABLED_STATE 16 +#endif + +#ifndef NPVERS_HAS_RESPONSE_HEADERS + #define NPVERS_HAS_RESPONSE_HEADERS 17 +#endif + +#ifndef NPVERS_HAS_NPOBJECT_ENUM + #define NPVERS_HAS_NPOBJECT_ENUM 18 +#endif + +#ifndef NPVERS_HAS_PLUGIN_THREAD_ASYNC_CALL + #define NPVERS_HAS_PLUGIN_THREAD_ASYNC_CALL 19 +#endif + +#ifndef NPVERS_MACOSX_HAS_EVENT_MODELS + #define NPVERS_MACOSX_HAS_EVENT_MODELS 20 +#endif + +#if NP_VERSION_MINOR < NPVERS_HAS_POPUPS_ENABLED_STATE + typedef void (*NPN_PushPopupsEnabledStateProcPtr)(NPP instance, NPBool enabled); + + typedef void (*NPN_PopPopupsEnabledStateProcPtr)(NPP instance); +#endif + +#if NP_VERSION_MINOR < NPVERS_HAS_NPOBJECT_ENUM + typedef bool (*NPN_EnumerateProcPtr) + (NPP npp, NPObject *npobj, NPIdentifier **identifier, uint32_t *count); +#endif + +#if NP_VERSION_MINOR < NPVERS_HAS_PLUGIN_THREAD_ASYNC_CALL + typedef void (*NPN_PluginThreadAsyncCallProcPtr) + (NPP npp, void (*func)(void *), void *userData); + typedef bool (*NPN_ConstructProcPtr) + (NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result); +#endif + +#if 0 + typedef uint32 (*NPN_ScheduleTimerProcPtr) + (NPP npp, uint32 interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32 timerID)); + + typedef void (*NPN_UnscheduleTimerProcPtr) + (NPP npp, uint32 timerID); + + typedef void * NPMenu; + typedef NPError (*NPN_PopUpContextMenuProcPtr)(NPP instance, NPMenu* menu); +#endif + +#if !defined(XP_MACOSX) + typedef void (*BP_CreatePluginMIMETypesPreferencesFuncPtr)(void); + typedef NPError (*MainFuncPtr)(NPNetscapeFuncs*, NPPluginFuncs*, NPP_ShutdownProcPtr*); +#endif + +#if NP_CLASS_STRUCT_VERSION < 2 + typedef bool (*NPEnumerationFunctionPtr) + (NPObject *npobj, NPIdentifier **value, uint32_t *count); +#endif + +// ================================================================================================= +// NPN and NPP variable fixups + +// Actually this mozilla check is somewhat superfluous -- no XP_MACOSX in old headers. + +#if defined(XP_MACOSX) + +#if defined(ZCONFIG_NPAPI_WebKit_10_4) || defined(ZCONFIG_NPAPI_Mozilla_Old) + +enum + { + NPPVpluginDrawingModel = 1000, + NPNVpluginDrawingModel = 1000, + NPNVsupportsCoreGraphicsBool = 2001, + NPNVsupportsOpenGLBool = 2002, + + #ifndef NP_NO_QUICKDRAW + NPNVsupportsQuickDrawBool = 2000, + #endif + NPNVSupportsWindowless = 17 + }; + +typedef enum + { + #ifndef NP_NO_QUICKDRAW + NPDrawingModelQuickDraw = 0, + #endif + + NPDrawingModelCoreGraphics = 1, + NPDrawingModelOpenGL = 2 + } NPDrawingModel; + +typedef struct NP_CGContext + { + CGContextRef context; + WindowRef window; + } NP_CGContext; + +#endif // ZCONFIG_NPAPI_WebKit_10_4 + +#if defined(ZCONFIG_NPAPI_WebKit_10_5) + +enum + { + NPPVpluginDrawingModel = 1000, + NPNVSupportsWindowless = 17 + }; + +#endif // defined(ZCONFIG_NPAPI_WebKit_10_5) + +#endif // defined(XP_MACOSX) + +// ================================================================================================= + +#endif // __ZCompat_npapi__ Modified: trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape.h 2009-07-21 15:28:25 UTC (rev 874) +++ trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape.h 2009-07-21 15:32:47 UTC (rev 875) @@ -24,7 +24,8 @@ #include "zoolib/ZCONFIG_SPI.h" -#include "zoolib/ZCompat_npapi.h" +#include "zoolib/netscape/ZCompat_npapi.h" + #include "zoolib/ZCompat_operator_bool.h" #include <string> Deleted: trunk/zoolib/source/cxx/zoolib/ZCompat_npapi.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZCompat_npapi.h 2009-07-21 15:28:25 UTC (rev 874) +++ trunk/zoolib/source/cxx/zoolib/ZCompat_npapi.h 2009-07-21 15:32:47 UTC (rev 875) @@ -1,238 +0,0 @@ -/* ------------------------------------------------------------------------------------------------- -Copyright (c) 2008 Andrew Green -http://www.zoolib.org - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software -and associated documentation files (the "Software"), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, merge, publish, distribute, -sublicense, and/or sell copies of the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING -BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES -OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------------------------- */ - -#ifndef __ZCompat_npapi__ -#define __ZCompat_npapi__ -#include "zconfig.h" - -#include "zoolib/ZCONFIG_SPI.h" - -// Pull in ZStdInt.h so we see its int32 definition -#include "zoolib/ZStdInt.h" - -#if defined(ZProjectHeader_npapi) - - #include ZProjectHeader_npapi - -#elif defined(__APPLE__) && !defined(__LP64__) - - #include <WebKit/npfunctions.h> - #if !defined(XP_MACOSX) - typedef NPError (*NP_InitializeFuncPtr)(NPNetscapeFuncs*); - typedef NPError (*NP_GetEntryPointsFuncPtr)(NPPluginFuncs*); - #endif - - #ifndef ZCONFIG_NPStringUpperCaseFieldNames - # define ZCONFIG_NPStringUpperCaseFieldNames 1 - #endif - - #define NPEventType_GetFocusEvent getFocusEvent - #define NPEventType_LoseFocusEvent loseFocusEvent - #define NPEventType_AdjustCursorEvent loseFocusEvent - -#else - - #include "zoolib/netscape/ZNetscape_API.h" - -#endif - -#if defined(_NPFUNCTIONS_H_) -# define ZCONFIG_NPAPI_WebKit_10_4 1 -#elif defined(NPFUNCTIONS_H) -# if defined(EXPORTED_CALLBACK) -# define ZCONFIG_NPAPI_WebKit_Recent 1 -# else -# define ZCONFIG_NPAPI_WebKit_10_5 1 -# endif -#elif defined(_NPUPP_H_) -# if defined(_NPUPP_USE_UPP_) -# define ZCONFIG_NPAPI_Mozilla_Old 1 -# else -# define ZCONFIG_NPAPI_Mozilla_New 1 -# endif -#endif - -// ================================================================================================= -// Fixup the NPString field name change - -#ifndef ZCONFIG_NPStringUpperCaseFieldNames -# define ZCONFIG_NPStringUpperCaseFieldNames 0 -#endif - -#if ZCONFIG_NPStringUpperCaseFieldNames - - inline const NPUTF8* const& sNPStringCharsConst(const NPString& iNPString) - { return iNPString.UTF8Characters; } - - inline NPUTF8*& sNPStringChars(NPString& iNPString) - { return const_cast<NPUTF8*&>(iNPString.UTF8Characters); } - - inline uint32_t sNPStringLengthConst(const NPString& iNPString) - { return iNPString.UTF8Length; } - - inline uint32_t& sNPStringLength(NPString& iNPString) - { return iNPString.UTF8Length; } - -#else - - inline const NPUTF8* const& sNPStringCharsConst(const NPString& iNPString) - { return iNPString.utf8characters; } - - inline NPUTF8*& sNPStringChars(NPString& iNPString) - { return const_cast<NPUTF8*&>(iNPString.utf8characters); } - - inline uint32_t sNPStringLengthConst(const NPString& iNPString) - { return iNPString.utf8length; } - - inline uint32_t& sNPStringLength(NPString& iNPString) - { return iNPString.utf8length; } - -#endif - -// ================================================================================================= -#pragma mark - -#pragma mark * npapi and npruntime header and macro fixups - -#ifndef NPVERS_HAS_XPCONNECT_SCRIPTING - #define NPVERS_HAS_XPCONNECT_SCRIPTING 13 -#endif - -#ifndef NPVERS_HAS_NPRUNTIME_SCRIPTING - #define NPVERS_HAS_NPRUNTIME_SCRIPTING 14 -#endif - -#ifndef NPVERS_HAS_FORM_VALUES - #define NPVERS_HAS_FORM_VALUES 15 -#endif - -#ifndef NPVERS_HAS_POPUPS_ENABLED_STATE - #define NPVERS_HAS_POPUPS_ENABLED_STATE 16 -#endif - -#ifndef NPVERS_HAS_RESPONSE_HEADERS - #define NPVERS_HAS_RESPONSE_HEADERS 17 -#endif - -#ifndef NPVERS_HAS_NPOBJECT_ENUM - #define NPVERS_HAS_NPOBJECT_ENUM 18 -#endif - -#ifndef NPVERS_HAS_PLUGIN_THREAD_ASYNC_CALL - #define NPVERS_HAS_PLUGIN_THREAD_ASYNC_CALL 19 -#endif - -#ifndef NPVERS_MACOSX_HAS_EVENT_MODELS - #define NPVERS_MACOSX_HAS_EVENT_MODELS 20 -#endif - -#if NP_VERSION_MINOR < NPVERS_HAS_POPUPS_ENABLED_STATE - typedef void (*NPN_PushPopupsEnabledStateProcPtr)(NPP instance, NPBool enabled); - - typedef void (*NPN_PopPopupsEnabledStateProcPtr)(NPP instance); -#endif - -#if NP_VERSION_MINOR < NPVERS_HAS_NPOBJECT_ENUM - typedef bool (*NPN_EnumerateProcPtr) - (NPP npp, NPObject *npobj, NPIdentifier **identifier, uint32_t *count); -#endif - -#if NP_VERSION_MINOR < NPVERS_HAS_PLUGIN_THREAD_ASYNC_CALL - typedef void (*NPN_PluginThreadAsyncCallProcPtr) - (NPP npp, void (*func)(void *), void *userData); - typedef bool (*NPN_ConstructProcPtr) - (NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result); -#endif - -#if 0 - typedef uint32 (*NPN_ScheduleTimerProcPtr) - (NPP npp, uint32 interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32 timerID)); - - typedef void (*NPN_UnscheduleTimerProcPtr) - (NPP npp, uint32 timerID); - - typedef void * NPMenu; - typedef NPError (*NPN_PopUpContextMenuProcPtr)(NPP instance, NPMenu* menu); -#endif - -#if !defined(XP_MACOSX) - typedef void (*BP_CreatePluginMIMETypesPreferencesFuncPtr)(void); - typedef NPError (*MainFuncPtr)(NPNetscapeFuncs*, NPPluginFuncs*, NPP_ShutdownProcPtr*); -#endif - -#if NP_CLASS_STRUCT_VERSION < 2 - typedef bool (*NPEnumerationFunctionPtr) - (NPObject *npobj, NPIdentifier **value, uint32_t *count); -#endif - -// ================================================================================================= -// NPN and NPP variable fixups - -// Actually this mozilla check is somewhat superfluous -- no XP_MACOSX in old headers. - -#if defined(XP_MACOSX) - -#if defined(ZCONFIG_NPAPI_WebKit_10_4) || defined(ZCONFIG_NPAPI_Mozilla_Old) - -enum - { - NPPVpluginDrawingModel = 1000, - NPNVpluginDrawingModel = 1000, - NPNVsupportsCoreGraphicsBool = 2001, - NPNVsupportsOpenGLBool = 2002, - - #ifndef NP_NO_QUICKDRAW - NPNVsupportsQuickDrawBool = 2000, - #endif - NPNVSupportsWindowless = 17 - }; - -typedef enum - { - #ifndef NP_NO_QUICKDRAW - NPDrawingModelQuickDraw = 0, - #endif - - NPDrawingModelCoreGraphics = 1, - NPDrawingModelOpenGL = 2 - } NPDrawingModel; - -typedef struct NP_CGContext - { - CGContextRef context; - WindowRef window; - } NP_CGContext; - -#endif // ZCONFIG_NPAPI_WebKit_10_4 - -#if defined(ZCONFIG_NPAPI_WebKit_10_5) - -enum - { - NPPVpluginDrawingModel = 1000, - NPNVSupportsWindowless = 17 - }; - -#endif // defined(ZCONFIG_NPAPI_WebKit_10_5) - -#endif // defined(XP_MACOSX) - -// ================================================================================================= - -#endif // __ZCompat_npapi__ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2009-07-21 16:59:56
|
Revision: 876 http://zoolib.svn.sourceforge.net/zoolib/?rev=876&view=rev Author: agreen Date: 2009-07-21 16:59:42 +0000 (Tue, 21 Jul 2009) Log Message: ----------- Move to tuplebase dir. Added Paths: ----------- trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZUtil_TupleIndex.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZUtil_TupleIndex.h Removed Paths: ------------- trunk/zoolib/source/cxx/zoolib/ZUtil_TupleIndex.cpp trunk/zoolib/source/cxx/zoolib/ZUtil_TupleIndex.h Copied: trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZUtil_TupleIndex.cpp (from rev 547, trunk/zoolib/source/cxx/zoolib/ZUtil_TupleIndex.cpp) =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZUtil_TupleIndex.cpp (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZUtil_TupleIndex.cpp 2009-07-21 16:59:42 UTC (rev 876) @@ -0,0 +1,91 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2006 Andrew Green and Learning in Motion, Inc. +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#include "zoolib/ZUtil_TupleIndex.h" + +#include "zoolib/ZTupleIndex_General.h" +#include "zoolib/ZTupleIndex_String.h" +#include "zoolib/ZTupleIndex_T.h" + +#define USEGENERAL false + +using std::string; +using std::vector; + +NAMESPACE_ZOOLIB_BEGIN + +// ================================================================================================= +#pragma mark - +#pragma mark * ZUtil_TupleIndex + +ZRef<ZTupleIndexFactory> ZUtil_TupleIndex::sCreate_General(const string& iPropName0) + { + if (USEGENERAL) + { + vector<string> propNames; + + propNames.push_back(iPropName0); + + return new ZTupleIndexFactory_General(propNames); + } + else + { + return new ZTupleIndexFactory_T<1>(&iPropName0); + } + } + +ZRef<ZTupleIndexFactory> ZUtil_TupleIndex::sCreate_General( + const string& iPropName0, + const string& iPropName1) + { + vector<string> propNames; + + propNames.push_back(iPropName0); + propNames.push_back(iPropName1); + + if (USEGENERAL) + return new ZTupleIndexFactory_General(propNames); + else + return new ZTupleIndexFactory_T<2>(&propNames[0]); + } + +ZRef<ZTupleIndexFactory> ZUtil_TupleIndex::sCreate_General( + const string& iPropName0, + const string& iPropName1, + const string& iPropName2) + { + vector<string> propNames; + + propNames.push_back(iPropName0); + propNames.push_back(iPropName1); + propNames.push_back(iPropName2); + + if (USEGENERAL) + return new ZTupleIndexFactory_General(propNames); + else + return new ZTupleIndexFactory_T<3>(&propNames[0]); + } + +ZRef<ZTupleIndexFactory> ZUtil_TupleIndex::sCreate_String(const string& iPropName) + { + return new ZTupleIndexFactory_String(iPropName); + } + +NAMESPACE_ZOOLIB_END Copied: trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZUtil_TupleIndex.h (from rev 547, trunk/zoolib/source/cxx/zoolib/ZUtil_TupleIndex.h) =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZUtil_TupleIndex.h (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZUtil_TupleIndex.h 2009-07-21 16:59:42 UTC (rev 876) @@ -0,0 +1,52 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2006 Andrew Green and Learning in Motion, Inc. +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#ifndef __ZUtil_TupleIndex__ +#define __ZUtil_TupleIndex__ +#include "zconfig.h" + +#include "zoolib/ZTupleIndex.h" + +NAMESPACE_ZOOLIB_BEGIN + +// ================================================================================================= +#pragma mark - +#pragma mark * ZUtil_TupleIndex + +namespace ZUtil_TupleIndex { + +ZRef<ZTupleIndexFactory> sCreate_General(const std::string& iPropName0); + +ZRef<ZTupleIndexFactory> sCreate_General( + const std::string& iPropName0, + const std::string& iPropName1); + +ZRef<ZTupleIndexFactory> sCreate_General( + const std::string& iPropName0, + const std::string& iPropName1, + const std::string& iPropName2); + +ZRef<ZTupleIndexFactory> sCreate_String(const std::string& iPropName); + +} // namespace ZUtil_TupleIndex + +NAMESPACE_ZOOLIB_END + +#endif // __ZUtil_TupleIndex__ Deleted: trunk/zoolib/source/cxx/zoolib/ZUtil_TupleIndex.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZUtil_TupleIndex.cpp 2009-07-21 15:32:47 UTC (rev 875) +++ trunk/zoolib/source/cxx/zoolib/ZUtil_TupleIndex.cpp 2009-07-21 16:59:42 UTC (rev 876) @@ -1,91 +0,0 @@ -/* ------------------------------------------------------------------------------------------------- -Copyright (c) 2006 Andrew Green and Learning in Motion, Inc. -http://www.zoolib.org - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software -and associated documentation files (the "Software"), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, merge, publish, distribute, -sublicense, and/or sell copies of the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING -BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES -OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------------------------- */ - -#include "zoolib/ZUtil_TupleIndex.h" - -#include "zoolib/ZTupleIndex_General.h" -#include "zoolib/ZTupleIndex_String.h" -#include "zoolib/ZTupleIndex_T.h" - -#define USEGENERAL false - -using std::string; -using std::vector; - -NAMESPACE_ZOOLIB_BEGIN - -// ================================================================================================= -#pragma mark - -#pragma mark * ZUtil_TupleIndex - -ZRef<ZTupleIndexFactory> ZUtil_TupleIndex::sCreate_General(const string& iPropName0) - { - if (USEGENERAL) - { - vector<string> propNames; - - propNames.push_back(iPropName0); - - return new ZTupleIndexFactory_General(propNames); - } - else - { - return new ZTupleIndexFactory_T<1>(&iPropName0); - } - } - -ZRef<ZTupleIndexFactory> ZUtil_TupleIndex::sCreate_General( - const string& iPropName0, - const string& iPropName1) - { - vector<string> propNames; - - propNames.push_back(iPropName0); - propNames.push_back(iPropName1); - - if (USEGENERAL) - return new ZTupleIndexFactory_General(propNames); - else - return new ZTupleIndexFactory_T<2>(&propNames[0]); - } - -ZRef<ZTupleIndexFactory> ZUtil_TupleIndex::sCreate_General( - const string& iPropName0, - const string& iPropName1, - const string& iPropName2) - { - vector<string> propNames; - - propNames.push_back(iPropName0); - propNames.push_back(iPropName1); - propNames.push_back(iPropName2); - - if (USEGENERAL) - return new ZTupleIndexFactory_General(propNames); - else - return new ZTupleIndexFactory_T<3>(&propNames[0]); - } - -ZRef<ZTupleIndexFactory> ZUtil_TupleIndex::sCreate_String(const string& iPropName) - { - return new ZTupleIndexFactory_String(iPropName); - } - -NAMESPACE_ZOOLIB_END Deleted: trunk/zoolib/source/cxx/zoolib/ZUtil_TupleIndex.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZUtil_TupleIndex.h 2009-07-21 15:32:47 UTC (rev 875) +++ trunk/zoolib/source/cxx/zoolib/ZUtil_TupleIndex.h 2009-07-21 16:59:42 UTC (rev 876) @@ -1,52 +0,0 @@ -/* ------------------------------------------------------------------------------------------------- -Copyright (c) 2006 Andrew Green and Learning in Motion, Inc. -http://www.zoolib.org - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software -and associated documentation files (the "Software"), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, merge, publish, distribute, -sublicense, and/or sell copies of the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING -BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES -OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------------------------- */ - -#ifndef __ZUtil_TupleIndex__ -#define __ZUtil_TupleIndex__ -#include "zconfig.h" - -#include "zoolib/ZTupleIndex.h" - -NAMESPACE_ZOOLIB_BEGIN - -// ================================================================================================= -#pragma mark - -#pragma mark * ZUtil_TupleIndex - -namespace ZUtil_TupleIndex { - -ZRef<ZTupleIndexFactory> sCreate_General(const std::string& iPropName0); - -ZRef<ZTupleIndexFactory> sCreate_General( - const std::string& iPropName0, - const std::string& iPropName1); - -ZRef<ZTupleIndexFactory> sCreate_General( - const std::string& iPropName0, - const std::string& iPropName1, - const std::string& iPropName2); - -ZRef<ZTupleIndexFactory> sCreate_String(const std::string& iPropName); - -} // namespace ZUtil_TupleIndex - -NAMESPACE_ZOOLIB_END - -#endif // __ZUtil_TupleIndex__ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2009-07-21 17:28:54
|
Revision: 877 http://zoolib.svn.sourceforge.net/zoolib/?rev=877&view=rev Author: agreen Date: 2009-07-21 17:28:50 +0000 (Tue, 21 Jul 2009) Log Message: ----------- Fix some #includes. Modified Paths: -------------- trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_GuestFactory.cpp trunk/zoolib/source/cxx/more/zoolib/tql/ZTQLEngine.cpp trunk/zoolib/source/cxx/more/zoolib/tql/ZTQLTest.cpp trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL.cpp trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL_Spec.cpp trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_TQLConvert.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBRep_Client.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBRep_TS.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTS_DB.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTS_RAM.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTS_Watchable.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex_General.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex_General.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex_String.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex_String.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex_T.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleQuisitioner.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleQuisitioner.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZUtil_Strim_TBSpec.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZUtil_TupleIndex.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZUtil_TupleIndex.h trunk/zoolib/source/cxx/zoolib/ZVal_ZooLib.cpp Modified: trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_GuestFactory.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_GuestFactory.cpp 2009-07-21 16:59:42 UTC (rev 876) +++ trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_GuestFactory.cpp 2009-07-21 17:28:50 UTC (rev 877) @@ -32,6 +32,7 @@ #if ZCONFIG_SPI_Enabled(CoreFoundation) #include ZMACINCLUDE2(CoreFoundation,CFBundle.h) + #include ZMACINCLUDE2(CoreFoundation,CFPlugin.h) #if __MACH__ # include <mach-o/dyld.h> // For NSModule #endif Modified: trunk/zoolib/source/cxx/more/zoolib/tql/ZTQLEngine.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tql/ZTQLEngine.cpp 2009-07-21 16:59:42 UTC (rev 876) +++ trunk/zoolib/source/cxx/more/zoolib/tql/ZTQLEngine.cpp 2009-07-21 17:28:50 UTC (rev 877) @@ -18,7 +18,7 @@ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ------------------------------------------------------------------------------------------------- */ -#include "zoolib/ZTQLEngine.h" +#include "zoolib/tql/ZTQLEngine.h" #include "zoolib/ZStrim.h" Modified: trunk/zoolib/source/cxx/more/zoolib/tql/ZTQLTest.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tql/ZTQLTest.cpp 2009-07-21 16:59:42 UTC (rev 876) +++ trunk/zoolib/source/cxx/more/zoolib/tql/ZTQLTest.cpp 2009-07-21 17:28:50 UTC (rev 877) @@ -1,9 +1,8 @@ +#include "zoolib/tql/ZTQL_Optimize.h" #include "zoolib/tql/ZTQL_Query.h" +#include "zoolib/tql/ZUtil_Strim_TQL.h" +#include "zoolib/tql/ZUtil_TQLConvert.h" -#include "zoolib/tql/ZTQL_Optimize.h" - -#include "zoolib/ZUtil_Strim_TQL.h" -#include "zoolib/ZUtil_TQLConvert.h" #include "zoolib/ZUtil_Strim_Tuple.h" NAMESPACE_ZOOLIB_USING Modified: trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL.cpp 2009-07-21 16:59:42 UTC (rev 876) +++ trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL.cpp 2009-07-21 17:28:50 UTC (rev 877) @@ -18,8 +18,9 @@ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ------------------------------------------------------------------------------------------------- */ -#include "zoolib/ZUtil_Strim_TQL.h" -#include "zoolib/ZUtil_Strim_TQL_Spec.h" +#include "zoolib/tql/ZUtil_Strim_TQL.h" +#include "zoolib/tql/ZUtil_Strim_TQL_Spec.h" + #include "zoolib/ZUtil_Strim_Tuple.h" NAMESPACE_ZOOLIB_BEGIN Modified: trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL_Spec.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL_Spec.cpp 2009-07-21 16:59:42 UTC (rev 876) +++ trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL_Spec.cpp 2009-07-21 17:28:50 UTC (rev 877) @@ -18,9 +18,9 @@ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ------------------------------------------------------------------------------------------------- */ -#include "zoolib/ZUtil_Strim_TQL_Spec.h" +#include "zoolib/tql/ZTQL_LogOp.h" +#include "zoolib/tql/ZUtil_Strim_TQL_Spec.h" -#include "zoolib/tql/ZTQL_LogOp.h" #include "zoolib/ZUtil_Strim_Tuple.h" NAMESPACE_ZOOLIB_BEGIN Modified: trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_TQLConvert.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_TQLConvert.cpp 2009-07-21 16:59:42 UTC (rev 876) +++ trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_TQLConvert.cpp 2009-07-21 17:28:50 UTC (rev 877) @@ -18,9 +18,8 @@ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ------------------------------------------------------------------------------------------------- */ -#include "zoolib/ZUtil_TQLConvert.h" - #include "zoolib/tql/ZTQL_Spec.h" +#include "zoolib/tql/ZUtil_TQLConvert.h" NAMESPACE_ZOOLIB_BEGIN Modified: trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBRep_Client.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBRep_Client.cpp 2009-07-21 16:59:42 UTC (rev 876) +++ trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBRep_Client.cpp 2009-07-21 17:28:50 UTC (rev 877) @@ -21,7 +21,7 @@ #include "zoolib/tuplebase/ZTBRep_Client.h" #include "zoolib/ZLog.h" -#include "zoolib/ZTupleIndex.h" +#include "zoolib/tuplebase/ZTupleIndex.h" #include "zoolib/ZUtil_STL.h" // For sSortedEraseMustContain etc #include "zoolib/ZUtil_Strim_Tuple.h" Modified: trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBRep_TS.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBRep_TS.cpp 2009-07-21 16:59:42 UTC (rev 876) +++ trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBRep_TS.cpp 2009-07-21 17:28:50 UTC (rev 877) @@ -19,10 +19,10 @@ ------------------------------------------------------------------------------------------------- */ #include "zoolib/tuplebase/ZTBRep_TS.h" +#include "zoolib/tuplebase/ZTupleQuisitioner.h" +#include "zoolib/tuplebase/ZTupleIndex.h" #include "zoolib/ZCompat_algorithm.h" -#include "zoolib/ZTupleQuisitioner.h" -#include "zoolib/ZTupleIndex.h" #include "zoolib/ZUtil_STL.h" #include "zoolib/ZUtil_Strim_Tuple.h" Modified: trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTS_DB.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTS_DB.h 2009-07-21 16:59:42 UTC (rev 876) +++ trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTS_DB.h 2009-07-21 17:28:50 UTC (rev 877) @@ -37,7 +37,7 @@ #if ZCONFIG_API_Enabled(TS_DB) #include "zoolib/ZFile.h" -#include "zoolib/ZTupleIndex.h" +#include "zoolib/tuplebase/ZTupleIndex.h" #include <string> #include <vector> Modified: trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTS_RAM.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTS_RAM.cpp 2009-07-21 16:59:42 UTC (rev 876) +++ trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTS_RAM.cpp 2009-07-21 17:28:50 UTC (rev 877) @@ -23,7 +23,7 @@ #include "zoolib/ZDebug.h" #include "zoolib/ZLog.h" #include "zoolib/ZStream.h" -#include "zoolib/ZTupleIndex.h" +#include "zoolib/tuplebase/ZTupleIndex.h" #include "zoolib/ZUtil_STL.h" #include "zoolib/ZUtil_Strim.h" #include "zoolib/ZUtil_Strim_Tuple.h" Modified: trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTS_Watchable.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTS_Watchable.cpp 2009-07-21 16:59:42 UTC (rev 876) +++ trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTS_Watchable.cpp 2009-07-21 17:28:50 UTC (rev 877) @@ -19,13 +19,13 @@ ------------------------------------------------------------------------------------------------- */ #include "zoolib/tuplebase/ZTS_Watchable.h" +#include "zoolib/tuplebase/ZTSWatcher.h" +#include "zoolib/tuplebase/ZTupleQuisitioner.h" #include "zoolib/ZDebug.h" #include "zoolib/ZDList.h" #include "zoolib/ZLog.h" #include "zoolib/ZString.h" -#include "zoolib/tuplebase/ZTSWatcher.h" -#include "zoolib/ZTupleQuisitioner.h" #include "zoolib/ZUtil_STL.h" #include "zoolib/ZUtil_Strim_Tuple.h" Modified: trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex.cpp 2009-07-21 16:59:42 UTC (rev 876) +++ trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex.cpp 2009-07-21 17:28:50 UTC (rev 877) @@ -18,7 +18,7 @@ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ------------------------------------------------------------------------------------------------- */ -#include "zoolib/ZTupleIndex.h" +#include "zoolib/tuplebase/ZTupleIndex.h" #include "zoolib/ZStrim.h" Modified: trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex_General.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex_General.cpp 2009-07-21 16:59:42 UTC (rev 876) +++ trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex_General.cpp 2009-07-21 17:28:50 UTC (rev 877) @@ -18,7 +18,7 @@ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ------------------------------------------------------------------------------------------------- */ -#include "zoolib/ZTupleIndex_General.h" +#include "zoolib/tuplebase/ZTupleIndex_General.h" #include "zoolib/ZStrim.h" Modified: trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex_General.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex_General.h 2009-07-21 16:59:42 UTC (rev 876) +++ trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex_General.h 2009-07-21 17:28:50 UTC (rev 877) @@ -22,7 +22,7 @@ #define __ZTupleIndex_General__ #include "zconfig.h" -#include "zoolib/ZTupleIndex.h" +#include "zoolib/tuplebase/ZTupleIndex.h" #include <set> #include <vector> Modified: trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex_String.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex_String.cpp 2009-07-21 16:59:42 UTC (rev 876) +++ trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex_String.cpp 2009-07-21 17:28:50 UTC (rev 877) @@ -19,7 +19,7 @@ ------------------------------------------------------------------------------------------------- */ #include "zoolib/ZStrim.h" -#include "zoolib/ZTupleIndex_String.h" +#include "zoolib/tuplebase/ZTupleIndex_String.h" #include "zoolib/ZUnicode.h" using std::set; Modified: trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex_String.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex_String.h 2009-07-21 16:59:42 UTC (rev 876) +++ trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex_String.h 2009-07-21 17:28:50 UTC (rev 877) @@ -22,7 +22,7 @@ #define __ZTupleIndex_String__ #include "zconfig.h" -#include "zoolib/ZTupleIndex.h" +#include "zoolib/tuplebase/ZTupleIndex.h" #include "zoolib/ZTextCollator.h" NAMESPACE_ZOOLIB_BEGIN Modified: trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex_T.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex_T.h 2009-07-21 16:59:42 UTC (rev 876) +++ trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex_T.h 2009-07-21 17:28:50 UTC (rev 877) @@ -22,7 +22,7 @@ #define __ZTupleIndex_T__ #include "zconfig.h" -#include "zoolib/ZTupleIndex.h" +#include "zoolib/tuplebase/ZTupleIndex.h" NAMESPACE_ZOOLIB_BEGIN Modified: trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleQuisitioner.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleQuisitioner.cpp 2009-07-21 16:59:42 UTC (rev 876) +++ trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleQuisitioner.cpp 2009-07-21 17:28:50 UTC (rev 877) @@ -18,7 +18,7 @@ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ------------------------------------------------------------------------------------------------- */ -#include "zoolib/ZTupleQuisitioner.h" +#include "zoolib/tuplebase/ZTupleQuisitioner.h" #define kDebug_TupleQuisitioner 2 Modified: trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleQuisitioner.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleQuisitioner.h 2009-07-21 16:59:42 UTC (rev 876) +++ trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleQuisitioner.h 2009-07-21 17:28:50 UTC (rev 877) @@ -23,6 +23,7 @@ #include "zconfig.h" #include "zoolib/tuplebase/ZTBQuery.h" + #include "zoolib/ZTextCollator.h" #include <map> Modified: trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZUtil_Strim_TBSpec.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZUtil_Strim_TBSpec.cpp 2009-07-21 16:59:42 UTC (rev 876) +++ trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZUtil_Strim_TBSpec.cpp 2009-07-21 17:28:50 UTC (rev 877) @@ -18,10 +18,10 @@ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ------------------------------------------------------------------------------------------------- */ -#include "zoolib/ZUtil_Strim_TBSpec.h" +#include "zoolib/tuplebase/ZUtil_Strim_TBSpec.h" +#include "zoolib/tuplebase/ZTBSpec.h" #include "zoolib/ZStrim.h" -#include "zoolib/tuplebase/ZTBSpec.h" #include "zoolib/ZUtil_Strim.h" #include "zoolib/ZUtil_Strim_Tuple.h" Modified: trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZUtil_TupleIndex.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZUtil_TupleIndex.cpp 2009-07-21 16:59:42 UTC (rev 876) +++ trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZUtil_TupleIndex.cpp 2009-07-21 17:28:50 UTC (rev 877) @@ -18,11 +18,11 @@ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ------------------------------------------------------------------------------------------------- */ -#include "zoolib/ZUtil_TupleIndex.h" +#include "zoolib/tuplebase/ZUtil_TupleIndex.h" -#include "zoolib/ZTupleIndex_General.h" -#include "zoolib/ZTupleIndex_String.h" -#include "zoolib/ZTupleIndex_T.h" +#include "zoolib/tuplebase/ZTupleIndex_General.h" +#include "zoolib/tuplebase/ZTupleIndex_String.h" +#include "zoolib/tuplebase/ZTupleIndex_T.h" #define USEGENERAL false Modified: trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZUtil_TupleIndex.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZUtil_TupleIndex.h 2009-07-21 16:59:42 UTC (rev 876) +++ trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZUtil_TupleIndex.h 2009-07-21 17:28:50 UTC (rev 877) @@ -22,7 +22,7 @@ #define __ZUtil_TupleIndex__ #include "zconfig.h" -#include "zoolib/ZTupleIndex.h" +#include "zoolib/tuplebase/ZTupleIndex.h" NAMESPACE_ZOOLIB_BEGIN Modified: trunk/zoolib/source/cxx/zoolib/ZVal_ZooLib.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZVal_ZooLib.cpp 2009-07-21 16:59:42 UTC (rev 876) +++ trunk/zoolib/source/cxx/zoolib/ZVal_ZooLib.cpp 2009-07-21 17:28:50 UTC (rev 877) @@ -1602,9 +1602,14 @@ if (fRep) { if (iOther.fRep) - return sCompare_T(fRep->fVector, iOther.fRep->fVector); + { + return sCompare_T(fRep->fVector.begin(), fRep->fVector.end(), + iOther.fRep->fVector.begin(), iOther.fRep->fVector.end()); + } else + { return 1; + } } else if (iOther.fRep) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2009-07-31 02:18:43
|
Revision: 894 http://zoolib.svn.sourceforge.net/zoolib/?rev=894&view=rev Author: agreen Date: 2009-07-31 02:17:47 +0000 (Fri, 31 Jul 2009) Log Message: ----------- Move to old. Added Paths: ----------- trunk/zoolib/source/cxx/old/zoolib/ZUtil_Win_UI.cpp trunk/zoolib/source/cxx/old/zoolib/ZUtil_Win_UI.h Removed Paths: ------------- trunk/zoolib/source/cxx/zoolib/ZUtil_Win_UI.cpp trunk/zoolib/source/cxx/zoolib/ZUtil_Win_UI.h Copied: trunk/zoolib/source/cxx/old/zoolib/ZUtil_Win_UI.cpp (from rev 867, trunk/zoolib/source/cxx/zoolib/ZUtil_Win_UI.cpp) =================================================================== --- trunk/zoolib/source/cxx/old/zoolib/ZUtil_Win_UI.cpp (rev 0) +++ trunk/zoolib/source/cxx/old/zoolib/ZUtil_Win_UI.cpp 2009-07-31 02:17:47 UTC (rev 894) @@ -0,0 +1,138 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2007 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#include "zoolib/ZUtil_Win_UI.h" + +#if ZCONFIG_SPI_Enabled(Win) + +#include "zoolib/ZUtil_Win.h" + +#include "zoolib/ZDC_GDI.h" +#include "zoolib/ZDCPixmap.h" +#include "zoolib/ZDebug.h" + +NAMESPACE_ZOOLIB_BEGIN + +#define kDebug_Win 2 + +bool ZUtil_Win::sDragFullWindows() + { + bool dragFullWindows = false; + HKEY keyDragFullWindows; + if (ERROR_SUCCESS == ::RegOpenKeyExA(HKEY_CURRENT_USER, + "Control Panel\\Desktop", 0, KEY_QUERY_VALUE, &keyDragFullWindows)) + { + BYTE buffer[100]; + DWORD bufferSize = 100; + if (ERROR_SUCCESS == ::RegQueryValueExA(keyDragFullWindows, + "DragFullWindows", NULL, NULL, buffer, &bufferSize)) + { + if (buffer[0] == '1') + dragFullWindows = true; + } + ::RegCloseKey(keyDragFullWindows); + } + return dragFullWindows; + } + +static bool sMungeProc_Invert(ZCoord hCoord, ZCoord vCoord, ZRGBColorPOD& ioColor, void* iRefcon) + { + ioColor = ZRGBColor::sWhite - ioColor; + return true; + } + +void ZUtil_Win::sPixmapsFromHICON(HICON iHICON, + ZDCPixmap* oColorPixmap, ZDCPixmap* oMonoPixmap, ZDCPixmap* oMaskPixmap) + { + ZAssertStop(2, iHICON); + ICONINFO theICONINFO; + ::GetIconInfo(iHICON, &theICONINFO); + + HDC dummyHDC = ::GetDC(nullptr); + + ZDCPixmap monoPixmap(new ZDCPixmapRep_DIB(dummyHDC, theICONINFO.hbmMask)); + + if (theICONINFO.hbmColor) + { + if (oColorPixmap) + *oColorPixmap = ZDCPixmap(new ZDCPixmapRep_DIB(dummyHDC, theICONINFO.hbmColor)); + if (oMaskPixmap) + *oMaskPixmap = monoPixmap; + } + else + { + // theICONINFO.hbmColor is nullptr, so theICONINFO.hbmMask (and thus monoPixmap) contains + // the mono pixmap and the mask stacked on top of each other. + ZPoint monoSize = monoPixmap.Size(); + if (oMonoPixmap) + *oMonoPixmap = ZDCPixmap(monoPixmap, ZRect(0, 0, monoSize.h, monoSize.v / 2)); + if (oMaskPixmap) + *oMaskPixmap = ZDCPixmap(monoPixmap, ZRect(0, monoSize.v / 2, monoSize.h, monoSize.v)); + } + + if (oMaskPixmap) + oMaskPixmap->Munge(sMungeProc_Invert, nullptr); + + if (theICONINFO.hbmMask) + ::DeleteObject(theICONINFO.hbmMask); + if (theICONINFO.hbmMask) + ::DeleteObject(theICONINFO.hbmColor); + + ::ReleaseDC(nullptr, dummyHDC); + } + +static HINSTANCE sGetAppModuleHandle() + { + if (ZUtil_Win::sUseWAPI()) + return ::GetModuleHandleW(0); + else + return ::GetModuleHandleA(0); + } + +HBITMAP ZUtil_Win::sLoadBitmapID(bool iFromApp, int iResourceID) + { + ZAssertStop(kDebug_Win, (iResourceID & 0xFFFF0000) == 0); + HINSTANCE theHINSTANCE = nullptr; + if (iFromApp) + theHINSTANCE = sGetAppModuleHandle(); + + if (ZUtil_Win::sUseWAPI()) + return ::LoadBitmapW(theHINSTANCE, MAKEINTRESOURCEW(iResourceID)); + else + return ::LoadBitmapA(theHINSTANCE, MAKEINTRESOURCEA(iResourceID)); + } + +HICON ZUtil_Win::sLoadIconID(bool iFromApp, int iResourceID) + { + ZAssertStop(kDebug_Win, (iResourceID & 0xFFFF0000) == 0); + + HINSTANCE theHINSTANCE = nullptr; + if (iFromApp) + theHINSTANCE = sGetAppModuleHandle(); + + if (ZUtil_Win::sUseWAPI()) + return ::LoadIconW(theHINSTANCE, MAKEINTRESOURCEW(iResourceID)); + else + return ::LoadIconA(theHINSTANCE, MAKEINTRESOURCEA(iResourceID)); + } + +NAMESPACE_ZOOLIB_END + +#endif // ZCONFIG_SPI_Enabled(Win) Copied: trunk/zoolib/source/cxx/old/zoolib/ZUtil_Win_UI.h (from rev 547, trunk/zoolib/source/cxx/zoolib/ZUtil_Win_UI.h) =================================================================== --- trunk/zoolib/source/cxx/old/zoolib/ZUtil_Win_UI.h (rev 0) +++ trunk/zoolib/source/cxx/old/zoolib/ZUtil_Win_UI.h 2009-07-31 02:17:47 UTC (rev 894) @@ -0,0 +1,50 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2007 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#ifndef __ZUtil_Win_UI__ +#define __ZUtil_Win_UI__ +#include "zconfig.h" +#include "zoolib/ZCONFIG_SPI.h" + +#if ZCONFIG_SPI_Enabled(Win) + +#include "zoolib/ZWinHeader.h" + +NAMESPACE_ZOOLIB_BEGIN + +class ZDCPixmap; + +namespace ZUtil_Win { + +bool sDragFullWindows(); + +void sPixmapsFromHICON(HICON iHICON, + ZDCPixmap* oColorPixmap, ZDCPixmap* oMonoPixmap, ZDCPixmap* oMaskPixmap); + +HBITMAP sLoadBitmapID(bool iFromApp, int iResourceID); +HICON sLoadIconID(bool iFromApp, int iResourceID); + +} // namespace ZUtil_Win + +NAMESPACE_ZOOLIB_END + +#endif // ZCONFIG_SPI_Enabled(Win) + +#endif // __ZUtil_Win_UI__ Deleted: trunk/zoolib/source/cxx/zoolib/ZUtil_Win_UI.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZUtil_Win_UI.cpp 2009-07-31 02:17:04 UTC (rev 893) +++ trunk/zoolib/source/cxx/zoolib/ZUtil_Win_UI.cpp 2009-07-31 02:17:47 UTC (rev 894) @@ -1,138 +0,0 @@ -/* ------------------------------------------------------------------------------------------------- -Copyright (c) 2007 Andrew Green -http://www.zoolib.org - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software -and associated documentation files (the "Software"), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, merge, publish, distribute, -sublicense, and/or sell copies of the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING -BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES -OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------------------------- */ - -#include "zoolib/ZUtil_Win_UI.h" - -#if ZCONFIG_SPI_Enabled(Win) - -#include "zoolib/ZUtil_Win.h" - -#include "zoolib/ZDC_GDI.h" -#include "zoolib/ZDCPixmap.h" -#include "zoolib/ZDebug.h" - -NAMESPACE_ZOOLIB_BEGIN - -#define kDebug_Win 2 - -bool ZUtil_Win::sDragFullWindows() - { - bool dragFullWindows = false; - HKEY keyDragFullWindows; - if (ERROR_SUCCESS == ::RegOpenKeyExA(HKEY_CURRENT_USER, - "Control Panel\\Desktop", 0, KEY_QUERY_VALUE, &keyDragFullWindows)) - { - BYTE buffer[100]; - DWORD bufferSize = 100; - if (ERROR_SUCCESS == ::RegQueryValueExA(keyDragFullWindows, - "DragFullWindows", NULL, NULL, buffer, &bufferSize)) - { - if (buffer[0] == '1') - dragFullWindows = true; - } - ::RegCloseKey(keyDragFullWindows); - } - return dragFullWindows; - } - -static bool sMungeProc_Invert(ZCoord hCoord, ZCoord vCoord, ZRGBColorPOD& ioColor, void* iRefcon) - { - ioColor = ZRGBColor::sWhite - ioColor; - return true; - } - -void ZUtil_Win::sPixmapsFromHICON(HICON iHICON, - ZDCPixmap* oColorPixmap, ZDCPixmap* oMonoPixmap, ZDCPixmap* oMaskPixmap) - { - ZAssertStop(2, iHICON); - ICONINFO theICONINFO; - ::GetIconInfo(iHICON, &theICONINFO); - - HDC dummyHDC = ::GetDC(nullptr); - - ZDCPixmap monoPixmap(new ZDCPixmapRep_DIB(dummyHDC, theICONINFO.hbmMask)); - - if (theICONINFO.hbmColor) - { - if (oColorPixmap) - *oColorPixmap = ZDCPixmap(new ZDCPixmapRep_DIB(dummyHDC, theICONINFO.hbmColor)); - if (oMaskPixmap) - *oMaskPixmap = monoPixmap; - } - else - { - // theICONINFO.hbmColor is nullptr, so theICONINFO.hbmMask (and thus monoPixmap) contains - // the mono pixmap and the mask stacked on top of each other. - ZPoint monoSize = monoPixmap.Size(); - if (oMonoPixmap) - *oMonoPixmap = ZDCPixmap(monoPixmap, ZRect(0, 0, monoSize.h, monoSize.v / 2)); - if (oMaskPixmap) - *oMaskPixmap = ZDCPixmap(monoPixmap, ZRect(0, monoSize.v / 2, monoSize.h, monoSize.v)); - } - - if (oMaskPixmap) - oMaskPixmap->Munge(sMungeProc_Invert, nullptr); - - if (theICONINFO.hbmMask) - ::DeleteObject(theICONINFO.hbmMask); - if (theICONINFO.hbmMask) - ::DeleteObject(theICONINFO.hbmColor); - - ::ReleaseDC(nullptr, dummyHDC); - } - -static HINSTANCE sGetAppModuleHandle() - { - if (ZUtil_Win::sUseWAPI()) - return ::GetModuleHandleW(0); - else - return ::GetModuleHandleA(0); - } - -HBITMAP ZUtil_Win::sLoadBitmapID(bool iFromApp, int iResourceID) - { - ZAssertStop(kDebug_Win, (iResourceID & 0xFFFF0000) == 0); - HINSTANCE theHINSTANCE = nullptr; - if (iFromApp) - theHINSTANCE = sGetAppModuleHandle(); - - if (ZUtil_Win::sUseWAPI()) - return ::LoadBitmapW(theHINSTANCE, MAKEINTRESOURCEW(iResourceID)); - else - return ::LoadBitmapA(theHINSTANCE, MAKEINTRESOURCEA(iResourceID)); - } - -HICON ZUtil_Win::sLoadIconID(bool iFromApp, int iResourceID) - { - ZAssertStop(kDebug_Win, (iResourceID & 0xFFFF0000) == 0); - - HINSTANCE theHINSTANCE = nullptr; - if (iFromApp) - theHINSTANCE = sGetAppModuleHandle(); - - if (ZUtil_Win::sUseWAPI()) - return ::LoadIconW(theHINSTANCE, MAKEINTRESOURCEW(iResourceID)); - else - return ::LoadIconA(theHINSTANCE, MAKEINTRESOURCEA(iResourceID)); - } - -NAMESPACE_ZOOLIB_END - -#endif // ZCONFIG_SPI_Enabled(Win) Deleted: trunk/zoolib/source/cxx/zoolib/ZUtil_Win_UI.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZUtil_Win_UI.h 2009-07-31 02:17:04 UTC (rev 893) +++ trunk/zoolib/source/cxx/zoolib/ZUtil_Win_UI.h 2009-07-31 02:17:47 UTC (rev 894) @@ -1,50 +0,0 @@ -/* ------------------------------------------------------------------------------------------------- -Copyright (c) 2007 Andrew Green -http://www.zoolib.org - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software -and associated documentation files (the "Software"), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, merge, publish, distribute, -sublicense, and/or sell copies of the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING -BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES -OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------------------------- */ - -#ifndef __ZUtil_Win_UI__ -#define __ZUtil_Win_UI__ -#include "zconfig.h" -#include "zoolib/ZCONFIG_SPI.h" - -#if ZCONFIG_SPI_Enabled(Win) - -#include "zoolib/ZWinHeader.h" - -NAMESPACE_ZOOLIB_BEGIN - -class ZDCPixmap; - -namespace ZUtil_Win { - -bool sDragFullWindows(); - -void sPixmapsFromHICON(HICON iHICON, - ZDCPixmap* oColorPixmap, ZDCPixmap* oMonoPixmap, ZDCPixmap* oMaskPixmap); - -HBITMAP sLoadBitmapID(bool iFromApp, int iResourceID); -HICON sLoadIconID(bool iFromApp, int iResourceID); - -} // namespace ZUtil_Win - -NAMESPACE_ZOOLIB_END - -#endif // ZCONFIG_SPI_Enabled(Win) - -#endif // __ZUtil_Win_UI__ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2009-08-05 18:55:43
|
Revision: 913 http://zoolib.svn.sourceforge.net/zoolib/?rev=913&view=rev Author: agreen Date: 2009-08-05 18:55:34 +0000 (Wed, 05 Aug 2009) Log Message: ----------- More ValData-->Data, ValList-->List, ValMap-->Map. Modified Paths: -------------- trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry.h trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerryServer.cpp trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry_BBDevMgr.cpp trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry_Client.cpp trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry_Streamer.cpp trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry_Streamer.h trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host.h trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host_Std.cpp trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.h trunk/zoolib/source/cxx/zoolib/ZData_Any.h trunk/zoolib/source/cxx/zoolib/ZData_CFType.h trunk/zoolib/source/cxx/zoolib/ZHTTP.cpp trunk/zoolib/source/cxx/zoolib/ZHTTP.h trunk/zoolib/source/cxx/zoolib/ZHTTP_Requests.cpp trunk/zoolib/source/cxx/zoolib/ZHTTP_Requests.h trunk/zoolib/source/cxx/zoolib/ZMemoryBlock.h trunk/zoolib/source/cxx/zoolib/ZTuple.cpp trunk/zoolib/source/cxx/zoolib/ZTuple.h trunk/zoolib/source/cxx/zoolib/ZVal.h trunk/zoolib/source/cxx/zoolib/ZVal_Any.h trunk/zoolib/source/cxx/zoolib/ZVal_AppleEvent.h trunk/zoolib/source/cxx/zoolib/ZVal_CFType.h trunk/zoolib/source/cxx/zoolib/ZVal_ZooLib.cpp trunk/zoolib/source/cxx/zoolib/ZVal_ZooLib.h trunk/zoolib/source/cxx/zoolib/ZYad_CFType.cpp trunk/zoolib/source/cxx/zoolib/ZYad_JSON.cpp trunk/zoolib/source/cxx/zoolib/ZYad_Val_T.h trunk/zoolib/source/cxx/zoolib/ZYad_ZooLib.h Added Paths: ----------- trunk/zoolib/source/cxx/zoolib/ZStream_Data_T.h Removed Paths: ------------- trunk/zoolib/source/cxx/zoolib/ZStream_ValData_T.h Modified: trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry.h 2009-08-05 18:40:07 UTC (rev 912) +++ trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry.h 2009-08-05 18:55:34 UTC (rev 913) @@ -33,7 +33,7 @@ namespace ZBlackBerry { -typedef ZValData_Any ValData; +typedef ZData_Any Data; struct PasswordHash { @@ -125,7 +125,7 @@ virtual ZRef<Channel> Open(bool iPreserveBoundaries, const std::string& iName, const PasswordHash* iPasswordHash, Error* oError) = 0; - virtual ValData GetAttribute(uint16 iObject, uint16 iAttribute) = 0; + virtual Data GetAttribute(uint16 iObject, uint16 iAttribute) = 0; virtual uint32 GetPIN(); class Observer Modified: trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerryServer.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerryServer.cpp 2009-08-05 18:40:07 UTC (rev 912) +++ trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerryServer.cpp 2009-08-05 18:55:34 UTC (rev 913) @@ -429,7 +429,7 @@ const uint16 attribute = r.ReadUInt16(); if (ZRef<ZBlackBerry::Device> theDevice = this->pGetDevice(deviceID)) { - const ZBlackBerry::ValData theMB = theDevice->GetAttribute(object, attribute); + const ZBlackBerry::Data theMB = theDevice->GetAttribute(object, attribute); w.WriteBool(true); w.WriteCount(theMB.GetSize()); w.Write(theMB.GetData(), theMB.GetSize()); Modified: trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry_BBDevMgr.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry_BBDevMgr.cpp 2009-08-05 18:40:07 UTC (rev 912) +++ trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry_BBDevMgr.cpp 2009-08-05 18:55:34 UTC (rev 913) @@ -489,7 +489,7 @@ // From ZBlackBerry::Device virtual ZRef<Channel> Open(bool iPreserveBoundaries, const string& iName, const PasswordHash* iPasswordHash, Error* oError); - virtual ValData GetAttribute(uint16 iObject, uint16 iAttribute); + virtual Data GetAttribute(uint16 iObject, uint16 iAttribute); virtual uint32 GetPIN(); // Called by Manager_BBDevMgr @@ -545,12 +545,12 @@ return ZRef<Channel>(); } -ValData Device_BBDevMgr::GetAttribute(uint16 iObject, uint16 iAttribute) +Data Device_BBDevMgr::GetAttribute(uint16 iObject, uint16 iAttribute) { if (ZLOG(s, eDebug + 3, "ZBlackBerry::Device_BBDevMgr")) s << "GetAttribute"; - return ValData(); + return Data(); } uint32 Device_BBDevMgr::GetPIN() Modified: trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry_Client.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry_Client.cpp 2009-08-05 18:40:07 UTC (rev 912) +++ trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry_Client.cpp 2009-08-05 18:55:34 UTC (rev 913) @@ -143,7 +143,7 @@ virtual ZRef<Channel> Open(bool iPreserveBoundaries, const string& iName, const PasswordHash* iPasswordHash, Error* oError); - virtual ValData GetAttribute(uint16 iObject, uint16 iAttribute); + virtual Data GetAttribute(uint16 iObject, uint16 iAttribute); virtual uint32 GetPIN(); // From ZStreamerReader via ZCommer @@ -234,7 +234,7 @@ return ZRef<Channel>(); } -ValData Device_Client::GetAttribute(uint16 iObject, uint16 iAttribute) +Data Device_Client::GetAttribute(uint16 iObject, uint16 iAttribute) { try { @@ -250,7 +250,7 @@ const ZStreamR& r = theSRWCon->GetStreamR(); if (r.ReadBool()) { - ValData theMB(r.ReadCount()); + Data theMB(r.ReadCount()); r.Read(theMB.GetData(), theMB.GetSize()); return theMB; } @@ -258,7 +258,7 @@ } catch (...) {} - return ValData(); + return Data(); } uint32 Device_Client::GetPIN() Modified: trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry_Streamer.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry_Streamer.cpp 2009-08-05 18:40:07 UTC (rev 912) +++ trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry_Streamer.cpp 2009-08-05 18:55:34 UTC (rev 913) @@ -486,12 +486,12 @@ return ZRef<Channel>(); } -ValData Device_Streamer::GetAttribute(uint16 iObject, uint16 iAttribute) +Data Device_Streamer::GetAttribute(uint16 iObject, uint16 iAttribute) { ZMutexLocker locker(fMutex); if (fLifecycle != eLifecycle_Running) - return ValData(); + return Data(); while (fGetAttribute) fCondition.Wait(fMutex); @@ -513,7 +513,7 @@ uint32 Device_Streamer::GetPIN() { - ValData theMB_PIN = this->GetAttribute(8, 4); + Data theMB_PIN = this->GetAttribute(8, 4); if (theMB_PIN.GetSize() >= 15) return ZByteSwap_ReadLittle32(static_cast<char*>(theMB_PIN.GetData()) + 11); return 0; @@ -681,7 +681,7 @@ if (fGetAttribute) { fGetAttribute->fFinished = true; - fGetAttribute->fResult = ValData(); + fGetAttribute->fResult = Data(); fGetAttribute = nullptr; fGetAttributeSent = false; fCondition.Broadcast(); @@ -1009,7 +1009,7 @@ } // We've already read one byte (containing the command); - ValData theMB(iPayloadSize - 1); + Data theMB(iPayloadSize - 1); iStreamR.Read(theMB.GetData(), theMB.GetSize()); ZMutexLocker locker(fMutex); Modified: trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry_Streamer.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry_Streamer.h 2009-08-05 18:40:07 UTC (rev 912) +++ trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry_Streamer.h 2009-08-05 18:55:34 UTC (rev 913) @@ -53,7 +53,7 @@ virtual ZRef<Channel> Open(bool iPreserveBoundaries, const std::string& iName, const PasswordHash* iPasswordHash, Error* oError); - virtual ValData GetAttribute(uint16 iObject, uint16 iAttribute); + virtual Data GetAttribute(uint16 iObject, uint16 iAttribute); virtual uint32 GetPIN(); @@ -105,7 +105,7 @@ uint16 fObject; uint16 fAttribute; bool fFinished; - ValData fResult; + Data fResult; }; bool fGetAttributeSent; GetAttribute_t* fGetAttribute; Modified: trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host.h 2009-08-05 18:40:07 UTC (rev 912) +++ trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host.h 2009-08-05 18:55:34 UTC (rev 913) @@ -184,25 +184,25 @@ // ================================================================================================= #pragma mark - -#pragma mark * ValMapH +#pragma mark * MapH // Sketch of API -- value semantics is an issue. typedef NPVariantH ValH; -class ValMapH +class MapH : public ZRef<NPObjectH> { public: - ValMapH(); - ValMapH(const ValMapH& iOther); - ~ValMapH(); - ValMapH& operator=(const ValMapH& iOther); + MapH(); + MapH(const MapH& iOther); + ~MapH(); + MapH& operator=(const MapH& iOther); - ValMapH(const ZRef<NPObjectH>& iOther); - ValMapH& operator=(const ZRef<NPObjectH>& iOther); + MapH(const ZRef<NPObjectH>& iOther); + MapH& operator=(const ZRef<NPObjectH>& iOther); -// ValMap protocol +// Map protocol bool QGet(const string& iName, ValH& oVal) const; ValH DGet(const ValH& iDefault, const string& iName) const; ValH Get(const string& iName) const; Modified: trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host_Std.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host_Std.cpp 2009-08-05 18:40:07 UTC (rev 912) +++ trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host_Std.cpp 2009-08-05 18:55:34 UTC (rev 913) @@ -25,7 +25,7 @@ #include "zoolib/ZHTTP_Requests.h" #include "zoolib/ZLog.h" #include "zoolib/ZNet_Internet.h" -#include "zoolib/ZStream_ValData_T.h" +#include "zoolib/ZStream_Data_T.h" #include "zoolib/ZString.h" #include "zoolib/ZUtil_STL.h" #include "zoolib/ZWaiter.h" @@ -533,7 +533,7 @@ : public ZWaiter { public: - HTTPFetcher(Host_Std* iHost, const string& iURL, ZHTTP::ValData* iData, void* iNotifyData); + HTTPFetcher(Host_Std* iHost, const string& iURL, ZHTTP::Data* iData, void* iNotifyData); // From ZWaiter virtual bool Execute(); @@ -543,13 +543,13 @@ private: Host_Std* fHost; const string fURL; - ZHTTP::ValData fData; + ZHTTP::Data fData; void* fNotifyData; bool fIsPOST; }; Host_Std::HTTPFetcher::HTTPFetcher( - Host_Std* iHost, const string& iURL, ZHTTP::ValData* iData, void* iNotifyData) + Host_Std* iHost, const string& iURL, ZHTTP::Data* iData, void* iNotifyData) : fHost(iHost), fURL(iURL), fNotifyData(iNotifyData) @@ -570,13 +570,13 @@ try { string theURL = fURL; - ZHTTP::ValMap theHeaders; - ZHTTP::ValData theRawHeaders; + ZHTTP::Map theHeaders; + ZHTTP::Data theRawHeaders; ZRef<ZStreamerR> theStreamerR; if (fIsPOST) { theStreamerR = ZHTTP::sPostRaw( - theURL, ZStreamRPos_ValData_T<ZHTTP::ValData>(fData), nullptr, + theURL, ZStreamRPos_Data_T<ZHTTP::Data>(fData), nullptr, &theHeaders, &theRawHeaders); } else @@ -586,7 +586,7 @@ if (theStreamerR && fHost) { - const ZHTTP::ValMap theCT = theHeaders.Get("content-type").GetMap(); + const ZHTTP::Map theCT = theHeaders.Get("content-type").GetMap(); const string theMIME = theCT.Get("type").GetString() + "/" + theCT.Get("subtype").GetString(); @@ -602,7 +602,7 @@ if (fHost) { fHost->pHTTPFetcher( - this, fNotifyData, fURL, "", ZHTTP::ValData(), ZRef<ZStreamerR>()); + this, fNotifyData, fURL, "", ZHTTP::Data(), ZRef<ZStreamerR>()); } return false; @@ -622,7 +622,7 @@ public: Sender(Host* iHost, const NPP_t& iNPP_t, void* iNotifyData, - const std::string& iURL, const std::string& iMIME, const ZHTTP::ValData& iHeaders, + const std::string& iURL, const std::string& iMIME, const ZHTTP::Data& iHeaders, ZRef<ZStreamerR> iStreamerR); ~Sender(); @@ -636,14 +636,14 @@ void* fNotifyData; const string fURL; const string fMIME; - const ZHTTP::ValData fHeaders; + const ZHTTP::Data fHeaders; NPStream_Z fNPStream; ZRef<ZStreamerR> fStreamerR; }; Host_Std::Sender::Sender(Host* iHost, const NPP_t& iNPP_t, void* iNotifyData, - const std::string& iURL, const std::string& iMIME, const ZHTTP::ValData& iHeaders, + const std::string& iURL, const std::string& iMIME, const ZHTTP::Data& iHeaders, ZRef<ZStreamerR> iStreamerR) : fSentNew(false), fHost(iHost), @@ -916,7 +916,7 @@ if (theURL.substr(0, 5) == "http:") { - ZHTTP::ValData theData(buf, len); + ZHTTP::Data theData(buf, len); ZRef<HTTPFetcher> theFetcher = new HTTPFetcher(this, theURL, &theData, notifyData); fHTTPFetchers.Add(theFetcher); sStartWaiterRunner(theFetcher); @@ -967,7 +967,7 @@ {} void Host_Std::pHTTPFetcher(ZRef<HTTPFetcher> iHTTPFetcher, void* iNotifyData, - const std::string& iURL, const std::string& iMIME, const ZHTTP::ValData& iHeaders, + const std::string& iURL, const std::string& iMIME, const ZHTTP::Data& iHeaders, ZRef<ZStreamerR> iStreamerR) { fHTTPFetchers.Erase(iHTTPFetcher); @@ -1015,7 +1015,7 @@ void Host_Std::SendDataAsync( void* iNotifyData, - const std::string& iURL, const std::string& iMIME, const ZHTTP::ValData& iHeaders, + const std::string& iURL, const std::string& iMIME, const ZHTTP::Data& iHeaders, ZRef<ZStreamerR> iStreamerR) { Sender* theSender = new Sender(this, this->GetNPP(), Modified: trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.h 2009-08-05 18:40:07 UTC (rev 912) +++ trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.h 2009-08-05 18:55:34 UTC (rev 913) @@ -348,7 +348,7 @@ List& operator=(PIActionList iOther); List& operator=(Adopt_T<PIActionList> iOther); -// ZValList protocol +// ZList protocol size_t Count() const; void Clear(); @@ -378,7 +378,7 @@ ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES(Map, operator_bool_generator_type, operator_bool_type); public: - typedef ZValMapIndex_T<Map> Index_t; + typedef ZMapIndex_T<Map> Index_t; operator operator_bool_type() const; @@ -400,7 +400,7 @@ Map(KeyID iType, Adopt_T<PIActionDescriptor> iOther); Map(const string8& iType, Adopt_T<PIActionDescriptor> iOther); -// ZValMap protocol +// ZMap protocol void Clear(); bool QGet(KeyID iKey, Val& oVal) const; Modified: trunk/zoolib/source/cxx/zoolib/ZData_Any.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZData_Any.h 2009-08-05 18:40:07 UTC (rev 912) +++ trunk/zoolib/source/cxx/zoolib/ZData_Any.h 2009-08-05 18:55:34 UTC (rev 913) @@ -18,8 +18,8 @@ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ------------------------------------------------------------------------------------------------- */ -#ifndef __ZValData_Any__ -#define __ZValData_Any__ 1 +#ifndef __ZData_Any__ +#define __ZData_Any__ 1 #include "zconfig.h" #include "zoolib/ZAny.h" @@ -79,4 +79,4 @@ NAMESPACE_ZOOLIB_END -#endif // __ZValData_Any__ +#endif // __ZData_Any__ Modified: trunk/zoolib/source/cxx/zoolib/ZData_CFType.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZData_CFType.h 2009-08-05 18:40:07 UTC (rev 912) +++ trunk/zoolib/source/cxx/zoolib/ZData_CFType.h 2009-08-05 18:55:34 UTC (rev 913) @@ -18,8 +18,8 @@ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ------------------------------------------------------------------------------------------------- */ -#ifndef __ZValData_CFType__ -#define __ZValData_CFType__ 1 +#ifndef __ZData_CFType__ +#define __ZData_CFType__ 1 #include "zconfig.h" #include "zoolib/ZCONFIG_SPI.h" @@ -62,7 +62,7 @@ ZData_CFType(size_t iSize); ZData_CFType(const void* iSourceData, size_t iSize); -// ZValData protocol +// ZData protocol size_t GetSize() const; void SetSize(size_t iSize); @@ -88,4 +88,4 @@ #endif // ZCONFIG_SPI_Enabled(CFType) -#endif // __ZValData_CFType__ +#endif // __ZData_CFType__ Modified: trunk/zoolib/source/cxx/zoolib/ZHTTP.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZHTTP.cpp 2009-08-05 18:40:07 UTC (rev 912) +++ trunk/zoolib/source/cxx/zoolib/ZHTTP.cpp 2009-08-05 18:55:34 UTC (rev 913) @@ -53,7 +53,7 @@ #pragma mark - #pragma mark * Utility stuff -static void sAppend(ValMap& ioFields, const string& iName, const Val& iValue) +static void sAppend(Map& ioFields, const string& iName, const Val& iValue) { ioFields.Mutable(iName).MutableList().Append(iValue); } static uint32 sHexCharToUInt(char iChar) @@ -211,7 +211,7 @@ bool sOrganizeRanges(size_t iSourceSize, const Val& iRangeParam, vector<pair<size_t, size_t> >& oRanges) { - ValMap asMap = iRangeParam.GetMap(); + Map asMap = iRangeParam.GetMap(); int64 reqBegin; if (asMap.Get("begin").QGetInt64(reqBegin)) { @@ -315,7 +315,7 @@ return true; } -bool sReadHeaderNoParsing(const ZStreamR& iStream, ValMap* oFields) +bool sReadHeaderNoParsing(const ZStreamR& iStream, Map* oFields) { if (oFields) oFields->Clear(); @@ -331,7 +331,7 @@ } } -bool sReadHeaderLineNoParsing(const ZStreamU& iStream, ValMap* ioFields) +bool sReadHeaderLineNoParsing(const ZStreamU& iStream, Map* ioFields) { string fieldNameExact; if (!sReadFieldName(iStream, nullptr, &fieldNameExact)) @@ -349,7 +349,7 @@ return true; } -bool sReadHeader(const ZStreamR& iStream, ValMap* oFields) +bool sReadHeader(const ZStreamR& iStream, Map* oFields) { if (oFields) oFields->Clear(); @@ -365,7 +365,7 @@ } } -bool sReadHeaderLine(const ZStreamU& iStream, ValMap* ioFields) +bool sReadHeaderLine(const ZStreamU& iStream, Map* ioFields) { string fieldName; if (!sReadFieldName(iStream, &fieldName, nullptr)) @@ -441,7 +441,7 @@ if (ioFields) { - ValMap cookieMap = ioFields->Get("cookie").GetMap(); + Map cookieMap = ioFields->Get("cookie").GetMap(); cookieMap.Set(cookieName, cookieValue); ioFields->Set("cookie", cookieMap); } @@ -563,7 +563,7 @@ return result; } -void sParseParam(const string& iString, ValMap& oParam) +void sParseParam(const string& iString, Map& oParam) { string::size_type prevPos = 0; string::size_type pos; @@ -590,10 +590,10 @@ } } -bool sParseQuery(const string& iString, ValMap& oTuple) +bool sParseQuery(const string& iString, Map& oTuple) { return sParseQuery(ZStreamRPos_String(iString), oTuple); } -bool sParseQuery(const ZStreamU& iStream, ValMap& oTuple) +bool sParseQuery(const ZStreamU& iStream, Map& oTuple) { for (;;) { @@ -739,7 +739,7 @@ if (iVal.QGetString(result)) return result; - const ValList& theList = iVal.GetList(); + const List& theList = iVal.GetList(); if (theList.Count()) return theList.Get(0).GetString(); @@ -747,7 +747,7 @@ } static ZRef<ZStreamerR> sMakeStreamer_Transfer( - const ValMap& iHeader, ZRef<ZStreamerR> iStreamerR) + const Map& iHeader, ZRef<ZStreamerR> iStreamerR) { // According to the spec, if content is chunked, content-length must be ignored. // I've seen some pages being returned with transfer-encoding "chunked, chunked", which @@ -766,7 +766,7 @@ return iStreamerR; } -ZRef<ZStreamerR> sMakeContentStreamer(const ValMap& iHeader, ZRef<ZStreamerR> iStreamerR) +ZRef<ZStreamerR> sMakeContentStreamer(const Map& iHeader, ZRef<ZStreamerR> iStreamerR) { iStreamerR = sMakeStreamer_Transfer(iHeader, iStreamerR); @@ -775,7 +775,7 @@ return iStreamerR; } -ZRef<ZStreamerR> sMakeContentStreamer(const ValMap& iHeader, const ZStreamR& iStreamR) +ZRef<ZStreamerR> sMakeContentStreamer(const Map& iHeader, const ZStreamR& iStreamR) { return sMakeContentStreamer(iHeader, new ZStreamerR_Stream(iStreamR)); } @@ -804,15 +804,15 @@ } <\endcode> */ -bool sRead_accept(const ZStreamU& iStream, ValMap* ioFields) +bool sRead_accept(const ZStreamU& iStream, Map* ioFields) { for (;;) { - ValMap parameters; + Map parameters; string type, subtype; if (!sReadMediaType(iStream, &type, &subtype, ¶meters, nullptr, nullptr)) break; - ValMap temp; + Map temp; temp.Set("type", type); temp.Set("subtype", subtype); if (parameters) @@ -828,10 +828,10 @@ return true; } -//bool sRead_accept_charset(const ZStreamU& iStream, ValMap* ioFields); -//bool sRead_accept_encoding(const ZStreamU& iStream, ValMap* ioFields); +//bool sRead_accept_charset(const ZStreamU& iStream, Map* ioFields); +//bool sRead_accept_encoding(const ZStreamU& iStream, Map* ioFields); -bool sRead_accept_language(const ZStreamU& iStream, ValMap* ioFields) +bool sRead_accept_language(const ZStreamU& iStream, Map* ioFields) { for (;;) { @@ -841,10 +841,10 @@ if (!sReadLanguageTag(iStream, &languageTag)) break; - ValMap temp; + Map temp; temp.Set("tag", languageTag); - ValMap parameters; + Map parameters; for (;;) { sSkipLWS(iStream); @@ -872,13 +872,13 @@ return true; } -//bool sRead_authorization(const ZStreamU& iStream, ValMap* ioFields); -//bool sRead_from(const ZStreamU& iStream, ValMap* ioFields); -//bool sRead_host(const ZStreamU& iStream, ValMap* ioFields); +//bool sRead_authorization(const ZStreamU& iStream, Map* ioFields); +//bool sRead_from(const ZStreamU& iStream, Map* ioFields); +//bool sRead_host(const ZStreamU& iStream, Map* ioFields); -bool sRead_range(const ZStreamU& iStream, ValMap* ioFields) +bool sRead_range(const ZStreamU& iStream, Map* ioFields) { - ValMap theRange; + Map theRange; if (!sRead_range(iStream, theRange)) return false; @@ -895,7 +895,7 @@ bytes=x- { begin = int64(x); } // (x to the end) bytes=-y { last = int64(y); } // (last y) */ -bool sRead_range(const ZStreamU& iStream, ValMap& oRange) +bool sRead_range(const ZStreamU& iStream, Map& oRange) { sSkipLWS(iStream); @@ -943,19 +943,19 @@ } } -//bool sRead_referer(const ZStreamU& iStream, ValMap* ioFields); +//bool sRead_referer(const ZStreamU& iStream, Map* ioFields); // ================================================================================================= #pragma mark - #pragma mark * ZHTTP, response headers -bool sRead_www_authenticate(const ZStreamU& iStream, ValMap* ioFields); +bool sRead_www_authenticate(const ZStreamU& iStream, Map* ioFields); // ================================================================================================= #pragma mark - #pragma mark * ZHTTP, request or response headers -bool sRead_transfer_encoding(const ZStreamU& iStream, ValMap* ioFields) +bool sRead_transfer_encoding(const ZStreamU& iStream, Map* ioFields) { string encoding; if (!sRead_transfer_encoding(iStream, encoding)) @@ -981,9 +981,9 @@ #pragma mark - #pragma mark * ZHTTP, entity headers -bool sRead_content_disposition(const ZStreamU& iStream, ValMap* ioFields) +bool sRead_content_disposition(const ZStreamU& iStream, Map* ioFields) { - ValMap dispositionTuple; + Map dispositionTuple; if (!sRead_content_disposition(iStream, dispositionTuple)) return false; @@ -992,17 +992,17 @@ return true; } -bool sRead_content_disposition(const ZStreamU& iStream, ValMap& oTuple) +bool sRead_content_disposition(const ZStreamU& iStream, Map& oTuple) { sSkipLWS(iStream); string disposition; if (sReadToken(iStream, &disposition, nullptr)) { - ValMap dispositionTuple; + Map dispositionTuple; oTuple.Set("value", disposition); - ValMap parameters; + Map parameters; for (;;) { sSkipLWS(iStream); @@ -1025,10 +1025,10 @@ return false; } -bool sRead_content_encoding(const ZStreamU& iStream, ValMap* ioFields); -bool sRead_content_language(const ZStreamU& iStream, ValMap* ioFields); +bool sRead_content_encoding(const ZStreamU& iStream, Map* ioFields); +bool sRead_content_language(const ZStreamU& iStream, Map* ioFields); -bool sRead_content_length(const ZStreamU& iStream, ValMap* ioFields) +bool sRead_content_length(const ZStreamU& iStream, Map* ioFields) { int64 theLength; if (sRead_content_length(iStream, theLength)) @@ -1046,10 +1046,10 @@ return sReadInt64(iStream, &oLength); } -bool sRead_content_location(const ZStreamU& iStream, ValMap* ioFields); -bool sRead_content_md5(const ZStreamU& iStream, ValMap* ioFields); +bool sRead_content_location(const ZStreamU& iStream, Map* ioFields); +bool sRead_content_md5(const ZStreamU& iStream, Map* ioFields); -bool sRead_content_range(const ZStreamU& iStream, ValMap* ioFields) +bool sRead_content_range(const ZStreamU& iStream, Map* ioFields) { int64 begin, end, maxLength; if (!sRead_content_range(iStream, begin, end, maxLength)) @@ -1057,7 +1057,7 @@ if (ioFields) { - ValMap temp; + Map temp; temp.Set("begin", begin); temp.Set("end", end); temp.Set("maxlength", maxLength); @@ -1103,16 +1103,16 @@ return true; } -bool sRead_content_type(const ZStreamU& iStream, ValMap* ioFields) +bool sRead_content_type(const ZStreamU& iStream, Map* ioFields) { string type, subType; - ValMap parameters; + Map parameters; if (!sRead_content_type(iStream, type, subType, parameters)) return false; if (ioFields) { - ValMap temp; + Map temp; temp.Set("type", type); temp.Set("subtype", subType); if (parameters) @@ -1123,7 +1123,7 @@ } bool sRead_content_type(const ZStreamU& iStream, - string& oType, string& oSubType, ValMap& oParameters) + string& oType, string& oSubType, Map& oParameters) { if (!sReadMediaType(iStream, &oType, &oSubType, &oParameters, nullptr, nullptr)) return false; @@ -1252,7 +1252,7 @@ } bool sReadMediaType(const ZStreamU& iStream, - string* oType, string* oSubtype, ValMap* oParameters, + string* oType, string* oSubtype, Map* oParameters, string* oTypeExact, string* oSubtypeExact) { if (oType) Modified: trunk/zoolib/source/cxx/zoolib/ZHTTP.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZHTTP.h 2009-08-05 18:40:07 UTC (rev 912) +++ trunk/zoolib/source/cxx/zoolib/ZHTTP.h 2009-08-05 18:55:34 UTC (rev 913) @@ -34,9 +34,9 @@ namespace ZHTTP { typedef ZVal_ZooLib Val; -typedef ZData_ZooLib ValData; -typedef ZList_ZooLib ValList; -typedef ZMap_ZooLib ValMap; +typedef ZData_ZooLib Data; +typedef ZList_ZooLib List; +typedef ZMap_ZooLib Map; class StreamR_Chunked; class StreamW_Chunked; @@ -80,17 +80,17 @@ bool sReadResponse(const ZStreamU& iStream, int32* oResultCode, std::string* oResultMessage); -bool sReadHeaderNoParsing(const ZStreamR& iStream, ValMap* oFields); -bool sReadHeaderLineNoParsing(const ZStreamU& iStream, ValMap* ioFields); +bool sReadHeaderNoParsing(const ZStreamR& iStream, Map* oFields); +bool sReadHeaderLineNoParsing(const ZStreamU& iStream, Map* ioFields); -bool sReadHeader(const ZStreamR& iStream, ValMap* oFields); -bool sReadHeaderLine(const ZStreamU& iStream, ValMap* ioFields); +bool sReadHeader(const ZStreamR& iStream, Map* oFields); +bool sReadHeaderLine(const ZStreamU& iStream, Map* ioFields); // Temporary home for this. -void sParseParam(const std::string& iString, ValMap& oParam); +void sParseParam(const std::string& iString, Map& oParam); -bool sParseQuery(const std::string& iString, ValMap& oTuple); -bool sParseQuery(const ZStreamU& iStream, ValMap& oTuple); +bool sParseQuery(const std::string& iString, Map& oTuple); +bool sParseQuery(const ZStreamU& iStream, Map& oTuple); bool sDecodeComponent(const ZStreamU& s, std::string& oComponent); ZTrail sDecodeTrail(const ZStreamU& s); @@ -101,57 +101,57 @@ std::string sGetString0(const Val& iVal); -ZRef<ZStreamerR> sMakeContentStreamer(const ValMap& iHeader, ZRef<ZStreamerR> iStreamerR); -ZRef<ZStreamerR> sMakeContentStreamer(const ValMap& iHeader, const ZStreamR& iStreamR); +ZRef<ZStreamerR> sMakeContentStreamer(const Map& iHeader, ZRef<ZStreamerR> iStreamerR); +ZRef<ZStreamerR> sMakeContentStreamer(const Map& iHeader, const ZStreamR& iStreamR); // ================================================================================================= // Request headers -bool sRead_accept(const ZStreamU& iStream, ValMap* ioFields); -//bool sRead_accept_charset(const ZStreamU& iStream, ValMap* ioFields); // Not done -//bool sRead_accept_encoding(const ZStreamU& iStream, ValMap* ioFields); // Not done -bool sRead_accept_language(const ZStreamU& iStream, ValMap* ioFields); -//bool sRead_authorization(const ZStreamU& iStream, ValMap* ioFields); // Not done -//bool sRead_from(const ZStreamU& iStream, ValMap* ioFields); // Not done -//bool sRead_host(const ZStreamU& iStream, ValMap* ioFields); // Not done +bool sRead_accept(const ZStreamU& iStream, Map* ioFields); +//bool sRead_accept_charset(const ZStreamU& iStream, Map* ioFields); // Not done +//bool sRead_accept_encoding(const ZStreamU& iStream, Map* ioFields); // Not done +bool sRead_accept_language(const ZStreamU& iStream, Map* ioFields); +//bool sRead_authorization(const ZStreamU& iStream, Map* ioFields); // Not done +//bool sRead_from(const ZStreamU& iStream, Map* ioFields); // Not done +//bool sRead_host(const ZStreamU& iStream, Map* ioFields); // Not done -bool sRead_range(const ZStreamU& iStream, ValMap* ioFields); -bool sRead_range(const ZStreamU& iStream, ValMap& oRange); +bool sRead_range(const ZStreamU& iStream, Map* ioFields); +bool sRead_range(const ZStreamU& iStream, Map& oRange); -//bool sRead_referer(const ZStreamU& iStream, ValMap* ioFields); // Not done +//bool sRead_referer(const ZStreamU& iStream, Map* ioFields); // Not done // ================================================================================================= // Response headers -bool sRead_www_authenticate(const ZStreamU& iStream, ValMap* ioFields); // Not done +bool sRead_www_authenticate(const ZStreamU& iStream, Map* ioFields); // Not done // ================================================================================================= // Request or response headers -bool sRead_transfer_encoding(const ZStreamU& iStream, ValMap* ioFields); +bool sRead_transfer_encoding(const ZStreamU& iStream, Map* ioFields); bool sRead_transfer_encoding(const ZStreamU& iStream, std::string& oEncoding); // ================================================================================================= // Entity headers -bool sRead_content_disposition(const ZStreamU& iStream, ValMap* ioFields); -bool sRead_content_disposition(const ZStreamU& iStream, ValMap& oTuple); +bool sRead_content_disposition(const ZStreamU& iStream, Map* ioFields); +bool sRead_content_disposition(const ZStreamU& iStream, Map& oTuple); -bool sRead_content_encoding(const ZStreamU& iStream, ValMap* ioFields); // Not done -bool sRead_content_language(const ZStreamU& iStream, ValMap* ioFields); // Not done +bool sRead_content_encoding(const ZStreamU& iStream, Map* ioFields); // Not done +bool sRead_content_language(const ZStreamU& iStream, Map* ioFields); // Not done -bool sRead_content_length(const ZStreamU& iStream, ValMap* ioFields); +bool sRead_content_length(const ZStreamU& iStream, Map* ioFields); bool sRead_content_length(const ZStreamU& iStream, int64& oLength); -bool sRead_content_location(const ZStreamU& iStream, ValMap* ioFields); // Not done -bool sRead_content_md5(const ZStreamU& iStream, ValMap* ioFields); // Not done +bool sRead_content_location(const ZStreamU& iStream, Map* ioFields); // Not done +bool sRead_content_md5(const ZStreamU& iStream, Map* ioFields); // Not done -bool sRead_content_range(const ZStreamU& iStream, ValMap* ioFields); +bool sRead_content_range(const ZStreamU& iStream, Map* ioFields); bool sRead_content_range(const ZStreamU& iStream, int64& oBegin, int64& oEnd, int64& oMaxLength); -bool sRead_content_type(const ZStreamU& iStream, ValMap* ioFields); +bool sRead_content_type(const ZStreamU& iStream, Map* ioFields); bool sRead_content_type( - const ZStreamU& iStream, std::string& oType, std::string& oSubType, ValMap& oParameters); + const ZStreamU& iStream, std::string& oType, std::string& oSubType, Map& oParameters); // ================================================================================================= @@ -168,7 +168,7 @@ const ZStreamU& iStream, std::string* oName, std::string* oValue, std::string* oNameExact); bool sReadMediaType(const ZStreamU& iStream, - std::string* oType, std::string* oSubtype, ValMap* oParameters, + std::string* oType, std::string* oSubtype, Map* oParameters, std::string* oTypeExact, std::string* oSubtypeExact); bool sReadLanguageTag(const ZStreamU& iStream, std::string* oLanguageTag); Modified: trunk/zoolib/source/cxx/zoolib/ZHTTP_Requests.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZHTTP_Requests.cpp 2009-08-05 18:40:07 UTC (rev 912) +++ trunk/zoolib/source/cxx/zoolib/ZHTTP_Requests.cpp 2009-08-05 18:55:34 UTC (rev 913) @@ -26,7 +26,7 @@ #include "zoolib/ZStreamR_SkipAllOnDestroy.h" #include "zoolib/ZStream_String.h" #include "zoolib/ZStream_Tee.h" -#include "zoolib/ZStream_ValData_T.h" +#include "zoolib/ZStream_Data_T.h" #include "zoolib/ZStrim_Stream.h" #include "zoolib/ZStrimmer.h" #include "zoolib/ZStrimmer_Stream.h" @@ -45,7 +45,7 @@ #pragma mark - #pragma mark * ZHTTP -static bool spReadResponse(const ZStreamR& r, int32* oResponseCode, ValMap* oHeader) +static bool spReadResponse(const ZStreamR& r, int32* oResponseCode, Map* oHeader) { ZMIME::StreamR_Header theSIH_Server(r); @@ -65,7 +65,7 @@ static bool spRequest(const ZStreamW& w, const ZStreamR& r, const string& iMethod, const string& iHost, const string& iPath, bool iSendConnectionClose, - int32* oResponseCode, ValMap* oHeader, ValData* oRawHeader) + int32* oResponseCode, Map* oHeader, Data* oRawHeader) { w.WriteString(iMethod); w.WriteString(" "); @@ -81,8 +81,8 @@ if (oRawHeader) { - ZStreamRWPos_ValData_T<ValData> theSRWP_ValData(*oRawHeader); - ZStreamR_Tee theStream_Tee(r, theSRWP_ValData); + ZStreamRWPos_Data_T<Data> theSRWP_Data(*oRawHeader); + ZStreamR_Tee theStream_Tee(r, theSRWP_Data); return spReadResponse(theStream_Tee, oResponseCode, oHeader); } else @@ -93,7 +93,7 @@ ZRef<ZStreamerR> sRequest( const string& iMethod, string& ioURL, - int32* oResultCode, ValMap* oFields, ValData* oRawHeader) + int32* oResultCode, Map* oFields, Data* oRawHeader) { for (bool keepGoing = true; keepGoing; /*no inc*/) { @@ -111,7 +111,7 @@ break; int32 theResponseCode; - ValMap theHeaders; + Map theHeaders; if (!spRequest( theEndpoint->GetStreamW(), theEndpoint->GetStreamR(), iMethod, theHost, thePath, @@ -174,12 +174,12 @@ } static bool spPost_Suffix(const ZStreamR& r, - int32* oResponseCode, ValMap* oHeader, ValData* oRawHeader) + int32* oResponseCode, Map* oHeader, Data* oRawHeader) { if (oRawHeader) { - ZStreamRWPos_ValData_T<ValData> theSRWP_ValData(*oRawHeader); - ZStreamR_Tee theStream_Tee(r, theSRWP_ValData); + ZStreamRWPos_Data_T<Data> theSRWP_Data(*oRawHeader); + ZStreamR_Tee theStream_Tee(r, theSRWP_Data); return spReadResponse(theStream_Tee, oResponseCode, oHeader); } else @@ -190,7 +190,7 @@ ZRef<ZStreamerR> sPost( const std::string& iURL, const ZStreamR& iBody, - int32* oResultCode, ValMap* oFields, ValData* oRawHeader) + int32* oResultCode, Map* oFields, Data* oRawHeader) { string theHost; ip_port thePort; @@ -222,7 +222,7 @@ w.Flush(); int32 theResponseCode; - ValMap theHeaders; + Map theHeaders; if (spPost_Suffix(r, &theResponseCode, &theHeaders, oRawHeader)) { if (200 == theResponseCode) @@ -246,7 +246,7 @@ ZRef<ZStreamerR> sPostRaw( const std::string& iURL, const ZStreamR& iBody, - int32* oResultCode, ValMap* oFields, ValData* oRawHeader) + int32* oResultCode, Map* oFields, Data* oRawHeader) { string theHost; ip_port thePort; @@ -264,7 +264,7 @@ w.Flush(); int32 theResponseCode; - ValMap theHeaders; + Map theHeaders; if (spPost_Suffix(r, &theResponseCode, &theHeaders, oRawHeader)) { if (200 == theResponseCode) @@ -288,9 +288,9 @@ // ================================================================================================= #pragma mark - -#pragma mark * ZHTTP, read a POST into a ValMap +#pragma mark * ZHTTP, read a POST into a Map -static ZRef<ZStrimmerR> spCreateStrimmerR(const ValMap& iHeader, const ZStreamR& iStreamR) +static ZRef<ZStrimmerR> spCreateStrimmerR(const Map& iHeader, const ZStreamR& iStreamR) { const string charset = iHeader .Get("content-type").GetMap() @@ -322,14 +322,14 @@ return gotAny; } -static bool spReadPOST(const ZStreamR& iStreamR, const ValMap& iHeader, Val& oVal) +static bool spReadPOST(const ZStreamR& iStreamR, const Map& iHeader, Val& oVal) { - const ValMap content_type = iHeader.Get("content-type").GetMap(); + const Map content_type = iHeader.Get("content-type").GetMap(); if (content_type.Get("type").GetString() == "application" && content_type.Get("subtype").GetString() == "x-www-url-encoded") { - // It's application/x-www-url-encoded. So we're going to unpack it into a ValMap. - // ValMap& theTuple = oVal.SetMutableTuple(); + // It's application/x-www-url-encoded. So we're going to unpack it into a Map. + // Map& theTuple = oVal.SetMutableTuple(); // yadda yadda. //#warning "not done yet" return true; @@ -345,7 +345,7 @@ ZStreamR_Boundary(baseBoundary, iStreamR).SkipAll(); const string boundary = "\r\n--" + baseBoundary; - ValMap theMap; + Map theMap; for (;;) { bool done = false; @@ -374,15 +374,15 @@ // We're now sitting at the beginning of the part's header. ZStreamR_Boundary streamPart(boundary, iStreamR); - // We parse it into the ValMap called 'header'. - ValMap header; + // We parse it into the Map called 'header'. + Map header; sReadHeader( ZStreamR_SkipAllOnDestroy(ZMIME::StreamR_Header(streamPart)), &header); - ValMap contentDisposition = header.Get("content-disposition").GetMap(); + Map contentDisposition = header.Get("content-disposition").GetMap(); if (contentDisposition.Get("value").GetString() == "form-data") { - const ValMap parameters = contentDisposition.Get("parameters").GetMap(); + const Map parameters = contentDisposition.Get("parameters").GetMap(); const string name = parameters.Get("name").GetString(); if (!name.empty()) { @@ -414,7 +414,7 @@ } // It's some other kind of content. Put it into a raw. - oVal = sReadAll_T<ValData>(iStreamR); + oVal = sReadAll_T<Data>(iStreamR); return true; } Modified: trunk/zoolib/source/cxx/zoolib/ZHTTP_Requests.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZHTTP_Requests.h 2009-08-05 18:40:07 UTC (rev 912) +++ trunk/zoolib/source/cxx/zoolib/ZHTTP_Requests.h 2009-08-05 18:55:34 UTC (rev 913) @@ -34,15 +34,15 @@ ZRef<ZStreamerR> sRequest( const std::string& iMethod, std::string& ioURL, - int32* oResultCode, ValMap* oFields, ValData* oRawHeader); + int32* oResultCode, Map* oFields, Data* oRawHeader); ZRef<ZStreamerR> sPost( const std::string& iURL, const ZStreamR& iBody, - int32* oResultCode, ValMap* oFields, ValData* oRawHeader); + int32* oResultCode, Map* oFields, Data* oRawHeader); ZRef<ZStreamerR> sPostRaw( const std::string& iURL, const ZStreamR& iBody, - int32* oResultCode, ValMap* oFields, ValData* oRawHeader); + int32* oResultCode, Map* oFields, Data* oRawHeader); } // namespace ZHTTP Modified: trunk/zoolib/source/cxx/zoolib/ZMemoryBlock.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZMemoryBlock.h 2009-08-05 18:40:07 UTC (rev 912) +++ trunk/zoolib/source/cxx/zoolib/ZMemoryBlock.h 2009-08-05 18:55:34 UTC (rev 913) @@ -23,14 +23,14 @@ #include "zconfig.h" #include "zoolib/ZData_Any.h" -#include "zoolib/ZStream_ValData_T.h" +#include "zoolib/ZStream_Data_T.h" NAMESPACE_ZOOLIB_BEGIN typedef ZData_Any ZMemoryBlock; -typedef ZStreamRPos_ValData_T<ZMemoryBlock> ZStreamRPos_MemoryBlock; -typedef ZStreamRWPos_ValData_T<ZMemoryBlock> ZStreamRWPos_MemoryBlock; +typedef ZStreamRPos_Data_T<ZMemoryBlock> ZStreamRPos_MemoryBlock; +typedef ZStreamRWPos_Data_T<ZMemoryBlock> ZStreamRWPos_MemoryBlock; NAMESPACE_ZOOLIB_END Copied: trunk/zoolib/source/cxx/zoolib/ZStream_Data_T.h (from rev 796, trunk/zoolib/source/cxx/zoolib/ZStream_ValData_T.h) =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZStream_Data_T.h (rev 0) +++ trunk/zoolib/source/cxx/zoolib/ZStream_Data_T.h 2009-08-05 18:55:34 UTC (rev 913) @@ -0,0 +1,213 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2009 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#ifndef __ZStream_Data_T__ +#define __ZStream_Data_T__ 1 +#include "zconfig.h" + +#include "zoolib/ZStream.h" + +NAMESPACE_ZOOLIB_BEGIN + +// ================================================================================================= +#pragma mark - +#pragma mark * ZStreamRPos_Data_T + +template <class T> +class ZStreamRPos_Data_T : public ZStreamRPos + { +public: + ZStreamRPos_Data_T(const T& iData) + : fData(iData), + fPosition(0) + {} + + ~ZStreamRPos_Data_T() + {} + +// From ZStreamR via ZStreamRPos + virtual void Imp_Read(void* iDest, size_t iCount, size_t* oCountRead) + { + size_t countToCopy = ZStream::sClampedSize(iCount, fData.GetSize(), fPosition); + fData.CopyTo(fPosition, iDest, countToCopy); + fPosition += countToCopy; + + if (oCountRead) + *oCountRead = countToCopy; + } + + virtual void Imp_Skip(uint64 iCount, uint64* oCountSkipped) + { + size_t realSkip = ZStream::sClampedSize(iCount, fData.GetSize(), fPosition); + fPosition += realSkip; + if (oCountSkipped) + *oCountSkipped = realSkip; + } + +// From ZStreamRPos + virtual uint64 Imp_GetPosition() + { return fPosition; } + + virtual void Imp_SetPosition(uint64 iPosition) + { fPosition = iPosition; } + + virtual uint64 Imp_GetSize() + { return fData.GetSize(); } + +private: + T fData; + uint64 fPosition; + }; + +// ================================================================================================= +#pragma mark - +#pragma mark * ZStreamRWPos_Data_T + +template <class T> +class ZStreamRWPos_Data_T : public ZStreamRWPos + { +public: + ZStreamRWPos_Data_T(T& iData, size_t iGrowIncrement) + : fData(iData) + { + fGrowIncrement = iGrowIncrement; + fPosition = 0; + fSizeLogical = fData.GetSize(); + } + + ZStreamRWPos_Data_T(T& iData) + : fData(iData) + { + fGrowIncrement = 64; + fPosition = 0; + fSizeLogical = fData.GetSize(); + } + + ~ZStreamRWPos_Data_T() + { + // Finally, make sure the Data is the real size, not the potentially + // overallocated size we've been using + fData.SetSize(fSizeLogical); + } + +// From ZStreamR via ZStreamRWPos + virtual void Imp_Read(void* iDest, size_t iCount, size_t* oCountRead) + { + const size_t countToCopy = ZStream::sClampedSize(iCount, fSizeLogical, fPosition); + fData.CopyTo(fPosition, iDest, countToCopy); + fPosition += countToCopy; + + if (oCountRead) + *oCountRead = countToCopy; + } + + virtual void Imp_Skip(uint64 iCount, uint64* oCountSkipped) + { + const size_t realSkip = ZStream::sClampedSize(iCount, fSizeLogical, fPosition); + fPosition += realSkip; + if (oCountSkipped) + *oCountSkipped = realSkip; + } + +// From ZStreamW via ZStreamRWPos + virtual void Imp_Write(const void* iSource, size_t iCount, size_t* oCountWritten) + { + const uint64 neededSpace = fPosition + iCount; + if (fData.GetSize() < neededSpace) + { + const uint64 realSize = std::max(neededSpace, uint64(fData.GetSize()) + fGrowIncrement); + fData.SetSize(ZStream::sClampedSize(realSize)); + } + + size_t countToCopy = ZStream::sClampedSize(iCount, fData.GetSize(), fPosition); + + fData.CopyFrom(fPosition, iSource, iCount); + + fPosition += countToCopy; + + if (fSizeLogical < fPosition) + fSizeLogical = fPosition; + + if (oCountWritten) + *oCountWritten = countToCopy; + } + + virtual void Imp_Flush() + { fData.SetSize(fSizeLogical); } + +// From ZStreamRPos/ZStreamWPos via ZStreamRWPos + virtual uint64 Imp_GetPosition() + { return fPosition; } + + virtual void Imp_SetPosition(uint64 iPosition) + { fPosition = iPosition; } + + virtual uint64 Imp_GetSize() + { return fSizeLogical; } + +// From ZStreamWPos via ZStreamRWPos + virtual void Imp_SetSize(uint64 iSize) + { + const size_t realSize = iSize; + if (realSize != iSize) + sThrowBadSize(); + + fData.SetSize(realSize); + fSizeLogical = realSize; + } + +private: + T& fData; + size_t fGrowIncrement; + uint64 fPosition; + size_t fSizeLogical; + }; + +// ================================================================================================= +#pragma mark - +#pragma mark * Data stream reading functions + +template <class T> +void sReadAll_T(T& ioData, const ZStreamR& iStreamR) + { ZStreamRWPos_Data_T<T>(ioData).CopyAllFrom(iStreamR); } + +template <class T> +void sRead_T(T& ioData, const ZStreamR& iStreamR, size_t iSize) + { ZStreamRWPos_Data_T<T>(ioData).CopyFrom(iStreamR, iSize); } + +template <class T> +T sReadAll_T(const ZStreamR& iStreamR) + { + T theData; + sReadAll_T<T>(theData, iStreamR); + return theData; + } + +template <class T> +T sReadAll(const ZStreamR& iStreamR, size_t iSize) + { + T theData; + sRead_T<T>(theData, iStreamR, iSize); + return theData; + } + +NAMESPACE_ZOOLIB_END + +#endif // __ZStream_Data_T__ Deleted: trunk/zoolib/source/cxx/zoolib/ZStream_ValData_T.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZStream_ValData_T.h 2009-08-05 18:40:07 UTC (rev 912) +++ trunk/zoolib/source/cxx/zoolib/ZStream_ValData_T.h 2009-08-05 18:55:34 UTC (rev 913) @@ -1,213 +0,0 @@ -/* ------------------------------------------------------------------------------------------------- -Copyright (c) 2009 Andrew Green -http://www.zoolib.org - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software -and associated documentation files (the "Software"), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, merge, publish, distribute, -sublicense, and/or sell copies of the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING -BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES -OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------------------------- */ - -#ifndef __ZStream_ValData_T__ -#define __ZStream_ValData_T__ 1 -#include "zconfig.h" - -#include "zoolib/ZStream.h" - -NAMESPACE_ZOOLIB_BEGIN - -// ================================================================================================= -#pragma mark - -#pragma mark * ZStreamRPos_ValData_T - -template <class T> -class ZStreamRPos_ValData_T : public ZStreamRPos - { -public: - ZStreamRPos_ValData_T(const T& iValData) - : fValData(iValData), - fPosition(0) - {} - - ~ZStreamRPos_ValData_T() - {} - -// From ZStreamR via ZStreamRPos - virtual void Imp_Read(void* iDest, size_t iCount, size_t* oCountRead) - { - size_t countToCopy = ZStream::sClampedSize(iCount, fValData.GetSize(), fPosition); - fValData.CopyTo(fPosition, iDest, countToCopy); - fPosition += countToCopy; - - if (oCountRead) - *oCountRead = countToCopy; - } - - virtual void Imp_Skip(uint64 iCount, uint64* oCountSkipped) - { - size_t realSkip = ZStream::sClampedSize(iCount, fValData.GetSize(), fPosition); - fPosition += realSkip; - if (oCountSkipped) - *oCountSkipped = realSkip; - } - -// From ZStreamRPos - virtual uint64 Imp_GetPosition() - { return fPosition; } - - virtual void Imp_SetPosition(uint64 iPosition) - { fPosition = iPosition; } - - virtual uint64 Imp_GetSize() - { return fValData.GetSize(); } - -private: - T fValData; - uint64 fPosition; - }; - -// ================================================================================================= -#pragma mark - -#pragma mark * ZStreamRWPos_ValData_T - -template <class T> -class ZStreamRWPos_ValData_T : public ZStreamRWPos - { -public: - ZStreamRWPos_ValData_T(T& iValData, size_t iGrowIncrement) - : fValData(iValData) - { - fGrowIncrement = iGrowIncrement; - fPosition = 0; - fSizeLogical = fValData.GetSize(); - } - - ZStreamRWPos_ValData_T(T& iValData) - : fValData(iValData) - { - fGrowIncrement = 64; - fPosition = 0; - fSizeLogical = fValData.GetSize(); - } - - ~ZStreamRWPos_ValData_T() - { - // Finally, make sure the Data is the real size, not the potentially - // overallocated size we've been using - fValData.SetSize(fSizeLogical); - } - -// From ZStreamR via ZStreamRWPos - virtual void Imp_Read(void* iDest, size_t iCount, size_t* oCountRead) - { - const size_t countToCopy = ZStream::sClampedSize(iCount, fSizeLogical, fPosition); - fValData.CopyTo(fPosition, iDest, countToCopy); - fPosition += countToCopy; - - if (oCountRead) - *oCountRead = countToCopy; - } - - virtual void Imp_Skip(uint64 iCount, uint64* oCountSkipped) - { - const size_t realSkip = ZStream::sClampedSize(iCount, fSizeLogical, fPosition); - fPosition += realSkip; - if (oCountSkipped) - *oCountSkipped = realSkip; - } - -// From ZStreamW via ZStreamRWPos - virtual void Imp_Write(const void* iSource, size_t iCount, size_t* oCountWritten) - { - const uint64 neededSpace = fPosition + iCount; - if (fValData.GetSize() < neededSpace) - { - const uint64 realSize = std::max(neededSpace, uint64(fValData.GetSize()) + fGrowIncrement); - fValData.SetSize(ZStream::sClampedSize(realSize)); - } - - size_t countToCopy = ZStream::sClampedSize(iCount, fValData.GetSize(), fPosition); - - fValData.CopyFrom(fPosition, iSource, iCount); - - fPosition += countToCopy; - - if (fSizeLogical < fPosition) - fSizeLogical = fPosition; - - if (oCountWritten) - *oCountWritten = countToCopy; - } - - virtual void Imp_Flush() - { fValData.SetSize(fSizeLogical); } - -// From ZStreamRPos/ZStreamWPos via ZStreamRWPos - virtual uint64 Imp_GetPosition() - { return fPosition; } - - virtual void Imp_SetPosition(uint64 iPosition) - { fPosition = iPosition; } - - virtual uint64 Imp_GetSize() - { return fSizeLogical; } - -// From ZStreamWPos via ZStreamRWPos - virtual void Imp_SetSize(uint64 iSize) - { - const size_t realSize = iSize; - if (realSize != iSize) - sThrowBadSize(); - - fValData.SetSize(realSize); - fSizeLogical = realSize; - } - -private: - T& fValData; - size_t fGrowIncrement; - uint64 fPosition; - size_t fSizeLogical; - }; - -// ================================================================================================= -#pragma mark - -#pragma mark * Data stream reading functions - -template <class T> -void sReadAll_T(T& ioValData, const ZStreamR& iStreamR) - { ZStreamRWPos_ValData_T<T>(ioValData).CopyAllFrom(iStreamR); } - -template <class T> -void sRead_T(T& ioValData, const ZStreamR& iStreamR, size_t iSize) - { ZStreamRWPos_ValData_T<T>(ioValData).CopyFrom(iStreamR, iSize); } - -template <class T> -T sReadAll_T(const ZStreamR& iStreamR) - { - T theData; - sReadAll_T<T>(theData, iStreamR); - return theData; - } - -template <class T> -T sReadAll(const ZStreamR& iStreamR, size_t iSize) - { - T theData; - sRead_T<T>(theData, iStreamR, iSize); - return theData; - } - -NAMESPACE_ZOOLIB_END - -#endif // __ZStream_ValData_T__ Modified: trunk/zoolib/source/cxx/zoolib/ZTuple.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZTuple.cpp 2009-08-05 18:40:07 UTC (rev 912) +++ trunk/zoolib/source/cxx/zoolib/ZTuple.cpp 2009-08-05 18:55:34 UTC (rev 913) @@ -98,7 +98,7 @@ #pragma mark - #pragma mark * ZMap_ZooLib typename accessors -#define ZMACRO_ZValMapAccessors_Def_Entry(Name_t, TYPENAME, TYPE) \ +#define ZMACRO_ZMapAccessors_Def_Entry(Name_t, TYPENAME, TYPE) \ bool ZTuple::QGet##TYPENAME(Name_t iName, TYPE& oVal) const \ { \ ZVal_ZooLib theVal; \ @@ -118,23 +118,23 @@ void ZTuple::Set##TYPENAME(Name_t iName, const TYPE& iVal) \ { return this->Set(iName, iVal); } \ -#define ZMACRO_ZValMapAccessors_Def(Name_t) \ - ZMACRO_ZValMapAccessors_Def_Entry(Name_t, ID, uint64) \ - ZMACRO_ZValMapAccessors_Def_Entry(Name_t, Int8, int8) \ - ZMACRO_ZValMapAccessors_Def_Entry(Name_t, Int16, int16) \ - ZMACRO_ZValMapAccessors_Def_Entry(Name_t, Int32, int32) \ - ZMACRO_ZValMapAccessors_Def_Entry(Name_t, Int64, int64) \ - ZMACRO_ZValMapAccessors_Def_Entry(Name_t, Bool, bool) \ - ZMACRO_ZValMapAccessors_Def_Entry(Name_t, Float, float) \ - ZMACRO_ZValMapAccessors_Def_Entry(Name_t, Double, double) \ - ZMACRO_ZValMapAccessors_Def_Entry(Name_t, String, std::string) \ - ZMACRO_ZValMapAccessors_Def_Entry(Name_t, Time, ZTime) \ +#define ZMACRO_ZMapAccessors_Def(Name_t) \ + ZMACRO_ZMapAccessors_Def_Entry(Name_t, ID, uint64) \ + ZMACRO_ZMapAccessors_Def_Entry(Name_t, Int8, int8) \ + ZMACRO_ZMapAccessors_Def_Entry(Name_t, Int16, int16) \ + ZMACRO_ZMapAccessors_Def_Entry(Name_t, Int32, int32) \ + ZMACRO_ZMapAccessors_Def_Entry(Name_t, Int64, int64) \ + ZMACRO_ZMapAccessors_Def_Entry(Name_t, Bool, bool) \ + ZMACRO_ZMapAccessors_Def_Entry(Name_t, Float, float) \ + ZMACRO_ZMapAccessors_Def_Entry(Name_t, Double, double) \ + ZMACRO_ZMapAccessors_Def_Entry(Name_t, String, std::string) \ + ZMACRO_ZMapAccessors_Def_Entry(Name_t, Time, ZTime) \ -ZMACRO_ZValMapAccessors_Def(const char*) -ZMACRO_ZValMapAccessors_Def(const ZTName&) -ZMACRO_ZValMapAccessors_Def(const_iterator) +ZMACRO_ZMapAccessors_Def(const char*) +ZMACRO_ZMapAccessors_Def(const ZTName&) +ZMACRO_ZMapAccessors_Def(const_iterator) -#undef ZMACRO_ZValMapAccessors_Def_Entry -#undef ZMACRO_ZValMapAccessors_Def +#undef ZMACRO_ZMapAccessors_Def_Entry +#undef ZMACRO_ZMapAccessors_Def NAMESPACE_ZOOLIB_END Modified: trunk/zoolib/source/cxx/zoolib/ZTuple.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZTuple.h 2009-08-05 18:40:07 UTC (rev 912) +++ trunk/zoolib/source/cxx/zoolib/ZTuple.h 2009-08-05 18:55:34 UTC (rev 913) @@ -32,23 +32,23 @@ #pragma mark - #pragma mark * ZTuple -#define ZMACRO_ZValMapAccessors_Decl_Entry(T, Name_t, TYPENAME, TYPE) \ +#define ZMACRO_ZMapAccessors_Decl_Entry(T, Name_t, TYPENAME, TYPE) \ bool QGet##TYPENAME(Name_t iName, TYPE& oVal) const; \ TYPE DGet##TYPENAME(Name_t iName, const TYPE& iDefault) const; \ TYPE Get##TYPENAME(Name_t iName) const; \ void Set##TYPENAME(Name_t iName, const TYPE& iVal); \ -#define ZMACRO_ZValMapAccessors_Decl(T, Name_t) \ - ZMACRO_ZValMapAccessors_Decl_Entry(T, Name_t, ID, uint64) \ - ZMACRO_ZValMapAccessors_Decl_Entry(T, Name_t, Int8, int8) \ - ZMACRO_ZValMapAccessors_Decl_Entry(T, Name_t, Int16, int16) \ - ZMACRO_ZValMapAccessors_Decl_Entry(T, Name_t, Int32, int32) \ - ZMACRO_ZValMapAccessors_Decl_Entry(T, Name_t, Int64, int64) \ - ZMACRO_ZValMapAccessors_Decl_Entry(T, Name_t, Bool, bool) \ - ZMACRO_ZValMapAccessors_Decl_Entry(T, Name_t, Float, float) \ - ZMACRO_ZValMapAccessors_Decl_Entry(T, Name_t, Double, double) \ - ZMACRO_ZValMapAccessors_Decl_Entry(T, Name_t, String, std::string) \ - ZMACRO_ZValMapAccessors_Decl_Entry(T, Name_t, Time, ZTime) \ +#define ZMACRO_ZMapAccessors_Decl(T, Name_t) \ + ZMACRO_ZMapAccessors_Decl_Entry(T, Name_t, ID, uint64) \ + ZMACRO_ZMapAccessors_Decl_Entry(T, Name_t, Int8, int8) \ + ZMACRO_ZMapAccessors_Decl_Entry(T, Name_t, Int16, int16) \ + ZMACRO_ZMapAccessors_Decl_Entry(T, Name_t, Int32, int32) \ + ZMACRO_ZMapAccessors_Decl_Entry(T, Name_t, Int64, int64) \ + ZMACRO_ZMapAccessors_Decl_Entry(T, Name_t, Bool, bool) \ + ZMACRO_ZMapAccessors_Decl_Entry(T, Name_t, Float, float) \ + ZMACRO_ZMapAccessors_Decl_Entry(T, Name_t, Double, double) \ + ZMACRO_ZMapAccessors_Decl_Entry(T, Name_t, String, std::string) \ + ZMACRO_ZMapAccessors_Decl_Entry(T, Name_t, Time, ZTime) \ class ZTuple : public ZMap_ZooLib { @@ -85,13 +85,13 @@ { return this->IndexOf(iPropName); } // Typename accessors - ZMACRO_ZValMapAccessors_Decl(ZMap_ZooLib, const char*) - ZMACRO_ZValMapAccessors_Decl(ZMap_ZooLib, const ZTName&) - ZMACRO_ZValMapAccessors_Decl(ZMap_ZooLib, const_iterator) + ZMACRO_ZMapAccessors_Decl(ZMap_ZooLib, const char*) + ZMACRO_ZMapAccessors_Decl(ZMap_ZooLib, const ZTName&) + ZMACRO_ZMapAccessors_Decl(ZMap_ZooLib, const_iterator) }; -#undef ZMACRO_ZValMapAccessors_Decl_Entry -#undef ZMACRO_ZValMapAccessors_Decl +#undef ZMACRO_ZMapAccessors_Decl_Entry +#undef ZMACRO_ZMapAccessors_Decl NAMESPACE_ZOOLIB_END Modified: trunk/zoolib/source/cxx/zoolib/ZVal.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZVal.h 2009-08-05 18:40:07 UTC (rev 912) +++ trunk/zoolib/source/cxx/zoolib/ZVal.h 2009-08-05 18:55:34 UTC (rev 913) @@ -107,34 +107,34 @@ // ================================================================================================= #pragma mark - -#pragma mark * ZValMapIndex_T +#pragma mark * ZMapIndex_T template <class T> -class ZValMapIndex_T +class ZMapIndex_T { public: - ZValMapIndex_T() : fVal(0) {} - ZValMapIndex_T(const ZValMapIndex_T& iOther) : fVal(iOther.fVal) {} - ~ZValMapIndex_T() {} - ZValMapIndex_T& operator=(const ZValMapIndex_T& iOther) + ZMapIndex_T() : fVal(0) {} + ZMapIndex_T(const ZMapIndex_T& iOther) : fVal(iOther.fVal) {} + ~ZMapIndex_T() {} + ZMapIndex_T& operator=(const ZMapIndex_T& iOther) { fVal = iOther.fVal; return *this; } - explicit ZValMapIndex_T(size_t iVal) : fVal(iVal) {} + explicit ZMapIndex_T(size_t iVal) : fVal(iVal) {} - ZValMapIndex_T& operator++() + ZMapIndex_T& operator++() { ++fVal; return *this; } - ZValMapIndex_T operator++(int) - { return ZValMapIndex_T(fVal++); } + ZMapIndex_T operator++(int) + { return ZMapIndex_T(fVal++); } - bool operator==(const ZValMapIndex_T& iOther) const { return fVal == iOther.fVal; } - bool operator!=(const ZValMapIndex_T& iOther) const { return fVal != iOther.fVal; } + bool operator==(const ZMapIndex_T& iOther) const { return fVal == iOther.fVal; } + bool operator!=(const ZMapIndex_T& iOther) const { return fVal != iOther.fVal; } size_t GetIndex() const { return fVal; } Modified: trunk/zoolib/source/cxx/zoolib/ZVal_Any.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZVal_Any.h 2009-08-05 18:... [truncated message content] |
From: <ag...@us...> - 2009-08-06 20:24:53
|
Revision: 914 http://zoolib.svn.sourceforge.net/zoolib/?rev=914&view=rev Author: agreen Date: 2009-08-06 20:24:41 +0000 (Thu, 06 Aug 2009) Log Message: ----------- More tweaks. Modified Paths: -------------- trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.cpp trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.h trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Yad.cpp trunk/zoolib/source/cxx/zoolib/ZAny.h trunk/zoolib/source/cxx/zoolib/ZData_Any.h 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/ZVal_CFType.h trunk/zoolib/source/cxx/zoolib/ZVal_ZooLib.cpp trunk/zoolib/source/cxx/zoolib/ZVal_ZooLib.h trunk/zoolib/source/cxx/zoolib/ZYad_Any.cpp trunk/zoolib/source/cxx/zoolib/ZYad_AppleEvent.cpp trunk/zoolib/source/cxx/zoolib/ZYad_Bencode.cpp trunk/zoolib/source/cxx/zoolib/ZYad_Std.cpp trunk/zoolib/source/cxx/zoolib/ZYad_Std.h trunk/zoolib/source/cxx/zoolib/ZYad_ZooLib.cpp trunk/zoolib/source/cxx/zoolib/ZYad_ZooLib.h Modified: trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.cpp 2009-08-05 18:55:34 UTC (rev 913) +++ trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.cpp 2009-08-06 20:24:41 UTC (rev 914) @@ -996,6 +996,9 @@ Val::operator operator_bool_type() const { return operator_bool_generator_type::translate(fAny.type() != typeid(void)); } +ZVal_Any Val::AsVal_Any() const + { return this->AsVal_Any(ZVal_Any()); } + ZVal_Any Val::AsVal_Any(const ZVal_Any& iDefault) const { if (const Map* theVal = ZAnyCast<Map>(&fAny)) @@ -1227,6 +1230,9 @@ List::operator operator_bool_type() const { return operator_bool_generator_type::translate(this->Count()); } +ZList_Any List::AsList_Any() const + { return this->AsList_Any(ZVal_Any()); } + ZList_Any List::AsList_Any(const ZVal_Any& iDefault) const { ZList_Any theList; @@ -1356,6 +1362,9 @@ Map::operator operator_bool_type() const { return operator_bool_generator_type::translate(this->pCount()); } +ZMap_Any Map::AsMap_Any() const + { return this->AsMap_Any(ZVal_Any()); } + ZMap_Any Map::AsMap_Any(const ZVal_Any& iDefault) const { ZMap_Any theMap; Modified: trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.h 2009-08-05 18:55:34 UTC (rev 913) +++ trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.h 2009-08-06 20:24:41 UTC (rev 914) @@ -265,6 +265,7 @@ public: operator operator_bool_type() const; + ZVal_Any AsVal_Any() const; ZVal_Any AsVal_Any(const ZVal_Any& iDefault) const; void swap(Val& iOther); @@ -333,6 +334,7 @@ public: operator operator_bool_type() const; + ZList_Any AsList_Any() const; ZList_Any AsList_Any(const ZVal_Any& iDefault) const; void swap(List& iOther); @@ -382,6 +384,7 @@ operator operator_bool_type() const; + ZMap_Any AsMap_Any() const; ZMap_Any AsMap_Any(const ZVal_Any& iDefault) const; void swap(Map& iOther); Modified: trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Yad.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Yad.cpp 2009-08-05 18:55:34 UTC (rev 913) +++ trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Yad.cpp 2009-08-06 20:24:41 UTC (rev 914) @@ -99,7 +99,7 @@ theMap.Set("!Type", string("UnitFloat")); theMap.Set("UnitID", spIntAsVal(asUnitFloat.fUnitID)); theMap.Set("Value", asUnitFloat.fValue); - return new ZYadMapRPos_Any(theMap); + return sMakeYadR(theMap); } Enumerated asEnumerated; @@ -109,7 +109,7 @@ theMap.Set("!Type", string("Enumerated")); theMap.Set("UnitID", spIntAsVal(asEnumerated.fEnumType)); theMap.Set("Value", spIntAsVal(asEnumerated.fValue)); - return new ZYadMapRPos_Any(theMap); + return sMakeYadR(theMap); } FileRef asFileRef; @@ -119,7 +119,7 @@ theMap.Set("!Type", string("FileRef")); theMap.Set("PathPOSIX", asFileRef.AsPathPOSIX()); theMap.Set("PathNative", asFileRef.AsPathNative()); - return new ZYadMapRPos_Any(theMap); + return sMakeYadR(theMap); } Spec asSpec; @@ -127,10 +127,10 @@ { ZMap_Any theMap; theMap.Set("!Type", string("Spec")); - return new ZYadMapRPos_Any(theMap); + return sMakeYadR(theMap); } - return new ZYadPrimR_Std(iVal.AsVal_Any(ZVal_Any())); + return new ZYadPrimR_Std(iVal.AsVal_Any()); } ZRef<ZYadListR> sMakeYadR(const List& iList) Modified: trunk/zoolib/source/cxx/zoolib/ZAny.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZAny.h 2009-08-05 18:55:34 UTC (rev 913) +++ trunk/zoolib/source/cxx/zoolib/ZAny.h 2009-08-06 20:24:41 UTC (rev 914) @@ -84,10 +84,10 @@ } ZAny& swap(ZAny& rhs); - + bool empty() const; const std::type_info & type() const; - + private: class placeholder { @@ -97,52 +97,53 @@ virtual const std::type_info& type() const = 0; virtual placeholder* clone() const = 0; }; - + template<typename ValueType> class holder : public placeholder { - public: + public: holder(const ValueType& value) : held(value) {} - + virtual const std::type_info& type() const { return typeid(ValueType); } - + virtual placeholder* clone() const { return new holder(held); } - + ValueType held; - + private: // intentionally left unimplemented holder& operator=(const holder&); }; - -#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS -private: // representation + +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS + public: // so ZAnyCast can be non-friend +#else +private: template<typename ValueType> friend ValueType* ZAnyCast(ZAny*); template<typename ValueType> friend const ValueType* ZAnyCast(const ZAny*); -#else - public: // representation (public so any_cast can be non-friend) -#endif - placeholder* content; +#endif + + placeholder* content; }; template<typename ValueType> ValueType* ZAnyCast(ZAny* operand) { - return operand && operand->type() == typeid(ValueType) - ? &static_cast<ZAny::holder<ValueType>*>(operand->content)->held - : 0; + if (!operand || operand->type() != typeid(ValueType)) + return 0; + return &static_cast<ZAny::holder<ValueType>*>(operand->content)->held; } template<typename ValueType> const ValueType* ZAnyCast(const ZAny* operand) { - return operand && operand->type() == typeid(ValueType) - ? &static_cast<ZAny::holder<ValueType>*>(operand->content)->held - : 0; + if (!operand || operand->type() != typeid(ValueType)) + return 0; + return &static_cast<ZAny::holder<ValueType>*>(operand->content)->held; } NAMESPACE_ZOOLIB_END Modified: trunk/zoolib/source/cxx/zoolib/ZData_Any.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZData_Any.h 2009-08-05 18:55:34 UTC (rev 913) +++ trunk/zoolib/source/cxx/zoolib/ZData_Any.h 2009-08-06 20:24:41 UTC (rev 914) @@ -22,7 +22,6 @@ #define __ZData_Any__ 1 #include "zconfig.h" -#include "zoolib/ZAny.h" #include "zoolib/ZCompat_operator_bool.h" #include "zoolib/ZCompare.h" #include "zoolib/ZRef.h" Modified: trunk/zoolib/source/cxx/zoolib/ZVal_Any.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZVal_Any.cpp 2009-08-05 18:55:34 UTC (rev 913) +++ trunk/zoolib/source/cxx/zoolib/ZVal_Any.cpp 2009-08-06 20:24:41 UTC (rev 914) @@ -26,6 +26,9 @@ #pragma mark - #pragma mark * ZVal_Any +ZVal_Any ZVal_Any::AsVal_Any() + { return *this; } + ZVal_Any ZVal_Any::AsVal_Any(const ZVal_Any& iDefault) { return *this; } @@ -36,7 +39,7 @@ {} ZVal_Any::ZVal_Any(const ZVal_Any& iOther) -: inherited(iOther) +: inherited(static_cast<const ZAny&>(iOther)) {} ZVal_Any::~ZVal_Any() @@ -44,7 +47,7 @@ ZVal_Any& ZVal_Any::operator=(const ZVal_Any& iOther) { - inherited::operator=(iOther); + inherited::operator=(static_cast<const ZAny&>(iOther)); return *this; } @@ -73,27 +76,23 @@ #pragma mark - #pragma mark * ZList_Any::Rep -class ZList_Any::Rep -: public ZRefCounted - { -public: - Rep() {} +ZList_Any::Rep::Rep() + {} - virtual ~Rep() {} +ZList_Any::Rep::~Rep() + {} - Rep(const vector<ZAny>& iVector) - : fVector(iVector) - {} +ZList_Any::Rep::Rep(const vector<ZAny>& iVector) +: fVector(iVector) + {} -private: - vector<ZAny> fVector; - friend class ZList_Any; - }; - // ================================================================================================= #pragma mark - #pragma mark * ZList_Any +ZList_Any ZList_Any::AsList_Any() + { return *this; } + ZList_Any ZList_Any::AsList_Any(const ZVal_Any& iDefault) { return *this; } @@ -162,6 +161,16 @@ return ZVal_Any(); } +ZVal_Any* ZList_Any::PGet(size_t iIndex) + { + if (fRep && iIndex < fRep->fVector.size()) + { + this->pTouch(); + return static_cast<ZVal_Any*>(&fRep->fVector[iIndex]); + } + return nullptr; + } + void ZList_Any::Set(size_t iIndex, const ZVal_Any& iVal) { if (fRep && iIndex < fRep->fVector.size()) @@ -225,6 +234,9 @@ static map<string, ZAny> spEmptyMap; +ZMap_Any ZMap_Any::AsMap_Any() + { return *this; } + ZMap_Any ZMap_Any::AsMap_Any(const ZVal_Any& iDefault) { return *this; } @@ -320,6 +332,26 @@ return ZVal_Any(); } +ZVal_Any* ZMap_Any::PGet(const string8& iName) + { + if (fRep) + { + this->pTouch(); + Index_t theIndex = fRep->fMap.find(iName); + if (theIndex != fRep->fMap.end()) + return static_cast<ZVal_Any*>(&(*theIndex).second); + } + return nullptr; + } + +ZVal_Any* ZMap_Any::PGet(const Index_t& iIndex) + { + map<string, ZAny>::iterator theIndex = this->pTouch(iIndex); + if (theIndex != this->End()) + return static_cast<ZVal_Any*>(&(*theIndex).second); + return nullptr; + } + void ZMap_Any::Set(const string8& iName, const ZVal_Any& iVal) { this->pTouch(); Modified: trunk/zoolib/source/cxx/zoolib/ZVal_Any.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZVal_Any.h 2009-08-05 18:55:34 UTC (rev 913) +++ trunk/zoolib/source/cxx/zoolib/ZVal_Any.h 2009-08-06 20:24:41 UTC (rev 914) @@ -23,6 +23,7 @@ #include "zconfig.h" #include "zoolib/ZCONFIG_SPI.h" +#include "zoolib/ZAny.h" #include "zoolib/ZCompat_operator_bool.h" #include "zoolib/ZData_Any.h" #include "zoolib/ZRef.h" @@ -58,6 +59,7 @@ typedef ZAny inherited; public: + ZVal_Any AsVal_Any(); ZVal_Any AsVal_Any(const ZVal_Any& iDefault); operator operator_bool_type() const; @@ -114,11 +116,24 @@ } template <class S> + S* PGet_T() + { return ZAnyCast<S>(this); } + + template <class S> + const S* PGet_T() const + { return ZAnyCast<S>(this); } + + template <class S> void Set_T(const S& iVal) { ZAny::operator=(iVal); } +// Our protocol + template <class S> + bool Is_T() const + { return ZAnyCast<S>(this); } + // Typename accessors ZMACRO_ZValAccessors_Decl_Entry(ZVal_Any, Data, ZData_Any) ZMACRO_ZValAccessors_Decl_Entry(ZVal_Any, List, ZList_Any) @@ -131,12 +146,13 @@ class ZList_Any { - ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES(ZMap_Any, + ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES(ZList_Any, operator_bool_generator_type, operator_bool_type); class Rep; public: + ZList_Any AsList_Any(); ZList_Any AsList_Any(const ZVal_Any& iDefault); operator operator_bool_type() const; @@ -150,6 +166,9 @@ ZList_Any& operator=(vector<ZAny>& iOther); + template <class Iterator> + ZList_Any(Iterator begin, Iterator end); + // ZList protocol size_t Count() const; @@ -158,6 +177,7 @@ bool QGet(size_t iIndex, ZVal_Any& oVal) const; ZVal_Any DGet(const ZVal_Any& iDefault, size_t iIndex) const; ZVal_Any Get(size_t iIndex) const; + ZVal_Any* PGet(size_t iIndex); void Set(size_t iIndex, const ZVal_Any& iVal); @@ -175,6 +195,37 @@ // ================================================================================================= #pragma mark - +#pragma mark * ZList_Any::Rep + +class ZList_Any::Rep +: public ZRefCounted + { +private: + Rep(); + virtual ~Rep(); + + Rep(const vector<ZAny>& iVector); + + template <class Iterator> + Rep(Iterator begin, Iterator end) + : fVector(begin, end) + {} + + vector<ZAny> fVector; + friend class ZList_Any; + }; + +// ================================================================================================= +#pragma mark - +#pragma mark * ZList_Any, inline templated constructor + +template <class Iterator> +ZList_Any::ZList_Any(Iterator begin, Iterator end) +: fRep(new Rep(begin, end)) + {} + +// ================================================================================================= +#pragma mark - #pragma mark * ZMap_Any class ZMap_Any @@ -187,6 +238,7 @@ public: typedef map<string, ZAny>::iterator Index_t; + ZMap_Any AsMap_Any(); ZMap_Any AsMap_Any(const ZVal_Any& iDefault); operator operator_bool_type() const; @@ -199,11 +251,11 @@ ZMap_Any(const map<string, ZAny>& iOther); ZMap_Any& operator=(map<string, ZAny>& iOther); - template <class T> - ZMap_Any(const vector<pair<string, T> >& iOther); + template <class Container> + ZMap_Any(const Container& iContainer); - template <class T> - ZMap_Any(const map<string, T>& iOther); + template <class Iterator> + ZMap_Any(Iterator begin, Iterator end); // ZMap protocol void Clear(); @@ -217,6 +269,9 @@ ZVal_Any Get(const string8& iName) const; ZVal_Any Get(const Index_t& iIndex) const; + ZVal_Any* PGet(const string8& iName); + ZVal_Any* PGet(const Index_t& iIndex); + void Set(const string8& iName, const ZVal_Any& iVal); void Set(const Index_t& iIndex, const ZVal_Any& iVal); @@ -246,7 +301,7 @@ class ZMap_Any::Rep : public ZRefCounted { -public: +private: Rep(); virtual ~Rep(); @@ -257,23 +312,22 @@ : fMap(begin, end) {} -private: map<string, ZAny> fMap; friend class ZMap_Any; }; // ================================================================================================= #pragma mark - -#pragma mark * ZMap_Any, inline templated constructors +#pragma mark * ZMap_Any, inline templated constructor -template <class T> -ZMap_Any::ZMap_Any(const vector<pair<string, T> >& iOther) -: fRep(new Rep(iOther.begin(), iOther.end())) +template <class Container> +ZMap_Any::ZMap_Any(const Container& iContainer) +: fRep(new Rep(iContainer.begin(), iContainer.end())) {} -template <class T> -ZMap_Any::ZMap_Any(const map<string, T>& iOther) -: fRep(new Rep(iOther.begin(), iOther.end())) +template <class Iterator> +ZMap_Any::ZMap_Any(Iterator begin, Iterator end) +: fRep(new Rep(begin, end)) {} NAMESPACE_ZOOLIB_END Modified: trunk/zoolib/source/cxx/zoolib/ZVal_AppleEvent.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZVal_AppleEvent.cpp 2009-08-05 18:55:34 UTC (rev 913) +++ trunk/zoolib/source/cxx/zoolib/ZVal_AppleEvent.cpp 2009-08-06 20:24:41 UTC (rev 914) @@ -199,6 +199,9 @@ #pragma mark - #pragma mark * ZVal_AppleEvent +ZVal_Any ZVal_AppleEvent::AsVal_Any() const + { return this->AsVal_Any(ZVal_Any()); } + ZVal_Any ZVal_AppleEvent::AsVal_Any(const ZVal_Any& iDefault) const { return spAsVal_Any(*this, iDefault); } @@ -416,6 +419,9 @@ #pragma mark - #pragma mark * ZList_AppleEvent +ZList_Any ZList_AppleEvent::AsList_Any() const + { return this->AsList_Any(ZVal_Any()); } + ZList_Any ZList_AppleEvent::AsList_Any(const ZVal_Any& iDefault) const { return spAsList_Any(*this, iDefault); } @@ -531,6 +537,9 @@ #pragma mark - #pragma mark * ZMap_AppleEvent +ZMap_Any ZMap_AppleEvent::AsMap_Any() const + { return this->AsMap_Any(ZVal_Any()); } + ZMap_Any ZMap_AppleEvent::AsMap_Any(const ZVal_Any& iDefault) const { return spAsMap_Any(*this, iDefault); } Modified: trunk/zoolib/source/cxx/zoolib/ZVal_AppleEvent.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZVal_AppleEvent.h 2009-08-05 18:55:34 UTC (rev 913) +++ trunk/zoolib/source/cxx/zoolib/ZVal_AppleEvent.h 2009-08-06 20:24:41 UTC (rev 914) @@ -56,6 +56,7 @@ operator_bool_generator_type, operator_bool_type); public: + ZVal_Any AsVal_Any() const; ZVal_Any AsVal_Any(const ZVal_Any& iDefault) const; operator operator_bool_type() const; @@ -126,10 +127,11 @@ class ZList_AppleEvent : public AEDescList { - ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES(ZMap_AppleEvent, + ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES(ZList_AppleEvent, operator_bool_generator_type, operator_bool_type); public: + ZList_Any AsList_Any() const; ZList_Any AsList_Any(const ZVal_Any& iDefault) const; operator operator_bool_type() const; @@ -176,6 +178,7 @@ public: typedef ZMapIndex_T<ZMap_AppleEvent> Index_t; + ZMap_Any AsMap_Any() const; ZMap_Any AsMap_Any(const ZVal_Any& iDefault) const; operator operator_bool_type() const; Modified: trunk/zoolib/source/cxx/zoolib/ZVal_CFType.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZVal_CFType.cpp 2009-08-05 18:55:34 UTC (rev 913) +++ trunk/zoolib/source/cxx/zoolib/ZVal_CFType.cpp 2009-08-06 20:24:41 UTC (rev 914) @@ -71,6 +71,9 @@ bool ZVal_CFType::sFromAny(const ZAny& iAny, ZVal_CFType& oVal) { return ZUtil_CFType::sAsCFType(iAny, oVal); } +ZVal_Any ZVal_CFType::AsVal_Any() const + { return this->AsVal_Any(ZVal_Any()); } + ZVal_Any ZVal_CFType::AsVal_Any(const ZVal_Any& iDefault) const { return ZUtil_CFType::sAsVal_Any(this, iDefault); } @@ -379,6 +382,9 @@ #pragma mark - #pragma mark * ZList_CFType +ZList_Any ZList_CFType::AsList_Any() const + { return this->AsList_Any(ZVal_Any()); } + ZList_Any ZList_CFType::AsList_Any(const ZVal_Any& iDefault) const { return ZUtil_CFType::sAsList_Any(this->pArray(), iDefault); } @@ -527,6 +533,9 @@ #pragma mark - #pragma mark * ZMap_CFType +ZMap_Any ZMap_CFType::AsMap_Any() const + { return this->AsMap_Any(ZVal_Any()); } + ZMap_Any ZMap_CFType::AsMap_Any(const ZVal_Any& iDefault) const { return ZUtil_CFType::sAsMap_Any(this->pDictionary(), iDefault); } Modified: trunk/zoolib/source/cxx/zoolib/ZVal_CFType.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZVal_CFType.h 2009-08-05 18:55:34 UTC (rev 913) +++ trunk/zoolib/source/cxx/zoolib/ZVal_CFType.h 2009-08-06 20:24:41 UTC (rev 914) @@ -53,6 +53,8 @@ typedef ZRef<CFTypeRef> inherited; public: bool sFromAny(const ZAny& iAny, ZVal_CFType& oVal); + + ZVal_Any AsVal_Any() const; ZVal_Any AsVal_Any(const ZVal_Any& iDefault) const; operator bool() const; @@ -113,7 +115,9 @@ : public ZRef<CFArrayRef> { typedef ZRef<CFArrayRef> inherited; + public: + ZList_Any AsList_Any() const; ZList_Any AsList_Any(const ZVal_Any& iDefault) const; operator bool() const; @@ -163,7 +167,9 @@ : public ZRef<CFDictionaryRef> { typedef ZRef<CFDictionaryRef> inherited; + public: + ZMap_Any AsMap_Any() const; ZMap_Any AsMap_Any(const ZVal_Any& iDefault) const; operator bool() const; Modified: trunk/zoolib/source/cxx/zoolib/ZVal_ZooLib.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZVal_ZooLib.cpp 2009-08-05 18:55:34 UTC (rev 913) +++ trunk/zoolib/source/cxx/zoolib/ZVal_ZooLib.cpp 2009-08-06 20:24:41 UTC (rev 914) @@ -305,6 +305,11 @@ else oVal = ZData_ZooLib(); } + else if (const ZData_Any* theValue = ZAnyCast<ZData_Any>(&iAny)) + { + // This relies on the fact that ZData_ZooLib is a typedef of ZData_Any. + oVal = *theValue; + } else if (const vector<ZAny>* theValue = ZAnyCast<vector<ZAny> >(&iAny)) { ZList_ZooLib theList; @@ -363,6 +368,9 @@ return true; } +ZVal_Any ZVal_ZooLib::AsVal_Any() const + { return this->AsVal_Any(ZVal_Any()); } + ZVal_Any ZVal_ZooLib::AsVal_Any(const ZVal_Any& iDefault) const { switch (fType.fType) @@ -1753,6 +1761,9 @@ #pragma mark - #pragma mark * ZList_ZooLib +ZList_Any ZList_ZooLib::AsList_Any() const + { return this->AsList_Any(ZVal_Any()); } + ZList_Any ZList_ZooLib::AsList_Any(const ZVal_Any& iDefault) const { ZList_Any theList; @@ -2030,6 +2041,9 @@ #pragma mark - #pragma mark * ZMap_ZooLib +ZMap_Any ZMap_ZooLib::AsMap_Any() const + { return this->AsMap_Any(ZVal_Any()); } + ZMap_Any ZMap_ZooLib::AsMap_Any(const ZVal_Any& iDefault) const { ZMap_Any theMap; Modified: trunk/zoolib/source/cxx/zoolib/ZVal_ZooLib.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZVal_ZooLib.h 2009-08-05 18:55:34 UTC (rev 913) +++ trunk/zoolib/source/cxx/zoolib/ZVal_ZooLib.h 2009-08-06 20:24:41 UTC (rev 914) @@ -74,6 +74,8 @@ public: static bool sFromAny(const ZAny& iAny, ZVal_ZooLib& oVal); + + ZVal_Any AsVal_Any() const; ZVal_Any AsVal_Any(const ZVal_Any& iDefault) const; operator operator_bool_type() const; @@ -256,6 +258,7 @@ class Rep; public: + ZList_Any AsList_Any() const; ZList_Any AsList_Any(const ZVal_Any& iDefault) const; operator operator_bool_type() const; @@ -384,6 +387,7 @@ typedef std::vector<NameVal> PropList; typedef PropList::iterator Index_t; + ZMap_Any AsMap_Any() const; ZMap_Any AsMap_Any(const ZVal_Any& iDefault) const; operator operator_bool_type() const; Modified: trunk/zoolib/source/cxx/zoolib/ZYad_Any.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZYad_Any.cpp 2009-08-05 18:55:34 UTC (rev 913) +++ trunk/zoolib/source/cxx/zoolib/ZYad_Any.cpp 2009-08-06 20:24:41 UTC (rev 914) @@ -31,22 +31,18 @@ ZRef<ZYadR> sMakeYadR(const ZVal_Any& iVal) { - ZMap_Any asMap; - if (iVal.QGet_T<ZMap_Any>(asMap)) - return new ZYadMapRPos_Any(asMap); + if (const ZMap_Any* theVal = iVal.PGet_T<ZMap_Any>()) + return sMakeYadR(*theVal); - ZList_Any asList; - if (iVal.QGet_T<ZList_Any>(asList)) - return new ZYadListRPos_Any(asList); - - string8 asString; - if (iVal.QGet_T<string8>(asString)) - return new ZYadStrimU_String(asString); + if (const ZList_Any* theVal = iVal.PGet_T<ZList_Any>()) + return sMakeYadR(*theVal); - ZData_Any asData; - if (iVal.QGet_T<ZData_Any>(asData)) - return new ZYadStreamRPos_Any(asData); + if (const string8* theVal = iVal.PGet_T<string8>()) + return sMakeYadR(*theVal); + if (const ZData_Any* theVal = iVal.PGet_T<ZData_Any>()) + return new ZYadStreamRPos_Any(*theVal); + return new ZYadPrimR_Std(iVal); } Modified: trunk/zoolib/source/cxx/zoolib/ZYad_AppleEvent.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZYad_AppleEvent.cpp 2009-08-05 18:55:34 UTC (rev 913) +++ trunk/zoolib/source/cxx/zoolib/ZYad_AppleEvent.cpp 2009-08-06 20:24:41 UTC (rev 914) @@ -62,7 +62,7 @@ string8 asString; if (iVal.QGetString(asString)) - return new ZYadStrimU_String(asString); + return sMakeYadR(asString); // if (iVal.QGetData(asData)) // return new ZYadStreamRPos_AppleEvent(asData); Modified: trunk/zoolib/source/cxx/zoolib/ZYad_Bencode.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZYad_Bencode.cpp 2009-08-05 18:55:34 UTC (rev 913) +++ trunk/zoolib/source/cxx/zoolib/ZYad_Bencode.cpp 2009-08-06 20:24:41 UTC (rev 914) @@ -125,11 +125,11 @@ if (countSkipped == 0) { // We skipped no code units, so theString is valid UTF8. - return new ZYadStrimU_String(theString); + return sMakeYadR(theString); } else { - return new ZYadStreamRPos_Any(ZData_Any(theString.data(), theLength)); + return sMakeYadR(ZData_Any(theString.data(), theLength)); } } Modified: trunk/zoolib/source/cxx/zoolib/ZYad_Std.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZYad_Std.cpp 2009-08-05 18:55:34 UTC (rev 913) +++ trunk/zoolib/source/cxx/zoolib/ZYad_Std.cpp 2009-08-06 20:24:41 UTC (rev 914) @@ -52,17 +52,6 @@ // ================================================================================================= #pragma mark - -#pragma mark * ZYadStrimU_String - -ZYadStrimU_String::ZYadStrimU_String(const string& iString) -: ZStrimmerU_String(iString) - {} - -bool ZYadStrimU_String::IsSimple(const ZYadOptions& iOptions) - { return true; } - -// ================================================================================================= -#pragma mark - #pragma mark * ZYadListR_Std ZYadListR_Std::ZYadListR_Std() @@ -125,4 +114,36 @@ return fValue; } +// ================================================================================================= +#pragma mark - +#pragma mark * sMakeYadR + +namespace ZANONYMOUS { + +typedef ZStrimmerU_T<ZStrimU_String> StrimmerU_String; + +class YadStrimU_String +: public ZYadStrimR, + public StrimmerU_String + { +public: + YadStrimU_String(const std::string& iString); + +// From ZYadR + virtual bool IsSimple(const ZYadOptions& iOptions); + }; + + +YadStrimU_String::YadStrimU_String(const string& iString) +: StrimmerU_String(iString) + {} + +bool YadStrimU_String::IsSimple(const ZYadOptions& iOptions) + { return true; } + +} // anonymous namespace + +ZRef<ZYadR> sMakeYadR(const string& iVal) + { return new YadStrimU_String(iVal); } + NAMESPACE_ZOOLIB_END Modified: trunk/zoolib/source/cxx/zoolib/ZYad_Std.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZYad_Std.h 2009-08-05 18:55:34 UTC (rev 913) +++ trunk/zoolib/source/cxx/zoolib/ZYad_Std.h 2009-08-06 20:24:41 UTC (rev 914) @@ -58,23 +58,6 @@ // ================================================================================================= #pragma mark - -#pragma mark * ZYadStrimU_String - -typedef ZStrimmerU_T<ZStrimU_String> ZStrimmerU_String; - -class ZYadStrimU_String -: public ZYadStrimR, - public ZStrimmerU_String - { -public: - ZYadStrimU_String(const std::string& iString); - -// From ZYadR - virtual bool IsSimple(const ZYadOptions& iOptions); - }; - -// ================================================================================================= -#pragma mark - #pragma mark * ZYadListR_Std class ZYadListR_Std @@ -123,6 +106,12 @@ ZRef<ZYadR> fValue; }; +// ================================================================================================= +#pragma mark - +#pragma mark * sMakeYadR + +ZRef<ZYadR> sMakeYadR(const std::string& iVal); + NAMESPACE_ZOOLIB_END #endif // __ZYad_Std__ Modified: trunk/zoolib/source/cxx/zoolib/ZYad_ZooLib.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZYad_ZooLib.cpp 2009-08-05 18:55:34 UTC (rev 913) +++ trunk/zoolib/source/cxx/zoolib/ZYad_ZooLib.cpp 2009-08-06 20:24:41 UTC (rev 914) @@ -96,17 +96,6 @@ // ================================================================================================= #pragma mark - -#pragma mark * ZYadR_ZooLib - -ZYadR_ZooLib::ZYadR_ZooLib() - {} - -ZYadR_ZooLib::ZYadR_ZooLib(const ZVal_ZooLib& iVal) -: YadBase_t(iVal) - {} - -// ================================================================================================= -#pragma mark - #pragma mark * ZYadPrimR_ZooLib ZYadPrimR_ZooLib::ZYadPrimR_ZooLib() @@ -124,7 +113,7 @@ { return spIsSimple(iOptions, fVal); } ZAny ZYadPrimR_ZooLib::AsAny() - { return fVal.AsVal_Any(ZVal_Any()); } + { return fVal.AsVal_Any(); } // ================================================================================================= #pragma mark - @@ -168,10 +157,10 @@ { switch (iVal.TypeOf()) { - case eZType_Vector: return new ZYadListRPos_ZooLib(iVal.GetList()); - case eZType_Tuple: return new ZYadMapRPos_ZooLib(iVal.GetMap()); + case eZType_Vector: return sMakeYadR(iVal.GetList()); + case eZType_Tuple: return sMakeYadR(iVal.GetMap()); case eZType_Raw: return new ZYadStreamRPos_ZooLib(iVal.GetData()); - case eZType_String: return new ZYadStrimU_String(iVal.GetString()); + case eZType_String: return sMakeYadR(iVal.GetString()); } return new ZYadPrimR_ZooLib(iVal); Modified: trunk/zoolib/source/cxx/zoolib/ZYad_ZooLib.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZYad_ZooLib.h 2009-08-05 18:55:34 UTC (rev 913) +++ trunk/zoolib/source/cxx/zoolib/ZYad_ZooLib.h 2009-08-06 20:24:41 UTC (rev 914) @@ -32,13 +32,7 @@ #pragma mark - #pragma mark * ZYadR_ZooLib -class ZYadR_ZooLib -: public ZYadR_Val_T<ZVal_ZooLib> - { -public: - ZYadR_ZooLib(); - ZYadR_ZooLib(const ZVal_ZooLib& iVal); - }; +typedef ZYadR_Val_T<ZVal_ZooLib> ZYadR_ZooLib; // ================================================================================================= #pragma mark - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2009-08-08 02:10:27
|
Revision: 920 http://zoolib.svn.sourceforge.net/zoolib/?rev=920&view=rev Author: agreen Date: 2009-08-08 02:10:13 +0000 (Sat, 08 Aug 2009) Log Message: ----------- Conform to other changes. Modified Paths: -------------- trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Condition.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBSpec.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex_General.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex_String.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex_T.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleQuisitioner.cpp trunk/zoolib/source/cxx/old/zoolib/ZDCPixmap_Asset_BMP.cpp trunk/zoolib/source/cxx/old/zoolib/ZDC_GDI.cpp trunk/zoolib/source/cxx/old/zoolib/ZTS_Umbrella.cpp trunk/zoolib/source/cxx/old/zoolib/ZTS_Umbrella.h Modified: trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Condition.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Condition.cpp 2009-08-08 02:09:04 UTC (rev 919) +++ trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Condition.cpp 2009-08-08 02:10:13 UTC (rev 920) @@ -106,7 +106,7 @@ {} const ZTValue& ComparandRep_Name::Imp_GetValue(const ZTuple& iTuple) - { return iTuple.RGet(fName); } + { return *iTuple.PGet(fName); } void ComparandRep_Name::GatherPropNames(set<ZTName>& ioNames) { ioNames.insert(fName); } Modified: trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBSpec.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBSpec.cpp 2009-08-08 02:09:04 UTC (rev 919) +++ trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBSpec.cpp 2009-08-08 02:10:13 UTC (rev 920) @@ -656,7 +656,7 @@ } case eRel_HasOfType: { - return iTuple.RGet(propIter).TypeOf() == this->GetTValue().GetType(); + return iTuple.PGet(propIter)->TypeOf() == this->GetTValue().GetType(); } case eRel_Lacks: { @@ -666,7 +666,7 @@ } case eRel_LacksOfType: { - return iTuple.RGet(propIter).TypeOf() != this->GetTValue().GetType(); + return iTuple.PGet(propIter)->TypeOf() != this->GetTValue().GetType(); } case eRel_VectorContains: { Modified: trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex_General.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex_General.cpp 2009-08-08 02:09:04 UTC (rev 919) +++ trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex_General.cpp 2009-08-08 02:10:13 UTC (rev 920) @@ -322,10 +322,10 @@ oKey.fPropCount = fPropNameCount; - oKey.fValues[0] = &iTuple->RGet(tupleIter); + oKey.fValues[0] = iTuple->PGet(tupleIter); for (size_t x = 1; x < fPropNameCount; ++x) - oKey.fValues[x] = &iTuple->RGet(fPropNames[x]); + oKey.fValues[x] = iTuple->PGet(fPropNames[x]); oKey.fID = iID; return true; Modified: trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex_String.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex_String.cpp 2009-08-08 02:09:04 UTC (rev 919) +++ trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex_String.cpp 2009-08-08 02:10:13 UTC (rev 920) @@ -170,7 +170,7 @@ ZTuple::const_iterator propIter = iTuple->IteratorOf(fPropName); if (propIter == iTuple->end()) return false; - if (iTuple->RGet(propIter).TypeOf() != eZType_String) + if (iTuple->PGet(propIter)->TypeOf() != eZType_String) return false; oKey.fValue = ZUnicode::sAsUTF16(iTuple->GetString(propIter)); oKey.fID = iID; Modified: trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex_T.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex_T.h 2009-08-08 02:09:04 UTC (rev 919) +++ trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex_T.h 2009-08-08 02:10:13 UTC (rev 920) @@ -292,10 +292,10 @@ return false; } - oKey.fValues[0] = &iTuple->RGet(tupleIter); + oKey.fValues[0] = iTuple->PGet(tupleIter); for (size_t x = 1; x < kPropCount; ++x) - oKey.fValues[x] = &iTuple->RGet(fPropNames[x]); + oKey.fValues[x] = iTuple->PGet(fPropNames[x]); oKey.fID = iID; return true; Modified: trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleQuisitioner.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleQuisitioner.cpp 2009-08-08 02:09:04 UTC (rev 919) +++ trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleQuisitioner.cpp 2009-08-08 02:10:13 UTC (rev 920) @@ -99,7 +99,7 @@ for (vector<ZTBQuery::SortSpec>::const_iterator i = iSort.begin(), theEnd = iSort.end(); i != theEnd; ++i) { - oProps.push_back(&iTuple.RGet((*i).fPropName)); + oProps.push_back(iTuple.PGet((*i).fPropName)); } } Modified: trunk/zoolib/source/cxx/old/zoolib/ZDCPixmap_Asset_BMP.cpp =================================================================== --- trunk/zoolib/source/cxx/old/zoolib/ZDCPixmap_Asset_BMP.cpp 2009-08-08 02:09:04 UTC (rev 919) +++ trunk/zoolib/source/cxx/old/zoolib/ZDCPixmap_Asset_BMP.cpp 2009-08-08 02:10:13 UTC (rev 920) @@ -139,7 +139,7 @@ } // Read in the color table, if any - vector<ZRGBColorPOD> localColorVector; + vector<ZRGBA_POD> localColorVector; if (biClrUsed > 0) { localColorVector.resize(biClrUsed); @@ -149,7 +149,7 @@ for (size_t x = 0; x < biClrUsed; ++x) { - ZRGBColorPOD& theColor = localColorVector[x]; + ZRGBA_POD& theColor = localColorVector[x]; theColor.blue = (*theColors++) * 0x101; theColor.green = (*theColors++) * 0x101; theColor.red = (*theColors++) * 0x101; Modified: trunk/zoolib/source/cxx/old/zoolib/ZDC_GDI.cpp =================================================================== --- trunk/zoolib/source/cxx/old/zoolib/ZDC_GDI.cpp 2009-08-08 02:09:04 UTC (rev 919) +++ trunk/zoolib/source/cxx/old/zoolib/ZDC_GDI.cpp 2009-08-08 02:10:13 UTC (rev 920) @@ -2339,13 +2339,13 @@ } else { - vector<ZRGBColorSmallPOD> colorTable(colorTableSize); + vector<ZRGBColorPOD> colorTable(colorTableSize); for (size_t x = 0; x < colorTable.size(); ++x) { - colorTable[x].red = fBITMAPINFO->bmiColors[x].rgbRed; - colorTable[x].green = fBITMAPINFO->bmiColors[x].rgbGreen; - colorTable[x].blue = fBITMAPINFO->bmiColors[x].rgbBlue; - colorTable[x].alpha = 0xFFU; + colorTable[x].red = 0x101 * fBITMAPINFO->bmiColors[x].rgbRed; + colorTable[x].green = 0x101 * fBITMAPINFO->bmiColors[x].rgbGreen; + colorTable[x].blue = 0x101 * fBITMAPINFO->bmiColors[x].rgbBlue; + colorTable[x].alpha = 0xFFFFU; } fPixelDesc = PixelDesc(&colorTable[0], colorTable.size()); } Modified: trunk/zoolib/source/cxx/old/zoolib/ZTS_Umbrella.cpp =================================================================== --- trunk/zoolib/source/cxx/old/zoolib/ZTS_Umbrella.cpp 2009-08-08 02:09:04 UTC (rev 919) +++ trunk/zoolib/source/cxx/old/zoolib/ZTS_Umbrella.cpp 2009-08-08 02:10:13 UTC (rev 920) @@ -158,7 +158,7 @@ } } -void ZTS_Umbrella::pTranslate_GlobalToLocal(size_t iChildIndex, ZValMap_ZooLib& ioTuple) +void ZTS_Umbrella::pTranslate_GlobalToLocal(size_t iChildIndex, ZMap_ZooLib& ioTuple) { for (ZTuple::const_iterator i = ioTuple.begin(), theEnd = ioTuple.end(); i != theEnd; ++i) @@ -192,7 +192,7 @@ } } -void ZTS_Umbrella::pTranslate_LocalToGlobal(size_t iChildIndex, ZValMap_ZooLib& ioTuple) +void ZTS_Umbrella::pTranslate_LocalToGlobal(size_t iChildIndex, ZMap_ZooLib& ioTuple) { for (ZTuple::const_iterator i = ioTuple.begin(), theEnd = ioTuple.end(); i != theEnd; ++i) Modified: trunk/zoolib/source/cxx/old/zoolib/ZTS_Umbrella.h =================================================================== --- trunk/zoolib/source/cxx/old/zoolib/ZTS_Umbrella.h 2009-08-08 02:09:04 UTC (rev 919) +++ trunk/zoolib/source/cxx/old/zoolib/ZTS_Umbrella.h 2009-08-08 02:10:13 UTC (rev 920) @@ -60,8 +60,8 @@ uint64 pAllocateID(); uint64 pAllocateID(ZRef<ZTS> iTS); - void pTranslate_GlobalToLocal(size_t iChildIndex, ZValMap_ZooLib& ioTuple); - void pTranslate_LocalToGlobal(size_t iChildIndex, ZValMap_ZooLib& ioTuple); + void pTranslate_GlobalToLocal(size_t iChildIndex, ZMap_ZooLib& ioTuple); + void pTranslate_LocalToGlobal(size_t iChildIndex, ZMap_ZooLib& ioTuple); uint64 pGlobalToLocal(size_t iChildIndex, uint64 iGlobalID); uint64 pLocalToGlobal(size_t iChildIndex, uint64 iLocalID); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2009-08-10 05:29:15
|
Revision: 931 http://zoolib.svn.sourceforge.net/zoolib/?rev=931&view=rev Author: agreen Date: 2009-08-10 05:29:07 +0000 (Mon, 10 Aug 2009) Log Message: ----------- Simplify ZUtil_Strim_Tuple, with a view to probably removing it. Modified Paths: -------------- trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL.cpp trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL_Spec.cpp trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL_Spec.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBServer.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTSWatcherServer.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTS_Watchable.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZUtil_Strim_TBSpec.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZUtil_Strim_TBSpec.h trunk/zoolib/source/cxx/zoolib/ZUtil_Strim_Tuple.cpp trunk/zoolib/source/cxx/zoolib/ZUtil_Strim_Tuple.h trunk/zoolib/source/cxx/zoolib/ZUtil_TS.cpp Modified: trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL.cpp 2009-08-10 05:28:22 UTC (rev 930) +++ trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL.cpp 2009-08-10 05:29:07 UTC (rev 931) @@ -22,6 +22,7 @@ #include "zoolib/tql/ZUtil_Strim_TQL_Spec.h" #include "zoolib/ZUtil_Strim_Tuple.h" +#include "zoolib/ZYad_ZooLibStrim.h" NAMESPACE_ZOOLIB_BEGIN @@ -111,7 +112,7 @@ if (!isFirst) s.Write(", "); isFirst = false; - ZUtil_Strim_Tuple::sWrite_PropName(s, *i); + ZYad_ZooLibStrim::sWrite_PropName(*i, s); } } @@ -252,7 +253,7 @@ sWrite_LFIndent(fStrimW, fIndent + 1, fOptions); sWrite(fStrimW, "("); sWrite_LFIndent(fStrimW, fIndent + 1, fOptions); - ZUtil_Strim_TQL_Spec::sToStrim(fStrimW, iNode->GetCondition()); + ZUtil_Strim_TQL_Spec::sToStrim(iNode->GetCondition(), fStrimW); sWrite(fStrimW, ","); sWrite(fStrimW, fIndent + 1, fOptions, iNode->GetNode()); sWrite_LFIndent(fStrimW, fIndent + 1, fOptions); @@ -267,7 +268,7 @@ sWrite_LFIndent(fStrimW, fIndent + 1, fOptions); sWrite(fStrimW, "("); sWrite_LFIndent(fStrimW, fIndent + 1, fOptions); - ZUtil_Strim_TQL_Spec::sToStrim(fStrimW, iNode->GetLogOp()); + ZUtil_Strim_TQL_Spec::sToStrim(iNode->GetLogOp(), fStrimW); sWrite(fStrimW, ","); sWrite(fStrimW, fIndent + 1, fOptions, iNode->GetNode()); sWrite_LFIndent(fStrimW, fIndent + 1, fOptions); @@ -305,7 +306,7 @@ void sWrite_PropName(const ZStrimW& s, const ZTName& iTName) { s.Write("@"); - ZUtil_Strim_Tuple::sWrite_PropName(s, iTName); + ZYad_ZooLibStrim::sWrite_PropName(iTName, s); } void sWrite_RelHead(const ZStrimW& s, const RelHead& iRelHead) Modified: trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL_Spec.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL_Spec.cpp 2009-08-10 05:28:22 UTC (rev 930) +++ trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL_Spec.cpp 2009-08-10 05:29:07 UTC (rev 931) @@ -22,6 +22,7 @@ #include "zoolib/tql/ZUtil_Strim_TQL_Spec.h" #include "zoolib/ZUtil_Strim_Tuple.h" +#include "zoolib/ZYad_ZooLibStrim.h" NAMESPACE_ZOOLIB_BEGIN @@ -31,7 +32,7 @@ #pragma mark - #pragma mark * Static helper functions -static void sToStrim(const ZStrimW& s, ZRef<ComparandRep> iCR) +static void spToStrim(ZRef<ComparandRep> iCR, const ZStrimW& s) { if (!iCR) { @@ -40,7 +41,7 @@ else if (ZRef<ComparandRep_Name> cr = ZRefDynamicCast<ComparandRep_Name>(iCR)) { s << "@"; - ZUtil_Strim_Tuple::sWrite_PropName(s, cr->GetName()); + ZYad_ZooLibStrim::sWrite_PropName(cr->GetName(), s); } else if (ZRef<ComparandRep_Value> cr = ZRefDynamicCast<ComparandRep_Value>(iCR)) { @@ -52,7 +53,7 @@ } } -static void sToStrim(const ZStrimW& s, ZRef<ComparatorRep> iCR) +static void spToStrim(ZRef<ComparatorRep> iCR, const ZStrimW& s) { if (!iCR) { @@ -137,9 +138,9 @@ bool Writer::Visit_And(ZRef<LogOp_And> iLogOp) { fStrimW << "("; - sToStrim(fStrimW, iLogOp->GetLHS()); + sToStrim(iLogOp->GetLHS(), fStrimW); fStrimW << " & "; - sToStrim(fStrimW, iLogOp->GetRHS()); + sToStrim(iLogOp->GetRHS(), fStrimW); fStrimW << ")"; return true; } @@ -147,16 +148,16 @@ bool Writer::Visit_Or(ZRef<LogOp_Or> iLogOp) { fStrimW << "("; - sToStrim(fStrimW, iLogOp->GetLHS()); + sToStrim(iLogOp->GetLHS(), fStrimW); fStrimW << " | "; - sToStrim(fStrimW, iLogOp->GetRHS()); + sToStrim(iLogOp->GetRHS(), fStrimW); fStrimW << ")"; return true; } bool Writer::Visit_Condition(ZRef<LogOp_Condition> iLogOp) { - ZUtil_Strim_TQL_Spec::sToStrim(fStrimW, iLogOp->GetCondition()); + ZUtil_Strim_TQL_Spec::sToStrim(iLogOp->GetCondition(), fStrimW); return true; } @@ -164,19 +165,17 @@ #pragma mark - #pragma mark * ZUtil_Strim_TQL_Spec -void sToStrim(const ZStrimW& s, const Condition& iCondition) +void sToStrim(const Condition& iCondition, const ZStrimW& s) { - sToStrim(s, iCondition.GetLHS().GetRep()); - sToStrim(s, iCondition.GetComparator().GetRep()); - sToStrim(s, iCondition.GetRHS().GetRep()); + spToStrim(iCondition.GetLHS().GetRep(), s); + spToStrim(iCondition.GetComparator().GetRep(), s); + spToStrim(iCondition.GetRHS().GetRep(), s); } -void sToStrim(const ZStrimW& s, const Spec& iSpec) - { - sToStrim(s, iSpec.GetLogOp()); - } +void sToStrim(const Spec& iSpec, const ZStrimW& s) + { sToStrim(iSpec.GetLogOp(), s); } -void sToStrim(const ZStrimW& s, ZRef<LogOp> iLogOp) +void sToStrim(ZRef<LogOp> iLogOp, const ZStrimW& s) { if (iLogOp) { Modified: trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL_Spec.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL_Spec.h 2009-08-10 05:28:22 UTC (rev 930) +++ trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL_Spec.h 2009-08-10 05:29:07 UTC (rev 931) @@ -36,9 +36,9 @@ #pragma mark - #pragma mark * ZUtil_Strim_TQL_Spec -void sToStrim(const ZStrimW& iStrimW, const Condition& iCondition); -void sToStrim(const ZStrimW& iStrimW, const Spec& iSpec); -void sToStrim(const ZStrimW& iStrimW, ZRef<LogOp> iLogOp); +void sToStrim(const Condition& iCondition, const ZStrimW& iStrimW); +void sToStrim(const Spec& iSpec, const ZStrimW& iStrimW); +void sToStrim(ZRef<LogOp> iLogOp, const ZStrimW& iStrimW); } // namespace ZUtil_Strim_TQL_Spec Modified: trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBServer.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBServer.cpp 2009-08-10 05:28:22 UTC (rev 930) +++ trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBServer.cpp 2009-08-10 05:29:07 UTC (rev 931) @@ -57,7 +57,7 @@ if (ZLOG(s, eDebug, iLogFacility)) { s.Writef("<< Server: %08X ", iServer); - ZUtil_Strim_Tuple::sToStrim(s, iTuple); + s << iTuple; } #endif } @@ -69,7 +69,7 @@ if (ZLOG(s, eDebug, iLogFacility)) { s.Writef(">> Server: %08X ", iConnection); - ZUtil_Strim_Tuple::sToStrim(s, iTuple); + s << iTuple; } #endif locker.Release(); Modified: trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTSWatcherServer.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTSWatcherServer.cpp 2009-08-10 05:28:22 UTC (rev 930) +++ trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTSWatcherServer.cpp 2009-08-10 05:29:07 UTC (rev 931) @@ -64,8 +64,7 @@ if (ZLOG(s, eDebug, "ZTSWatcherServer")) { s.Writef(">> ZTSWatcherServer: %08X ", iWatcher.GetObject()); - ZUtil_Strim_Tuple::sToStrim(s, iTuple); - s.Write("\n"); + s << iTuple; } #endif } @@ -76,8 +75,7 @@ if (ZLOG(s, eDebug, "ZTSWatcherServer")) { s.Writef("<< ZTSWatcherServer: %08X ", iWatcher.GetObject()); - ZUtil_Strim_Tuple::sToStrim(s, iTuple); - s.Write("\n"); + s << iTuple; } #endif iTuple.ToStream(iStreamW); Modified: trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTS_Watchable.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTS_Watchable.cpp 2009-08-10 05:28:22 UTC (rev 930) +++ trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTS_Watchable.cpp 2009-08-10 05:29:07 UTC (rev 931) @@ -990,7 +990,7 @@ if (ZLOG(s, eDebug, "ZTS_Watchable")) { s.Writef("Slow query, %.3fms\n", elapsed * 1000); - ZUtil_Strim_Tuple::sToStrim(s, iPQuery->fTBQuery.AsTuple(), 0, ZUtil_Strim_Tuple::Options(true)); + s << ZUtil_Strim_Tuple::Format(iPQuery->fTBQuery.AsTuple(), 0, ZYadOptions(true)); } } if (false && sDumpQuery) Modified: trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZUtil_Strim_TBSpec.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZUtil_Strim_TBSpec.cpp 2009-08-10 05:28:22 UTC (rev 930) +++ trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZUtil_Strim_TBSpec.cpp 2009-08-10 05:29:07 UTC (rev 931) @@ -23,6 +23,8 @@ #include "zoolib/ZStrim.h" #include "zoolib/ZUtil_Strim.h" +#include "zoolib/ZYad_ZooLib.h" +#include "zoolib/ZYad_ZooLibStrim.h" #include "zoolib/ZUtil_Strim_Tuple.h" using std::string; @@ -68,7 +70,7 @@ static void sWrite_Criterion(const ZStrimW& iStrimW, const ZTBSpec::Criterion& iCriterion) { - ZUtil_Strim_Tuple::sWrite_PropName(iStrimW, iCriterion.GetPropName()); + ZYad_ZooLibStrim::sWrite_PropName(iCriterion.GetPropName(), iStrimW); iStrimW << " "; @@ -181,7 +183,7 @@ { if (!sTryRead_EscapedString(iStrimU, '\'', thePropertyName)) { - if (!ZUtil_Strim_Tuple::sRead_Identifier(iStrimU, &thePropertyNameLC, &thePropertyName)) + if (!ZYad_ZooLibStrim::sRead_Identifier(iStrimU, &thePropertyNameLC, &thePropertyName)) return false; wasIdentifier = true; } @@ -209,7 +211,7 @@ } sSkip_WSAndCPlusPlusComments(iStrimU); - + ZTValue theTV; if (!ZUtil_Strim_Tuple::sFromStrim(iStrimU, theTV)) throw ParseException("Expected a value after a relationship"); @@ -275,7 +277,7 @@ */ namespace ZUtil_Strim_TBSpec { -void sToStrim(const ZStrimW& iStrimW, const ZTBSpec& iTBSpec) +void sToStrim(const ZTBSpec& iTBSpec, const ZStrimW& iStrimW) { typedef ZTBSpec::CriterionUnion TBU; typedef ZTBSpec::CriterionSect TBS; @@ -369,7 +371,7 @@ const ZStrimW& operator<<(const ZStrimW& s, const ZTBSpec& iTBSpec) { - ZUtil_Strim_TBSpec::sToStrim(s, iTBSpec); + ZUtil_Strim_TBSpec::sToStrim(iTBSpec, s); return s; } Modified: trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZUtil_Strim_TBSpec.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZUtil_Strim_TBSpec.h 2009-08-10 05:28:22 UTC (rev 930) +++ trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZUtil_Strim_TBSpec.h 2009-08-10 05:29:07 UTC (rev 931) @@ -34,7 +34,7 @@ namespace ZUtil_Strim_TBSpec { -void sToStrim(const ZStrimW& iStrimW, const ZTBSpec& iTBSpec); +void sToStrim(const ZTBSpec& iTBSpec, const ZStrimW& iStrimW); bool sFromStrim(const ZStrimU& iStrimU, ZTBSpec& oTBSpec); Modified: trunk/zoolib/source/cxx/zoolib/ZUtil_Strim_Tuple.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZUtil_Strim_Tuple.cpp 2009-08-10 05:28:22 UTC (rev 930) +++ trunk/zoolib/source/cxx/zoolib/ZUtil_Strim_Tuple.cpp 2009-08-10 05:29:07 UTC (rev 931) @@ -25,9 +25,6 @@ NAMESPACE_ZOOLIB_BEGIN -using std::string; -using std::vector; - // ================================================================================================= #pragma mark - #pragma mark * Format @@ -41,72 +38,34 @@ // ================================================================================================= #pragma mark - -#pragma mark * ZUtil_Strim_Tuple, writing and parsing pieces +#pragma mark * ZUtil_Strim_Tuple::sFromStrim -void ZUtil_Strim_Tuple::sWrite_PropName(const ZStrimW& iStrimW, const ZTName& iPropName) - { ZYad_ZooLibStrim::sWrite_PropName(iPropName.AsString(), iStrimW); } - -bool ZUtil_Strim_Tuple::sRead_Identifier( - const ZStrimU& iStrimU, string* oStringLC, string* oStringExact) - { return ZYad_ZooLibStrim::sRead_Identifier(iStrimU, oStringLC, oStringExact); } - -// ================================================================================================= -#pragma mark - -#pragma mark * ZTValue - -void ZUtil_Strim_Tuple::sToStrim(const ZStrimW& s, const ZTValue& iTV) - { - ZRef<ZYadR> theYadR = sMakeYadR(iTV); - ZYad_ZooLibStrim::sToStrim(0, ZYadOptions(), theYadR, s); - } - -void ZUtil_Strim_Tuple::sToStrim(const ZStrimW& s, const ZTValue& iTV, - size_t iInitialIndent, const ZYadOptions& iOptions) - { - ZYad_ZooLibStrim::sToStrim(iInitialIndent, iOptions, sMakeYadR(iTV), s); - } - -string ZUtil_Strim_Tuple::sAsString(const ZTValue& iTV, size_t iInitialIndent, const ZYadOptions& iOptions) - { - string theString; - sToStrim(ZStrimW_String(theString), iTV, iInitialIndent, iOptions); - return theString; - } - -string ZUtil_Strim_Tuple::sAsString(const ZTValue& iTV) - { - string theString; - sToStrim(ZStrimW_String(theString), iTV); - return theString; - } - bool ZUtil_Strim_Tuple::sFromStrim(const ZStrimU& iStrimU, ZTValue& oTV) { - ZRef<ZStrimmerU_Strim> theStrimmerU = new ZStrimmerU_Strim(iStrimU); + ZRef<ZStrimmerU> theStrimmerU = new ZStrimmerU_Strim(iStrimU); if (ZRef<ZYadR> theYadR = ZYad_ZooLibStrim::sMakeYadR(theStrimmerU)) { - oTV = sFromYadR(theYadR, ZTValue()); + oTV = sFromYadR(ZTValue(), theYadR); return true; } return false; } -bool ZUtil_Strim_Tuple::sFromString(const string& iString, ZTValue& oTV) - { return sFromStrim(ZStrimU_String(iString), oTV); } - // ================================================================================================= #pragma mark - #pragma mark * operator<< overloads const ZStrimW& operator<<(const ZStrimW& s, const ZTValue& iTV) { - ZUtil_Strim_Tuple::sToStrim(s, iTV); + ZRef<ZYadR> theYadR = sMakeYadR(iTV); + ZYad_ZooLibStrim::sToStrim(0, ZYadOptions(), theYadR, s); return s; } const ZStrimW& operator<<(const ZStrimW& s, const ZUtil_Strim_Tuple::Format& iFormat) { - ZUtil_Strim_Tuple::sToStrim(s, iFormat.fTValue, iFormat.fInitialIndent, iFormat.fOptions); + ZRef<ZYadR> theYadR = sMakeYadR(iFormat.fTValue); + ZYad_ZooLibStrim::sToStrim(0, ZYadOptions(), theYadR, s); return s; } Modified: trunk/zoolib/source/cxx/zoolib/ZUtil_Strim_Tuple.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZUtil_Strim_Tuple.h 2009-08-10 05:28:22 UTC (rev 930) +++ trunk/zoolib/source/cxx/zoolib/ZUtil_Strim_Tuple.h 2009-08-10 05:29:07 UTC (rev 931) @@ -25,24 +25,14 @@ #include "zoolib/ZTuple.h" #include "zoolib/ZYad.h" -#include <string> - NAMESPACE_ZOOLIB_BEGIN -class ZStrimR; -class ZStrimU; class ZStrimW; namespace ZUtil_Strim_Tuple { // ================================================================================================= #pragma mark - -#pragma mark * ZUtil_Strim_Tuple::Options - -typedef ZYadOptions Options; - -// ================================================================================================= -#pragma mark - #pragma mark * ZUtil_Strim_Tuple::Format struct Format @@ -54,26 +44,8 @@ const ZYadOptions& fOptions; }; -// ================================================================================================= -#pragma mark - -#pragma mark * ZUtil_Strim_Tuple, writing and parsing pieces - -void sWrite_PropName(const ZStrimW& iStrimW, const ZTName& iPropName); - -bool sRead_Identifier(const ZStrimU& iStrimU, std::string* oStringLC, std::string* oStringExact); - -void sToStrim(const ZStrimW& iStrimW, const ZTValue& iTV); - -void sToStrim(const ZStrimW& iStrimW, const ZTValue& iTV, - size_t iInitialIndent, const ZYadOptions& iOptions); - -std::string sAsString(const ZTValue& iTV, size_t iInitialIndent, const ZYadOptions& iOptions); -std::string sAsString(const ZTValue& iTV); - bool sFromStrim(const ZStrimU& iStrimU, ZTValue& oTV); -bool sFromString(const std::string& iString, ZTValue& oTV); - } // namespace ZUtil_Strim_Tuple // ================================================================================================= Modified: trunk/zoolib/source/cxx/zoolib/ZUtil_TS.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZUtil_TS.cpp 2009-08-10 05:28:22 UTC (rev 930) +++ trunk/zoolib/source/cxx/zoolib/ZUtil_TS.cpp 2009-08-10 05:29:07 UTC (rev 931) @@ -28,6 +28,8 @@ #include "zoolib/ZTuple.h" #include "zoolib/ZUtil_Strim.h" #include "zoolib/ZUtil_Strim_Tuple.h" +#include "zoolib/ZYad_ZooLib.h" +#include "zoolib/ZYad_ZooLibStrim.h" using std::map; using std::pair; @@ -204,7 +206,7 @@ iStrimW.Writef("// Version 1.0\n// Next unused ID: \n0x%llX /*%lld*/\n", iNextUnusedID, iNextUnusedID); - ZUtil_Strim_Tuple::Options theOptions; + ZYadOptions theOptions; theOptions.fEOLString = "\n\t"; theOptions.fIndentString = " "; theOptions.fRawChunkSize = 16; @@ -218,7 +220,7 @@ if (!iSource.Get(anID, aTuple)) break; iStrimW.Writef("0x%llX /*%lld*/:\t", anID, anID); - ZUtil_Strim_Tuple::sToStrim(iStrimW, aTuple, 0, theOptions); + ZYad_ZooLibStrim::sToStrim(0, theOptions, sMakeYadR(aTuple), iStrimW); iStrimW.Write("\n"); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2009-08-20 22:42:52
|
Revision: 950 http://zoolib.svn.sourceforge.net/zoolib/?rev=950&view=rev Author: agreen Date: 2009-08-20 22:42:36 +0000 (Thu, 20 Aug 2009) Log Message: ----------- Whitespace. Modified Paths: -------------- trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.cpp trunk/zoolib/source/cxx/zoolib/ZServer.cpp Modified: trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.cpp 2009-08-18 19:52:18 UTC (rev 949) +++ trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.cpp 2009-08-20 22:42:36 UTC (rev 950) @@ -50,7 +50,8 @@ #include ZMACINCLUDE2(CoreFoundation,CFBundle.h) -#if !defined(MAC_OS_X_VERSION_MIN_REQUIRED) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_2 +#if !defined(MAC_OS_X_VERSION_MIN_REQUIRED) \ + || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_2 typedef UInt32 FSAliasInfoBitmap; enum { @@ -110,7 +111,9 @@ return -1; } -#endif +#endif !defined(MAC_OS_X_VERSION_MIN_REQUIRED) \ + || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_2 + #endif // __PIMac__ // ================================================================================================= Modified: trunk/zoolib/source/cxx/zoolib/ZServer.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZServer.cpp 2009-08-18 19:52:18 UTC (rev 949) +++ trunk/zoolib/source/cxx/zoolib/ZServer.cpp 2009-08-20 22:42:36 UTC (rev 950) @@ -23,8 +23,6 @@ NAMESPACE_ZOOLIB_BEGIN -//using std::vector; - // ================================================================================================= #pragma mark - #pragma mark * ZServer::StreamerListener This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2009-09-22 06:14:53
|
Revision: 992 http://zoolib.svn.sourceforge.net/zoolib/?rev=992&view=rev Author: agreen Date: 2009-09-22 06:14:44 +0000 (Tue, 22 Sep 2009) Log Message: ----------- Bite the bullet, and make ZAny the lingua franca for Val, Yad and value-manipulating methods. ZAny must be explicitly constructed from source values, whereas ZVal_Any can be implicitly constructed. This removes the problem where a ZAny would end up encapsulating a ZVal_Any, rather than simply referencing the same underlying holder. Modified Paths: -------------- trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry.h trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_ObjectPriv.h trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Variant.h trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_VariantPriv.h trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_FileRef.cpp trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_FileRef.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/more/zoolib/photoshop/ZPhotoshop_Yad.cpp trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Yad.h trunk/zoolib/source/cxx/zoolib/ZAny.cpp trunk/zoolib/source/cxx/zoolib/ZAny.h trunk/zoolib/source/cxx/zoolib/ZData_Any.cpp trunk/zoolib/source/cxx/zoolib/ZData_Any.h trunk/zoolib/source/cxx/zoolib/ZData_CFType.cpp trunk/zoolib/source/cxx/zoolib/ZData_CFType.h trunk/zoolib/source/cxx/zoolib/ZDebug.cpp trunk/zoolib/source/cxx/zoolib/ZNet_RFCOMM_OSX.mm trunk/zoolib/source/cxx/zoolib/ZRef_Counted.cpp trunk/zoolib/source/cxx/zoolib/ZUtil_CFType.cpp trunk/zoolib/source/cxx/zoolib/ZUtil_CFType.h trunk/zoolib/source/cxx/zoolib/ZUtil_NSObject.h trunk/zoolib/source/cxx/zoolib/ZUtil_NSObject.mm 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/ZVal_CFType.h trunk/zoolib/source/cxx/zoolib/ZVal_ZooLib.cpp trunk/zoolib/source/cxx/zoolib/ZVal_ZooLib.h trunk/zoolib/source/cxx/zoolib/ZYad.cpp trunk/zoolib/source/cxx/zoolib/ZYad.h trunk/zoolib/source/cxx/zoolib/ZYad_Any.cpp trunk/zoolib/source/cxx/zoolib/ZYad_Any.h trunk/zoolib/source/cxx/zoolib/ZYad_CFType.cpp trunk/zoolib/source/cxx/zoolib/ZYad_CFType.h trunk/zoolib/source/cxx/zoolib/ZYad_JSONNormalize.cpp trunk/zoolib/source/cxx/zoolib/ZYad_JSONNormalize.h trunk/zoolib/source/cxx/zoolib/ZYad_Std.cpp trunk/zoolib/source/cxx/zoolib/ZYad_Std.h trunk/zoolib/source/cxx/zoolib/ZYad_ZooLib.cpp trunk/zoolib/source/cxx/zoolib/ZYad_ZooLibStrim.cpp Modified: trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry.h 2009-09-22 05:21:03 UTC (rev 991) +++ trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry.h 2009-09-22 06:14:44 UTC (rev 992) @@ -24,7 +24,7 @@ #include "zoolib/ZStreamer.h" #include "zoolib/ZThreadOld.h" -#include "zoolib/ZVal_Any.h" +#include "zoolib/ZData_Any.h" #include <set> #include <vector> Modified: trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_ObjectPriv.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_ObjectPriv.h 2009-09-22 05:21:03 UTC (rev 991) +++ trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_ObjectPriv.h 2009-09-22 06:14:44 UTC (rev 992) @@ -172,7 +172,7 @@ { return static_cast<Self_t*>(this)->SetProperty(iIndex, iValue); } template <class Variant_t> -bool NPObject_T<Variant_t>::Erase(const string& iName) +bool NPObject_T<Variant_t>::Erase(const std::string& iName) { return static_cast<Self_t*>(this)->RemoveProperty(iName); } template <class Variant_t> Modified: trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Variant.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Variant.h 2009-09-22 05:21:03 UTC (rev 991) +++ trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Variant.h 2009-09-22 06:14:44 UTC (rev 992) @@ -22,11 +22,12 @@ #define __ZNetscape_Variant__ 1 #include "zconfig.h" -#include "zoolib/netscape/ZNetscape.h" +#include "zoolib/ZAny.h" #include "zoolib/ZRef.h" -#include "zoolib/ZVal_Any.h" #include "zoolib/ZValAccessors.h" +#include "zoolib/netscape/ZNetscape.h" + NAMESPACE_ZOOLIB_BEGIN namespace ZNetscape { @@ -90,8 +91,8 @@ typedef T Object_t; - ZVal_Any AsVal_Any() const; - ZVal_Any AsVal_Any(const ZVal_Any& iDefault) const; + ZAny AsAny() const; + ZAny AsAny(const ZAny& iDefault) const; NPVariant_T(); NPVariant_T(const NPVariant_T& iOther); Modified: trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_VariantPriv.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_VariantPriv.h 2009-09-22 05:21:03 UTC (rev 991) +++ trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_VariantPriv.h 2009-09-22 06:14:44 UTC (rev 992) @@ -33,36 +33,35 @@ #pragma mark * NPVariant_T template <class T> -ZVal_Any NPVariant_T<T>::AsVal_Any() const - { return this->AsVal_Any(ZVal_Any()); } +ZAny NPVariant_T<T>::AsAny() const + { return this->AsAny(ZAny()); } template <class T> -ZVal_Any NPVariant_T<T>::AsVal_Any(const ZVal_Any& iDefault) const +ZAny NPVariant_T<T>::AsAny(const ZAny& iDefault) const { switch (type) { case NPVariantType_Bool: { - return bool(value.boolValue); + return ZAny(bool(value.boolValue)); } case NPVariantType_Int32: { - return int32(value.intValue); - break; + return ZAny(int32(value.intValue)); } case NPVariantType_Double: { - return value.doubleValue; + return ZAny(value.doubleValue); } case NPVariantType_String: { - return std::string( + return ZAny(std::string( sNPStringCharsConst(value.stringValue), - sNPStringLengthConst(value.stringValue)); + sNPStringLengthConst(value.stringValue))); } case NPVariantType_Object: { - return ZRef<T>(static_cast<T*>(value.objectValue)); + return ZAny(ZRef<T>(static_cast<T*>(value.objectValue))); } } return iDefault; Modified: trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_FileRef.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_FileRef.cpp 2009-09-22 05:21:03 UTC (rev 991) +++ trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_FileRef.cpp 2009-09-22 06:14:44 UTC (rev 992) @@ -38,7 +38,6 @@ #pragma mark - #pragma mark * ZPhotoshop suites, for local use -//###undef kPSAliasSuite #ifdef kPSAliasSuite static AutoSuite<PSAliasSuite> spPSAlias(kPSAliasSuite, kPSAliasSuiteVersion1); Modified: trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_FileRef.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_FileRef.h 2009-09-22 05:21:03 UTC (rev 991) +++ trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_FileRef.h 2009-09-22 06:14:44 UTC (rev 992) @@ -29,9 +29,10 @@ #include "zoolib/ZTypes.h" #include "zoolib/ZUnicodeString.h" -#include "PITypes.h" -#include "SPFiles.h" +#include "zoolib/photoshop/ZPhotoshop.h" +#include "SPFiles.h" // For SPPlatformFileSpecification + NAMESPACE_ZOOLIB_BEGIN // ================================================================================================= Modified: trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.cpp 2009-09-22 05:21:03 UTC (rev 991) +++ trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.cpp 2009-09-22 06:14:44 UTC (rev 992) @@ -22,12 +22,13 @@ #include "zoolib/ZDebug.h" #include "zoolib/ZUnicode.h" +#include "zoolib/ZVal_Any.h" #include "ASZStringSuite.h" #include "PITerminology.h" #include "PIUSuites.h" -#ifdef __PIMac__ +#if ZCONFIG_SPI_Enabled(Carbon) # if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4 # include ZMACINCLUDE3(ApplicationServices,AE,AEObjects.h) # else @@ -263,35 +264,35 @@ #define SETTERCASES(SUITE, PARAM) \ if (false) \ {} \ - else if (const int32* theVal = ZAnyCast<int32>(&iVal.fAny)) \ + else if (const int32* theVal = iVal.PGet_T<int32>()) \ { SUITE->PutInteger(PARAM, *theVal); return; } \ - else if (const float* theVal = ZAnyCast<float>(&iVal.fAny)) \ + else if (const float* theVal = iVal.PGet_T<float>()) \ { SUITE->PutFloat(PARAM, *theVal); return; } \ - else if (const UnitFloat* theVal = ZAnyCast<UnitFloat>(&iVal.fAny)) \ + else if (const UnitFloat* theVal = iVal.PGet_T<UnitFloat>()) \ { SUITE->PutUnitFloat(PARAM, theVal->fUnitID, theVal->fValue); return; } \ - else if (const string8* theVal = ZAnyCast<string8>(&iVal.fAny)) \ + else if (const string8* theVal = iVal.PGet_T<string8>()) \ { SUITE->PutString(PARAM, const_cast<char*>(theVal->c_str())); return; } \ - else if (const bool* theVal = ZAnyCast<bool>(&iVal.fAny)) \ + else if (const bool* theVal = iVal.PGet_T<bool>()) \ { SUITE->PutBoolean(PARAM, *theVal); return; } \ - else if (const List* theVal = ZAnyCast<List>(&iVal.fAny)) \ + else if (const List* theVal = iVal.PGet_T<List>()) \ { SUITE->PutList(PARAM, theVal->IParam()); return; } \ - else if (const Map* theVal = ZAnyCast<Map>(&iVal.fAny)) \ + else if (const Map* theVal = iVal.PGet_T<Map>()) \ { SUITE->PutObject(PARAM, theVal->GetType(), theVal->IParam()); return; } \ /* global object? */ \ - else if (const Enumerated* theVal = ZAnyCast<Enumerated>(&iVal.fAny)) \ + else if (const Enumerated* theVal = iVal.PGet_T<Enumerated>()) \ { SUITE->PutEnumerated(PARAM, theVal->fEnumType, theVal->fValue); return; } \ - else if (const Spec* theVal = ZAnyCast<Spec>(&iVal.fAny)) \ + else if (const Spec* theVal = iVal.PGet_T<Spec>()) \ { \ PIActionReference tempRef = theVal->MakeRef(); \ SUITE->PutReference(PARAM, tempRef); \ spPSActionReference->Free(tempRef); \ return; \ } \ -/*Hmmm else if (const ClassID* theVal = ZAnyCast<ClassID>(&iVal.fAny)) \ +/*Hmmm else if (const ClassID* theVal = iVal.PGet_T<ClassID>()) \ { ZUnimplemented(); } Hmm??? SUITE->PutInteger(PARAM, *theVal); return; } */\ - else if (const FileRef* theVal = ZAnyCast<FileRef>(&iVal.fAny)) \ + else if (const FileRef* theVal = iVal.PGet_T<FileRef>()) \ { SUITE->PutAlias(PARAM, theVal->Get()); return; } \ - else if (const Data* theVal = ZAnyCast<Data>(&iVal.fAny)) \ + else if (const Data* theVal = iVal.PGet_T<Data>()) \ { SUITE->PutData(PARAM, theVal->GetSize(), const_cast<void*>(theVal->GetData())); return; } // ================================================================================================= @@ -302,7 +303,7 @@ spPSActionDescriptor(kPSActionDescriptorSuite, kPSActionDescriptorSuiteVersion); static AutoSuite<PSActionControlProcs> - spPSActionControl(kPSActionControlSuite, kPSActionControlSuitePrevVersion); + spPSActionControl(kPSActionControlSuite, kPSActionControlSuiteVersion); static AutoSuite<PSActionReferenceProcs> spPSActionReference(kPSActionReferenceSuite, kPSActionReferenceSuiteVersion); @@ -385,6 +386,7 @@ TypeID theType; if (noErr != spPSActionDescriptor->GetType(iSource, theKey, &theType)) break; + #define COMMA() , COPYFROMTO(spPSActionDescriptor, iSource, theKey, theType, theDest COMMA() theKey) @@ -980,31 +982,25 @@ #pragma mark - #pragma mark * Val -Val::operator operator_bool_type() const - { return operator_bool_generator_type::translate(fAny.type() != typeid(void)); } +ZAny Val::AsAny() const + { return this->AsAny(ZAny()); } -ZVal_Any Val::AsVal_Any() const - { return this->AsVal_Any(ZVal_Any()); } - -ZVal_Any Val::AsVal_Any(const ZVal_Any& iDefault) const +ZAny Val::AsAny(const ZAny& iDefault) const { - if (const Map* theVal = ZAnyCast<Map>(&fAny)) - return theVal->AsMap_Any(iDefault); + if (const Map* theVal = this->PGet_T<Map>()) + return ZAny(theVal->AsAny(iDefault)); - if (const List* theVal = ZAnyCast<List>(&fAny)) - return theVal->AsList_Any(iDefault); + if (const List* theVal = this->PGet_T<List>()) + return ZAny(theVal->AsAny(iDefault)); - return fAny; + return *this; } -void Val::swap(Val& iOther) - { std::swap(fAny, iOther.fAny); } - Val::Val() {} Val::Val(const Val& iOther) -: fAny(iOther.fAny) +: ZAny((const ZAny&)iOther) {} Val::~Val() @@ -1012,90 +1008,58 @@ Val& Val::operator=(const Val& iOther) { - fAny = iOther.fAny; + ZAny::operator=((const ZAny&)iOther); return *this; } +Val::Val(const ZAny& iOther) +: ZAny(iOther) + {} + Val::Val(int32 iVal) -: fAny(iVal) +: ZAny(iVal) {} Val::Val(double iVal) -: fAny(iVal) +: ZAny(iVal) {} Val::Val(bool iVal) -: fAny(iVal) +: ZAny(iVal) {} Val::Val(const string8& iVal) -: fAny(iVal) +: ZAny(iVal) {} Val::Val(const Data& iVal) -: fAny(iVal) +: ZAny(iVal) {} Val::Val(const UnitFloat& iVal) -: fAny(iVal) +: ZAny(iVal) {} Val::Val(const Enumerated& iVal) -: fAny(iVal) +: ZAny(iVal) {} Val::Val(const FileRef& iVal) -: fAny(iVal) +: ZAny(iVal) {} Val::Val(const List& iVal) -: fAny(iVal) +: ZAny(iVal) {} Val::Val(const Map& iVal) -: fAny(iVal) +: ZAny(iVal) {} Val::Val(const Spec& iVal) -: fAny(iVal) +: ZAny(iVal) {} -void Val::Clear() - { fAny = ZAny(); } - -template <class S> -bool Val::QGet_T(S& oVal) const - { - if (const S* theVal = ZAnyCast<S>(&fAny)) - { - oVal = *theVal; - return true; - } - return false; - } - -template <class S> -S Val::DGet_T(const S& iDefault) const - { - if (const S* theVal = ZAnyCast<S>(&fAny)) - return *theVal; - return iDefault; - } - -template <class S> -S Val::Get_T() const - { - if (const S* theVal = ZAnyCast<S>(&fAny)) - return *theVal; - return S(); - } - -template <class S> -void Val::Set_T(const S& iVal) - { - fAny = iVal; - } - // ================================================================================================= #pragma mark - #pragma mark * Val typename accessors @@ -1120,18 +1084,18 @@ List::operator operator_bool_type() const { return operator_bool_generator_type::translate(this->Count()); } -ZList_Any List::AsList_Any() const - { return this->AsList_Any(ZVal_Any()); } +ZAny List::AsAny() const + { return this->AsAny(ZAny()); } -ZList_Any List::AsList_Any(const ZVal_Any& iDefault) const +ZAny List::AsAny(const ZAny& iDefault) const { ZList_Any theList; if (size_t theCount = this->Count()) { for (size_t x = 0; x < theCount; ++x) - theList.Append(this->Get(x).AsVal_Any(iDefault)); + theList.Append(this->Get(x).AsAny(iDefault)); } - return theList; + return ZAny(theList); } void List::swap(List& iOther) @@ -1252,15 +1216,15 @@ Map::operator operator_bool_type() const { return operator_bool_generator_type::translate(this->pCount()); } -ZMap_Any Map::AsMap_Any() const - { return this->AsMap_Any(ZVal_Any()); } +ZAny Map::AsAny() const + { return this->AsAny(ZAny()); } -ZMap_Any Map::AsMap_Any(const ZVal_Any& iDefault) const +ZAny Map::AsAny(const ZAny& iDefault) const { ZMap_Any theMap; for (Index_t i = this->Begin(), end = this->End(); i != end; ++i) - theMap.Set(this->NameOf(i), this->Get(i).AsVal_Any(iDefault)); - return theMap; + theMap.Set(this->NameOf(i), this->Get(i).AsAny(iDefault)); + return ZAny(theMap); } void Map::swap(Map& iOther) Modified: trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.h 2009-09-22 05:21:03 UTC (rev 991) +++ trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.h 2009-09-22 06:14:44 UTC (rev 992) @@ -25,13 +25,14 @@ #include "zoolib/ZAny.h" #include "zoolib/ZCompat_operator_bool.h" +#include "zoolib/ZData_Any.h" #include "zoolib/ZFile.h" #include "zoolib/ZRef.h" #include "zoolib/ZUnicodeString.h" #include "zoolib/ZVal.h" #include "zoolib/ZValAccessors_Std.h" -#include "zoolib/ZVal_Any.h" +#include "zoolib/photoshop/ZPhotoshop.h" #include "zoolib/photoshop/ZPhotoshop_FileRef.h" #include <vector> @@ -222,24 +223,19 @@ #pragma mark - #pragma mark * Val -class Val +class Val : public ZAny { - ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES(Val, - operator_bool_generator_type, operator_bool_type); - public: - operator operator_bool_type() const; + ZAny AsAny() const; + ZAny AsAny(const ZAny& iDefault) const; - ZVal_Any AsVal_Any() const; - ZVal_Any AsVal_Any(const ZVal_Any& iDefault) const; - - void swap(Val& iOther); - Val(); Val(const Val& iOther); ~Val(); Val& operator=(const Val& iOther); + Val(const ZAny& iOther); + Val(int32 iVal); Val(double iVal); Val(bool iVal); @@ -252,29 +248,6 @@ Val(const Map& iVal); Val(const Spec& iVal); -// ZVal protocol - void Clear(); - - template <class S> - S* PGet_T() - { return ZAnyCast<S>(&fAny); } - - template <class S> - const S* PGet_T() const - { return ZAnyCast<S>(&fAny); } - - template <class S> - bool QGet_T(S& oVal) const; - - template <class S> - S DGet_T(const S& iDefault) const; - - template <class S> - S Get_T() const; - - template <class S> - void Set_T(const S& iVal); - // Typename accessors ZMACRO_ZValAccessors_Decl_Entry(Val, Int32, int32) ZMACRO_ZValAccessors_Decl_Entry(Val, Double, double) @@ -288,11 +261,6 @@ ZMACRO_ZValAccessors_Decl_Entry(Val, List, List) ZMACRO_ZValAccessors_Decl_Entry(Val, Map, Map) ZMACRO_ZValAccessors_Decl_Entry(Val, Spec, Spec) - -private: - ZAny fAny; - friend class List; - friend class Map; }; // ================================================================================================= @@ -307,8 +275,8 @@ public: operator operator_bool_type() const; - ZList_Any AsList_Any() const; - ZList_Any AsList_Any(const ZVal_Any& iDefault) const; + ZAny AsAny() const; + ZAny AsAny(const ZAny& iDefault) const; void swap(List& iOther); @@ -357,8 +325,8 @@ operator operator_bool_type() const; - ZMap_Any AsMap_Any() const; - ZMap_Any AsMap_Any(const ZVal_Any& iDefault) const; + ZAny AsAny() const; + ZAny AsAny(const ZAny& iDefault) const; void swap(Map& iOther); Modified: trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Yad.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Yad.cpp 2009-09-22 05:21:03 UTC (rev 991) +++ trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Yad.cpp 2009-09-22 06:14:44 UTC (rev 992) @@ -21,7 +21,6 @@ #include "zoolib/photoshop/ZPhotoshop_Yad.h" #include "zoolib/ZYad_Any.h" -#include "zoolib/ZYad_Std.h" NAMESPACE_ZOOLIB_BEGIN @@ -116,14 +115,14 @@ return sMakeYadR(theMap); } - if (const Spec* asSpec = iVal.PGet_T<Spec>()) + if (/*const Spec* asSpec = */iVal.PGet_T<Spec>()) { ZMap_Any theMap; theMap.Set("!Type", string("Spec")); return sMakeYadR(theMap); } - return new ZYadPrimR_Std(iVal.AsVal_Any().AsAny()); + return new ZYadPrimR_Any(iVal.AsAny()); } ZRef<ZYadListR> sMakeYadR(const List& iList) Modified: trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Yad.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Yad.h 2009-09-22 05:21:03 UTC (rev 991) +++ trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Yad.h 2009-09-22 06:14:44 UTC (rev 992) @@ -22,10 +22,11 @@ #define __ZPhotoshop_Yad__ 1 #include "zconfig.h" +#include "zoolib/ZYad.h" + +#include "zoolib/photoshop/ZPhotoshop.h" #include "zoolib/photoshop/ZPhotoshop_Val.h" -#include "zoolib/ZYad_Val_T.h" - NAMESPACE_ZOOLIB_BEGIN namespace ZPhotoshop { Modified: trunk/zoolib/source/cxx/zoolib/ZAny.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZAny.cpp 2009-09-22 05:21:03 UTC (rev 991) +++ trunk/zoolib/source/cxx/zoolib/ZAny.cpp 2009-09-22 06:14:44 UTC (rev 992) @@ -28,33 +28,33 @@ NAMESPACE_ZOOLIB_BEGIN -ZAny::ZAny() +ZAnyBase::ZAnyBase() : content(0) {} -ZAny::ZAny(const ZAny& other) +ZAnyBase::ZAnyBase(const ZAnyBase& other) : content(other.content ? other.content->clone() : 0) {} -ZAny::~ZAny() +ZAnyBase::~ZAnyBase() { delete content; } -ZAny& ZAny::operator=(ZAny rhs) +ZAnyBase& ZAnyBase::operator=(ZAnyBase rhs) { rhs.swap(*this); return *this; } -ZAny& ZAny::swap(ZAny& rhs) +ZAnyBase& ZAnyBase::swap(ZAnyBase& rhs) { std::swap(content, rhs.content); return *this; } -bool ZAny::empty() const +bool ZAnyBase::empty() const { return !content; } -const std::type_info& ZAny::type() const +const std::type_info& ZAnyBase::type() const { return content ? content->type() : typeid(void); } NAMESPACE_ZOOLIB_END @@ -63,6 +63,23 @@ // ================================================================================================= #pragma mark - +#pragma mark * ZAny + +NAMESPACE_ZOOLIB_BEGIN + +ZAny::operator operator_bool_type() const + { return operator_bool_generator_type::translate(this->type() != typeid(void)); } + +void ZAny::Clear() + { + ZAny temp; + this->swap(temp); + } + +NAMESPACE_ZOOLIB_END + +// ================================================================================================= +#pragma mark - #pragma mark * Coercion NAMESPACE_ZOOLIB_BEGIN Modified: trunk/zoolib/source/cxx/zoolib/ZAny.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZAny.h 2009-09-22 05:21:03 UTC (rev 991) +++ trunk/zoolib/source/cxx/zoolib/ZAny.h 2009-09-22 06:14:44 UTC (rev 992) @@ -22,8 +22,10 @@ #define __ZAny__ #include "zconfig.h" #include "zoolib/ZCONFIG_SPI.h" -#include "zoolib/ZTypes.h" +#include "zoolib/ZCompat_operator_bool.h" +#include "zoolib/ZTypes.h" // For int64 + // ================================================================================================= #pragma mark - #pragma mark * ZAny as a typedef of boost::any @@ -34,14 +36,14 @@ NAMESPACE_ZOOLIB_BEGIN -typedef boost::any ZAny; +typedef boost::any ZAnyBase; template<typename ValueType> -ValueType* ZAnyCast(ZAny* operand) +ValueType* ZAnyBaseCast(ZAnyBase* operand) { return boost::any_cast<ValueType>(operand); } template<typename ValueType> -const ValueType* ZAnyCast(const ZAny* operand) +const ValueType* ZAnyBaseCast(const ZAnyBase* operand) { return boost::any_cast<ValueType>(operand); } NAMESPACE_ZOOLIB_END @@ -50,7 +52,7 @@ // ================================================================================================= #pragma mark - -#pragma mark * ZAny, copied/reworked from boost::any +#pragma mark * ZAnyBase, copied/reworked from boost::any #if ! ZCONFIG_SPI_Enabled(boost) @@ -73,27 +75,27 @@ NAMESPACE_ZOOLIB_BEGIN -class ZAny +class ZAnyBase { public: - ZAny(); - ZAny(const ZAny& other); - ~ZAny(); - ZAny& operator=(ZAny rhs); + ZAnyBase(); + ZAnyBase(const ZAnyBase& other); + ~ZAnyBase(); + ZAnyBase& operator=(ZAnyBase rhs); template<typename ValueType> - ZAny(const ValueType & value) + ZAnyBase(const ValueType & value) : content(new holder<ValueType>(value)) {} template<typename ValueType> - ZAny& operator=(const ValueType & rhs) + ZAnyBase& operator=(const ValueType & rhs) { - ZAny(rhs).swap(*this); + ZAnyBase(rhs).swap(*this); return *this; } - ZAny& swap(ZAny& rhs); + ZAnyBase& swap(ZAnyBase& rhs); bool empty() const; const std::type_info & type() const; @@ -127,33 +129,33 @@ }; #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS - public: // so ZAnyCast can be non-friend + public: // so ZAnyBaseCast can be non-friend #else private: template<typename ValueType> - friend ValueType* ZAnyCast(ZAny*); + friend ValueType* ZAnyBaseCast(ZAnyBase*); template<typename ValueType> - friend const ValueType* ZAnyCast(const ZAny*); + friend const ValueType* ZAnyBaseCast(const ZAnyBase*); #endif placeholder* content; }; template<typename ValueType> -ValueType* ZAnyCast(ZAny* operand) +ValueType* ZAnyBaseCast(ZAnyBase* operand) { if (!operand || operand->type() != typeid(ValueType)) return 0; - return &static_cast<ZAny::holder<ValueType>*>(operand->content)->held; + return &static_cast<ZAnyBase::holder<ValueType>*>(operand->content)->held; } template<typename ValueType> -const ValueType* ZAnyCast(const ZAny* operand) +const ValueType* ZAnyBaseCast(const ZAnyBase* operand) { if (!operand || operand->type() != typeid(ValueType)) return 0; - return &static_cast<ZAny::holder<ValueType>*>(operand->content)->held; + return &static_cast<ZAnyBase::holder<ValueType>*>(operand->content)->held; } NAMESPACE_ZOOLIB_END @@ -162,6 +164,112 @@ // ================================================================================================= #pragma mark - +#pragma mark * ZAny + +NAMESPACE_ZOOLIB_BEGIN + +class ZAny : private ZAnyBase + { +public: + ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES(ZAny, + operator_bool_generator_type, operator_bool_type); + + operator operator_bool_type() const; + + void swap(ZAny& rhs) + { ZAnyBase::swap((ZAnyBase&)rhs); } + + const std::type_info & type() const + { return ZAnyBase::type(); } + + ZAny() + {} + + ZAny(const ZAny& other) + : ZAnyBase((const ZAnyBase&)other) + {} + + ~ZAny() + {} + + ZAny& operator=(const ZAny& rhs) + { + ZAnyBase::operator=((const ZAnyBase&)rhs); + return *this; + } + + template <class S> + explicit ZAny(const S& iVal) + : ZAnyBase(iVal) + {} + + template <class S> + ZAny& operator=(const S& iVal) + { + ZAnyBase::operator=(iVal); + return *this; + } + +// ZVal protocol, for use by ZVal derivatives + void Clear(); + + template <class S> + S* PGet_T() + { return ZAnyBaseCast<S>(this); } + + template <class S> + const S* PGet_T() const + { return ZAnyBaseCast<S>(this); } + + template <class S> + bool QGet_T(S& oVal) const + { + if (const S* theVal = this->PGet_T<S>()) + { + oVal = *theVal; + return true; + } + return false; + } + + template <class S> + S DGet_T(const S& iDefault) const + { + if (const S* theVal = this->PGet_T<S>()) + return *theVal; + return iDefault; + } + + template <class S> + S Get_T() const + { + if (const S* theVal = this->PGet_T<S>()) + return *theVal; + return S(); + } + + template <class S> + void Set_T(const S& iVal) + { ZAnyBase::operator=(iVal); } + +// Our protocol + template <class S> + bool Is_T() const + { return this->PGet_T<S>(); } + }; + +template<typename ValueType> +ValueType* ZAnyCast(ZAny* operand) + { return operand->PGet_T<ValueType>(); } + +template<typename ValueType> +const ValueType* ZAnyCast(const ZAny* operand) + { return operand->PGet_T<ValueType>(); } + +NAMESPACE_ZOOLIB_END + +// ================================================================================================= +#pragma mark - #pragma mark * ZAny coercion NAMESPACE_ZOOLIB_BEGIN Modified: trunk/zoolib/source/cxx/zoolib/ZData_Any.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZData_Any.cpp 2009-09-22 05:21:03 UTC (rev 991) +++ trunk/zoolib/source/cxx/zoolib/ZData_Any.cpp 2009-09-22 06:14:44 UTC (rev 992) @@ -57,8 +57,8 @@ #pragma mark - #pragma mark * ZData_Any -ZData_Any ZData_Any::AsData_Any() const - { return *this; } +ZAny ZData_Any::AsAny() const + { return ZAny(*this); } ZData_Any::operator operator_bool_type() const { return operator_bool_generator_type::translate(fRep->fVector.size()); } Modified: trunk/zoolib/source/cxx/zoolib/ZData_Any.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZData_Any.h 2009-09-22 05:21:03 UTC (rev 991) +++ trunk/zoolib/source/cxx/zoolib/ZData_Any.h 2009-09-22 06:14:44 UTC (rev 992) @@ -22,6 +22,7 @@ #define __ZData_Any__ 1 #include "zconfig.h" +#include "zoolib/ZAny.h" #include "zoolib/ZCompat_operator_bool.h" #include "zoolib/ZCompare.h" #include "zoolib/ZRef.h" @@ -39,7 +40,7 @@ class Rep; public: - ZData_Any AsData_Any() const; + ZAny AsAny() const; operator operator_bool_type() const; Modified: trunk/zoolib/source/cxx/zoolib/ZData_CFType.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZData_CFType.cpp 2009-09-22 05:21:03 UTC (rev 991) +++ trunk/zoolib/source/cxx/zoolib/ZData_CFType.cpp 2009-09-22 06:14:44 UTC (rev 992) @@ -33,8 +33,8 @@ #pragma mark - #pragma mark * ZData_CFType -ZData_Any ZData_CFType::AsData_Any() const - { return ZUtil_CFType::sAsData_Any(this->pData()); } +ZAny ZData_CFType::AsAny() const + { return ZUtil_CFType::sAsAny(this->pData()); } ZData_CFType::operator bool() const { return this->GetSize(); } Modified: trunk/zoolib/source/cxx/zoolib/ZData_CFType.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZData_CFType.h 2009-09-22 05:21:03 UTC (rev 991) +++ trunk/zoolib/source/cxx/zoolib/ZData_CFType.h 2009-09-22 06:14:44 UTC (rev 992) @@ -44,7 +44,7 @@ class Rep; public: - ZData_Any AsData_Any() const; + ZAny AsAny() const; operator bool() const; Modified: trunk/zoolib/source/cxx/zoolib/ZDebug.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZDebug.cpp 2009-09-22 05:21:03 UTC (rev 991) +++ trunk/zoolib/source/cxx/zoolib/ZDebug.cpp 2009-09-22 06:14:44 UTC (rev 992) @@ -134,7 +134,38 @@ } sDebugFunction_POSIX; #endif // ZCONFIG_SPI_Enabled(POSIX) +#if 0 +// Mac IDP. +extern "C" { + +bool IsDebuggerPresent() { + int mib[4]; + struct kinfo_proc info; + size_t size; + + info.kp_proc.p_flag = 0; + mib[0] = CTL_KERN; + mib[1] = KERN_PROC; + mib[2] = KERN_PROC_PID; + mib[3] = getpid(); + + size = sizeof(info); + sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, NULL, 0); + + return ((info.kp_proc.p_flag & P_TRACED) != 0); +} + +void OutputDebugString(const char *restrict fmt, ...) { + if( !IsDebuggerPresent() ) + return; + + va_list args; + va_start(args, fmt); + vprintf(fmt, args); + va_end(args); +} +#endif // ================================================================================================= #pragma mark - #pragma mark * Win Modified: trunk/zoolib/source/cxx/zoolib/ZNet_RFCOMM_OSX.mm =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZNet_RFCOMM_OSX.mm 2009-09-22 05:21:03 UTC (rev 991) +++ trunk/zoolib/source/cxx/zoolib/ZNet_RFCOMM_OSX.mm 2009-09-22 06:14:44 UTC (rev 992) @@ -181,7 +181,7 @@ void ZNetListener_RFCOMM_OSX::pChannelOpened(IOBluetoothRFCOMMChannel* iChannel) { ZGuardMtx locker(fMutex); - [iChannel release]; + [iChannel release]; // ?? fQueue.push_back(iChannel); fCondition.Broadcast(); } Modified: trunk/zoolib/source/cxx/zoolib/ZRef_Counted.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZRef_Counted.cpp 2009-09-22 05:21:03 UTC (rev 991) +++ trunk/zoolib/source/cxx/zoolib/ZRef_Counted.cpp 2009-09-22 06:14:44 UTC (rev 992) @@ -108,10 +108,10 @@ int ZRefCountedWithFinalizeBase::pCOMAddRef() { - int newCount = ZAtomic_Add(&fRefCount, 1); - if (newCount == 1) + int oldRefCount = ZAtomic_Add(&fRefCount, 1); + if (oldRefCount == 0) this->Initialize(); - return newCount; + return oldRefCount + 1; } int ZRefCountedWithFinalizeBase::pCOMRelease() Modified: trunk/zoolib/source/cxx/zoolib/ZUtil_CFType.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZUtil_CFType.cpp 2009-09-22 05:21:03 UTC (rev 991) +++ trunk/zoolib/source/cxx/zoolib/ZUtil_CFType.cpp 2009-09-22 06:14:44 UTC (rev 992) @@ -23,11 +23,7 @@ #if ZCONFIG_SPI_Enabled(CFType) #include "zoolib/ZTime.h" -#include "zoolib/ZVal_Any.h" -#include <map> -#include <vector> - #include ZMACINCLUDE2(CoreFoundation,CFArray.h) #include ZMACINCLUDE2(CoreFoundation,CFData.h) #include ZMACINCLUDE2(CoreFoundation,CFDate.h) @@ -37,11 +33,6 @@ NAMESPACE_ZOOLIB_BEGIN -using std::map; -using std::pair; -using std::string; -using std::vector; - namespace ZUtil_CFType { // ================================================================================================= @@ -88,6 +79,62 @@ ZRef<CFMutableStringRef> sStringMutable(const ZRef<CFStringRef>& iCFString) { return NoRetain(::CFStringCreateMutableCopy(kCFAllocatorDefault, 0, iCFString)); } +ZRef<CFDictionaryRef> sDictionary() + { + return NoRetain(::CFDictionaryCreate(kCFAllocatorDefault, nullptr, nullptr, 0, + &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); + } + +ZRef<CFMutableDictionaryRef> sDictionaryMutable() + { + return NoRetain(::CFDictionaryCreateMutable(kCFAllocatorDefault, 0, + &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); + } + +ZRef<CFMutableDictionaryRef> sDictionaryMutable(const ZRef<CFDictionaryRef>& iCFDictionary) + { + return NoRetain(::CFDictionaryCreateMutableCopy(kCFAllocatorDefault, + ::CFDictionaryGetCount(iCFDictionary), iCFDictionary)); + } + +ZRef<CFArrayRef> sArray() + { return NoRetain(::CFArrayCreate(kCFAllocatorDefault, nullptr, 0, &kCFTypeArrayCallBacks)); } + +ZRef<CFMutableArrayRef> sArrayMutable() + { return NoRetain(::CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks)); } + +ZRef<CFMutableArrayRef> sArrayMutable(const ZRef<CFArrayRef>& iCFArray) + { + return NoRetain(::CFArrayCreateMutableCopy(kCFAllocatorDefault, + ::CFArrayGetCount(iCFArray), iCFArray)); + } + +ZRef<CFDataRef> sData() + { return NoRetain(::CFDataCreate(kCFAllocatorDefault, 0, 0)); } + +ZRef<CFDataRef> sData(const void* iSource, size_t iSize) + { + return NoRetain(::CFDataCreate(kCFAllocatorDefault, + static_cast<const UInt8*>(iSource), iSize)); + } + +ZRef<CFMutableDataRef> sDataMutable() + { return NoRetain(::CFDataCreateMutable(kCFAllocatorDefault, 0)); } + +ZRef<CFMutableDataRef> sDataMutable(size_t iSize) + { + ZRef<CFMutableDataRef> theData = NoRetain(::CFDataCreateMutable(kCFAllocatorDefault, 0)); + ::CFDataSetLength(theData, iSize); + return theData; + } + +ZRef<CFMutableDataRef> sDataMutable(const ZRef<CFDataRef>& iCFData) + { return NoRetain(::CFDataCreateMutableCopy(kCFAllocatorDefault, 0, iCFData)); } + +// ================================================================================================= +#pragma mark - +#pragma mark * ZUtil_CFType, conversions + string8 sAsUTF8(CFStringRef iCFString) { if (const char *s = ::CFStringGetCStringPtr(iCFString, kCFStringEncodingUTF8)) @@ -130,96 +177,78 @@ return result; } -ZRef<CFDictionaryRef> sDictionary() +static ZData_Any spAsData_Any(const ZRef<CFDataRef>& iCFData) { - return NoRetain(::CFDictionaryCreate(kCFAllocatorDefault, nullptr, nullptr, 0, - &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); + ZData_Any theData; + if (size_t theLength = ::CFDataGetLength(iCFData)) + return ZData_Any(::CFDataGetBytePtr(iCFData), theLength); + return ZData_Any(); } -ZRef<CFMutableDictionaryRef> sDictionaryMutable() +static ZList_Any spAsList_Any(const ZAny& iDefault, const ZRef<CFArrayRef>& iCFArray) { - return NoRetain(::CFDictionaryCreateMutable(kCFAllocatorDefault, 0, - &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); - } + ZList_Any theList; -ZRef<CFMutableDictionaryRef> sDictionaryMutable(const ZRef<CFDictionaryRef>& iCFDictionary) - { - return NoRetain(::CFDictionaryCreateMutableCopy(kCFAllocatorDefault, - ::CFDictionaryGetCount(iCFDictionary), iCFDictionary)); + for (size_t x = 0, theCount = ::CFArrayGetCount(iCFArray); x < theCount; ++x) + theList.Append(sAsAny(iDefault, ::CFArrayGetValueAtIndex(iCFArray, x))); + + return theList; } -ZRef<CFArrayRef> sArray() - { return NoRetain(::CFArrayCreate(kCFAllocatorDefault, nullptr, 0, &kCFTypeArrayCallBacks)); } - -ZRef<CFMutableArrayRef> sArrayMutable() - { return NoRetain(::CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks)); } - -ZRef<CFMutableArrayRef> sArrayMutable(const ZRef<CFArrayRef>& iCFArray) +static void spGatherContents(const void* iKey, const void* iValue, void* iRefcon) { - return NoRetain(::CFArrayCreateMutableCopy(kCFAllocatorDefault, - ::CFArrayGetCount(iCFArray), iCFArray)); - } + CFStringRef theKey = static_cast<CFStringRef>(iKey); + CFTypeRef theValue = static_cast<CFTypeRef>(iValue); -ZRef<CFDataRef> sData() - { return NoRetain(::CFDataCreate(kCFAllocatorDefault, 0, 0)); } + pair<ZMap_Any*, const ZAny*>* thePair = + static_cast<pair<ZMap_Any*, const ZAny*>*>(iRefcon); -ZRef<CFDataRef> sData(const void* iSource, size_t iSize) - { - return NoRetain(::CFDataCreate(kCFAllocatorDefault, - static_cast<const UInt8*>(iSource), iSize)); + thePair->first->Set(sAsUTF8(theKey), sAsAny(*thePair->second, theValue)); } -ZRef<CFMutableDataRef> sDataMutable() - { return NoRetain(::CFDataCreateMutable(kCFAllocatorDefault, 0)); } - -ZRef<CFMutableDataRef> sDataMutable(size_t iSize) +static ZMap_Any spAsMap_Any(const ZAny& iDefault, const ZRef<CFDictionaryRef>& iCFDictionary) { - ZRef<CFMutableDataRef> theData = NoRetain(::CFDataCreateMutable(kCFAllocatorDefault, 0)); - ::CFDataSetLength(theData, iSize); - return theData; + ZMap_Any theMap; + pair<ZMap_Any*, const ZAny*> thePair(&theMap, &iDefault); + ::CFDictionaryApplyFunction(iCFDictionary, spGatherContents, &thePair); + return theMap; } -ZRef<CFMutableDataRef> sDataMutable(const ZRef<CFDataRef>& iCFData) - { return NoRetain(::CFDataCreateMutableCopy(kCFAllocatorDefault, 0, iCFData)); } - -// ================================================================================================= -#pragma mark - -#pragma mark * ZUtil_CFType - -ZVal_Any sAsVal_Any(const ZVal_Any& iDefault, ZRef<CFTypeRef> iVal) +ZAny sAsAny(const ZAny& iDefault, ZRef<CFTypeRef> iVal) { CFTypeRef theCFTypeRef = iVal; + if (!theCFTypeRef) - return ZVal_Any(); + return ZAny(); const CFTypeID theTypeID = ::CFGetTypeID(theCFTypeRef); #if defined(MAC_OS_X_VERSION_MIN_REQUIRED) \ && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_2 if (theTypeID == ::CFNullGetTypeID()) - return ZVal_Any(); + return ZAny(); #endif if (theTypeID == ::CFStringGetTypeID()) - return sAsUTF8(static_cast<CFStringRef>(theCFTypeRef)); + return ZAny(sAsUTF8(static_cast<CFStringRef>(theCFTypeRef))); if (theTypeID == ::CFDictionaryGetTypeID()) - return sAsMap_Any(iDefault, static_cast<CFDictionaryRef>(theCFTypeRef)); + return ZAny(spAsMap_Any(iDefault, static_cast<CFDictionaryRef>(theCFTypeRef))); if (theTypeID == ::CFArrayGetTypeID()) - return sAsList_Any(iDefault, static_cast<CFArrayRef>(theCFTypeRef)); + return ZAny(spAsList_Any(iDefault, static_cast<CFArrayRef>(theCFTypeRef))); if (theTypeID == ::CFBooleanGetTypeID()) - return bool(::CFBooleanGetValue(static_cast<CFBooleanRef>(theCFTypeRef))); + return ZAny(bool(::CFBooleanGetValue(static_cast<CFBooleanRef>(theCFTypeRef)))); if (theTypeID == ::CFDateGetTypeID()) { - return ZTime(kCFAbsoluteTimeIntervalSince1970 - + ::CFDateGetAbsoluteTime(static_cast<CFDateRef>(theCFTypeRef))); + return ZAny(ZTime(kCFAbsoluteTimeIntervalSince1970 + + ::CFDateGetAbsoluteTime(static_cast<CFDateRef>(theCFTypeRef)))); } if (theTypeID == ::CFDataGetTypeID()) - return sAsData_Any(static_cast<CFDataRef>(theCFTypeRef)); + return ZAny(spAsData_Any(static_cast<CFDataRef>(theCFTypeRef))); if (theTypeID == ::CFNumberGetTypeID()) { @@ -231,42 +260,42 @@ { int8 theValue; ::CFNumberGetValue(theNumberRef, kCFNumberSInt8Type, &theValue); - return theValue; + return ZAny(theValue); } case kCFNumberSInt16Type: case kCFNumberShortType: { int16 theValue; ::CFNumberGetValue(theNumberRef, kCFNumberSInt16Type, &theValue); - return theValue; + return ZAny(theValue); } case kCFNumberSInt32Type: case kCFNumberIntType: { int32 theValue; ::CFNumberGetValue(theNumberRef, kCFNumberSInt32Type, &theValue); - return theValue; + return ZAny(theValue); } case kCFNumberSInt64Type: case kCFNumberLongLongType: { int64 theValue; ::CFNumberGetValue(theNumberRef, kCFNumberSInt64Type, &theValue); - return theValue; + return ZAny(theValue); } case kCFNumberFloat32Type: case kCFNumberFloatType: { float theValue; ::CFNumberGetValue(theNumberRef, kCFNumberFloat32Type, &theValue); - return theValue; + return ZAny(theValue); } case kCFNumberFloat64Type: case kCFNumberDoubleType: { double theValue; ::CFNumberGetValue(theNumberRef, kCFNumberFloat64Type, &theValue); - return theValue; + return ZAny(theValue); } } } @@ -274,54 +303,17 @@ return iDefault; } -ZVal_Any sAsVal_Any(ZRef<CFTypeRef> iVal) - { return sAsVal_Any(ZVal_Any(), iVal); } +ZAny sAsAny(ZRef<CFTypeRef> iVal) + { return sAsAny(ZAny(), iVal); } -ZData_Any sAsData_Any(const ZRef<CFDataRef>& iCFData) - { - ZData_Any theData; - if (size_t theLength = ::CFDataGetLength(iCFData)) - return ZData_Any(::CFDataGetBytePtr(iCFData), theLength); - return ZData_Any(); - } - -ZList_Any sAsList_Any(const ZVal_Any& iDefault, const ZRef<CFArrayRef>& iCFArray) - { - ZList_Any theList; - - for (size_t x = 0, theCount = ::CFArrayGetCount(iCFArray); x < theCount; ++x) - theList.Append(sAsVal_Any(iDefault, ::CFArrayGetValueAtIndex(iCFArray, x))); - - return theList; - } - -static void spGatherContents(const void* iKey, const void* iValue, void* iRefcon) - { - CFStringRef theKey = static_cast<CFStringRef>(iKey); - CFTypeRef theValue = static_cast<CFTypeRef>(iValue); - - pair<ZMap_Any*, const ZVal_Any*>* thePair = - static_cast<pair<ZMap_Any*, const ZVal_Any*>*>(iRefcon); - - thePair->first->Set(sAsUTF8(theKey), sAsVal_Any(*thePair->second, theValue)); - } - -ZMap_Any sAsMap_Any(const ZVal_Any& iDefault, const ZRef<CFDictionaryRef>& iCFDictionary) - { - ZMap_Any theMap; - pair<ZMap_Any*, const ZVal_Any*> thePair(&theMap, &iDefault); - ::CFDictionaryApplyFunction(iCFDictionary, spGatherContents, &thePair); - return theMap; - } - static ZRef<CFTypeRef> spMakeNumber(CFNumberType iType, const void* iVal) { return Adopt_T<CFTypeRef>(::CFNumberCreate( kCFAllocatorDefault, iType, iVal)); } -ZRef<CFTypeRef> sAsCFType(const ZRef<CFTypeRef>& iDefault, const ZAny& iAny) +ZRef<CFTypeRef> sAsCFType(const ZRef<CFTypeRef>& iDefault, const ZAny& iVal) { if (false) {} - else if (iAny.type() == typeid(void)) + else if (!iVal) { #if defined(MAC_OS_X_VERSION_MIN_REQUIRED) \ && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_2 @@ -330,57 +322,36 @@ return ZRef<CFTypeRef>(); #endif } - else if (const string8* theValue = ZAnyCast<string8>(&iAny)) + else if (const string8* theValue = iVal.PGet_T<string8>()) { return sString(*theValue); } - else if (const vector<char>* theValue = ZAnyCast<vector<char> >(&iAny)) + else if (const vector<char>* theValue = iVal.PGet_T<vector<char> >()) { if (size_t theSize = theValue->size()) return sData(&(*theValue)[0], theSize); else return sData(); } - else if (const ZData_Any* theValue = ZAnyCast<ZData_Any>(&iAny)) + else if (const ZData_Any* theValue = iVal.PGet_T<ZData_Any>()) { if (size_t theSize = theValue->GetSize()) return sData(theValue->GetData(), theSize); else return sData(); } - else if (const vector<ZAny>* theValue = ZAnyCast<vector<ZAny> >(&iAny)) + else if (const ZList_Any* theValue = iVal.PGet_T<ZList_Any>()) { ZRef<CFMutableArrayRef> theArray; - for (vector<ZAny>::const_iterator i = theValue->begin(), end = theValue->end(); - i != end; ++i) - { - ::CFArrayAppendValue(theArray, sAsCFType(iDefault, *i)); - } - return theArray; - } - else if (const ZList_Any* theValue = ZAnyCast<ZList_Any>(&iAny)) - { - ZRef<CFMutableArrayRef> theArray; for (size_t x = 0, count = theValue->Count(); x < count; ++x) { ::CFArrayAppendValue(theArray, sAsCFType(iDefault, theValue->Get(x))); } return theArray; } - else if (const map<string, ZAny>* theValue = ZAnyCast<map<string, ZAny> >(&iAny)) + else if (const ZMap_Any* theValue = iVal.PGet_T<ZMap_Any>()) { ZRef<CFMutableDictionaryRef> theDictionary = sDictionaryMutable(); - for (map<string, ZAny>::const_iterator i = theValue->begin(), end = theValue->end(); - i != end; ++i) - { - ::CFDictionarySetValue(theDictionary, - sString((*i).first), sAsCFType(iDefault, (*i).second)); - } - return theDictionary; - } - else if (const ZMap_Any* theValue = ZAnyCast<ZMap_Any>(&iAny)) - { - ZRef<CFMutableDictionaryRef> theDictionary = sDictionaryMutable(); for (ZMap_Any::Index_t i = theValue->Begin(), end = theValue->End(); i != end; ++i) { @@ -389,79 +360,79 @@ } return theDictionary; } - else if (const bool* theValue = ZAnyCast<bool>(&iAny)) + else if (const bool* theValue = iVal.PGet_T<bool>()) { if (*theValue) return kCFBooleanTrue; else return kCFBooleanFalse; } - else if (const ZTime* theValue = ZAnyCast<ZTime>(&iAny)) + else if (const ZTime* theValue = iVal.PGet_T<ZTime>()) { return Adopt_T<CFTypeRef>(::CFDateCreate(kCFAllocatorDefault, theValue->fVal - kCFAbsoluteTimeIntervalSince1970)); } - else if (const char* theValue = ZAnyCast<char>(&iAny)) + else if (const char* theValue = iVal.PGet_T<char>()) { return spMakeNumber(kCFNumberSInt8Type, theValue); } - else if (const unsigned char* theValue = ZAnyCast<unsigned char>(&iAny)) + else if (const unsigned char* theValue = iVal.PGet_T<unsigned char>()) { return spMakeNumber(kCFNumberSInt8Type, theValue); } - else if (const signed char* theValue = ZAnyCast<signed char>(&iAny)) + else if (const signed char* theValue = iVal.PGet_T<signed char>()) { return spMakeNumber(kCFNumberSInt8Type, theValue); } - else if (const short* theValue = ZAnyCast<short>(&iAny)) + else if (const short* theValue = iVal.PGet_T<short>()) { return spMakeNumber(kCFNumberSInt16Type, theValue); } - else if (const unsigned short* theValue = ZAnyCast<unsigned short>(&iAny)) + else if (const unsigned short* theValue = iVal.PGet_T<unsigned short>()) { return spMakeNumber(kCFNumberSInt16Type, theValue); } - else if (const int* theValue = ZAnyCast<int>(&iAny)) + else if (const int* theValue = iVal.PGet_T<int>()) { if (ZIntIs32Bit) return spMakeNumber(kCFNumberSInt32Type, theValue); else return spMakeNumber(kCFNumberSInt64Type, theValue); } - else if (const unsigned int* theValue = ZAnyCast<unsigned int>(&iAny)) + else if (const unsigned int* theValue = iVal.PGet_T<unsigned int>()) { if (ZIntIs32Bit) return spMakeNumber(kCFNumberSInt32Type, theValue); else return spMakeNumber(kCFNumberSInt64Type, theValue); } - else if (const long* theValue = ZAnyCast<long>(&iAny)) + else if (const long* theValue = iVal.PGet_T<long>()) { if (ZLongIs32Bit) return spMakeNumber(kCFNumberSInt32Type, theValue); else return spMakeNumber(kCFNumberSInt64Type, theValue); } - else if (const unsigned long* theValue = ZAnyCast<unsigned long>(&iAny)) + else if (const unsigned long* theValue = iVal.PGet_T<unsigned long>()) { if (ZLongIs32Bit) return spMakeNumber(kCFNumberSInt32Type, theValue); else return spMakeNumber(kCFNumberSInt64Type, theValue); } - else if (const int64* theValue = ZAnyCast<int64>(&iAny)) + else if (const int64* theValue = iVal.PGet_T<int64>()) { return spMakeNumber(kCFNumberSInt64Type, theValue); } - else if (const uint64* theValue = ZAnyCast<uint64>(&iAny)) + else if (const uint64* theValue = iVal.PGet_T<uint64>()) { return spMakeNumber(kCFNumberSInt64Type, theValue); } - else if (const float* theValue = ZAnyCast<float>(&iAny)) + else if (const float* theValue = iVal.PGet_T<float>()) { return spMakeNumber(kCFNumberFloatType, theValue); } - else if (const double* theValue = ZAnyCast<double>(&iAny)) + else if (const double* theValue = iVal.PGet_T<double>()) { return spMakeNumber(kCFNumberDoubleType, theValue); } @@ -469,8 +440,8 @@ return iDefault; } -ZRef<CFTypeRef> sAsCFType(const ZAny& iAny) - { return sAsCFType(ZRef<CFTypeRef>(), iAny); } +ZRef<CFTypeRef> sAsCFType(const ZAny& iVal) + { return sAsCFType(ZRef<CFTypeRef>(), iVal); } } // namespace ZUtil_CFType Modified: trunk/zoolib/source/cxx/zoolib/ZUtil_CFType.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZUtil_CFType.h 2009-09-22 05:21:03 UTC (rev 991) +++ trunk/zoolib/source/cxx/zoolib/ZUtil_CFType.h 2009-09-22 06:14:44 UTC (rev 992) @@ -47,22 +47,21 @@ ZRef<CFMutableStringRef> sStringMutable(const string16& iString16); ZRef<CFMutableStringRef> sStringMutable(const ZRef<CFStringRef>& iCFString); +// ----- -string8 sAsUTF8(CFStringRef iCFString); -string16 sAsUTF16(CFStringRef iCFString); - - ZRef<CFDictionaryRef> sDictionary(); ZRef<CFMutableDictionaryRef> sDictionaryMutable(); ZRef<CFMutableDictionaryRef> sDictionaryMutable(const ZRef<CFDictionaryRef>& iCFDictionary); +// ----- ZRef<CFArrayRef> sArray(); ZRef<CFMutableArrayRef> sArrayMutable(); ZRef<CFMutableArrayRef> sArrayMutable(const ZRef<CFArrayRef>& iCFArray); +// ----- ZRef<CFDataRef> sData(); ZRef<CFDataRef> sData(const void* iSource, size_t iSize); @@ -71,16 +70,16 @@ ZRef<CFMutableDataRef> sDataMutable(size_t iSize); ZRef<CFMutableDataRef> sDataMutable(const ZRef<CFDataRef>& iCFData); +// ----- -ZVal_Any sAsVal_Any(const ZVal_Any& iDefault, ZRef<CFTypeRef> iVal); -ZVal_Any sAsVal_Any(ZRef<CFTypeRef> iVal); +string8 sAsUTF8(CFStringRef iCFString); +string16 sAsUTF16(CFStringRef iCFString); -ZData_Any sAsData_Any(const ZRef<CFDataRef>& iCFData); -ZList_Any sAsList_Any(const ZVal_Any& iDefault, const ZRef<CFArrayRef>& iCFArray); -ZMap_Any sAsMap_Any(const ZVal_Any& iDefault, const ZRef<CFDictionaryRef>& iCFDictionary); +ZAny sAsAny(const ZAny& iDefault, ZRef<CFTypeRef> iVal); +ZAny sAsAny(ZRef<CFTypeRef> iVal); -ZRef<CFTypeRef> sAsCFType(const ZRef<CFTypeRef>& iDefault, const ZAny& iAny); -ZRef<CFTypeRef> sAsCFType(const ZAny& iAny); +ZRef<CFTypeRef> sAsCFType(const ZRef<CFTypeRef>& iDefault, const ZAny& iVal); +ZRef<CFTypeRef> sAsCFType(const ZAny& iVal); } // namespace ZUtil_CFType Modified: trunk/zoolib/source/cxx/zoolib/ZUtil_NSObject.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZUtil_NSObject.h 2009-09-22 05:21:03 UTC (rev 991) +++ trunk/zoolib/source/cxx/zoolib/ZUtil_NSObject.h 2009-09-22 06:14:44 UTC (rev 992) @@ -29,8 +29,8 @@ // with Cocotron, otherwise va_list isn't appropriately visible to ObjC code. #include <Foundation/Foundation.h> -#include "zoolib/ZTuple.h" #include "zoolib/ZUnicodeString.h" +#include "zoolib/ZVal_Any.h" NAMESPACE_ZOOLIB_BEGIN @@ -40,21 +40,49 @@ namespace ZUtil_NSObject { -NSString* sCreateNSString_UTF8(const string8& iString8); -NSString* sCreateNSString_UTF16(const string16& iString16); +NSString* sString(); +NSString* sString(const string8& iString8); +NSString* sString(const string16& iString16); +NSMutableString* sStringMutable(); +NSMutableString* sStringMutable(const string8& iString8); +NSMutableString* sStringMutable(const string16& iString16); +NSMutableString* sStringMutable(NSString* iNSString); + +// ----- + +NSDictionary* sDictionary(); + +NSMutableDictionary* sDictionaryMutable(); +NSMutableDictionary* sDictionaryMutable(NSDictionary* iNSDictionary); + +// ----- + +NSArray* sArray(); + +NSMutableArray* sArrayMutable(); +NSMutableArray* sArrayMutable(NSArray* iNSArray); + +// ----- + +NSData* sData(); +NSData* sData(const void* iSource, size_t iSize); + +NSMutableData* sDataMutable(); +NSMutableData* sDataMutable(size_t iSize); +NSMutableData* sDataMutable(NSData* iNSData); + +// ----- + string8 sAsUTF8(NSString* iNSString); string16 sAsUTF16(NSString* iNSString); -ZTValue sAsTV(id iNSObject); -id sCreateNSObject(const ZTValue& iTV); +ZAny sAsAny(const ZAny& iDefault, NSObject* iVal); +ZAny sAsAny(NSObject* iVal); -ZTuple sAsTuple(NSDictionary* iNSDictionary); -NSDictionary* sCreateNSDictionary(const ZTuple& iTuple); +NSObject* sAsNSObject(NSObject* iDefault, const ZAny& iVal); +NSObject* sAsNSObject(const ZAny& iVal); -void sAsVector(NSArray* iNSArray, std::vector<ZTValue>& oVector); -NSArray* sCreateNSArray(const std::vector<ZTValue>& iVector); - } // namespace ZUtil_NSObject NAMESPACE_ZOOLIB_END Modified: trunk/zoolib/source/cxx/zoolib/ZUtil_NSObject.mm =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZUtil_NSObject.mm 2009-09-22 05:21:03 UTC (rev 991) +++ trunk/zoolib/source/cxx/zoolib/ZUtil_NSObject.mm 2009-09-22 06:14:44 UTC (rev 992) @@ -22,6 +22,8 @@ #if ZCONFIG_SPI_Enabled(Cocoa) +#include "zoolib/ZObjC.h" +#include "zoolib/ZTime.h" #include "zoolib/ZUnicode.h" #import <Foundation/NSString.h> @@ -31,230 +33,335 @@ NAMESPACE_ZOOLIB_USING +@interface NSObject (ZAny_Additions) +-(ZAny)asAnyWithDefault:(const ZAny&)iDefault; +@end + // ================================================================================================= +#pragma mark - +#pragma mark * ZUtil_NSObject -@interface NSObject (ZTValueAdditions) --(ZTValue)AsZTValue; -@end +NAMESPACE_ZOOLIB_BEGIN -@interface NSDictionary (ZTValueAdditions) --(ZTValue)AsZTValue; -@end +namespace ZUtil_NSObject { -@interface NSArray (ZTValueAdditions) --(ZTValue)AsZTValue; -@end +NSString* sString() + { return [NSString string]; } -@interface NSString (ZTValueAdditions) --(ZTValue)AsZTValue; -@end +NSString* sString(const string8& iString8) + { return [NSString stringWithUTF8String:iString8.c_str()]; } -@interface NSNumber (ZTValueAdditions) --(ZTValue)AsZTValue; -@end +NSString* sString(const string16& iString16) + { + return [NSString + stringWithCharacters:(const unichar*)iString16.c_str() + length:iString16.length()]; + } -/* -@interface NSData (ZTValueAdditions) --(ZTValue)AsZTValue; -@end -*/ -// ================================================================================================= +NSMutableString* sStringMutable() + { return [NSMutableString string]; } -@implementation NSObject (ZTValueAdditions) +NSMutableString* sStringMutable(const string8& iString8) + { return [NSMutableString stringWithUTF8String:iString8.c_str()]; } --(ZTValue)AsZTValue +NSMutableString* sStringMutable(const string16& iString16) { - // Hmm, log and return null or what? - ZDebugLogf(0, ("NSObject (ZTValueAdditions) AsZTValue called")); - return ZTValue(); + return [NSMutableString + stringWithCharacters:(const unichar*)iString16.c_str() + length:iString16.length()]; } -@end +NSMutableString* sStringMutable(NSString* iNSString) + { return [NSMutableString stringWithString:iNSString]; } -// ================================================================================================= +// ----- -@implementation NSDictionary (ZTValueAdditions) +NSDictionary* sDictionary() + { return [NSDictionary dictionary]; } --(ZTValue)AsZTValue - { - ZTuple result; - for (id theKey, i = [self keyEnumerator]; (theKey = [i nextObject]); /*no inc*/) - { - const ZTValue theValue = [[self objectForKey:theKey] AsZTValue]; - const string theName = ZUtil_NSObject::sAsUTF8((NSString*)theKey); - result.Set(theName, theValue); - } - return result; - } +NSMutableDictionary* sDictionaryMutable() + { return [NSMutableDictionary dictionary]; } -@end +NSMutableDictionary* sDictionaryMutable(NSDictionary* iNSDictionary) + { return [NSMutableDictionary dictionaryWithDictionary:iNSDictionary]; } + -// ================================================================================================= +// ----- -@implementation NSArray (ZTValueAdditions) +NSArray* sArray() + { return [NSArray array]; } --(ZTValue)AsZTValue +NSMutableArray* sArrayMutable() + { return [NSMutableArray array]; } + +NSMutableArray* sArrayMutable(NSArray* iNSArray) + { return [NSMutableArray arrayWithArray:iNSArray]; } + +// ----- + +NSData* sData() + { return [NSData data]; } + +NSData* sData(const void* iSource, size_t iSize) + { return [NSData dataWithBytes:iSource length:iSize]; } + +NSMutableData* sDataMutable() + { return [NSMutableData data]; } + +NSMutableData* sDataMutable(size_t iSize) { - ZTValue result; - vector<ZTValue>& theVec = result.MutableList().MutableVector(); - for (id theValue, i = [self objectEnumerator]; (theValue = [i nextObject]); /*no inc*/) - theVec.push_back([theValue AsZTValue]); + NSMutableData* result = [NSMutableData data]; + [result setLength:iSize]; return result; } -@end +NSMutableData* sDataMutable(NSData* iNSData) + { return [NSMutableData dataWithData:iNSData]; } // ================================================================================================= +#pragma mark - +#pragma mark * ZUtil_NSObject, conversions -@implementation NSString (ZTValueAdditions) +string8 sAsUTF8(NSString* iNSString) + { return [iNSString UTF8String]; } --(ZTValue)AsZTValue +string16 sAsUTF16(NSString* iNSString) + { return ZUnicode::sAsUTF16([iNSString UTF8String]); } + +ZAny sAsAny(const ZAny& iDefault, NSObject* iVal) { - return ZTValue([self UTF8String]); + if (iVal) + { + @try + { + return [iVal asAnyWithDefault:iDefault]; + } + @catch (id ex) + {} + } + return iDefault; } -@end +ZAny sAsAny(NSObject* iVal) + { return sAsAny(ZAny(), iVal); } +NSObject* sAsNSObject(NSObject* iDefault, const ZAny& iVal) + { + if (false) + {} + else if (!iVal) + { + return [NSNull null]; + } + else if (const string8* theValue = iVal.PGet_T<string8>()) + { + return sString(*theValue); + } + else if (const vector<char>* theValue = iVal.PGet_T<vector<char> >()) + { + if (size_t theSize = theValue->size()) + return sData(&(*theValue)[0], theSize); + else + return sData(); + } + else if (const ZData_Any* theValue = iVal.PGet_T<ZData_Any>()) + { + if (size_t theSize = theValue->GetSize()) + return sData(theValue->GetData(), theSize); + else + return sData(); + } + else if (const ZList_Any* theValue = iVal.PGet_T<ZList_Any>()) + { + NSMutableArray* theArray = sArrayMutable(); + for (size_t x = 0, count = theValue->Count(); x < count; ++x) + [theArray addObject:sAsNSObject(iDefault, theValue->Get(x))]; + return theArray; + } + else if (const ZMap_Any* theValue = iVal.PGet_T<ZMap_Any>()) + { + NSMutableDictionary* theDictionary = sDictionaryMutable(); + for (ZMap_Any::Index_t i = theValue->Begin(), end = theValue->End(); + i != end; ++i) + { + [theDictionary setObject:sAsNSObject(iDefault, theValue->Get(i)) + forKey:sString(theValue->NameOf(i))]; + } + return theDictionary; + } + else if (const bool* theValue = iVal.PGet_T<bool>()) + { + return [NSNumber numberWithBool:(BOOL)*theValue]; + } + else if (const ZTime* theValue = iVal.PGet_T<ZTime>()) + { + return [NSDate dateWithTimeIntervalSince1970:theValue->fVal]; + } + else if (const char* theValue = iVal.PGet_T<char>()) + { + return [NSNumber numberWithChar:*theValue]; + } + else if (const unsigned char* theValue = iVal.PGet_T<unsigned char>()) + { + return [NSNumber numberWithUnsignedChar:*theValue]; + } + else if (const signed char* theValue = iVal.PGet_T<signed char>()) + { + return [NSNumber numberWithChar:*theValue]; + } + else if (const short* theValue = iVal.PGet_T<short>()) + { + return [NSNumber numberWithShort:*theValue]; + } + else if (const unsigned short* theValue = iVal.PGet_T<unsigned short>()) + { + return [NSNumber numberWithUnsignedShort:*theValue]; + } + else if (const int* theValue = iVal.PGet_T<int>()) + { + return [NSNumber numberWithInt:*theValue]; + } + else if (const unsigned int* theValue = iVal.PGet_T<unsigned int>()) + { + return [NSNumber numberWithUnsignedInt:*theValue]; + } + else if (const long* theValue = iVal.PGet_T<long>()) + { + return [NSNumber numberWithLong:*theValue]; + } + else if (const unsigned long* theValue = iVal.PGe... [truncated message content] |
From: <ag...@us...> - 2010-01-20 07:44:28
|
Revision: 1112 http://zoolib.svn.sourceforge.net/zoolib/?rev=1112&view=rev Author: agreen Date: 2010-01-20 07:43:59 +0000 (Wed, 20 Jan 2010) Log Message: ----------- Fix sRelease_T issues. Modified Paths: -------------- trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Guest.cpp trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host.cpp trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.cpp trunk/zoolib/source/cxx/zoolib/ZRef.h trunk/zoolib/source/cxx/zoolib/ZRef_CFType.cpp Modified: trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Guest.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Guest.cpp 2010-01-20 06:24:48 UTC (rev 1111) +++ trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Guest.cpp 2010-01-20 07:43:59 UTC (rev 1112) @@ -43,6 +43,13 @@ NAMESPACE_ZOOLIB_BEGIN +template <> +void sRelease_T(const ZNetscape::NPVariantG& iNPVariantG) + { + ZNetscape::GuestMeister::sGet()-> + Host_ReleaseVariantValue(const_cast<ZNetscape::NPVariantG*>(&iNPVariantG)); + } + namespace ZNetscape { // ================================================================================================= @@ -80,10 +87,6 @@ return false; } -//template <> -//void sRelease_T(NPVariantG& iNPVariantG) -// { GuestMeister::sGet()->Host_ReleaseVariantValue(&iNPVariantG); } - template <> void* sMalloc_T(NPVariantG&, size_t iLength) { return GuestMeister::sGet()->Host_MemAlloc(iLength); } Modified: trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host.cpp 2010-01-20 06:24:48 UTC (rev 1111) +++ trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host.cpp 2010-01-20 07:43:59 UTC (rev 1112) @@ -36,6 +36,13 @@ NAMESPACE_ZOOLIB_BEGIN +template <> +void sRelease_T(const ZNetscape::NPVariantH& iNPVariantH) + { + ZNetscape::HostMeister::sGet()-> + ReleaseVariantValue(const_cast<ZNetscape::NPVariantH*>(&iNPVariantH)); + } + namespace ZNetscape { // ================================================================================================= @@ -57,10 +64,6 @@ return false; } -//template <> -//void sRelease_T(NPVariantH& iNPVariantH) -// { HostMeister::sGet()->ReleaseVariantValue(&iNPVariantH); } - template <> void* sMalloc_T(NPVariantH&, size_t iLength) { return HostMeister::sGet()->MemAlloc(iLength); } Modified: trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.cpp 2010-01-20 06:24:48 UTC (rev 1111) +++ trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.cpp 2010-01-20 07:43:59 UTC (rev 1112) @@ -327,14 +327,14 @@ #pragma mark * Support for ZRef<ASZString> template <> -void sRetain_T(struct ASZByteRun*& iString) +void sRetain_T(const ASZString& iString) { if (iString) spASZString->AddRef(iString); } template <> -void sRelease_T(struct ASZByteRun* iString) +void sRelease_T(const ASZString& iString) { if (iString) spASZString->Release(iString); Modified: trunk/zoolib/source/cxx/zoolib/ZRef.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZRef.h 2010-01-20 06:24:48 UTC (rev 1111) +++ trunk/zoolib/source/cxx/zoolib/ZRef.h 2010-01-20 07:43:59 UTC (rev 1112) @@ -200,7 +200,7 @@ #pragma mark * ZRef partially specialized for pointer types template <class T> void sRetain_T(T&); -template <class T> void sRelease_T(T); +template <class T> void sRelease_T(const T&); template <class T> class ZRef<T*> Modified: trunk/zoolib/source/cxx/zoolib/ZRef_CFType.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZRef_CFType.cpp 2010-01-20 06:24:48 UTC (rev 1111) +++ trunk/zoolib/source/cxx/zoolib/ZRef_CFType.cpp 2010-01-20 07:43:59 UTC (rev 1112) @@ -29,7 +29,7 @@ #define ZOOLIB_RETAIN_RELEASE(a) \ NAMESPACE_ZOOLIB_BEGIN \ template <> void sRetain_T(a& iRef) { if (iRef) ::CFRetain(iRef); } \ - template <> void sRelease_T(a iRef) { if (iRef) ::CFRelease(iRef); } \ + template <> void sRelease_T(const a& iRef) { if (iRef) ::CFRelease(iRef); } \ NAMESPACE_ZOOLIB_END // ================================================================================================= This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2010-01-20 17:26:33
|
Revision: 1113 http://zoolib.svn.sourceforge.net/zoolib/?rev=1113&view=rev Author: agreen Date: 2010-01-20 17:25:54 +0000 (Wed, 20 Jan 2010) Log Message: ----------- Last night's changes were wrong -- the ambiguity between ZooLib::sRetain_T and ZooLib::ZNetscape::sRetain_T was because they are different kinds of retain and so should have different signatures. Modified Paths: -------------- trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Guest.cpp trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host.cpp trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Variant.h trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_VariantPriv.h trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.cpp trunk/zoolib/source/cxx/zoolib/ZRef.h trunk/zoolib/source/cxx/zoolib/ZRef_CFType.cpp Modified: trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Guest.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Guest.cpp 2010-01-20 07:43:59 UTC (rev 1112) +++ trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Guest.cpp 2010-01-20 17:25:54 UTC (rev 1113) @@ -43,13 +43,6 @@ NAMESPACE_ZOOLIB_BEGIN -template <> -void sRelease_T(const ZNetscape::NPVariantG& iNPVariantG) - { - ZNetscape::GuestMeister::sGet()-> - Host_ReleaseVariantValue(const_cast<ZNetscape::NPVariantG*>(&iNPVariantG)); - } - namespace ZNetscape { // ================================================================================================= @@ -88,6 +81,10 @@ } template <> +void sVariantRelease_T(NPVariantG& iNPVariantG) + { GuestMeister::sGet()->ReleaseVariantValue(&NPVariantG); } + +template <> void* sMalloc_T(NPVariantG&, size_t iLength) { return GuestMeister::sGet()->Host_MemAlloc(iLength); } Modified: trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host.cpp 2010-01-20 07:43:59 UTC (rev 1112) +++ trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host.cpp 2010-01-20 17:25:54 UTC (rev 1113) @@ -36,13 +36,6 @@ NAMESPACE_ZOOLIB_BEGIN -template <> -void sRelease_T(const ZNetscape::NPVariantH& iNPVariantH) - { - ZNetscape::HostMeister::sGet()-> - ReleaseVariantValue(const_cast<ZNetscape::NPVariantH*>(&iNPVariantH)); - } - namespace ZNetscape { // ================================================================================================= @@ -65,6 +58,10 @@ } template <> +void sVariantRelease_T(NPVariantH& iNPVariantH) + { HostMeister::sGet()->ReleaseVariantValue(&iNPVariantH); } + +template <> void* sMalloc_T(NPVariantH&, size_t iLength) { return HostMeister::sGet()->MemAlloc(iLength); } Modified: trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Variant.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Variant.h 2010-01-20 07:43:59 UTC (rev 1112) +++ trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Variant.h 2010-01-20 17:25:54 UTC (rev 1113) @@ -66,6 +66,9 @@ #pragma mark * NPVariant_T template <class T> +void sVariantRelease_T(T&); + +template <class T> void* sMalloc_T(T&, size_t); template <class T> Modified: trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_VariantPriv.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_VariantPriv.h 2010-01-20 07:43:59 UTC (rev 1112) +++ trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_VariantPriv.h 2010-01-20 17:25:54 UTC (rev 1113) @@ -109,7 +109,7 @@ template <class T> void NPVariant_T<T>::pRelease() - { sRelease_T(*this); } + { sVariantRelease_T(*this); } template <class T> NPVariant_T<T>::NPVariant_T() Modified: trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.cpp 2010-01-20 07:43:59 UTC (rev 1112) +++ trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.cpp 2010-01-20 17:25:54 UTC (rev 1113) @@ -334,7 +334,7 @@ } template <> -void sRelease_T(const ASZString& iString) +void sRelease_T(struct ASZByteRun* iString) { if (iString) spASZString->Release(iString); Modified: trunk/zoolib/source/cxx/zoolib/ZRef.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZRef.h 2010-01-20 07:43:59 UTC (rev 1112) +++ trunk/zoolib/source/cxx/zoolib/ZRef.h 2010-01-20 17:25:54 UTC (rev 1113) @@ -200,7 +200,7 @@ #pragma mark * ZRef partially specialized for pointer types template <class T> void sRetain_T(T&); -template <class T> void sRelease_T(const T&); +template <class T> void sRelease_T(T); template <class T> class ZRef<T*> Modified: trunk/zoolib/source/cxx/zoolib/ZRef_CFType.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZRef_CFType.cpp 2010-01-20 07:43:59 UTC (rev 1112) +++ trunk/zoolib/source/cxx/zoolib/ZRef_CFType.cpp 2010-01-20 17:25:54 UTC (rev 1113) @@ -29,7 +29,7 @@ #define ZOOLIB_RETAIN_RELEASE(a) \ NAMESPACE_ZOOLIB_BEGIN \ template <> void sRetain_T(a& iRef) { if (iRef) ::CFRetain(iRef); } \ - template <> void sRelease_T(const a& iRef) { if (iRef) ::CFRelease(iRef); } \ + template <> void sRelease_T(a iRef) { if (iRef) ::CFRelease(iRef); } \ NAMESPACE_ZOOLIB_END // ================================================================================================= This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2010-01-20 23:57:19
|
Revision: 1116 http://zoolib.svn.sourceforge.net/zoolib/?rev=1116&view=rev Author: agreen Date: 2010-01-20 23:57:11 +0000 (Wed, 20 Jan 2010) Log Message: ----------- Rename ZList-->ZSeq. To my mind the word 'list' has an overly strong association with a linked list in STL-using C++. Modified Paths: -------------- trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape.cpp trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape.h trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Guest.cpp trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.cpp trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.h trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Yad.cpp trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Yad.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBQuery.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBRep_Client.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBServer.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBSpec.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTSWatcherServer.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTSWatcher_Client.cpp trunk/zoolib/source/cxx/old/zoolib/ZTS_Umbrella.cpp trunk/zoolib/source/cxx/old/zoolib/ZWebDAV.cpp trunk/zoolib/source/cxx/zoolib/ZHTTP.cpp trunk/zoolib/source/cxx/zoolib/ZHTTP.h trunk/zoolib/source/cxx/zoolib/ZTuple.cpp trunk/zoolib/source/cxx/zoolib/ZUtil_CFType.cpp trunk/zoolib/source/cxx/zoolib/ZUtil_NSObject.mm trunk/zoolib/source/cxx/zoolib/ZUtil_Yad.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/ZVal_CFType.h trunk/zoolib/source/cxx/zoolib/ZVal_NS.h trunk/zoolib/source/cxx/zoolib/ZVal_NS.mm trunk/zoolib/source/cxx/zoolib/ZVal_ZooLib.cpp trunk/zoolib/source/cxx/zoolib/ZVal_ZooLib.h trunk/zoolib/source/cxx/zoolib/ZYad.cpp trunk/zoolib/source/cxx/zoolib/ZYad.h trunk/zoolib/source/cxx/zoolib/ZYad_Any.cpp trunk/zoolib/source/cxx/zoolib/ZYad_Any.h trunk/zoolib/source/cxx/zoolib/ZYad_AppleEvent.cpp trunk/zoolib/source/cxx/zoolib/ZYad_AppleEvent.h trunk/zoolib/source/cxx/zoolib/ZYad_Bencode.cpp trunk/zoolib/source/cxx/zoolib/ZYad_Bencode.h trunk/zoolib/source/cxx/zoolib/ZYad_CFType.cpp trunk/zoolib/source/cxx/zoolib/ZYad_CFType.h trunk/zoolib/source/cxx/zoolib/ZYad_JSON.cpp trunk/zoolib/source/cxx/zoolib/ZYad_JSON.h trunk/zoolib/source/cxx/zoolib/ZYad_JSONNormalize.cpp trunk/zoolib/source/cxx/zoolib/ZYad_JSONNormalize.h trunk/zoolib/source/cxx/zoolib/ZYad_NS.h trunk/zoolib/source/cxx/zoolib/ZYad_NS.mm trunk/zoolib/source/cxx/zoolib/ZYad_Std.cpp trunk/zoolib/source/cxx/zoolib/ZYad_Std.h trunk/zoolib/source/cxx/zoolib/ZYad_Val_T.h trunk/zoolib/source/cxx/zoolib/ZYad_XMLPList.cpp trunk/zoolib/source/cxx/zoolib/ZYad_XMLPList.h trunk/zoolib/source/cxx/zoolib/ZYad_XMLRPC.cpp trunk/zoolib/source/cxx/zoolib/ZYad_XMLRPC.h trunk/zoolib/source/cxx/zoolib/ZYad_ZooLib.cpp trunk/zoolib/source/cxx/zoolib/ZYad_ZooLib.h trunk/zoolib/source/cxx/zoolib/ZYad_ZooLibStream.cpp trunk/zoolib/source/cxx/zoolib/ZYad_ZooLibStrim.cpp trunk/zoolib/source/cxx/zoolib/ZYad_ZooLibStrim.h Modified: trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape.cpp 2010-01-20 17:48:23 UTC (rev 1115) +++ trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape.cpp 2010-01-20 23:57:11 UTC (rev 1116) @@ -35,9 +35,6 @@ #pragma mark - #pragma mark * ZNetscape::NPClass_Z -//#define ASSIGN(a) \ -// *static_cast<intptr_t*>(static_cast<void*>(&this->a)) = reinterpret_cast<intptr_t>(a); - #define ASSIGN(a) this->a = a NPClass_Z::NPClass_Z( @@ -82,7 +79,7 @@ #define CASE(a) case a: return #a -std::string sAsString(NPNVariable iVar) +string sAsString(NPNVariable iVar) { switch (iVar) { @@ -109,7 +106,7 @@ return ZString::sFormat("NPNVariable=%d", iVar); } -std::string sAsString(NPPVariable iVar) +string sAsString(NPPVariable iVar) { switch (iVar) { Modified: trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape.h 2010-01-20 17:48:23 UTC (rev 1115) +++ trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape.h 2010-01-20 23:57:11 UTC (rev 1116) @@ -26,8 +26,6 @@ #include "zoolib/netscape/ZCompat_npapi.h" -#include "zoolib/ZCompat_operator_bool.h" - #include <string> #include <vector> Modified: trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Guest.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Guest.cpp 2010-01-20 17:48:23 UTC (rev 1115) +++ trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Guest.cpp 2010-01-20 23:57:11 UTC (rev 1116) @@ -82,7 +82,7 @@ template <> void sVariantRelease_T(NPVariantG& iNPVariantG) - { GuestMeister::sGet()->ReleaseVariantValue(&NPVariantG); } + { GuestMeister::sGet()->Host_ReleaseVariantValue(&iNPVariantG); } template <> void* sMalloc_T(NPVariantG&, size_t iLength) Modified: trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.cpp 2010-01-20 17:48:23 UTC (rev 1115) +++ trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.cpp 2010-01-20 23:57:11 UTC (rev 1116) @@ -36,8 +36,6 @@ # endif #endif -#include <map> - #if ZCONFIG_SPI_Enabled(Win) enum { @@ -48,7 +46,7 @@ // ================================================================================================= #pragma mark - -#pragma mark * List and Map Copy, Getter, Setter macros +#pragma mark * Seq and Map Copy, Getter, Setter macros #define COPYFROMTO(SUITE, iSource, iKey, iType, DEST) \ switch (iType) \ @@ -228,7 +226,7 @@ { \ PIActionList theVal; \ if (noErr == SUITE->GetList(P0, P1, &theVal)) \ - { oVal = List(Adopt(theVal)); return true; } \ + { oVal = Seq(Adopt(theVal)); return true; } \ break; \ } \ case typeObject: \ @@ -282,7 +280,7 @@ { SUITE->PutString(PARAM, const_cast<char*>(theVal->c_str())); } \ else if (const bool* theVal = iVal.PGet_T<bool>()) \ { SUITE->PutBoolean(PARAM, *theVal); } \ - else if (const List* theVal = iVal.PGet_T<List>()) \ + else if (const Seq* theVal = iVal.PGet_T<Seq>()) \ { SUITE->PutList(PARAM, theVal->IParam()); } \ else if (const Map* theVal = iVal.PGet_T<Map>()) \ { SUITE->PutObject(PARAM, theVal->GetType(), theVal->IParam()); } \ @@ -454,7 +452,6 @@ static string8 spAsString(KeyID iKeyID) { return spFromRuntimeTypeID(iKeyID); } - // ================================================================================================= #pragma mark - #pragma mark * Public utilities @@ -492,6 +489,7 @@ return true; } + bool sFromRuntimeTypeID(TypeID iTypeID, string8& oString) { char buf[1024]; @@ -997,7 +995,7 @@ if (const Map* theVal = this->PGet_T<Map>()) return ZAny(theVal->AsAny(iDefault)); - if (const List* theVal = this->PGet_T<List>()) + if (const Seq* theVal = this->PGet_T<Seq>()) return ZAny(theVal->AsAny(iDefault)); return *this; @@ -1055,7 +1053,7 @@ : ZAny(iVal) {} -Val::Val(const List& iVal) +Val::Val(const Seq& iVal) : ZAny(iVal) {} @@ -1080,23 +1078,23 @@ ZMACRO_ZValAccessors_Def_Entry(Val, UnitFloat, UnitFloat) ZMACRO_ZValAccessors_Def_Entry(Val, Enumerated, Enumerated) ZMACRO_ZValAccessors_Def_Entry(Val, FileRef, FileRef) -ZMACRO_ZValAccessors_Def_Entry(Val, List, List) +ZMACRO_ZValAccessors_Def_Entry(Val, Seq, Seq) ZMACRO_ZValAccessors_Def_Entry(Val, Map, Map) ZMACRO_ZValAccessors_Def_Entry(Val, Spec, Spec) // ================================================================================================= #pragma mark - -#pragma mark * List +#pragma mark * Seq -List::operator operator_bool_type() const +Seq::operator operator_bool_type() const { return operator_bool_generator_type::translate(this->Count()); } -ZAny List::AsAny() const +ZAny Seq::AsAny() const { return this->AsAny(ZAny()); } -ZAny List::AsAny(const ZAny& iDefault) const +ZAny Seq::AsAny(const ZAny& iDefault) const { - ZList_Any theList; + ZSeq_Any theList; if (size_t theCount = this->Count()) { for (size_t x = 0; x < theCount; ++x) @@ -1105,20 +1103,20 @@ return ZAny(theList); } -void List::swap(List& iOther) +void Seq::swap(Seq& iOther) { std::swap(fAL, iOther.fAL); } -List::List() +Seq::Seq() { spPSActionList->Make(&fAL); } -List::List(const List& iOther) +Seq::Seq(const Seq& iOther) : fAL(spDuplicate(iOther.fAL)) {} -List::~List() +Seq::~Seq() { spPSActionList->Free(fAL); } -List& List::operator=(const List& iOther) +Seq& Seq::operator=(const Seq& iOther) { if (this != &iOther) { @@ -1128,29 +1126,29 @@ return *this; } -List::List(PIActionList iOther) +Seq::Seq(PIActionList iOther) : fAL(spDuplicate(iOther)) {} -List::List(Adopt_T<PIActionList> iOther) +Seq::Seq(Adopt_T<PIActionList> iOther) : fAL(iOther.Get()) {} -List& List::operator=(PIActionList iOther) +Seq& Seq::operator=(PIActionList iOther) { spPSActionList->Free(fAL); fAL = spDuplicate(iOther); return *this; } -List& List::operator=(Adopt_T<PIActionList> iOther) +Seq& Seq::operator=(Adopt_T<PIActionList> iOther) { spPSActionList->Free(fAL); fAL = iOther.Get(); return *this; } -size_t List::Count() const +size_t Seq::Count() const { uint32 result; if (noErr == spPSActionList->GetCount(fAL, &result)) @@ -1158,13 +1156,13 @@ return 0; } -void List::Clear() +void Seq::Clear() { spPSActionList->Free(fAL); spPSActionList->Make(&fAL); } -bool List::QGet(size_t iIndex, Val& oVal) const +bool Seq::QGet(size_t iIndex, Val& oVal) const { if (iIndex >= this->Count()) return false; @@ -1182,7 +1180,7 @@ return false; } -Val List::DGet(const Val& iDefault, size_t iIndex) const +Val Seq::DGet(const Val& iDefault, size_t iIndex) const { Val result; if (this->QGet(iIndex, result)) @@ -1190,16 +1188,16 @@ return iDefault; } -Val List::Get(size_t iIndex) const +Val Seq::Get(size_t iIndex) const { return this->DGet(Val(), iIndex); } -List& List::Append(const Val& iVal) +Seq& Seq::Append(const Val& iVal) { SETTERCASES(spPSActionList, fAL) return *this; } -PIActionList& List::OParam() +PIActionList& Seq::OParam() { if (fAL) spPSActionList->Free(fAL); @@ -1207,10 +1205,10 @@ return fAL; } -PIActionList List::IParam() const +PIActionList Seq::IParam() const { return fAL; } -PIActionList List::Orphan() +PIActionList Seq::Orphan() { PIActionList result = fAL; fAL = nullptr; Modified: trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.h 2010-01-20 17:48:23 UTC (rev 1115) +++ trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.h 2010-01-20 23:57:11 UTC (rev 1116) @@ -52,8 +52,8 @@ typedef ZData_Any Data; -class List; class Map; +class Seq; class Spec; class Val; @@ -244,7 +244,7 @@ Val(const UnitFloat& iVal); Val(const Enumerated& iVal); Val(const FileRef& iVal); - Val(const List& iVal); + Val(const Seq& iVal); Val(const Map& iVal); Val(const Spec& iVal); @@ -258,18 +258,18 @@ ZMACRO_ZValAccessors_Decl_Entry(Val, UnitFloat, UnitFloat) ZMACRO_ZValAccessors_Decl_Entry(Val, Enumerated, Enumerated) ZMACRO_ZValAccessors_Decl_Entry(Val, FileRef, FileRef) - ZMACRO_ZValAccessors_Decl_Entry(Val, List, List) + ZMACRO_ZValAccessors_Decl_Entry(Val, Seq, Seq) ZMACRO_ZValAccessors_Decl_Entry(Val, Map, Map) ZMACRO_ZValAccessors_Decl_Entry(Val, Spec, Spec) }; // ================================================================================================= #pragma mark - -#pragma mark * List +#pragma mark * Seq -class List +class Seq { - ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES(List, + ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES(Seq, operator_bool_generator_type, operator_bool_type); public: @@ -278,20 +278,20 @@ ZAny AsAny() const; ZAny AsAny(const ZAny& iDefault) const; - void swap(List& iOther); + void swap(Seq& iOther); - List(); - List(const List& iOther); - ~List(); - List& operator=(const List& iOther); + Seq(); + Seq(const Seq& iOther); + ~Seq(); + Seq& operator=(const Seq& iOther); - List(PIActionList iOther); - List(Adopt_T<PIActionList> iOther); + Seq(PIActionList iOther); + Seq(Adopt_T<PIActionList> iOther); - List& operator=(PIActionList iOther); - List& operator=(Adopt_T<PIActionList> iOther); + Seq& operator=(PIActionList iOther); + Seq& operator=(Adopt_T<PIActionList> iOther); -// ZList protocol +// ZSeq protocol size_t Count() const; void Clear(); @@ -300,7 +300,7 @@ Val DGet(const Val& iDefault, size_t iIndex) const; Val Get(size_t iIndex) const; - List& Append(const Val& iVal); + Seq& Append(const Val& iVal); // Our protocol PIActionList& OParam(); @@ -409,7 +409,7 @@ inline void swap(ZOOLIB_PREFIX::ZPhotoshop::Val& a, ZOOLIB_PREFIX::ZPhotoshop::Val& b) { a.swap(b); } -inline void swap(ZOOLIB_PREFIX::ZPhotoshop::List& a, ZOOLIB_PREFIX::ZPhotoshop::List& b) +inline void swap(ZOOLIB_PREFIX::ZPhotoshop::Seq& a, ZOOLIB_PREFIX::ZPhotoshop::Seq& b) { a.swap(b); } inline void swap(ZOOLIB_PREFIX::ZPhotoshop::Map& a, ZOOLIB_PREFIX::ZPhotoshop::Map& b) Modified: trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Yad.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Yad.cpp 2010-01-20 17:48:23 UTC (rev 1115) +++ trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Yad.cpp 2010-01-20 23:57:11 UTC (rev 1116) @@ -67,9 +67,9 @@ // ================================================================================================= #pragma mark - -#pragma mark * YadListRPos +#pragma mark * YadSeqRPos -typedef ZYadListRPos_Val_T<List> YadListRPos; +typedef ZYadSeqRPos_Val_T<Seq> YadSeqRPos; // ================================================================================================= #pragma mark - @@ -86,47 +86,47 @@ if (const Map* asMap = iVal.PGet_T<Map>()) return new YadMapRPos(*asMap); - if (const List* asList = iVal.PGet_T<List>()) - return new YadListRPos(*asList); + if (const Seq* asSeq = iVal.PGet_T<Seq>()) + return new YadSeqRPos(*asSeq); if (const UnitFloat* asUnitFloat = iVal.PGet_T<UnitFloat>()) { - ZMap_Any theMap; - theMap.Set("!Type", string("UnitFloat")); - theMap.Set("UnitID", spIntAsVal(asUnitFloat->fUnitID)); - theMap.Set("Value", asUnitFloat->fValue); + const ZMap_Any theMap = ZMap_Any() + .Set("!Type", string("UnitFloat")) + .Set("UnitID", spIntAsVal(asUnitFloat->fUnitID)) + .Set("Value", asUnitFloat->fValue); return sMakeYadR(theMap); } if (const Enumerated* asEnumerated = iVal.PGet_T<Enumerated>()) { - ZMap_Any theMap; - theMap.Set("!Type", string("Enumerated")); - theMap.Set("UnitID", spIntAsVal(asEnumerated->fEnumType)); - theMap.Set("Value", spIntAsVal(asEnumerated->fValue)); + const ZMap_Any theMap = ZMap_Any() + .Set("!Type", string("Enumerated")) + .Set("UnitID", spIntAsVal(asEnumerated->fEnumType)) + .Set("Value", spIntAsVal(asEnumerated->fValue)); return sMakeYadR(theMap); } if (const FileRef* asFileRef = iVal.PGet_T<FileRef>()) { - ZMap_Any theMap; - theMap.Set("!Type", string("FileRef")); - theMap.Set("PathTrail", asFileRef->AsTrail().AsString()); + const ZMap_Any theMap = ZMap_Any() + .Set("!Type", string("FileRef")) + .Set("PathTrail", asFileRef->AsTrail().AsString()); return sMakeYadR(theMap); } if (/*const Spec* asSpec = */iVal.PGet_T<Spec>()) { - ZMap_Any theMap; - theMap.Set("!Type", string("Spec")); + const ZMap_Any theMap = ZMap_Any() + .Set("!Type", string("Spec")); return sMakeYadR(theMap); } return new ZYadPrimR_Any(iVal.AsAny()); } -ZRef<ZYadListR> sMakeYadR(const List& iList) - { return new YadListRPos(iList); } +ZRef<ZYadSeqR> sMakeYadR(const Seq& iSeq) + { return new YadSeqRPos(iSeq); } ZRef<ZYadMapR> sMakeYadR(const Map& iMap) { return new YadMapRPos(iMap); } Modified: trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Yad.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Yad.h 2010-01-20 17:48:23 UTC (rev 1115) +++ trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Yad.h 2010-01-20 23:57:11 UTC (rev 1116) @@ -37,7 +37,7 @@ ZRef<ZYadR> sMakeYadR(const Val& iVal); -ZRef<ZYadListR> sMakeYadR(const List& iList); +ZRef<ZYadSeqR> sMakeYadR(const Seq& iSeq); ZRef<ZYadMapR> sMakeYadR(const Map& iMap); Modified: trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBQuery.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBQuery.cpp 2010-01-20 17:48:23 UTC (rev 1115) +++ trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBQuery.cpp 2010-01-20 23:57:11 UTC (rev 1116) @@ -614,7 +614,7 @@ ZTBQueryNode_Combo::Intersection::Intersection(const ZTuple& iTuple) { fFilter = ZTBSpec(iTuple.GetTuple("Filter")); - const vector<ZTValue>& nodes = iTuple.Get("Nodes").GetList().GetVector(); + const vector<ZTValue>& nodes = iTuple.Get("Nodes").GetSeq().GetVector(); for (vector<ZTValue>::const_iterator i = nodes.begin(); i != nodes.end(); ++i) { if (ZRef<ZTBQueryNode> aNode = sNodeFromTuple((*i).GetTuple())) @@ -1050,7 +1050,7 @@ else if (nodeKind == "Combo") { vector<ZTBQuery::SortSpec> theSort; - const vector<ZTValue>& vectorSort = iTuple.Get("Sort").GetList().GetVector(); + const vector<ZTValue>& vectorSort = iTuple.Get("Sort").GetSeq().GetVector(); for (vector<ZTValue>::const_iterator i = vectorSort.begin(); i != vectorSort.end(); ++i) { const ZTuple& temp = (*i).GetTuple(); @@ -1058,7 +1058,7 @@ ZTName(temp.GetString("PropName")), temp.GetBool("Ascending"), temp.GetInt32("Strength"))); } - const vector<ZTValue>& sourceSect = iTuple.Get("Intersections").GetList().GetVector(); + const vector<ZTValue>& sourceSect = iTuple.Get("Intersections").GetSeq().GetVector(); vector<ZTBQueryNode_Combo::Intersection> theIntersections; for (vector<ZTValue>::const_iterator i = sourceSect.begin(); i != sourceSect.end(); ++i) theIntersections.push_back(ZTBQueryNode_Combo::Intersection((*i).GetTuple())); @@ -1080,7 +1080,7 @@ else if (nodeKind == "ID_Constant") { vector<uint64> theIDs; - iTuple.Get("IDs").GetList().GetVector_T(back_inserter(theIDs), uint64()); + iTuple.Get("IDs").GetSeq().GetVector_T(back_inserter(theIDs), uint64()); return new ZTBQueryNode_ID_Constant(theIDs, true); } else if (nodeKind == "ID_FromSource") Modified: trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBRep_Client.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBRep_Client.cpp 2010-01-20 17:48:23 UTC (rev 1115) +++ trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBRep_Client.cpp 2010-01-20 23:57:11 UTC (rev 1116) @@ -886,7 +886,7 @@ } else if (theWhat == "Create_Ack") { - const vector<ZTValue>& vectorIDs = theResp.Get("IDs").GetList().GetVector(); + const vector<ZTValue>& vectorIDs = theResp.Get("IDs").GetSeq().GetVector(); for (vector<ZTValue>::const_iterator i = vectorIDs.begin(); i != vectorIDs.end(); ++i) { ZTuple theTuple = (*i).GetTuple(); @@ -907,7 +907,7 @@ } else if (theWhat == "Validate_Succeeded") { - const vector<ZTValue>& vectorClientIDs = theResp.Get("ClientIDs").GetList().GetVector(); + const vector<ZTValue>& vectorClientIDs = theResp.Get("ClientIDs").GetSeq().GetVector(); for (vector<ZTValue>::const_iterator i = vectorClientIDs.begin(); i != vectorClientIDs.end(); ++i) { @@ -924,7 +924,7 @@ } else if (theWhat == "Validate_Failed") { - const vector<ZTValue>& vectorClientIDs = theResp.Get("ClientIDs").GetList().GetVector(); + const vector<ZTValue>& vectorClientIDs = theResp.Get("ClientIDs").GetSeq().GetVector(); for (vector<ZTValue>::const_iterator i = vectorClientIDs.begin(); i != vectorClientIDs.end(); ++i) { @@ -941,7 +941,7 @@ } else if (theWhat == "Commit_Ack") { - const vector<ZTValue>& vectorClientIDs = theResp.Get("ClientIDs").GetList().GetVector(); + const vector<ZTValue>& vectorClientIDs = theResp.Get("ClientIDs").GetSeq().GetVector(); for (vector<ZTValue>::const_iterator i = vectorClientIDs.begin(); i != vectorClientIDs.end(); ++i) { @@ -957,7 +957,9 @@ } else if (theWhat == "GetTuples_Ack") { - const vector<ZTValue>& vectorTransactions = theResp.Get("Transactions").GetList().GetVector(); + const vector<ZTValue>& vectorTransactions = + theResp.Get("Transactions").GetSeq().GetVector(); + for (vector<ZTValue>::const_iterator i = vectorTransactions.begin(); i != vectorTransactions.end(); ++i) { @@ -965,7 +967,9 @@ Transaction* theTransaction = reinterpret_cast<Transaction*>(theTransactionTuple.GetInt64("ClientID")); - const vector<ZTValue>& vectorIDTuples = theTransactionTuple.Get("IDValues").GetList().GetVector(); + const vector<ZTValue>& vectorIDTuples = + theTransactionTuple.Get("IDValues").GetSeq().GetVector(); + for (vector<ZTValue>::const_iterator i = vectorIDTuples.begin(); i != vectorIDTuples.end(); ++i) { @@ -992,7 +996,7 @@ } else if (theWhat == "Search_Ack") { - const vector<ZTValue>& vectorSearches = theResp.Get("Searches").GetList().GetVector(); + const vector<ZTValue>& vectorSearches = theResp.Get("Searches").GetSeq().GetVector(); for (vector<ZTValue>::const_iterator i = vectorSearches.begin(); i != vectorSearches.end(); ++i) { @@ -1003,7 +1007,8 @@ theTransaction->fSearches_Waiting.erase(theSearch); vector<uint64> vectorResultIDs; - theSearchTuple.Get("Results").MutableList().GetVector_T(back_inserter(vectorResultIDs), uint64()); + theSearchTuple.Get("Results").MutableSeq() + .GetVector_T(back_inserter(vectorResultIDs), uint64()); theSearch->fCallback(theSearch->fRefcon, vectorResultIDs); delete theSearch; @@ -1011,7 +1016,7 @@ } else if (theWhat == "Count_Ack") { - const vector<ZTValue>& vectorCounts = theResp.Get("Counts").GetList().GetVector(); + const vector<ZTValue>& vectorCounts = theResp.Get("Counts").GetSeq().GetVector(); for (vector<ZTValue>::const_iterator i = vectorCounts.begin(); i != vectorCounts.end(); ++i) { @@ -1084,8 +1089,8 @@ ZTuple reqTuple; reqTuple.SetString("What", "Create"); - ZList_ZooLib theList; - vector<ZTValue>& vectorTransactionIDs = theList.MutableVector(); + ZSeq_ZooLib theSeq; + vector<ZTValue>& vectorTransactionIDs = theSeq.MutableVector(); for (vector<Transaction*>::iterator i = fTransactions_Create_Unsent.begin(); i != fTransactions_Create_Unsent.end(); /*no inc*/) { @@ -1106,7 +1111,7 @@ if (!vectorTransactionIDs.empty()) { - reqTuple.Set("ClientIDs", theList); + reqTuple.Set("ClientIDs", theSeq); sSend(locker, iStream, reqTuple); didAnything = true; } @@ -1117,8 +1122,8 @@ ZTuple reqTuple; reqTuple.SetString("What", "Abort"); - ZList_ZooLib theList; - vector<ZTValue>& vectorServerIDs = theList.MutableVector(); + ZSeq_ZooLib theSeq; + vector<ZTValue>& vectorServerIDs = theSeq.MutableVector(); for (vector<Transaction*>::iterator i = fTransactions_Aborted_Unsent.begin(); i != fTransactions_Aborted_Unsent.end(); /*no inc*/) { @@ -1138,7 +1143,7 @@ if (!vectorServerIDs.empty()) { - reqTuple.Set("ServerIDs", theList); + reqTuple.Set("ServerIDs", theSeq); sSend(locker, iStream, reqTuple); didAnything = true; } @@ -1152,8 +1157,8 @@ ZTuple reqTuple; reqTuple.SetString("What", "Validate"); - ZList_ZooLib theList; - vector<ZTValue>& vectorServerIDs = theList.MutableVector(); + ZSeq_ZooLib theSeq; + vector<ZTValue>& vectorServerIDs = theSeq.MutableVector(); for (vector<Transaction*>::iterator i = fTransactions_Validate_Unsent.begin(); i != fTransactions_Validate_Unsent.end(); /*no inc*/) { @@ -1172,7 +1177,7 @@ } } - reqTuple.Set("ServerIDs", theList); + reqTuple.Set("ServerIDs", theSeq); sSend(locker, iStream, reqTuple); } didAnything = true; @@ -1183,8 +1188,8 @@ ZTuple reqTuple; reqTuple.SetString("What", "Commit"); - ZList_ZooLib theList; - vector<ZTValue>& vectorServerIDs = theList.MutableVector(); + ZSeq_ZooLib theSeq; + vector<ZTValue>& vectorServerIDs = theSeq.MutableVector(); for (vector<Transaction*>::iterator i = fTransactions_Commit_Unsent.begin(); i != fTransactions_Commit_Unsent.end(); /*no inc*/) { @@ -1205,7 +1210,7 @@ if (!vectorServerIDs.empty()) { - reqTuple.Set("ServerIDs", theList); + reqTuple.Set("ServerIDs", theSeq); sSend(locker, iStream, reqTuple); didAnything = true; } @@ -1230,7 +1235,7 @@ ZTuple actionsTuple; if (!theTransaction->fTransTuples_NeedWork.empty()) { - ZList_ZooLib valWrites, valGets; + ZSeq_ZooLib valWrites, valGets; vector<ZTValue>& vectorWrites = valWrites.MutableVector(); vector<ZTValue>& vectorGets = valGets.MutableVector(); @@ -1277,8 +1282,8 @@ searchesTuple.SetString("What", "Search"); searchesTuple.SetInt64("ServerID", theTransaction->fServerID); - ZList_ZooLib theList; - vector<ZTValue>& vectorSearches = theList.MutableVector(); + ZSeq_ZooLib theSeq; + vector<ZTValue>& vectorSearches = theSeq.MutableVector(); for (vector<TransSearch_t*>::iterator i = theTransaction->fSearches_Unsent.begin(); i != theTransaction->fSearches_Unsent.end(); ++i) { @@ -1289,7 +1294,7 @@ vectorSearches.push_back(theTuple); theTransaction->fSearches_Waiting.insert(theSearch); } - searchesTuple.Set("Searches", theList); + searchesTuple.Set("Searches", theSeq); theTransaction->fSearches_Unsent.clear(); } @@ -1299,8 +1304,8 @@ countsTuple.SetString("What", "Count"); countsTuple.SetInt64("ServerID", theTransaction->fServerID); - ZList_ZooLib theList; - vector<ZTValue>& vectorCounts = theList.MutableVector(); + ZSeq_ZooLib theSeq; + vector<ZTValue>& vectorCounts = theSeq.MutableVector(); for (vector<TransCount_t*>::iterator i = theTransaction->fCounts_Unsent.begin(); i != theTransaction->fCounts_Unsent.end(); ++i) { @@ -1311,7 +1316,7 @@ vectorCounts.push_back(theTuple); theTransaction->fCounts_Waiting.insert(theCount); } - countsTuple.Set("Counts", theList); + countsTuple.Set("Counts", theSeq); theTransaction->fCounts_Unsent.clear(); } Modified: trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBServer.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBServer.cpp 2010-01-20 17:48:23 UTC (rev 1115) +++ trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBServer.cpp 2010-01-20 23:57:11 UTC (rev 1116) @@ -482,7 +482,7 @@ { ZMutexLocker locker(fMutex_Structure); - const vector<ZTValue>& vectorClientIDs = iReq.Get("ClientIDs").GetList().GetVector(); + const vector<ZTValue>& vectorClientIDs = iReq.Get("ClientIDs").GetSeq().GetVector(); for (vector<ZTValue>::const_iterator i = vectorClientIDs.begin(); i != vectorClientIDs.end(); ++i) { @@ -558,7 +558,7 @@ Transaction* theTransaction = reinterpret_cast<Transaction*>(iReq.GetInt64("ServerID")); ZAssert(theTransaction->fServer == this); - const vector<ZTValue>& vectorSearches = iReq.Get("Searches").GetList().GetVector(); + const vector<ZTValue>& vectorSearches = iReq.Get("Searches").GetSeq().GetVector(); for (vector<ZTValue>::const_iterator i = vectorSearches.begin(); i != vectorSearches.end(); ++i) { @@ -596,7 +596,7 @@ Transaction* theTransaction = reinterpret_cast<Transaction*>(iReq.GetInt64("ServerID")); ZAssert(theTransaction->fServer == this); - const vector<ZTValue>& vectorCounts = iReq.Get("Counts").GetList().GetVector(); + const vector<ZTValue>& vectorCounts = iReq.Get("Counts").GetSeq().GetVector(); for (vector<ZTValue>::const_iterator i = vectorCounts.begin(); i != vectorCounts.end(); ++i) { ZTuple t = (*i).GetTuple(); @@ -636,7 +636,7 @@ { ZMutexLocker locker(fMutex_Structure); - const vector<ZTValue>& vectorServerIDs = iReq.Get("ServerIDs").GetList().GetVector(); + const vector<ZTValue>& vectorServerIDs = iReq.Get("ServerIDs").GetSeq().GetVector(); for (vector<ZTValue>::const_iterator i = vectorServerIDs.begin(); i != vectorServerIDs.end(); ++i) { @@ -657,7 +657,7 @@ { ZMutexLocker locker(fMutex_Structure); - const vector<ZTValue>& vectorServerIDs = iReq.Get("ServerIDs").GetList().GetVector(); + const vector<ZTValue>& vectorServerIDs = iReq.Get("ServerIDs").GetSeq().GetVector(); for (vector<ZTValue>::const_iterator i = vectorServerIDs.begin(); i != vectorServerIDs.end(); ++i) { @@ -698,7 +698,7 @@ { ZMutexLocker locker(fMutex_Structure); - const vector<ZTValue>& vectorServerIDs = iReq.Get("ServerIDs").GetList().GetVector(); + const vector<ZTValue>& vectorServerIDs = iReq.Get("ServerIDs").GetSeq().GetVector(); for (vector<ZTValue>::const_iterator i = vectorServerIDs.begin(); i != vectorServerIDs.end(); ++i) { @@ -741,12 +741,12 @@ Transaction* theTransaction = reinterpret_cast<Transaction*>(iReq.GetInt64("ServerID")); vector<uint64> vectorGets; - iReq.Get("Gets").GetList().GetVector_T(back_inserter(vectorGets), uint64()); + iReq.Get("Gets").GetSeq().GetVector_T(back_inserter(vectorGets), uint64()); theTransaction->fTBRepTransaction->GetTuples( vectorGets.size(), &vectorGets[0], sCallback_GetTuple, theTransaction); - const vector<ZTValue>& vectorWrites = iReq.Get("Writes").GetList().GetVector(); + const vector<ZTValue>& vectorWrites = iReq.Get("Writes").GetSeq().GetVector(); for (vector<ZTValue>::const_iterator i = vectorWrites.begin(); i != vectorWrites.end(); ++i) { const ZTuple& t = (*i).GetTuple(); Modified: trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBSpec.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBSpec.cpp 2010-01-20 17:48:23 UTC (rev 1115) +++ trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBSpec.cpp 2010-01-20 23:57:11 UTC (rev 1116) @@ -84,7 +84,7 @@ static void sCriterionUnionFromTuple( const ZTuple& iTuple, ZTBSpec::CriterionUnion& ioCriterionUnion) { - const vector<ZTValue>& outerVector = iTuple.Get("Criteria").GetList().GetVector(); + const vector<ZTValue>& outerVector = iTuple.Get("Criteria").GetSeq().GetVector(); ioCriterionUnion.resize(outerVector.size()); ZTBSpec::CriterionUnion::iterator critListIter = ioCriterionUnion.begin(); @@ -92,8 +92,8 @@ for (vector<ZTValue>::const_iterator outerIter = outerVector.begin(); outerIter != outerVector.end(); ++outerIter, ++critListIter) { - const ZList_ZooLib theList = (*outerIter).GetList(); - const vector<ZTValue>& innerVector = theList.GetVector(); + const ZSeq_ZooLib theSeq = (*outerIter).GetSeq(); + const vector<ZTValue>& innerVector = theSeq.GetVector(); for (vector<ZTValue>::const_iterator inner = innerVector.begin(); inner != innerVector.end(); ++inner) { @@ -116,7 +116,7 @@ critListIter != critListEnd; ++critListIter, ++outerIter) { - vector<ZTValue>& innerVector = (*outerIter).MutableList().MutableVector(); + vector<ZTValue>& innerVector = (*outerIter).MutableSeq().MutableVector(); for (ZTBSpec::CriterionSect::const_iterator i = (*critListIter).begin(), theEnd = (*critListIter).end(); i != theEnd; ++i) @@ -670,10 +670,10 @@ } case eRel_VectorContains: { - ZList_ZooLib theList; - if (iTuple.Get(propIter).QGetList(theList)) + ZSeq_ZooLib theSeq; + if (iTuple.Get(propIter).QGetSeq(theSeq)) { - const vector<ZTValue>& theVector = theList.GetVector(); + const vector<ZTValue>& theVector = theSeq.GetVector(); for (vector<ZTValue>::const_iterator i = theVector.begin(); i != theVector.end(); ++i) { Modified: trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTSWatcherServer.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTSWatcherServer.cpp 2010-01-20 17:48:23 UTC (rev 1115) +++ trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTSWatcherServer.cpp 2010-01-20 23:57:11 UTC (rev 1116) @@ -138,20 +138,20 @@ vector<uint64> removedIDs; - iReq.Get("removedIDs").GetList().GetVector_T(back_inserter(removedIDs), uint64()); + iReq.Get("removedIDs").GetSeq().GetVector_T(back_inserter(removedIDs), uint64()); vector<uint64> addedIDs; - iReq.Get("addedIDs").GetList().GetVector_T(back_inserter(addedIDs), uint64()); + iReq.Get("addedIDs").GetSeq().GetVector_T(back_inserter(addedIDs), uint64()); vector<int64> removedQueries; - iReq.Get("removedQueries").GetList().GetVector_T(back_inserter(removedQueries), uint64()); + iReq.Get("removedQueries").GetSeq().GetVector_T(back_inserter(removedQueries), uint64()); vector<ZTSWatcher::AddedQueryCombo> addedQueries; { - const vector<ZTValue>& addedQueriesV = iReq.Get("addedQueries").GetList().GetVector(); + const vector<ZTValue>& addedQueriesV = iReq.Get("addedQueries").GetSeq().GetVector(); if (size_t theCount = addedQueriesV.size()) { addedQueries.reserve(theCount); @@ -183,7 +183,7 @@ vector<ZTuple> writtenTuples; bool writeNeededSort = false; { - const vector<ZTValue>& writtenTuplesV = iReq.Get("writtenTuples").GetList().GetVector(); + const vector<ZTValue>& writtenTuplesV = iReq.Get("writtenTuples").GetSeq().GetVector(); if (size_t theCount = writtenTuplesV.size()) { writtenTupleIDs.reserve(theCount); Modified: trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTSWatcher_Client.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTSWatcher_Client.cpp 2010-01-20 17:48:23 UTC (rev 1115) +++ trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTSWatcher_Client.cpp 2010-01-20 23:57:11 UTC (rev 1116) @@ -300,12 +300,12 @@ } oAddedIDs.clear(); - response.Get("addedTuples").GetList().GetVector_T(back_inserter(oAddedIDs), uint64()); + response.Get("addedTuples").GetSeq().GetVector_T(back_inserter(oAddedIDs), uint64()); oChangedTupleIDs.clear(); oChangedTuples.clear(); - const vector<ZTValue>& changedTuplesV = response.Get("changedTuples").GetList().GetVector(); + const vector<ZTValue>& changedTuplesV = response.Get("changedTuples").GetSeq().GetVector(); if (size_t theCount = changedTuplesV.size()) { oChangedTupleIDs.reserve(theCount); @@ -331,7 +331,7 @@ oChangedQueries.clear(); - const vector<ZTValue>& changedQueriesV = response.Get("changedQueries").GetList().GetVector(); + const vector<ZTValue>& changedQueriesV = response.Get("changedQueries").GetSeq().GetVector(); for (vector<ZTValue>::const_iterator i = changedQueriesV.begin(), theEnd = changedQueriesV.end(); i != theEnd; ++i) @@ -344,8 +344,8 @@ pair<map<int64, vector<uint64> >::iterator, bool> pos = oChangedQueries.insert(pair<int64, vector<uint64> >(theRefcon, vector<uint64>())); vector<uint64>& theIDs = (*pos.first).second; - theIDs.reserve(entry.Get("IDs").GetList().Count()); - entry.Get("IDs").GetList().GetVector_T(back_inserter(theIDs), uint64()); + theIDs.reserve(entry.Get("IDs").GetSeq().Count()); + entry.Get("IDs").GetSeq().GetVector_T(back_inserter(theIDs), uint64()); } } Modified: trunk/zoolib/source/cxx/old/zoolib/ZTS_Umbrella.cpp =================================================================== --- trunk/zoolib/source/cxx/old/zoolib/ZTS_Umbrella.cpp 2010-01-20 17:48:23 UTC (rev 1115) +++ trunk/zoolib/source/cxx/old/zoolib/ZTS_Umbrella.cpp 2010-01-20 23:57:11 UTC (rev 1116) @@ -178,7 +178,7 @@ } case eZType_Vector: { - vector<ZTValue>& theVector = ioTuple.Mutable(i).MutableList().MutableVector(); + vector<ZTValue>& theVector = ioTuple.Mutable(i).MutableSeq().MutableVector(); for (vector<ZTValue>::iterator j = theVector.begin(); j != theVector.end(); ++j) { if (eZType_ID == (*j).TypeOf()) @@ -212,7 +212,7 @@ } case eZType_Vector: { - vector<ZTValue>& theVector = ioTuple.Mutable(i).MutableList().MutableVector(); + vector<ZTValue>& theVector = ioTuple.Mutable(i).MutableSeq().MutableVector(); for (vector<ZTValue>::iterator j = theVector.begin(); j != theVector.end(); ++j) { if (eZType_ID == (*j).TypeOf()) Modified: trunk/zoolib/source/cxx/old/zoolib/ZWebDAV.cpp =================================================================== --- trunk/zoolib/source/cxx/old/zoolib/ZWebDAV.cpp 2010-01-20 17:48:23 UTC (rev 1115) +++ trunk/zoolib/source/cxx/old/zoolib/ZWebDAV.cpp 2010-01-20 23:57:11 UTC (rev 1116) @@ -292,7 +292,7 @@ { case eZType_Vector: { - const vector<ZTValue>& v = iTV.GetList().GetVector(); + const vector<ZTValue>& v = iTV.GetSeq().GetVector(); for (vector<ZTValue>::const_iterator i = v.begin(); i != v.end(); ++i) sWriteAsXML(s, iName, *i); break; @@ -326,7 +326,7 @@ if (iTuple.QGetString(iName, oString)) return true; - const vector<ZTValue>& theVector = iTuple.Get(iName).GetList().GetVector(); + const vector<ZTValue>& theVector = iTuple.Get(iName).GetSeq().GetVector(); if (!theVector.empty()) return theVector[0].QGetString(oString); @@ -405,9 +405,9 @@ for (vector<string>::const_iterator i = iPropNames.begin(); i != iPropNames.end(); ++i) { if (ZTuple propT = sGetProp(iNode, *i)) - oGoodT.Mutable("D:prop").MutableList().Append(propT); + oGoodT.Mutable("D:prop").MutableSeq().Append(propT); else - oBadT.Mutable("D:prop").MutableList().Append(ZTuple().SetNull(*i)); + oBadT.Mutable("D:prop").MutableSeq().Append(ZTuple().SetNull(*i)); } } @@ -463,7 +463,7 @@ ZTuple responseT; responseT.SetString("D:href", sMakeHREF(iPrefix, iRoot, iNode)); responseT.SetString("D:status", "HTTP/1.1 404"); - ioT.Mutable("D:response").MutableList().Append(responseT); + ioT.Mutable("D:response").MutableSeq().Append(responseT); } return false; } @@ -840,16 +840,16 @@ if (goodT) { goodT.SetString("D:status", "HTTP/1.1 200 OK"); - responseT.Mutable("D:propstat").MutableList().Append(goodT); + responseT.Mutable("D:propstat").MutableSeq().Append(goodT); } if (badT) { badT.SetString("D:status", "HTTP/1.1 404 Not Found"); - responseT.Mutable("D:propstat").MutableList().Append(badT); + responseT.Mutable("D:propstat").MutableSeq().Append(badT); } - ioTuple.Mutable("D:response").MutableList().Append(responseT); + ioTuple.Mutable("D:response").MutableSeq().Append(responseT); } } } @@ -878,10 +878,10 @@ if (goodT) { goodT.SetString("D:status", "HTTP/1.1 200 OK"); - responseT.Mutable("D:propstat").MutableList().Append(goodT); + responseT.Mutable("D:propstat").MutableSeq().Append(goodT); } - ioTuple.Mutable("D:response").MutableList().Append(responseT); + ioTuple.Mutable("D:response").MutableSeq().Append(responseT); } } } Modified: trunk/zoolib/source/cxx/zoolib/ZHTTP.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZHTTP.cpp 2010-01-20 17:48:23 UTC (rev 1115) +++ trunk/zoolib/source/cxx/zoolib/ZHTTP.cpp 2010-01-20 23:57:11 UTC (rev 1116) @@ -54,7 +54,7 @@ #pragma mark * Utility stuff static void sAppend(Map& ioFields, const string& iName, const Val& iValue) - { ioFields.Mutable(iName).MutableList().Append(iValue); } + { ioFields.Mutable(iName).MutableSeq().Append(iValue); } static uint32 sHexCharToUInt(char iChar) { @@ -739,9 +739,9 @@ if (iVal.QGetString(result)) return result; - const List& theList = iVal.GetList(); - if (theList.Count()) - return theList.Get(0).GetString(); + const Seq& theSeq = iVal.GetSeq(); + if (theSeq.Count()) + return theSeq.Get(0).GetString(); return string(); } Modified: trunk/zoolib/source/cxx/zoolib/ZHTTP.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZHTTP.h 2010-01-20 17:48:23 UTC (rev 1115) +++ trunk/zoolib/source/cxx/zoolib/ZHTTP.h 2010-01-20 23:57:11 UTC (rev 1116) @@ -33,9 +33,9 @@ namespace ZHTTP { +typedef ZData_ZooLib Data; typedef ZVal_ZooLib Val; -typedef ZData_ZooLib Data; -typedef ZList_ZooLib List; +typedef ZSeq_ZooLib Seq; typedef ZMap_ZooLib Map; class StreamR_Chunked; Modified: trunk/zoolib/source/cxx/zoolib/ZTuple.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZTuple.cpp 2010-01-20 17:48:23 UTC (rev 1115) +++ trunk/zoolib/source/cxx/zoolib/ZTuple.cpp 2010-01-20 23:57:11 UTC (rev 1116) @@ -85,7 +85,7 @@ vector<ZVal_ZooLib>& ZTuple::SetMutableVector(const ZTName& iPropName) { this->pTouch(); - return this->pFindOrAllocate(iPropName)->MutableList().MutableVector(); + return this->pFindOrAllocate(iPropName)->MutableSeq().MutableVector(); } ZTuple ZTuple::GetTuple(const ZTName& iPropName) const Modified: trunk/zoolib/source/cxx/zoolib/ZUtil_CFType.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZUtil_CFType.cpp 2010-01-20 17:48:23 UTC (rev 1115) +++ trunk/zoolib/source/cxx/zoolib/ZUtil_CFType.cpp 2010-01-20 23:57:11 UTC (rev 1116) @@ -184,14 +184,14 @@ return ZData_Any(); } -static ZList_Any spAsList_Any(const ZAny& iDefault, const ZRef<CFArrayRef>& iCFArray) +static ZSeq_Any spAsSeq_Any(const ZAny& iDefault, const ZRef<CFArrayRef>& iCFArray) { - ZList_Any theList; + ZSeq_Any theSeq; for (size_t x = 0, theCount = ::CFArrayGetCount(iCFArray); x < theCount; ++x) - theList.Append(sAsAny(iDefault, ::CFArrayGetValueAtIndex(iCFArray, x))); + theSeq.Append(sAsAny(iDefault, ::CFArrayGetValueAtIndex(iCFArray, x))); - return theList; + return theSeq; } static void spGatherContents(const void* iKey, const void* iValue, void* iRefcon) @@ -235,7 +235,7 @@ return ZAny(spAsMap_Any(iDefault, static_cast<CFDictionaryRef>(theCFTypeRef))); if (theTypeID == ::CFArrayGetTypeID()) - return ZAny(spAsList_Any(iDefault, static_cast<CFArrayRef>(theCFTypeRef))); + return ZAny(spAsSeq_Any(iDefault, static_cast<CFArrayRef>(theCFTypeRef))); if (theTypeID == ::CFBooleanGetTypeID()) return ZAny(bool(::CFBooleanGetValue(static_cast<CFBooleanRef>(theCFTypeRef)))); @@ -339,7 +339,7 @@ else return sData(); } - else if (const ZList_Any* theValue = iVal.PGet_T<ZList_Any>()) + else if (const ZSeq_Any* theValue = iVal.PGet_T<ZSeq_Any>()) { ZRef<CFMutableArrayRef> theArray; for (size_t x = 0, count = theValue->Count(); x < count; ++x) Modified: trunk/zoolib/source/cxx/zoolib/ZUtil_NSObject.mm =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZUtil_NSObject.mm 2010-01-20 17:48:23 UTC (rev 1115) +++ trunk/zoolib/source/cxx/zoolib/ZUtil_NSObject.mm 2010-01-20 23:57:11 UTC (rev 1116) @@ -175,7 +175,7 @@ else return sData(); } - else if (const ZList_Any* theValue = iVal.PGet_T<ZList_Any>()) + else if (const ZSeq_Any* theValue = iVal.PGet_T<ZSeq_Any>()) { NSMutableArray* theArray = sArrayMutable(); for (size_t x = 0, count = theValue->Count(); x < count; ++x) @@ -320,7 +320,7 @@ -(ZAny)asAnyWithDefault:(const ZAny&)iDefault { - ZList_Any result; + ZSeq_Any result; for (id theValue, i = [self objectEnumerator]; (theValue = [i nextObject]); /*no inc*/) { Modified: trunk/zoolib/source/cxx/zoolib/ZUtil_Yad.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZUtil_Yad.cpp 2010-01-20 17:48:23 UTC (rev 1115) +++ trunk/zoolib/source/cxx/zoolib/ZUtil_Yad.cpp 2010-01-20 23:57:11 UTC (rev 1116) @@ -56,21 +56,21 @@ } } } - else if (ZRef<ZYadListR> theYadListR = ZRefDynamicCast<ZYadListR>(iYadR)) + else if (ZRef<ZYadSeqR> theYadSeqR = ZRefDynamicCast<ZYadSeqR>(iYadR)) { int64 theIntIndex; if (ZString::sQInt64(iName, theIntIndex) && theIntIndex >= 0) { - if (ZRef<ZYadListRPos> theYadListPosR = ZRefDynamicCast<ZYadListRPos>(iYadR)) + if (ZRef<ZYadSeqRPos> theYadSeqPosR = ZRefDynamicCast<ZYadSeqRPos>(iYadR)) { - theYadListPosR->SetPosition(theIntIndex); - return theYadListPosR->ReadInc(); + theYadSeqPosR->SetPosition(theIntIndex); + return theYadSeqPosR->ReadInc(); } else { for (;;) { - if (ZRef<ZYadR> cur = theYadListR->ReadInc()) + if (ZRef<ZYadR> cur = theYadSeqR->ReadInc()) { if (0 == theIntIndex--) return cur; Modified: trunk/zoolib/source/cxx/zoolib/ZVal_Any.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZVal_Any.cpp 2010-01-20 17:48:23 UTC (rev 1115) +++ trunk/zoolib/source/cxx/zoolib/ZVal_Any.cpp 2010-01-20 23:57:11 UTC (rev 1116) @@ -27,73 +27,73 @@ #pragma mark * ZVal_Any typename accessors ZMACRO_ZValAccessors_Def_Entry(ZVal_Any, Data, ZData_Any) -ZMACRO_ZValAccessors_Def_Entry(ZVal_Any, List, ZList_Any) +ZMACRO_ZValAccessors_Def_Entry(ZVal_Any, Seq, ZSeq_Any) ZMACRO_ZValAccessors_Def_Entry(ZVal_Any, Map, ZMap_Any) // ================================================================================================= #pragma mark - -#pragma mark * ZList_Any::Rep +#pragma mark * ZSeq_Any::Rep -ZList_Any::Rep::Rep() +ZSeq_Any::Rep::Rep() {} -ZList_Any::Rep::~Rep() +ZSeq_Any::Rep::~Rep() {} -ZList_Any::Rep::Rep(const vector<ZVal_Any>& iVector) +ZSeq_Any::Rep::Rep(const vector<ZVal_Any>& iVector) : fVector(iVector) {} // ================================================================================================= #pragma mark - -#pragma mark * ZList_Any +#pragma mark * ZSeq_Any -ZAny ZList_Any::AsAny() const +ZAny ZSeq_Any::AsAny() const { return ZAny(*this); } -ZAny ZList_Any::AsAny(const ZAny& iDefault) const +ZAny ZSeq_Any::AsAny(const ZAny& iDefault) const { return ZAny(*this); } -ZList_Any::operator operator_bool_type() const +ZSeq_Any::operator operator_bool_type() const { return operator_bool_generator_type::translate(fRep && !fRep->fVector.empty()); } -ZList_Any::ZList_Any() +ZSeq_Any::ZSeq_Any() {} -ZList_Any::ZList_Any(const ZList_Any& iOther) +ZSeq_Any::ZSeq_Any(const ZSeq_Any& iOther) : fRep(iOther.fRep) {} -ZList_Any::~ZList_Any() +ZSeq_Any::~ZSeq_Any() {} -ZList_Any& ZList_Any::operator=(const ZList_Any& iOther) +ZSeq_Any& ZSeq_Any::operator=(const ZSeq_Any& iOther) { fRep = iOther.fRep; return *this; } -ZList_Any::ZList_Any(const vector<ZVal_Any>& iOther) +ZSeq_Any::ZSeq_Any(const vector<ZVal_Any>& iOther) : fRep(new Rep(iOther)) {} -ZList_Any& ZList_Any::operator=(const vector<ZVal_Any>& iOther) +ZSeq_Any& ZSeq_Any::operator=(const vector<ZVal_Any>& iOther) { fRep = new Rep(iOther); return *this; } -size_t ZList_Any::Count() const +size_t ZSeq_Any::Count() const { if (fRep) return fRep->fVector.size(); return 0; } -void ZList_Any::Clear() +void ZSeq_Any::Clear() { fRep.Clear(); } -ZVal_Any* ZList_Any::PGet(size_t iIndex) +ZVal_Any* ZSeq_Any::PGet(size_t iIndex) { if (fRep && iIndex < fRep->fVector.size()) { @@ -103,14 +103,14 @@ return nullptr; } -const ZVal_Any* ZList_Any::PGet(size_t iIndex) const +const ZVal_Any* ZSeq_Any::PGet(size_t iIndex) const { if (fRep && iIndex < fRep->fVector.size()) return &fRep->fVector[iIndex]; return nullptr; } -bool ZList_Any::QGet(size_t iIndex, ZVal_Any& oVal) const +bool ZSeq_Any::QGet(size_t iIndex, ZVal_Any& oVal) const { if (const ZVal_Any* theVal = this->PGet(iIndex)) { @@ -120,21 +120,21 @@ return false; } -ZVal_Any ZList_Any::DGet(const ZVal_Any& iDefault, size_t iIndex) const +ZVal_Any ZSeq_Any::DGet(const ZVal_Any& iDefault, size_t iIndex) const { if (const ZVal_Any* theVal = this->PGet(iIndex)) return *theVal; return iDefault; } -ZVal_Any ZList_Any::Get(size_t iIndex) const +ZVal_Any ZSeq_Any::Get(size_t iIndex) const { if (const ZVal_Any* theVal = this->PGet(iIndex)) return *theVal; return ZVal_Any(); } -ZList_Any& ZList_Any::Set(size_t iIndex, const ZVal_Any& iVal) +ZSeq_Any& ZSeq_Any::Set(size_t iIndex, const ZVal_Any& iVal) { if (fRep && iIndex < fRep->fVector.size()) { @@ -144,7 +144,7 @@ return *this; } -ZList_Any& ZList_Any::Erase(size_t iIndex) +ZSeq_Any& ZSeq_Any::Erase(size_t iIndex) { if (fRep && iIndex < fRep->fVector.size()) { @@ -154,7 +154,7 @@ return *this; } -ZList_Any& ZList_Any::Insert(size_t iIndex, const ZVal_Any& iVal) +ZSeq_Any& ZSeq_Any::Insert(size_t iIndex, const ZVal_Any& iVal) { this->pTouch(); if (iIndex <= fRep->fVector.size()) @@ -162,14 +162,14 @@ return *this; } -ZList_Any& ZList_Any::Append(const ZVal_Any& iVal) +ZSeq_Any& ZSeq_Any::Append(const ZVal_Any& iVal) { this->pTouch(); fRep->fVector.push_back(iVal); return *this; } -void ZList_Any::pTouch() +void ZSeq_Any::pTouch() { if (!fRep) { Modified: trunk/zoolib/source/cxx/zoolib/ZVal_Any.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZVal_Any.h 2010-01-20 17:48:23 UTC (rev 1115) +++ trunk/zoolib/source/cxx/zoolib/ZVal_Any.h 2010-01-20 23:57:11 UTC (rev 1116) @@ -42,7 +42,7 @@ using std::vector; class ZVal_Any; -class ZList_Any; +class ZSeq_Any; class ZMap_Any; // ================================================================================================= @@ -95,17 +95,17 @@ // Typename accessors ZMACRO_ZValAccessors_Decl_Entry(ZVal_Any, Data, ZData_Any) - ZMACRO_ZValAccessors_Decl_Entry(ZVal_Any, List, ZList_Any) + ZMACRO_ZValAccessors_Decl_Entry(ZVal_Any, Seq, ZSeq_Any) ZMACRO_ZValAccessors_Decl_Entry(ZVal_Any, Map, ZMap_Any) }; // ================================================================================================= #pragma mark - -#pragma mark * ZList_Any +#pragma mark * ZSeq_Any -class ZList_Any +class ZSeq_Any { - ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES(ZList_Any, + ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES(ZSeq_Any, operator_bool_generator_type, operator_bool_type); class Rep; @@ -118,19 +118,19 @@ operator operator_bool_type() const; - ZList_Any(); - ZList_Any(const ZList_Any& iOther); - ~ZList_Any(); - ZList_Any& operator=(const ZList_Any& iOther); + ZSeq_Any(); + ZSeq_Any(const ZSeq_Any& iOther); + ~ZSeq_Any(); + ZSeq_Any& operator=(const ZSeq_Any& iOther); - ZList_Any(const vector<ZVal_Any>& iOther); + ZSeq_Any(const vector<ZVal_Any>& iOther); - ZList_Any& operator=(const vector<ZVal_Any>& iOther); + ZSeq_Any& operator=(const vector<ZVal_Any>& iOther); template <class Iterator> - ZList_Any(Iterator begin, Iterator end); + ZSeq_Any(Iterator begin, Iterator end); -// ZList protocol +// ZSeq protocol size_t Count() const; void Clear(); @@ -150,13 +150,13 @@ ZVal_Any DGet(const ZVal_Any& iDefault, size_t iIndex) const; ZVal_Any Get(size_t iIndex) const; - ZList_Any& Set(size_t iIndex, const ZVal_Any& iVal); + ZSeq_Any& Set(size_t iIndex, const ZVal_Any& iVal); - ZList_Any& Erase(size_t iIndex); + ZSeq_Any& Erase(size_t iIndex); - ZList_Any& Insert(size_t iIndex, const ZVal_Any& iVal); + ZSeq_Any& Insert(size_t iIndex, const ZVal_Any& iVal); - ZList_Any& Append(const ZVal_Any& iVal); + ZSeq_Any& Append(const ZVal_Any& iVal); private: void pTouch(); @@ -166,7 +166,7 @@ template <class S> inline -S* ZList_Any::PGet_T(size_t iIndex) +S* ZSeq_Any::PGet_T(size_t iIndex) { if (ZVal_Any* theVal = this->PGet(iIndex)) return theVal->PGet_T<S>(); @@ -175,7 +175,7 @@ template <class S> inline -const S* ZList_Any::PGet_T(size_t iIndex) const +const S* ZSeq_Any::PGet_T(size_t iIndex) const { if (const ZVal_Any* theVal = this->PGet(iIndex)) return theVal->PGet_T<S>(); @@ -184,14 +184,14 @@ template <class S> inline -S ZList_Any::Get_T(size_t iIndex) const +S ZSeq_Any::Get_T(size_t iIndex) const { return this->Get(iIndex).Get_T<S>(); } // ================================================================================================= #pragma mark - -#pragma mark * ZList_Any::Rep +#pragma mark * ZSeq_Any::Rep -class ZList_Any::Rep +class ZSeq_Any::Rep : public ZRefCounted { private: @@ -206,15 +206,15 @@ {} vector<ZVal_Any> fVector; - friend class ZList_Any; + friend class ZSeq_Any; }; // ================================================================================================= #pragma mark - -#pragma mark * ZList_Any, inline templated constructor +#pragma mark * ZSeq_Any, inline templated constructor template <class Iterator> -ZList_Any::ZList_Any(Iterator begin, Iterator end) +ZSeq_Any::ZSeq_Any(Iterator begin, Iterator end) : fRep(new Rep(begin, end)) {} Modified: trunk/zoolib/source/cxx/zoolib/ZVal_AppleEvent.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZVal_AppleEvent.cpp 2010-01-20 17:48:23 UTC (rev 1115) +++ trunk/zoolib/source/cxx/zoolib/ZVal_AppleEvent.cpp 2010-01-20 23:57:11 UTC (rev 1116) @@ -129,9 +129,9 @@ static ZAny spAsAny(const ZAny& iDefault, const AEDesc& iDesc); -static ZList_Any spAsList_Any(const ZAny& iDefault, const AEDesc& iDesc) +static ZSeq_Any spAsSeq_Any(const ZAny& iDefault, const AEDesc& iDesc) { - ZList_Any theList; + ZSeq_Any theSeq; long count; if (noErr == ::AECountItems(&iDesc, &count)) @@ -140,13 +140,13 @@ { ZVal_AppleEvent result; if (noErr == ::AEGetNthDesc(&iDesc, x + 1, typeWildCard, nullptr, &result.OParam())) - theList.Append(spAsAny(iDefault, result)); + theSeq.Append(spAsAny(iDefault, result)); else - theList.Append(iDefault); + theSeq.Append(iDefault); } } - return theList; + return theSeq; } static ZMap_Any spAsMap_Any(const ZAny& iDefault, const AEDesc& iDesc) @@ -182,7 +182,7 @@ return ZAny(spAsMap_Any(iDefault, iDesc)); if (typeAEList == iDesc.descriptorType) - return ZAny(spAsList_Any(iDefault, iDesc)); + return ZAny(spAsSeq_Any(iDefault, iDesc)); switch (iDesc.descriptorType) { @@ -302,7 +302,7 @@ #endif } -ZVal_AppleEvent::ZVal_AppleEvent(const ZList_AppleEvent& iVal) +ZVal_AppleEvent::ZVal_AppleEvent(const ZSeq_AppleEvent& iVal) { ::AEDuplicateDesc(&iVal, this); } ZVal_AppleEvent::ZVal_AppleEvent(const ZMap_AppleEvent& iVal) @@ -366,7 +366,7 @@ } template <> -bool ZVal_AppleEvent::QGet_T<ZList_AppleEvent>(ZList_AppleEvent& oVal) const +bool ZVal_AppleEvent::QGet_T<ZSeq_AppleEvent>(ZSeq_AppleEvent& oVal) const { if (typeAEList == descriptorType) { @@ -427,7 +427,7 @@ } template <> -void ZVal_AppleEvent::Set_T<ZList_AppleEvent>(const ZList_AppleEvent& iVal) +void ZVal_AppleEvent::Set_T<ZSeq_AppleEvent>(const ZSeq_AppleEvent& iVal) { ::AEDisposeDesc(this); ::AEDuplicateDesc(&iVal, this); @@ -464,40 +464,40 @@ ZMACRO_ZValAccessors_Def_Entry(ZVal_AppleEvent, Float, float) ZMACRO_ZValAccessors_Def_Entry(ZVal_AppleEvent, Double, double) ZMACRO_ZValAccessors_Def_Entry(ZVal_AppleEvent, String, std::string) -ZMACRO_ZValAccessors_Def_Entry(ZVal_AppleEvent, List, ZList_AppleEvent) +ZMACRO_ZValAccessors_Def_Entry(ZVal_AppleEvent, Seq, ZSeq_AppleEvent) ZMACRO_ZValAccessors_Def_Entry(ZVal_AppleEvent, Map, ZMap_AppleEvent) ZMACRO_ZValAccessors_Def_Entry(ZVal_AppleEvent, FSSpec, FSSpec) ZMACRO_ZValAccessors_Def_Entry(ZVal_AppleEvent, FSRef, FSRef) // ================================================================================================= #pragma mark - -#pragma mark * ZList_AppleEvent +#pragma mark * ZSeq_AppleEvent -ZList_Any ZList_AppleEvent::AsList_Any() const - { return this->AsList_Any(ZAny()); } +ZSeq_Any ZSeq_AppleEvent::AsSeq_Any() const + { return this->AsSeq_Any(ZAny()); } -ZList_Any ZList_AppleEvent::AsList_Any(const ZAny& iDefault) const - { return spAsList_Any(iDefault, *this); } +ZSeq_Any ZSeq_AppleEvent::AsSeq_Any(const ZAny& iDefault) const + { return spAsSeq_Any(iDefault, *this); } -ZList_AppleEvent::operator operator_bool_type() const +ZSeq_AppleEvent::operator operator_bool_type() const { return operator_bool_generator_type::translate(this->Count()); } -void ZList_AppleEvent::swap(ZList_AppleEvent& iOther) +void ZSeq_AppleEvent::swap(ZSeq_AppleEvent& iOther) { std::swap(static_cast<AEDesc&>(*this), static_cast<AEDesc&>(iOther)); } -ZList_AppleEvent::ZList_AppleEvent() +ZSeq_AppleEvent::ZSeq_AppleEvent() { ::AECreateList(nullptr, 0, false, this); } -ZList_AppleEvent::ZList_AppleEvent(const ZList_AppleEvent& iOther) +ZSeq_AppleEvent::ZSeq_AppleEvent(const ZSeq_AppleEvent& iOther) { ZAssert(typeAEList == iOther.descriptorType); ::AEDuplicateDesc(&iOther, this); } -ZList_AppleEvent::~ZList_AppleEvent() +ZSeq_AppleEvent::~ZSeq_AppleEvent() { ::AEDisposeDesc(this); } -ZList_AppleEvent& ZList_AppleEvent::operator=(const ZList_AppleEvent& iOther) +ZSeq_AppleEvent& ZSeq_AppleEvent::operator=(const ZSeq_AppleEvent& iOther) { if (this != &iOther) { @@ -508,7 +508,7 @@ return *this; } -ZList_AppleEvent::ZList_AppleEvent(const AEDescList& iOther) +ZSeq_AppleEvent::ZSeq_AppleEvent(const AEDescList& iOther) { if (typeAEList == iOther.descriptorType) ::AEDuplicateDesc(&iOther, this); @@ -516,7 +516,7 @@ ::AECreateList(nullptr, 0, false, this); } -ZList_AppleEvent& ZList_AppleEvent::operator=(const AEDescList& iOther) +ZSeq_AppleEvent& ZSeq_AppleEvent::operator=(const AEDescList& iOther) { if (this != &iOther) { @@ -527,7 +527,7 @@ return *this; } -size_t ZList_AppleEvent::Count() const +size_t ZSeq_AppleEvent::Count() const { long result; if (noErr == ::AECountItems(this, &result)) @@ -535,16 +535,16 @@ return 0; } -void ZList_AppleEvent::Clear() +void ZSeq_AppleEvent::Clear() { ::AEDisposeDesc(this); ::AECreateList(nullptr, 0, false, this); } -bool ZList_AppleEvent::ZList_AppleEvent::QGet(size_t iIndex, ZVal_AppleEvent& oVal) const +bool ZSeq_AppleEvent::ZSeq_AppleEvent::QGet(size_t iIndex, ZVal_AppleEvent& oVal) const { return noErr == ::AEGetNthDesc(this, iIndex + 1, typeWildCard, nullptr, &oVal.OParam()); } -ZVal_AppleEvent ZList_AppleEvent::DGet(const ZVal_AppleEvent& iDefault, size_t iIndex) const +ZVal_AppleEvent ZSeq_AppleEvent::DGet(const ZVal_AppleEvent& iDefault, size_t iIndex) const { ZVal_AppleEvent result; if (noErr == ::AEGetNthDesc(this, iIndex + 1, typeWildCard, nullptr, &result.OParam())) @@ -552,7 +552,7 @@ return iDefault; } -ZVal_AppleEvent ZList_AppleEvent::Get(size_t iIndex) const +ZVal_AppleEvent ZSeq_AppleEvent::Get(size_t iIndex) const { ZVal_AppleEvent result; if (noErr == ::AEGetNthDesc(this, iIndex + 1, typeWildCard, nullptr, &result.OParam())) @@ -560,18 +560,18 @@ return ZVal_AppleEvent(); } -ZList_AppleEvent& ZList_AppleEvent::Erase(size_t iIndex) +ZSeq_AppleEvent& ZSeq_AppleEvent::Erase(size_t iIndex) {::AEDeleteItem(this, iIndex + 1); return *this; } -ZList_AppleEvent& ZList_AppleEvent::Set(size_t iIndex, const AEDesc& iVal) +ZSeq_AppleEvent& ZSeq_AppleEvent::Set(size_t iIndex, const AEDesc& iVal) { ::AEPutDesc(this, iIndex + 1, &iVal); return *this; } -ZList_AppleEvent& ZList_AppleEvent::Insert(size_t iIndex, const AEDesc& iVal) +ZSeq_AppleEvent& ZSeq_AppleEvent::Insert(size_t iIndex, const AEDesc& iVal) { long theCount; if (noErr == ::AECountItems(this, &theCount)) @@ -587,13 +587,13 @@ return *this; } -ZList_AppleEvent& ZList_AppleEvent::Append(const AEDesc& iVal) +ZSeq_AppleEvent& ZSeq_AppleEvent::Append(const AEDesc& iVal) { ::AEPutDesc(this, 0, &iVal); return *this; } -ZList_AppleEvent& ZList_AppleEvent::Append(const ZVal_AppleEvent& iVal) +ZSeq_AppleEvent& ZSeq_AppleEvent::Append(const ZVal_AppleEvent& iVal) { ::AEPutDesc(this, 0, &iVal); r... [truncated message content] |
From: <ag...@us...> - 2010-01-21 20:41:27
|
Revision: 1120 http://zoolib.svn.sourceforge.net/zoolib/?rev=1120&view=rev Author: agreen Date: 2010-01-21 20:41:15 +0000 (Thu, 21 Jan 2010) Log Message: ----------- Make use of Carbon64 SPI macro. Modified Paths: -------------- trunk/zoolib/source/cxx/more/zoolib/netscape/ZCompat_npapi.h trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape.cpp trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_API.h trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host_Mac.cpp trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host_Mac.h trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_FileRef.cpp trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.cpp trunk/zoolib/source/cxx/zoolib/ZHandle_T.h trunk/zoolib/source/cxx/zoolib/ZMacOSX.cpp trunk/zoolib/source/cxx/zoolib/ZStdInt.h trunk/zoolib/source/cxx/zoolib/ZStream_Mac.cpp trunk/zoolib/source/cxx/zoolib/ZStream_Mac.h trunk/zoolib/source/cxx/zoolib/ZTextCoder_Mac.h trunk/zoolib/source/cxx/zoolib/ZTime.cpp trunk/zoolib/source/cxx/zoolib/ZUtil_AppleEvent.h trunk/zoolib/source/cxx/zoolib/ZUtil_CarbonEvents.cpp trunk/zoolib/source/cxx/zoolib/ZUtil_CarbonEvents.h trunk/zoolib/source/cxx/zoolib/ZUtil_Time.cpp trunk/zoolib/source/cxx/zoolib/ZVal_AppleEvent.cpp Modified: trunk/zoolib/source/cxx/more/zoolib/netscape/ZCompat_npapi.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/netscape/ZCompat_npapi.h 2010-01-21 20:34:01 UTC (rev 1119) +++ trunk/zoolib/source/cxx/more/zoolib/netscape/ZCompat_npapi.h 2010-01-21 20:41:15 UTC (rev 1120) @@ -31,7 +31,7 @@ #include ZProjectHeader_npapi -#elif defined(__APPLE__) && !defined(__LP64__) +#elif defined(__APPLE__) && ! __LP64__ #include <WebKit/npfunctions.h> #if !defined(XP_MACOSX) Modified: trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape.cpp 2010-01-21 20:34:01 UTC (rev 1119) +++ trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape.cpp 2010-01-21 20:41:15 UTC (rev 1120) @@ -98,7 +98,9 @@ CASE(NPNVPluginElementNPObject); CASE(NPNVSupportsWindowless); #if defined(XP_MACOSX) - CASE(NPNVsupportsQuickDrawBool); + #ifndef NP_NO_QUICKDRAW + CASE(NPNVsupportsQuickDrawBool); + #endif CASE(NPNVsupportsCoreGraphicsBool); CASE(NPNVsupportsOpenGLBool); #endif Modified: trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_API.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_API.h 2010-01-21 20:34:01 UTC (rev 1119) +++ trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_API.h 2010-01-21 20:41:15 UTC (rev 1120) @@ -35,7 +35,7 @@ # define XP_WIN 1 -#elif ZCONFIG_SPI_Enabled(Carbon) +#elif ZCONFIG_SPI_Enabled(Carbon64) # if __MACH__ # define XP_MACOSX 1 @@ -53,7 +53,7 @@ #pragma mark - #pragma mark * NP_NO_QUICKDRAW and NP_NO_CARBON -#if defined(XP_MACOSX) && defined(__LP64__) +#if defined(XP_MACOSX) && __LP64__ # define NP_NO_QUICKDRAW 1 # define NP_NO_CARBON 1 #endif @@ -65,12 +65,9 @@ #if defined(XP_MACOSX) # include <ApplicationServices/ApplicationServices.h> # include <OpenGL/OpenGL.h> -# if !defined(NP_NO_CARBON) -# include <Carbon/Carbon.h> -# endif #endif -#if defined(XP_MAC) +#if defined(XP_MACOSX) || defined(XP_MAC) # include ZMACINCLUDE2(Carbon,Carbon.h) #endif @@ -101,7 +98,7 @@ #pragma mark - #pragma mark "* Mac-specific, set structure alignment to be 68K" -#if !defined(__LP64__) +#if ! __LP64__ # if defined(XP_MAC) || defined(XP_MACOSX) # pragma options align=mac68k # endif @@ -869,7 +866,7 @@ #pragma mark - #pragma mark * Mac-specific, reset structure alignment -#if !defined(__LP64__) +#if ! __LP64__ # if defined(XP_MAC) || defined(XP_MACOSX) # pragma options align=reset # endif Modified: trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host_Mac.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host_Mac.cpp 2010-01-21 20:34:01 UTC (rev 1119) +++ trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host_Mac.cpp 2010-01-21 20:41:15 UTC (rev 1120) @@ -116,7 +116,9 @@ fNP_CGContext.window = nullptr; #endif - ZBlockZero(&fNP_Port, sizeof(fNP_Port)); + #if !defined(NP_NO_QUICKDRAW) + ZBlockZero(&fNP_Port, sizeof(fNP_Port)); + #endif fNPWindow.type = NPWindowTypeDrawable; @@ -161,7 +163,7 @@ { if (ZLOG(s, eDebug, "Host_Mac")) s << "Host_SetValue, NPPVpluginDrawingModel"; - if (reinterpret_cast<int>(value) == NPDrawingModelCoreGraphics) + if (reinterpret_cast<intptr_t>(value) == NPDrawingModelCoreGraphics) fUseCoreGraphics = true; else fUseCoreGraphics = false; @@ -250,8 +252,10 @@ if (ZLOG(s, eDebug + 1, "Host_Mac")) s.Writef("DoSetWindow, (%d, %d, %d, %d)", iX, iY, iX + iWidth, iY + iHeight); - fNP_Port.portx = -iX; - fNP_Port.porty = -iY; + #if !defined(NP_NO_QUICKDRAW) + fNP_Port.portx = -iX; + fNP_Port.porty = -iY; + #endif fNPWindow.x = iX; fNPWindow.y = iY; @@ -403,11 +407,17 @@ fNPWindow.window = &fNP_CGContext; } #endif // defined(XP_MACOSX) - else + #if !defined(NP_NO_QUICKDRAW) + else if (true) { fNP_Port.port = ::GetWindowPort(fWindowRef); fNPWindow.window = &fNP_Port; } + #endif // !defined(NP_NO_QUICKDRAW) + else + { + ZUnimplemented(); + } Rect winFrameRect; ::GetWindowBounds(fWindowRef, kWindowGlobalPortRgn, &winFrameRect); @@ -688,11 +698,17 @@ fNPWindow.window = &fNP_CGContext; } #endif // defined(XP_MACOSX) - else + #if !defined(NP_NO_QUICKDRAW) + else if (true) { fNP_Port.port = ::GetWindowPort(theWindowRef); fNPWindow.window = &fNP_Port; } + #endif // !defined(NP_NO_QUICKDRAW) + else + { + ZUnimplemented(); + } ZGRectf theFrame; ::HIViewGetBounds(fHIViewRef, &sHI(theFrame)); Modified: trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host_Mac.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host_Mac.h 2010-01-21 20:34:01 UTC (rev 1119) +++ trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host_Mac.h 2010-01-21 20:41:15 UTC (rev 1120) @@ -75,7 +75,10 @@ bool fUseCoreGraphics; #endif - NP_Port fNP_Port; + #if !defined(NP_NO_QUICKDRAW) + NP_Port fNP_Port; + #endif + float fLeft; float fTop; float fRight; Modified: trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_FileRef.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_FileRef.cpp 2010-01-21 20:34:01 UTC (rev 1119) +++ trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_FileRef.cpp 2010-01-21 20:41:15 UTC (rev 1120) @@ -96,8 +96,7 @@ #pragma mark - #pragma mark * Helpers -#if defined(__PIMac__) - +#if ZCONFIG_SPI_Enabled(Carbon) static ZTrail spMacAsTrail(short iVRefNum, long iDirID, const unsigned char* iName) { ZTrail theResult; @@ -151,9 +150,19 @@ return theResult; } +#endif // ZCONFIG_SPI_Enabled(Carbon) -#endif // defined(__PIMac__) +#if ZCONFIG_SPI_Enabled(Carbon64) +static ZTrail spMacAsTrail(const FSRef& iFSRef) + { + char buffer[1024]; + if (noErr == ::FSRefMakePath(&iFSRef, (UInt8*)buffer, 1024)) + return ZTrail(buffer); + return ZTrail(false); + } +#endif // ZCONFIG_SPI_Enabled(Carbon64) + static string8 spTrailAsWin(const ZTrail& iTrail) { string8 result; @@ -189,16 +198,22 @@ ZTrail sAsTrail(const SPPlatformFileSpecification& iSpec) { - #if defined(__PIMac__) + #if ZCONFIG_SPI_Enabled(Carbon) + return spMacAsTrail(iSpec.vRefNum, iSpec.parID, iSpec.name); - #endif - #if defined(__PIWin__) + #elif ZCONFIG_SPI_Enabled(Carbon64) + + return spMacAsTrail(iSpec.mReference); + + #elif defined(__PIWin__) + AutoSuite<PSGetPathSuite1> theSPGetPath(kPSGetPathSuite, kPSGetPathSuiteVersion1); char buf[1024]; theSPGetPath->GetPathName(const_cast<SPPlatformFileSpecification*>(&iSpec), buf, sizeof(buf)); return sWinAsTrail(buf); + #endif } Modified: trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.cpp 2010-01-21 20:34:01 UTC (rev 1119) +++ trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.cpp 2010-01-21 20:41:15 UTC (rev 1120) @@ -28,7 +28,7 @@ #include "PITerminology.h" #include "PIUSuites.h" -#if ZCONFIG_SPI_Enabled(Carbon) +#if ZCONFIG_SPI_Enabled(Carbon64) # if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4 # include ZMACINCLUDE3(ApplicationServices,AE,AEObjects.h) # else Modified: trunk/zoolib/source/cxx/zoolib/ZHandle_T.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZHandle_T.h 2010-01-21 20:34:01 UTC (rev 1119) +++ trunk/zoolib/source/cxx/zoolib/ZHandle_T.h 2010-01-21 20:41:15 UTC (rev 1120) @@ -23,7 +23,7 @@ #include "zconfig.h" #include "zoolib/ZCONFIG_SPI.h" -#if ZCONFIG_SPI_Enabled(Carbon) +#if ZCONFIG_SPI_Enabled(Carbon64) #include "zoolib/ZTypes.h" // For Adopt_T @@ -143,6 +143,6 @@ NAMESPACE_ZOOLIB_END -#endif // ZCONFIG_SPI_Enabled(Carbon) +#endif // ZCONFIG_SPI_Enabled(Carbon64) #endif // __ZHandle_T__ Modified: trunk/zoolib/source/cxx/zoolib/ZMacOSX.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZMacOSX.cpp 2010-01-21 20:34:01 UTC (rev 1119) +++ trunk/zoolib/source/cxx/zoolib/ZMacOSX.cpp 2010-01-21 20:41:15 UTC (rev 1120) @@ -22,7 +22,7 @@ #include "zoolib/ZCONFIG_SPI.h" -#if ZCONFIG_SPI_Enabled(Carbon) +#if ZCONFIG_SPI_Enabled(Carbon64) # include ZMACINCLUDE3(CoreServices,CarbonCore,Gestalt.h) # if !ZCONFIG_SPI_Enabled(MacOSX) static bool sIsMacOSX_Checked; @@ -38,7 +38,7 @@ return true; - #elif ZCONFIG_SPI_Enabled(Carbon) + #elif ZCONFIG_SPI_Enabled(Carbon64) if (!sIsMacOSX_Checked) { Modified: trunk/zoolib/source/cxx/zoolib/ZStdInt.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZStdInt.h 2010-01-21 20:34:01 UTC (rev 1119) +++ trunk/zoolib/source/cxx/zoolib/ZStdInt.h 2010-01-21 20:41:15 UTC (rev 1120) @@ -47,7 +47,7 @@ #if ZCONFIG_SPI_Enabled(MacOSX) \ || ZCONFIG_SPI_Enabled(MacClassic) \ - || ZCONFIG_SPI_Enabled(Carbon) + || ZCONFIG_SPI_Enabled(Carbon64) #if __arm__ #include <MacTypes.h> Modified: trunk/zoolib/source/cxx/zoolib/ZStream_Mac.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZStream_Mac.cpp 2010-01-21 20:34:01 UTC (rev 1119) +++ trunk/zoolib/source/cxx/zoolib/ZStream_Mac.cpp 2010-01-21 20:41:15 UTC (rev 1120) @@ -20,7 +20,7 @@ #include "zoolib/ZStream_Mac.h" -#if ZCONFIG_SPI_Enabled(Carbon) +#if ZCONFIG_SPI_Enabled(Carbon64) #include "zoolib/ZCompat_algorithm.h" // For min #include "zoolib/ZDebug.h" @@ -100,4 +100,4 @@ NAMESPACE_ZOOLIB_END -#endif // ZCONFIG_SPI_Enabled(Carbon) +#endif // ZCONFIG_SPI_Enabled(Carbon64) Modified: trunk/zoolib/source/cxx/zoolib/ZStream_Mac.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZStream_Mac.h 2010-01-21 20:34:01 UTC (rev 1119) +++ trunk/zoolib/source/cxx/zoolib/ZStream_Mac.h 2010-01-21 20:41:15 UTC (rev 1120) @@ -23,7 +23,7 @@ #include "zconfig.h" #include "zoolib/ZCONFIG_SPI.h" -#if ZCONFIG_SPI_Enabled(Carbon) +#if ZCONFIG_SPI_Enabled(Carbon64) #include "zoolib/ZStreamer.h" @@ -77,6 +77,6 @@ NAMESPACE_ZOOLIB_END -#endif // ZCONFIG_SPI_Enabled(Carbon) +#endif // ZCONFIG_SPI_Enabled(Carbon64) #endif // __ZStream_Mac__ Modified: trunk/zoolib/source/cxx/zoolib/ZTextCoder_Mac.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZTextCoder_Mac.h 2010-01-21 20:34:01 UTC (rev 1119) +++ trunk/zoolib/source/cxx/zoolib/ZTextCoder_Mac.h 2010-01-21 20:41:15 UTC (rev 1120) @@ -26,8 +26,7 @@ #ifndef ZCONFIG_API_Avail__TextCoder_Mac # define ZCONFIG_API_Avail__TextCoder_Mac \ - (ZCONFIG_SPI_Enabled(Carbon) \ - || ZCONFIG_SPI_Enabled(MacOSX) \ + (ZCONFIG_SPI_Enabled(Carbon64) \ || ZCONFIG_SPI_Enabled(MacClassic)) #endif Modified: trunk/zoolib/source/cxx/zoolib/ZTime.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZTime.cpp 2010-01-21 20:34:01 UTC (rev 1119) +++ trunk/zoolib/source/cxx/zoolib/ZTime.cpp 2010-01-21 20:41:15 UTC (rev 1120) @@ -33,7 +33,7 @@ # include <DriverServices.h> // For UpTime #endif -#if ZCONFIG_SPI_Enabled(Carbon) +#if ZCONFIG_SPI_Enabled(Carbon64) # include ZMACINCLUDE2(CoreServices,CoreServices.h) #endif @@ -125,7 +125,7 @@ ::gettimeofday(&theTimeVal, nullptr); return theTimeVal.tv_sec + double(theTimeVal.tv_usec) / 1e6; -#elif ZCONFIG_SPI_Enabled(Carbon) +#elif ZCONFIG_SPI_Enabled(Carbon64) UTCDateTime theUTCDateTime; ::GetUTCDateTime(&theUTCDateTime, kUTCDefaultOptions); @@ -200,7 +200,7 @@ sLast = result; return result + sDelta; -#elif ZCONFIG_SPI_Enabled(Carbon) || ZCONFIG_SPI_Enabled(MacClassic) +#elif ZCONFIG_SPI_Enabled(Carbon64) || ZCONFIG_SPI_Enabled(MacClassic) Nanoseconds theNanoseconds = AbsoluteToNanoseconds(UpTime()); return double(*reinterpret_cast<uint64*>(&theNanoseconds)) / 1e9; Modified: trunk/zoolib/source/cxx/zoolib/ZUtil_AppleEvent.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZUtil_AppleEvent.h 2010-01-21 20:34:01 UTC (rev 1119) +++ trunk/zoolib/source/cxx/zoolib/ZUtil_AppleEvent.h 2010-01-21 20:41:15 UTC (rev 1120) @@ -65,9 +65,12 @@ ZMACRO_AELookup(float, typeIEEE32BitFloatingPoint) ZMACRO_AELookup(double, typeIEEE64BitFloatingPoint) ZMACRO_AELookup(FSRef, typeFSRef) -ZMACRO_AELookup(FSSpec, typeFSS) ZMACRO_AELookup(AliasHandle, typeAlias) +#if ZCONFIG_SPI_Enabled(Carbon) + ZMACRO_AELookup(FSSpec, typeFSS) +#endif + ZMACRO_AELookup_CPP2Desc(ZHandle_T<AliasHandle>, typeAlias) #undef ZMACRO_AELookup_Desc2CPP Modified: trunk/zoolib/source/cxx/zoolib/ZUtil_CarbonEvents.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZUtil_CarbonEvents.cpp 2010-01-21 20:34:01 UTC (rev 1119) +++ trunk/zoolib/source/cxx/zoolib/ZUtil_CarbonEvents.cpp 2010-01-21 20:41:15 UTC (rev 1120) @@ -20,7 +20,7 @@ #include "zoolib/ZUtil_CarbonEvents.h" -#if ZCONFIG_SPI_Enabled(Carbon) +#if ZCONFIG_SPI_Enabled(Carbon64) #include "zoolib/ZByteSwap.h" #include "zoolib/ZLog.h" @@ -52,7 +52,7 @@ size_t ZUtil_CarbonEvents::sGetParamLength( EventRef iEventRef, EventParamName iName, EventParamType iType) { - UInt32 theLength; + ByteCount theLength; if (noErr == ::GetEventParameter(iEventRef, iName, iType, nullptr, 0, &theLength, nullptr)) return theLength; return 0; @@ -285,8 +285,10 @@ CLASS(kEventClassWindow); switch (iEK) { - KIND(kEventWindowUpdate); - KIND(kEventWindowDrawContent); + #if ZCONFIG_SPI_Enabled(Carbon) + KIND(kEventWindowUpdate); + KIND(kEventWindowDrawContent); + #endif KIND(kEventWindowActivated); KIND(kEventWindowDeactivated); KIND(kEventWindowGetClickActivation); @@ -304,13 +306,15 @@ KIND(kEventWindowDragStarted); KIND(kEventWindowDragCompleted); KIND(kEventWindowClosed); - KIND(kEventWindowClickDragRgn); - KIND(kEventWindowClickResizeRgn); - KIND(kEventWindowClickCollapseRgn); - KIND(kEventWindowClickCloseRgn); - KIND(kEventWindowClickZoomRgn); - KIND(kEventWindowClickContentRgn); - KIND(kEventWindowClickProxyIconRgn); + #if ZCONFIG_SPI_Enabled(Carbon) + KIND(kEventWindowClickDragRgn); + KIND(kEventWindowClickResizeRgn); + KIND(kEventWindowClickCollapseRgn); + KIND(kEventWindowClickCloseRgn); + KIND(kEventWindowClickZoomRgn); + KIND(kEventWindowClickContentRgn); + KIND(kEventWindowClickProxyIconRgn); + #endif KIND(kEventWindowCursorChange); KIND(kEventWindowCollapse); KIND(kEventWindowCollapseAll); @@ -326,7 +330,9 @@ KIND(kEventWindowGetMinimumSize); KIND(kEventWindowGetMaximumSize); KIND(kEventWindowConstrain); - KIND(kEventWindowHandleContentClick); + #if ZCONFIG_SPI_Enabled(Carbon) + KIND(kEventWindowHandleContentClick); + #endif KIND(kEventWindowProxyBeginDrag); KIND(kEventWindowProxyEndDrag); KIND(kEventWindowFocusAcquired); @@ -354,8 +360,10 @@ KIND(kEventWindowExpanding); KIND(kEventWindowTransitionStarted); KIND(kEventWindowTransitionCompleted); - KIND(kEventWindowClickToolbarButtonRgn); - KIND(kEventWindowClickStructureRgn); + #if ZCONFIG_SPI_Enabled(Carbon) + KIND(kEventWindowClickToolbarButtonRgn); + KIND(kEventWindowClickStructureRgn); + #endif KIND(kEventWindowFocusDrawer); KIND(kEventWindowGetDockTileMenu); KIND(kEventWindowToolbarSwitchMode); @@ -423,7 +431,9 @@ KIND(kEventControlSimulateHit); KIND(kEventControlHitTest); KIND(kEventControlDraw); - KIND(kEventControlApplyBackground); + #if ZCONFIG_SPI_Enabled(Carbon) + KIND(kEventControlApplyBackground); + #endif KIND(kEventControlApplyTextColor); KIND(kEventControlSetFocusPart); KIND(kEventControlGetFocusPart); @@ -449,7 +459,9 @@ KIND(kEventControlRemovingSubControl); KIND(kEventControlBoundsChanged); KIND(kEventControlOwningWindowChanged); - KIND(kEventControlArbitraryMessage); + #if ZCONFIG_SPI_Enabled(Carbon) + KIND(kEventControlArbitraryMessage); + #endif #if !USING_ANCIENT_HEADERS KIND(kEventControlGetNextFocusCandidate); @@ -508,4 +520,4 @@ NAMESPACE_ZOOLIB_END -#endif // ZCONFIG_SPI_Enabled(Carbon) +#endif // ZCONFIG_SPI_Enabled(Carbon64) Modified: trunk/zoolib/source/cxx/zoolib/ZUtil_CarbonEvents.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZUtil_CarbonEvents.h 2010-01-21 20:34:01 UTC (rev 1119) +++ trunk/zoolib/source/cxx/zoolib/ZUtil_CarbonEvents.h 2010-01-21 20:41:15 UTC (rev 1120) @@ -23,7 +23,7 @@ #include "zconfig.h" #include "zoolib/ZCONFIG_SPI.h" -#if ZCONFIG_SPI_Enabled(Carbon) +#if ZCONFIG_SPI_Enabled(Carbon64) #include ZMACINCLUDE3(Carbon,HIToolbox,CarbonEvents.h) @@ -103,6 +103,6 @@ NAMESPACE_ZOOLIB_END -#endif // ZCONFIG_SPI_Enabled(Carbon) +#endif // ZCONFIG_SPI_Enabled(Carbon64) #endif // __ZUtil_CarbonEvents__ Modified: trunk/zoolib/source/cxx/zoolib/ZUtil_Time.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZUtil_Time.cpp 2010-01-21 20:34:01 UTC (rev 1119) +++ trunk/zoolib/source/cxx/zoolib/ZUtil_Time.cpp 2010-01-21 20:41:15 UTC (rev 1120) @@ -28,7 +28,7 @@ #include <stdio.h> #include <time.h> -#if ZCONFIG_SPI_Enabled(MacClassic) || ZCONFIG_SPI_Enabled(Carbon) +#if ZCONFIG_SPI_Enabled(MacClassic) || ZCONFIG_SPI_Enabled(Carbon64) # include ZMACINCLUDE3(CoreServices,CarbonCore,OSUtils.h) #endif Modified: trunk/zoolib/source/cxx/zoolib/ZVal_AppleEvent.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZVal_AppleEvent.cpp 2010-01-21 20:34:01 UTC (rev 1119) +++ trunk/zoolib/source/cxx/zoolib/ZVal_AppleEvent.cpp 2010-01-21 20:41:15 UTC (rev 1120) @@ -193,7 +193,9 @@ AEGETTER(float, typeIEEE32BitFloatingPoint) AEGETTER(double, typeIEEE64BitFloatingPoint) AEGETTER(FSRef, typeFSRef) - AEGETTER(FSSpec, typeFSS) + #if ZCONFIG_SPI_Enabled(Carbon) + AEGETTER(FSSpec, typeFSS) + #endif case typeTrue: return ZAny(true); case typeFalse: return ZAny(false); @@ -230,7 +232,7 @@ return ZAny(result); } -// AEGETTER(ZHandle_T<AliasHandle>, typeAlias) +// AEGETTER(ZHandle_T<AliasHandle>, typeAlias) } return iDefault; @@ -387,6 +389,7 @@ return false; } +#if ZCONFIG_SPI_Enabled(Carbon) template <> bool ZVal_AppleEvent::QGet_T<FSSpec>(FSSpec& oVal) const { @@ -397,6 +400,7 @@ } return false; } +#endif // ZCONFIG_SPI_Enabled(Carbon) template <class S> bool ZVal_AppleEvent::QGet_T(S& oVal) const @@ -466,9 +470,12 @@ ZMACRO_ZValAccessors_Def_Entry(ZVal_AppleEvent, String, std::string) ZMACRO_ZValAccessors_Def_Entry(ZVal_AppleEvent, Seq, ZSeq_AppleEvent) ZMACRO_ZValAccessors_Def_Entry(ZVal_AppleEvent, Map, ZMap_AppleEvent) -ZMACRO_ZValAccessors_Def_Entry(ZVal_AppleEvent, FSSpec, FSSpec) ZMACRO_ZValAccessors_Def_Entry(ZVal_AppleEvent, FSRef, FSRef) +#if ZCONFIG_SPI_Enabled(Carbon) + ZMACRO_ZValAccessors_Def_Entry(ZVal_AppleEvent, FSSpec, FSSpec) +#endif + // ================================================================================================= #pragma mark - #pragma mark * ZSeq_AppleEvent This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2010-02-11 09:16:38
|
Revision: 1157 http://zoolib.svn.sourceforge.net/zoolib/?rev=1157&view=rev Author: agreen Date: 2010-02-11 09:16:30 +0000 (Thu, 11 Feb 2010) Log Message: ----------- Move XLib stuff into old -- if I get back to UI stuff, then they'll get revamped and used again. Added Paths: ----------- trunk/zoolib/source/cxx/old/zoolib/ZXLib.cpp trunk/zoolib/source/cxx/old/zoolib/ZXLib.h trunk/zoolib/source/cxx/old/zoolib/ZXServer.cpp trunk/zoolib/source/cxx/old/zoolib/ZXServer.h Removed Paths: ------------- trunk/zoolib/source/cxx/zoolib/ZXLib.cpp trunk/zoolib/source/cxx/zoolib/ZXLib.h trunk/zoolib/source/cxx/zoolib/ZXServer.cpp trunk/zoolib/source/cxx/zoolib/ZXServer.h Copied: trunk/zoolib/source/cxx/old/zoolib/ZXLib.cpp (from rev 1121, trunk/zoolib/source/cxx/zoolib/ZXLib.cpp) =================================================================== --- trunk/zoolib/source/cxx/old/zoolib/ZXLib.cpp (rev 0) +++ trunk/zoolib/source/cxx/old/zoolib/ZXLib.cpp 2010-02-11 09:16:30 UTC (rev 1157) @@ -0,0 +1,749 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2000 Andrew Green and Learning in Motion, Inc. +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#include "zoolib/ZXLib.h" + +// ================================================================================================= +#if ZCONFIG_SPI_Enabled(X11) + +#include "zoolib/ZThreadOld.h" + +#include <X11/Xproto.h> // For definitions of request codes + +NAMESPACE_ZOOLIB_BEGIN + +ZMutex ZXLib::sMutex; + +// ================================================================================================= +#pragma mark - +#pragma mark * ZXLib::ErrorTrap + +ZXLib::ErrorTrap* ZXLib::ErrorTrap::sCurrent; + +struct RequestCodeLookup_t + { + int fCodeAsInt; + const char* fCodeAsText; + }; + +#define XX(a) { a, #a } + +RequestCodeLookup_t sRequestCodeLookup [] = + { + XX(X_CreateWindow), + XX(X_ChangeWindowAttributes), + XX(X_GetWindowAttributes), + XX(X_DestroyWindow), + XX(X_DestroySubwindows), + XX(X_ChangeSaveSet), + XX(X_ReparentWindow), + XX(X_MapWindow), + XX(X_MapSubwindows), + XX(X_UnmapWindow), + XX(X_UnmapSubwindows), + XX(X_ConfigureWindow), + XX(X_CirculateWindow), + XX(X_GetGeometry), + XX(X_QueryTree), + XX(X_InternAtom), + XX(X_GetAtomName), + XX(X_ChangeProperty), + XX(X_DeleteProperty), + XX(X_GetProperty), + XX(X_ListProperties), + XX(X_SetSelectionOwner), + XX(X_GetSelectionOwner), + XX(X_ConvertSelection), + XX(X_SendEvent), + XX(X_GrabPointer), + XX(X_UngrabPointer), + XX(X_GrabButton), + XX(X_UngrabButton), + XX(X_ChangeActivePointerGrab), + XX(X_GrabKeyboard), + XX(X_UngrabKeyboard), + XX(X_GrabKey), + XX(X_UngrabKey), + XX(X_AllowEvents), + XX(X_GrabServer), + XX(X_UngrabServer), + XX(X_QueryPointer), + XX(X_GetMotionEvents), + XX(X_TranslateCoords), + XX(X_WarpPointer), + XX(X_SetInputFocus), + XX(X_GetInputFocus), + XX(X_QueryKeymap), + XX(X_OpenFont), + XX(X_CloseFont), + XX(X_QueryFont), + XX(X_QueryTextExtents), + XX(X_ListFonts), + XX(X_ListFontsWithInfo), + XX(X_SetFontPath), + XX(X_GetFontPath), + XX(X_CreatePixmap), + XX(X_FreePixmap), + XX(X_CreateGC), + XX(X_ChangeGC), + XX(X_CopyGC), + XX(X_SetDashes), + XX(X_SetClipRectangles), + XX(X_FreeGC), + XX(X_ClearArea), + XX(X_CopyArea), + XX(X_CopyPlane), + XX(X_PolyPoint), + XX(X_PolyLine), + XX(X_PolySegment), + XX(X_PolyRectangle), + XX(X_PolyArc), + XX(X_FillPoly), + XX(X_PolyFillRectangle), + XX(X_PolyFillArc), + XX(X_PutImage), + XX(X_GetImage), + XX(X_PolyText8), + XX(X_PolyText16), + XX(X_ImageText8), + XX(X_ImageText16), + XX(X_CreateColormap), + XX(X_FreeColormap), + XX(X_CopyColormapAndFree), + XX(X_InstallColormap), + XX(X_UninstallColormap), + XX(X_ListInstalledColormaps), + XX(X_AllocColor), + XX(X_AllocNamedColor), + XX(X_AllocColorCells), + XX(X_AllocColorPlanes), + XX(X_FreeColors), + XX(X_StoreColors), + XX(X_StoreNamedColor), + XX(X_QueryColors), + XX(X_LookupColor), + XX(X_CreateCursor), + XX(X_CreateGlyphCursor), + XX(X_FreeCursor), + XX(X_RecolorCursor), + XX(X_QueryBestSize), + XX(X_QueryExtension), + XX(X_ListExtensions), + XX(X_ChangeKeyboardMapping), + XX(X_GetKeyboardMapping), + XX(X_ChangeKeyboardControl), + XX(X_GetKeyboardControl), + XX(X_Bell), + XX(X_ChangePointerControl), + XX(X_GetPointerControl), + XX(X_SetScreenSaver), + XX(X_GetScreenSaver), + XX(X_ChangeHosts), + XX(X_ListHosts), + XX(X_SetAccessControl), + XX(X_SetCloseDownMode), + XX(X_KillClient), + XX(X_RotateProperties), + XX(X_ForceScreenSaver), + XX(X_SetPointerMapping), + XX(X_GetPointerMapping), + XX(X_SetModifierMapping), + XX(X_GetModifierMapping), + XX(X_NoOperation) + }; + +#undef XX + +ZXLib::ErrorTrap::ErrorTrap() + { + ZAssertStop(0, (sMutex.IsLocked())); + fErrorCode = 0; + fPrev = sCurrent; + sCurrent = this; + } + +ZXLib::ErrorTrap::~ErrorTrap() + { + ZAssertStop(0, (sMutex.IsLocked())); + if (sCurrent == this) + sCurrent = fPrev; + } + +int ZXLib::ErrorTrap::GetError() + { + return fErrorCode; + } + +void ZXLib::ErrorTrap::Release() + { + ZAssertStop(0, (sMutex.IsLocked())); + ZAssertStop(0, (sCurrent == this)); + sCurrent = fPrev; + fPrev = nullptr; + } + +int ZXLib::ErrorTrap::sErrorHandler(Display* inDisplay, XErrorEvent* inErrorEvent) + { + if (sCurrent) + { + sCurrent->fErrorCode = inErrorEvent->error_code; + } + else + { + char errorMessage[256]; + ZXLib::GetErrorText(inDisplay, inErrorEvent->error_code, errorMessage, 256); + const char* requestCodeText = ""; + for (size_t x = 0; x < countof(sRequestCodeLookup); ++x) + { + if (sRequestCodeLookup[x].fCodeAsInt == inErrorEvent->request_code) + { + requestCodeText = sRequestCodeLookup[x].fCodeAsText; + break; + } + } + ZDebugLogf(0, ("X Error, error_code: %d, %s\n" + "\tserial: %d\n" + "\trequest_code: %d, (%s)\n" + "\tminor_code: %d", + inErrorEvent->error_code, + errorMessage, + inErrorEvent->serial, + inErrorEvent->request_code, + requestCodeText, + inErrorEvent->error_code, + inErrorEvent->minor_code)); + ZDebugStopf(0, ("Error was not expected")); + } + return 0; // Result is ignored. + } + +class ZXLib::ErrorTrap::Init + { +public: + Init(); + ~Init(); + }; + +ZXLib::ErrorTrap::Init::Init() + { + ::XSetErrorHandler(ZXLib::ErrorTrap::sErrorHandler); + } + +ZXLib::ErrorTrap::Init::~Init() + {} + +ZXLib::ErrorTrap::Init ZXLib::ErrorTrap::sInit; + +// ================================================================================================= +#pragma mark - +#pragma mark * ZXLib + +Display* ZXLib::OpenDisplay(const char* a0) + { + ZMutexLocker locker(sMutex); + return ::XOpenDisplay(a0); + } + +int ZXLib::CloseDisplay(Display* a0) + { + ZMutexLocker locker(sMutex); + return ::XCloseDisplay(a0); + } + +XErrorHandler ZXLib::SetErrorHandler(XErrorHandler a0) + { + ZMutexLocker locker(sMutex); + return ::XSetErrorHandler(a0); + } + +int ZXLib::GetErrorText(Display* a0, int a1, char* a2, int a3) + { + ZMutexLocker locker(sMutex); + return ::XGetErrorText(a0, a1, a2, a3); + } + +int ZXLib::Pending(Display* a0) + { + ZMutexLocker locker(sMutex); + return ::XPending(a0); + } + +int ZXLib::NextEvent(Display* a0, XEvent* a1) + { + ZMutexLocker locker(sMutex); + return ::XNextEvent(a0, a1); + } + +Status ZXLib::SendEvent(Display* a0, Window a1, Bool a2, long a3, XEvent* a4) + { + ZMutexLocker locker(sMutex); + return ::XSendEvent(a0, a1, a2, a3, a4); + } + +XContext ZXLib::UniqueContext() + { + ZMutexLocker locker(sMutex); + return XUniqueContext(); + } + +int ZXLib::DeleteContext(Display* a0, XID a1, XContext a2) + { + ZMutexLocker locker(sMutex); + return ::XDeleteContext(a0, a1, a2); + } + +int ZXLib::SaveContext(Display* a0, XID a1, XContext a2, const char* a3) + { + ZMutexLocker locker(sMutex); + return ::XSaveContext(a0, a1, a2, a3); + } + +int ZXLib::FindContext(Display* a0, XID a1, XContext a2, XPointer* a3) + { + ZMutexLocker locker(sMutex); + return ::XFindContext(a0, a1, a2, a3); + } + +Window ZXLib::CreateSimpleWindow(Display* a0, Window a1, int a2, int a3, unsigned int a4, + unsigned int a5, unsigned int a6, unsigned long a7, unsigned long a8) + { + ZMutexLocker locker(sMutex); + return ::XCreateSimpleWindow(a0, a1, a2, a3, a4, a5, a6, a7, a8); + } + +Window ZXLib::CreateWindow(Display* a0, Window a1, int a2, int a3, unsigned int a4, + unsigned int a5, unsigned int a6, int a7, unsigned int a8, Visual* a9, + unsigned long a10, XSetWindowAttributes* a11) + { + ZMutexLocker locker(sMutex); + return ::XCreateWindow(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); + } + +int ZXLib::DestroyWindow(Display* a0, Window a1) + { + ZMutexLocker locker(sMutex); + return ::XDestroyWindow(a0, a1); + } + +int ZXLib::MapWindow(Display* a0, Window a1) + { + ZMutexLocker locker(sMutex); + return ::XMapWindow(a0, a1); + } + +int ZXLib::UnmapWindow(Display* a0, Window a1) + { + ZMutexLocker locker(sMutex); + return ::XUnmapWindow(a0, a1); + } + +int ZXLib::MoveWindow(Display* a0, Window a1, int a2, int a3) + { + ZMutexLocker locker(sMutex); + + int result = ::XMoveWindow(a0, a1, a2, a3); + return result; + } + +int ZXLib::ResizeWindow(Display* a0, Window a1, int a2, int a3) + { + ZMutexLocker locker(sMutex); + + // MDC If the creation attributes passed to ZApp::CreateOSWindow had + // fResizable set to false, attempting to programmatically change the + // size with XResizeWindow will fail with a result of BadRequest. + // So before attempting the resize, we check to see if the window + // is non-resizable, and if so, set it to a new non-resizable size + // with XSetWMNormalHints. + // + // X11 has a different behavior than Mac or Windows, which allow one + // to programmatically resize a window even if the user can't. + + XSizeHints *sizeHints = ::XAllocSizeHints(); + + // We could return BadAlloc if sizeHints is nullptr, but in most cases we + // would still be able to resize the window, so we don't. If the window is + // not resizable, XResizeWindow will return BadRequest, so there will still be + // an error result. + + if ( sizeHints != nullptr ){ + + long flags; + + Status stat = ::XGetWMNormalHints( a0, a1, sizeHints, &flags ); + + if ( stat ){ + + if ( ( flags & PMaxSize ) && ( flags & PMinSize ) ){ + if ( ( sizeHints->min_width == sizeHints->max_width ) + && ( sizeHints->min_height == sizeHints->max_height ) ){ + + // The window is not resizable. Resize it to a new, non-resizable + // size by setting both min and max sizes to the requested size + + sizeHints->flags = PMaxSize | PMinSize | PSize; + + sizeHints->min_width = a2; + sizeHints->max_width = a2; + sizeHints->width = a2; + + sizeHints->min_height = a3; + sizeHints->max_height = a3; + sizeHints->height = a3; + + ::XSetWMNormalHints( a0, a1, sizeHints ); + + ::XFree( sizeHints ); + + return Success; + } + } + + } + ::XFree( sizeHints ); + } + + int result = ::XResizeWindow(a0, a1, a2, a3); + + ZAssertStop( 2, ( result == Success ) || ( sizeHints == nullptr ) ); + + return result; + } + +int ZXLib::MoveResizeWindow(Display* a0, Window a1, int a2, int a3, int a4, int a5) + { + ZMutexLocker locker(sMutex); + return ::XMoveResizeWindow(a0, a1, a2, a3, a4, a5); + } + +void ZXLib::StoreName(Display* inDisplay, Window inWindow, const char* inWindowName) + { + ZMutexLocker locker(sMutex); + ::XStoreName(inDisplay, inWindow, const_cast<char*>(inWindowName)); + } + +void ZXLib::SetWMName(Display* a0, Window a1, const XTextProperty* a2) + { + ZMutexLocker locker(sMutex); + ::XSetWMName(a0, a1, const_cast<XTextProperty*>(a2)); + } + +void ZXLib::SetWMIconName(Display* a0, Window a1, const XTextProperty* a2) + { + ZMutexLocker locker(sMutex); + ::XSetWMIconName(a0, a1, const_cast<XTextProperty*>(a2)); + } + +Atom ZXLib::InternAtom(Display* a0, _Xconst char* a1, Bool a2) + { + ZMutexLocker locker(sMutex); + return ::XInternAtom(a0, a1, a2); + } + +char* ZXLib::GetAtomName(Display* a0, Atom a1) + { + ZMutexLocker locker(sMutex); + return ::XGetAtomName(a0, a1); + } + +void ZXLib::SetWMProtocols(Display* a0, Window a1, Atom* a2, int a3) + { + ZMutexLocker locker(sMutex); + ::XSetWMProtocols(a0, a1, a2, a3); + } + +XFontStruct* ZXLib::LoadQueryFont(Display* a0, _Xconst char* a1) + { + ZMutexLocker locker(sMutex); + return ::XLoadQueryFont(a0, a1); + } + +ZooLib_X11_Cursor ZXLib::CreateFontCursor(Display* a0, unsigned int a1) + { + ZMutexLocker locker(sMutex); + return ::XCreateFontCursor(a0, a1); + } + +ZooLib_X11_Cursor ZXLib::CreatePixmapCursor(Display* a0, Pixmap a1, Pixmap a2, XColor* a3, + XColor* a4, unsigned int a5, unsigned int a6) + { + ZMutexLocker locker(sMutex); + return ::XCreatePixmapCursor(a0, a1, a2, a3, a4, a5, a6); + } + +int ZXLib::FreeCursor(Display* a0, ZooLib_X11_Cursor a1) + { + ZMutexLocker locker(sMutex); + return ::XFreeCursor(a0, a1); + } + +int ZXLib::DefineCursor(Display* a0, Window a1, ZooLib_X11_Cursor a2) + { + ZMutexLocker locker(sMutex); + return ::XDefineCursor(a0, a1, a2); + } + +int ZXLib::GrabPointer(Display* a0, Window a1, Bool a2, unsigned int a3, int a4, int a5, + Window a6, ZooLib_X11_Cursor a7, Time a8) + { + ZMutexLocker locker(sMutex); + return ::XGrabPointer(a0, a1, a2, a3, a4, a5, a6, a7, a8); + } + +int ZXLib::UngrabPointer(Display* a0, Time a1) + { + ZMutexLocker locker(sMutex); + return ::XUngrabPointer(a0, a1); + } + +int ZXLib::GrabKeyboard(Display* a0, Window a1, Bool a2, int a3, int a4, Time a5) + { + ZMutexLocker locker(sMutex); + return ::XGrabKeyboard(a0, a1, a2, a3, a4, a5); + } + +int ZXLib::UngrabKeyboard(Display* a0, Time a1) + { + ZMutexLocker locker(sMutex); + return ::XUngrabKeyboard(a0, a1); + } + +GC ZXLib::CreateGC(Display* a0, Drawable a1, unsigned long a2, XGCValues* a3) + { + ZMutexLocker locker(sMutex); + return ::XCreateGC(a0, a1, a2, a3); + } + +int ZXLib::FreeGC(Display* a0, GC a1) + { + ZMutexLocker locker(sMutex); + return ::XFreeGC(a0, a1); + } + +int ZXLib::SetForeground(Display* a0, GC a1, unsigned long a2) + { + ZMutexLocker locker(sMutex); + return ::XSetForeground(a0, a1, a2); + } + +int ZXLib::SetBackground(Display* a0, GC a1, unsigned long a2) + { + ZMutexLocker locker(sMutex); + return ::XSetBackground(a0, a1, a2); + } + +int ZXLib::SetRegion(Display* a0, GC a1, Region a2) + { + ZMutexLocker locker(sMutex); + return ::XSetRegion(a0, a1, a2); + } + +int ZXLib::SetFunction(Display* a0, GC a1, int a2) + { + ZMutexLocker locker(sMutex); + return ::XSetFunction(a0, a1, a2); + } + +int ZXLib::SetTSOrigin(Display* a0, GC a1, int a2, int a3) + { + ZMutexLocker locker(sMutex); + return ::XSetTSOrigin(a0, a1, a2, a3); + } + +int ZXLib::SetLineAttributes(Display* a0, GC a1, unsigned int a2, int a3, int a4, int a5) + { + ZMutexLocker locker(sMutex); + return ::XSetLineAttributes(a0, a1, a2, a3, a4, a5); + } + +int ZXLib::SetFillStyle(Display* a0, GC a1, int a2) + { + ZMutexLocker locker(sMutex); + return ::XSetFillStyle(a0, a1, a2); + } + +int ZXLib::CopyArea(Display* a0, Drawable a1, Drawable a2, GC a3, int a4, int a5, + unsigned int a6, unsigned int a7, int a8, int a9) + { + ZMutexLocker locker(sMutex); + return ::XCopyArea(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); + } + +int ZXLib::DrawPoint(Display* a0, Drawable a1, GC a2, int a3, int a4) + { + ZMutexLocker locker(sMutex); + return ::XDrawPoint(a0, a1, a2, a3, a4); + } + +int ZXLib::DrawLine(Display* a0, Drawable a1, GC a2, int a3, int a4, int a5, int a6) + { + ZMutexLocker locker(sMutex); + return ::XDrawLine(a0, a1, a2, a3, a4, a5, a6); + } + +int ZXLib::FillRectangle(Display* a0, Drawable a1, GC a2, int a3, int a4, + unsigned int a5, unsigned int a6) + { + ZMutexLocker locker(sMutex); + return ::XFillRectangle(a0, a1, a2, a3, a4, a5, a6); + } + +int ZXLib::DrawRectangle(Display* a0, Drawable a1, GC a2, int a3, int a4, + unsigned int a5, unsigned int a6) + { + ZMutexLocker locker(sMutex); + return ::XDrawRectangle(a0, a1, a2, a3, a4, a5, a6); + } + +int ZXLib::FillPolygon(Display* a0, Drawable a1, GC a2, XPoint* a3, int a4, int a5, int a6) + { + ZMutexLocker locker(sMutex); + return ::XFillPolygon(a0, a1, a2, a3, a4, a5, a6); + } + +int ZXLib::DrawArc(Display* a0, Drawable a1, GC a2, int a3, int a4, unsigned int a5, + unsigned int a6, int a7, int a8) + { + ZMutexLocker locker(sMutex); + return ::XDrawArc(a0, a1, a2, a3, a4, a5, a6, a7, a8); + } + +int ZXLib::FillArc(Display* a0, Drawable a1, GC a2, int a3, int a4, unsigned int a5, + unsigned int a6, int a7, int a8) + { + ZMutexLocker locker(sMutex); + return ::XFillArc(a0, a1, a2, a3, a4, a5, a6, a7, a8); + } + +int ZXLib::Sync(Display* a0, Bool a1) + { + ZMutexLocker locker(sMutex); + return ::XSync(a0, a1); + } + +int ZXLib::Flush(Display* a0) + { + ZMutexLocker locker(sMutex); + return ::XFlush(a0); + } + +int ZXLib::SetStipple(Display* a0, GC a1, Pixmap a2) + { + ZMutexLocker locker(sMutex); + return ::XSetStipple(a0, a1, a2); + } + +int ZXLib::SetTile(Display* a0, GC a1, Pixmap a2) + { + ZMutexLocker locker(sMutex); + return ::XSetTile(a0, a1, a2); + } + +int ZXLib::SetFont(Display* a0, GC a1, Font a2) + { + ZMutexLocker locker(sMutex); + return ::XSetFont(a0, a1, a2); + } + +int ZXLib::DrawString(Display* a0, Drawable a1, GC a2, int a3, int a4, _Xconst char* a5, int a6) + { + ZMutexLocker locker(sMutex); + return ::XDrawString(a0, a1, a2, a3, a4, a5, a6); + } + +int ZXLib::TextWidth(XFontStruct* a0, _Xconst char* a1, int a2) + { + ZMutexLocker locker(sMutex); + return ::XTextWidth(a0, a1, a2); + } + +int ZXLib::SelectInput(Display* a0, Window a1, long a2) + { + ZMutexLocker locker(sMutex); + return ::XSelectInput(a0, a1, a2); + } + +Pixmap ZXLib::CreateBitmapFromData(Display* a0, Drawable a1, _Xconst char* a2, + unsigned int a3, unsigned int a4) + { + ZMutexLocker locker(sMutex); + return ::XCreateBitmapFromData(a0, a1, a2, a3, a4); + } + +Pixmap ZXLib::CreatePixmap(Display* a0, Drawable a1, unsigned int a2, unsigned int a3, int a4) + { + ZMutexLocker locker(sMutex); + return ::XCreatePixmap(a0, a1, a2, a3, a4); + } + +int ZXLib::FreePixmap(Display* a0, Pixmap a1) + { + ZMutexLocker locker(sMutex); + return ::XFreePixmap(a0, a1); + } + +Status ZXLib::AllocColor(Display* a0, Colormap a1, XColor* a2) + { + ZMutexLocker locker(sMutex); + return ::XAllocColor(a0, a1, a2); + } + +int ZXLib::Free(void* a0) + { + ZMutexLocker locker(sMutex); + return ::XFree(a0); + } + +XSizeHints* ZXLib::AllocSizeHints() + { + ZMutexLocker locker(sMutex); + return ::XAllocSizeHints(); + } + +XWMHints* ZXLib::AllocWMHints() + { + ZMutexLocker locker(sMutex); + return ::XAllocWMHints(); + } + +XClassHint* ZXLib::AllocClassHint() + { + ZMutexLocker locker(sMutex); + return ::XAllocClassHint(); + } + +Status ZXLib::StringListToTextProperty(const char** a0, int a1, XTextProperty* a2) + { + ZMutexLocker locker(sMutex); + return ::XStringListToTextProperty(const_cast<char**>(a0), a1, a2); + } + +void ZXLib::SetWMProperties(Display* a0, Window a1, XTextProperty* a2, + XTextProperty* a3, char** a4, int a5, XSizeHints* a6, XWMHints* a7, XClassHint* a8) + { + ZMutexLocker locker(sMutex); + ::XSetWMProperties(a0, a1, a2, a3, a4, a5, a6, a7, a8); + } + +NAMESPACE_ZOOLIB_END + +#endif // ZCONFIG_SPI_Enabled(X11) + +// ================================================================================================= Copied: trunk/zoolib/source/cxx/old/zoolib/ZXLib.h (from rev 1121, trunk/zoolib/source/cxx/zoolib/ZXLib.h) =================================================================== --- trunk/zoolib/source/cxx/old/zoolib/ZXLib.h (rev 0) +++ trunk/zoolib/source/cxx/old/zoolib/ZXLib.h 2010-02-11 09:16:30 UTC (rev 1157) @@ -0,0 +1,179 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2000 Andrew Green and Learning in Motion, Inc. +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#ifndef __ZXLib__ +#define __ZXLib__ 1 +#include "zconfig.h" +#include "zoolib/ZCONFIG_SPI.h" + +// ================================================================================================= +#if ZCONFIG_SPI_Enabled(X11) + +#include "zoolib/ZThreadOld.h" + +#include "zoolib/ZCompat_Xlib.h" +#include <X11/Xresource.h> +#include <X11/Xutil.h> + +NAMESPACE_ZOOLIB_BEGIN + +namespace ZXLib { + +extern ZMutex sMutex; + +class ErrorTrap + { +private: + ErrorTrap(const ErrorTrap&); // Not implemented + ErrorTrap& operator=(const ErrorTrap&); // Not implemented + +public: + ErrorTrap(); + ~ErrorTrap(); + + int GetError(); + + void Release(); + +protected: + class Init; + friend class Init; + static Init sInit; + + static int sErrorHandler(Display* inDisplay, XErrorEvent* inErrorEvent); + static ErrorTrap* sCurrent; + + ErrorTrap* fPrev; + int fErrorCode; + }; + +// ================================================== + +Display* OpenDisplay(const char*); +int CloseDisplay(Display*); + +XErrorHandler SetErrorHandler(XErrorHandler a0); +int GetErrorText(Display*, int, char*, int); + +int Pending(Display*); +int NextEvent(Display*, XEvent*); + +Status SendEvent(Display* a0, Window a1, Bool a2, long a3, XEvent* a4); + +XContext UniqueContext(); +int DeleteContext(Display* a0, XID a1, XContext a2); +int SaveContext(Display*, XID, XContext, const char*); +int FindContext(Display*, XID, XContext, XPointer*); + +Window CreateSimpleWindow(Display* a0, Window a1, int a2, int a3, unsigned int a4, + unsigned int a5, unsigned int a6, unsigned long a7, unsigned long a8); + +Window CreateWindow(Display* a0, Window a1, int a2, int a3, unsigned int a4, + unsigned int a5, unsigned int a6, int a7, unsigned int a8, Visual* a9, + unsigned long a10, XSetWindowAttributes* a11); + +int DestroyWindow(Display*, Window); + +int MapWindow(Display*, Window); +int UnmapWindow(Display* a0, Window a1); + +int MoveWindow(Display*, Window, int, int); +int ResizeWindow(Display*, Window, int, int); +int MoveResizeWindow(Display*, Window, int, int, int, int); + + +void StoreName(Display* a0, Window a1, const char* a2); +void SetWMName(Display* a0, Window a1, const XTextProperty* a2); +void SetWMIconName(Display* a0, Window a1, const XTextProperty* a2); + +Atom InternAtom(Display* a0, _Xconst char* a1, Bool a2); +char* GetAtomName(Display* a0, Atom a1); + +void SetWMProtocols(Display* a0, Window a1, Atom* a2, int a3); + +XFontStruct* LoadQueryFont(Display* a0, _Xconst char* a1); + +ZooLib_X11_Cursor CreateFontCursor(Display* a0, unsigned int a1); +ZooLib_X11_Cursor CreatePixmapCursor(Display* a0, Pixmap a1, Pixmap a2, XColor* a3, + XColor* a4, unsigned int a5, unsigned int a6); +int FreeCursor(Display* a0, ZooLib_X11_Cursor a1); + +int DefineCursor(Display* a0, Window a1, ZooLib_X11_Cursor a2); + +int GrabPointer(Display* a0, Window a1, Bool a2, unsigned int a3, int a4, int a5, + Window a6, ZooLib_X11_Cursor a7, Time a8); +int UngrabPointer(Display* a0, Time a1); +int GrabKeyboard(Display* a0, Window a1, Bool a2, int a3, int a4, Time a5); +int UngrabKeyboard(Display* a0, Time a1); + +GC CreateGC(Display* a0, Drawable a1, unsigned long a2, XGCValues* a3); +int FreeGC(Display* a0, GC a1); + +int SetForeground(Display* a0, GC a1, unsigned long a2); +int SetBackground(Display* a0, GC a1, unsigned long a2); +int SetRegion(Display* a0, GC a1, Region a2); +int SetFunction(Display* a0, GC a1, int a2); +int SetTSOrigin(Display* a0, GC a1, int a2, int a3); +int SetLineAttributes(Display* a0, GC a1, unsigned int a2, int a3, int a4, int a5); +int SetFillStyle(Display* a0, GC a1, int a2); +int CopyArea(Display* a0, Drawable a1, Drawable a2, GC a3, int a4, int a5, + unsigned int a6, unsigned int a7, int a8, int a9); +int DrawPoint(Display* a0, Drawable a1, GC a2, int a3, int a4); +int DrawLine(Display* a0, Drawable a1, GC a2, int a3, int a4, int a5, int a6); +int FillRectangle(Display* a0, Drawable a1, GC a2, int a3, int a4, + unsigned int a5, unsigned int a6); +int DrawRectangle(Display* a0, Drawable a1, GC a2, int a3, int a4, + unsigned int a5, unsigned int a6); +int FillPolygon(Display* a0, Drawable a1, GC a2, XPoint* a3, int a4, int a5, int a6); +int DrawArc(Display* a0, Drawable a1, GC a2, int a3, int a4, unsigned int a5, + unsigned int a6, int a7, int a8); +int FillArc(Display* a0, Drawable a1, GC a2, int a3, int a4, unsigned int a5, + unsigned int a6, int a7, int a8); +int Sync(Display* a0, Bool a1); +int Flush(Display* a0); +int SetStipple(Display* a0, GC a1, Pixmap a2); +int SetTile(Display* a0, GC a1, Pixmap a2); +int SetFont(Display* a0, GC a1, Font a2); +int DrawString(Display* a0, Drawable a1, GC a2, int a3, int a4, _Xconst char* a5, int a6); +int TextWidth(XFontStruct* a0, _Xconst char* a1, int a2); +int SelectInput(Display* a0, Window a1, long a2); +Pixmap CreateBitmapFromData(Display* a0, Drawable a1, _Xconst char* a2, + unsigned int a3, unsigned int a4); +Pixmap CreatePixmap(Display* a0, Drawable a1, unsigned int a2, unsigned int a3, int a4); +int FreePixmap(Display* a0, Pixmap a1); +Status AllocColor(Display* a0, Colormap a1, XColor* a2); + +int Free(void* a0); +XSizeHints* AllocSizeHints(); +XWMHints* AllocWMHints(); +XClassHint* AllocClassHint(); +Status StringListToTextProperty(const char** a0, int a1, XTextProperty* a2); +void SetWMProperties(Display* a0, Window a1, XTextProperty* a2, XTextProperty* a3, + char** a4, int a5, XSizeHints* a6, XWMHints* a7, XClassHint* a8); + +} // namespace ZXLib + +NAMESPACE_ZOOLIB_END + +#endif // ZCONFIG_SPI_Enabled(X11) + +// ================================================================================================= + +#endif // __ZXLib__ Copied: trunk/zoolib/source/cxx/old/zoolib/ZXServer.cpp (from rev 1121, trunk/zoolib/source/cxx/zoolib/ZXServer.cpp) =================================================================== --- trunk/zoolib/source/cxx/old/zoolib/ZXServer.cpp (rev 0) +++ trunk/zoolib/source/cxx/old/zoolib/ZXServer.cpp 2010-02-11 09:16:30 UTC (rev 1157) @@ -0,0 +1,1290 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2000 Andrew Green and Learning in Motion, Inc. +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#include "zoolib/ZXServer.h" + +#if ZCONFIG_SPI_Enabled(X11) + +#include "zoolib/ZDCPixmap.h" +#include "zoolib/ZDebug.h" + +#include <sys/ipc.h> +#include <sys/shm.h> + +NAMESPACE_ZOOLIB_BEGIN + +using std::bad_alloc; +using std::less; +using std::min; +using std::map; +using std::pair; +using std::string; +using std::runtime_error; +using std::vector; + +static XContext sXContext_Window = 0; + +// ================================================================================================= +#pragma mark - +#pragma mark * kDebug + +#define kDebug_X 2 + +#define kDebug_XHeavy 1 + +#if 0 +// ================================================================================================= +#pragma mark - +#pragma mark * ZXServerDummyWindow + +class ZXServerDummyWindow : public ZXWindow + { +public: + ZXServerDummyWindow(ZRef<ZXServer> inXServer, Window inWindow); + virtual ~ZXServerDummyWindow(); + +// From ZXWindow + virtual void HandleXEvent(const XEvent& inEvent); + }; + +ZXServerDummyWindow::ZXServerDummyWindow(ZRef<ZXServer> inXServer, Window inWindow) + { + this->AttachToWindow(inXServer, inWindow); + } + +ZXServerDummyWindow::~ZXServerDummyWindow() + { + fXServer->DestroyWindow(fWindow); + this->DetachFromWindow(); + } + +// From ZXWindow +void ZXServerDummyWindow::HandleXEvent(const XEvent& inEvent) + { + } +#endif + +// ================================================================================================= +#pragma mark - +#pragma mark * ZXServer + +ZXServer::ZXServer(const char* inDisplayName) + { + fHasSharedImages = false; + fHasSharedPixmaps = false; + + if (!sXContext_Window) + sXContext_Window = ZXLib::UniqueContext(); + + fDisplay = ZXLib::OpenDisplay(inDisplayName); + if (fDisplay == nullptr) + throw runtime_error("Couldn't connect to display"); + + fFont = ZXLib::LoadQueryFont(fDisplay, "fixed"); + + this->InitGraphics(); + } + +ZXServer::~ZXServer() + { + ZAssertStop(2, fDisplay == nullptr); + } + +void ZXServer::Close() + { + ZXLib::CloseDisplay(fDisplay); + fDisplay = nullptr; + } + +bool ZXServer::Pending() + { + return ZXLib::Pending(fDisplay); + } + +void ZXServer::NextEvent(XEvent& outEvent) + { + ZXLib::NextEvent(fDisplay, &outEvent); + } + +static const char* sXEventNames[] = + { + "zero", + "one", + "KeyPress", + "KeyRelease", + "ButtonPress", + "ButtonRelease", + "MotionNotify", + "EnterNotify", + "LeaveNotify", + "FocusIn", + "FocusOut", + "KeymapNotify", + "Expose", + "GraphicsExpose", + "NoExpose", + "VisibilityNotify", + "CreateNotify", + "DestroyNotify", + "UnmapNotify", + "MapNotify", + "MapRequest", + "ReparentNotify", + "ConfigureNotify", + "ConfigureRequest", + "GravityNotify", + "ResizeRequest", + "CirculateNotify", + "CirculateRequest", + "PropertyNotify", + "SelectionClear ", + "SelectionRequest", + "SelectionNotify", + "ColormapNotify", + "ClientMessage", + "MappingNotify" + }; + +void ZXServer::DispatchXEvent(const XEvent& inEvent) + { + ZAssert(inEvent.xany.display == fDisplay); + + ZXWindow* theXWindow = ZXWindow::sFromDisplayAndWindowNilOkay(fDisplay, inEvent.xany.window); + if (inEvent.xany.type == PropertyNotify) + { + string theAtomName = this->GetAtomName(inEvent.xproperty.atom); + ZDebugLogf(kDebug_XHeavy, ("type: %d (PropertyNotify), serial: %d, display: %08X, window: %08X, theXWindow: %08X, Atom: %s, Time: %d, state: %d", + inEvent.xany.type, + inEvent.xany.serial, + inEvent.xany.display, + inEvent.xany.window, + theXWindow, + theAtomName.c_str(), + inEvent.xproperty.time, + inEvent.xproperty.state)); + } + else if (inEvent.xany.type >= 0 && inEvent.xany.type < countof(sXEventNames)) + { + ZDebugLogf(kDebug_XHeavy, ("type: %d (%s), serial: %d, display: %08X, window: %08X, theXWindow: %08X", + inEvent.xany.type, + sXEventNames[inEvent.xany.type], + inEvent.xany.serial, + inEvent.xany.display, + inEvent.xany.window, + theXWindow)); + } + else if ((fHasSharedImages || fHasSharedPixmaps) && inEvent.xany.type == fShmCompletionEvent) + { + const XShmCompletionEvent& theShmEvent = reinterpret_cast<const XShmCompletionEvent&>(inEvent); + ZDebugLogf(kDebug_XHeavy, ("type: %d (ShmCompletion), serial: %d, send_event: %d, display: %08X, drawable: %08X, major_code: %d, minor_code: %d, shmseg: %08X, offset: %d", + theShmEvent.type, + theShmEvent.serial, + theShmEvent.send_event, + theShmEvent.display, + theShmEvent.drawable, + theShmEvent.major_code, + theShmEvent.minor_code, + theShmEvent.shmseg, + theShmEvent.offset)); + } + else + { + ZDebugLogf(kDebug_XHeavy, ("type: %d (unknown), serial: %d, display: %08X, window: %08X, theXWindow: %08X", + inEvent.xany.type, + inEvent.xany.serial, + inEvent.xany.display, + inEvent.xany.window,theXWindow)); + } + + if (theXWindow) + theXWindow->HandleXEvent(inEvent); + } + +Display* ZXServer::GetDisplay() + { + return fDisplay; + } + +Status ZXServer::SendEvent(Window theWindow, Bool propagate, long event_mask, const XEvent& outEvent) + { + return ZXLib::SendEvent(fDisplay, theWindow, propagate, event_mask, const_cast<XEvent*>(&outEvent)); + } + +bool ZXServer::CheckWindowEvent(Window inWindow, long event_mask, XEvent& outEvent) + { + ZMutexLocker locker(ZXLib::sMutex); + return ::XCheckWindowEvent(fDisplay, inWindow, event_mask, &outEvent); + } + +void ZXServer::DestroyWindow(Window inWindow) + { + ZMutexLocker structureLocker(fMutex_Structure); + map<ZRGBColor, unsigned long, less<ZRGBColor> >::iterator theIter = fCachedColors.begin(); + int index = 0; + for (map<ZRGBColor, unsigned long, less<ZRGBColor> >::iterator theIter = fCachedColors.begin(); theIter != fCachedColors.end(); ++theIter) + { + ZDebugPrintf(kDebug_XHeavy, ("index: %d, pixel: %08X, red: %04X, green: %04X, blue: %04X", index++, (*theIter).second, (*theIter).first.red, (*theIter).first.green, (*theIter).first.blue)); + } + + ZXLib::DestroyWindow(fDisplay, inWindow); + } + +void ZXServer::MapWindow(Window inWindow) + { + ZXLib::MapWindow(fDisplay, inWindow); + } + +void ZXServer::UnmapWindow(Window inWindow) + { + ZXLib::UnmapWindow(fDisplay, inWindow); + } + +void ZXServer::StoreName(Window inWindow, const char* inWindowName) + { + ZXLib::StoreName(fDisplay, inWindow, inWindowName); + } + +void ZXServer::SetWMName(Window inWindow, const XTextProperty* inWindowName) + { + ZXLib::SetWMName(fDisplay, inWindow, inWindowName); + } + +void ZXServer::SetWMIconName(Window inWindow, const XTextProperty* inWindowName) + { + ZXLib::SetWMIconName(fDisplay, inWindow, inWindowName); + } + +Atom ZXServer::InternAtom(const char* inAtomName) + { + return ZXLib::InternAtom(fDisplay, const_cast<char*>(inAtomName), false); + } + +string ZXServer::GetAtomName(Atom inAtom) + { + string result; + if (char* theAtomName = ZXLib::GetAtomName(fDisplay, inAtom)) + { + result = theAtomName; + XFree(theAtomName); + } + + return result; + } + +void ZXServer::SetWMProtocols(Window inWindow, const Atom* inAtoms, int inCount) + { + ZXLib::SetWMProtocols(fDisplay, inWindow, const_cast<Atom*>(inAtoms), inCount); + } + +void ZXServer::MoveWindow(Window inWindow, int inLocationH, int inLocationV) + { + ZXLib::MoveWindow(fDisplay, inWindow, inLocationH, inLocationV); + } + +void ZXServer::ResizeWindow(Window inWindow, unsigned int inSizeH, unsigned int inSizeV) + { + ZXLib::ResizeWindow(fDisplay, inWindow, inSizeH, inSizeV); + } + +void ZXServer::MoveResizeWindow(Window inWindow, int inLocationH, int inLocationV, unsigned int inSizeH, unsigned int inSizeV) + { + ZXLib::MoveResizeWindow(fDisplay, inWindow, inLocationH, inLocationV, inSizeH, inSizeV); + } + +ZooLib_X11_Cursor ZXServer::CreateFontCursor(int inCursorShape) + { + return ZXLib::CreateFontCursor(fDisplay, inCursorShape); + } + +ZooLib_X11_Cursor ZXServer::CreateCursorFromDCPixmaps(Drawable inDrawable, const ZDCPixmap& inPixmap, const ZDCPixmap& inMask, ZPoint inHotPoint) + { + Pixmap theCursorPixmap = this->CreateBitmapFromDCPixmap(inDrawable, inPixmap, ZRect(16, 16), true); + Pixmap theMaskPixmap = this->CreateBitmapFromDCPixmap(inDrawable, inMask, ZRect(16, 16), false); + XColor theForeColor = ZRGBColor::sBlack; + XColor theBackColor = ZRGBColor::sWhite; + ZooLib_X11_Cursor theCursor = ZXLib::CreatePixmapCursor(fDisplay, theCursorPixmap, theMaskPixmap, &theForeColor, &theBackColor, inHotPoint.h, inHotPoint.v); + ZXLib::FreePixmap(fDisplay, theCursorPixmap); + ZXLib::FreePixmap(fDisplay, theMaskPixmap); + return theCursor; + } + +void ZXServer::FreeCursor(ZooLib_X11_Cursor inCursor) + { + ZXLib::FreeCursor(fDisplay, inCursor); + } + +void ZXServer::DefineCursor(Window inWindow, ZooLib_X11_Cursor inCursor) + { + ZXLib::DefineCursor(fDisplay, inWindow, inCursor); + } + +int ZXServer::GrabPointer(Window inWindow, Bool inOwnerEvents, unsigned int inEventMask, int inPointerMode, int inKeyboardMode, Window inConfineTo, ZooLib_X11_Cursor inCursor, Time inTime) + { + return ZXLib::GrabPointer(fDisplay, inWindow, inOwnerEvents, inEventMask, inPointerMode, inKeyboardMode, inConfineTo, inCursor, inTime); + } + +int ZXServer::UngrabPointer(Time inTime) + { + return ZXLib::UngrabPointer(fDisplay, inTime); + } + +int ZXServer::GrabKeyboard(Window inWindow, Bool inOwnerEvents, int inPointerMode, int inKeyboardMode, Time inTime) + { + return ZXLib::GrabKeyboard(fDisplay, inWindow, inOwnerEvents, inPointerMode, inKeyboardMode, inTime); + } + +int ZXServer::UngrabKeyboard(Time inTime) + { + return ZXLib::UngrabKeyboard(fDisplay, inTime); + } + +// ================================================== + +void ZXServer::SetForeground(GC inGC, const ZRGBColor& inColor) + { + ZXLib::SetForeground(fDisplay, inGC, this->pLookupColor(inColor)); + } + +void ZXServer::SetForeground(GC inGC, uint32 inPixVal) + { + ZXLib::SetForeground(fDisplay, inGC, inPixVal); + } + +void ZXServer::SetBackground(GC inGC, const ZRGBColor& inColor) + { + ZXLib::SetBackground(fDisplay, inGC, this->pLookupColor(inColor)); + } + +void ZXServer::SetBackground(GC inGC, uint32 inPixVal) + { + ZXLib::SetBackground(fDisplay, inGC, inPixVal); + } + +void ZXServer::SetRegion(GC inGC, Region inRegion) + { + ZXLib::SetRegion(fDisplay, inGC, inRegion); + } + +void ZXServer::SetFunction(GC inGC, int inFunction) + { + ZXLib::SetFunction(fDisplay, inGC, inFunction); + } + +void ZXServer::SetClipMask(GC inGC, Pixmap inMask) + { + ZMutexLocker locker(ZXLib::sMutex); + ::XSetClipMask(fDisplay, inGC, inMask); + } + +void ZXServer::SetClipOrigin(GC inGC, int inOriginH, int inOriginV) + { + ZMutexLocker locker(ZXLib::sMutex); + ::XSetClipOrigin(fDisplay, inGC, inOriginH, inOriginV); + } + +void ZXServer::SetTSOrigin(GC inGC, int inOriginH, int inOriginV) + { + ZXLib::SetTSOrigin(fDisplay, inGC, inOriginH, inOriginV); + } + +void ZXServer::SetLineAttributes(GC inGC, unsigned int inLineWidth, int inLineStyle, int inCapStyle, int inJoinStyle) + { + ZXLib::SetLineAttributes(fDisplay, inGC, inLineWidth, inLineStyle, inCapStyle, inJoinStyle); + } + +void ZXServer::SetFillStyle(GC inGC, int inFillStyle) + { + ZXLib::SetFillStyle(fDisplay, inGC, inFillStyle); + } + +void ZXServer::CopyArea(Drawable inSourceDrawable, Drawable inDestDrawable, GC inGC, + int inSourceLocationH, int inSourceLocationV, unsigned int inSizeH, unsigned int inSizeV, int inDestLocationH, int inDestLocationV) + { + ZXLib::CopyArea(fDisplay, inSourceDrawable, inDestDrawable, inGC, + inSourceLocationH, inSourceLocationV, inSizeH, inSizeV, inDestLocationH, inDestLocationV); + } + +void ZXServer::DrawPoint(Drawable inDrawable, GC inGC, int inLocationH, int inLocationV) + { + ZXLib::DrawPoint(fDisplay, inDrawable, inGC, inLocationH, inLocationV); + } + +void ZXServer::DrawLine(Drawable inDrawable, GC inGC, int inStartH, int inStartV, int inEndH, int EndV) + { + ZXLib::DrawLine(fDisplay, inDrawable, inGC, inStartH, inStartV, inEndH, EndV); + } + +void ZXServer::FillRectangle(Drawable inDrawable, GC inGC, int inLocationH, int inLocationV, unsigned int inSizeH, unsigned int inSizeV) + { + ZXLib::FillRectangle(fDisplay, inDrawable, inGC, inLocationH, inLocationV, inSizeH, inSizeV); + } + +void ZXServer::DrawRectangle(Drawable inDrawable, GC inGC, int inLocationH, int inLocationV, unsigned int inSizeH, unsigned int inSizeV) + { + ZXLib::DrawRectangle(fDisplay, inDrawable, inGC, inLocationH, inLocationV, inSizeH, inSizeV); + } + +void ZXServer::FillPolygon(Drawable inDrawable, GC inGC, XPoint* inPoints, size_t inCount, int inShape, int inMode) + { + ZXLib::FillPolygon(fDisplay, inDrawable, inGC, inPoints, inCount, inShape, inMode); + } + +void ZXServer::DrawArc(Drawable inDrawable, GC inGC, int inLocationH, int inLocationV, unsigned int inSizeH, unsigned int inSizeV, int inAngle1, int inAngle2) + { + ZXLib::DrawArc(fDisplay, inDrawable, inGC, inLocationH, inLocationV, inSizeH, inSizeV, inAngle1, inAngle2); + } + +void ZXServer::FillArc(Drawable inDrawable, GC inGC, int inLocationH, int inLocationV, unsigned int inSizeH, unsigned int inSizeV, int inAngle1, int inAngle2) + { + ZXLib::FillArc(fDisplay, inDrawable, inGC, inLocationH, inLocationV, inSizeH, inSizeV, inAngle1, inAngle2); + } + +void ZXServer::Sync(bool inDiscard) + { + ZXLib::Sync(fDisplay, inDiscard); + } + +void ZXServer::Flush() + { + ZXLib::Flush(fDisplay); + } + +void ZXServer::SetStipple(GC inGC, Pixmap inStipple) + { + int result = ZXLib::SetStipple(fDisplay, inGC, inStipple); + ZAssertStopf(0, result != 0, ("ZXServer::SetStipple result: %d", result)); + } + +void ZXServer::SetTile(GC inGC, Pixmap inTile) + { + int result = ZXLib::SetTile(fDisplay, inGC, inTile); + ZAssertStopf(0, result != 0, ("ZXServer::SetTile result: %d", result)); + } + +void ZXServer::SetFont(GC inGC, const ZDCFont& inFont) + { + ZMutexLocker structureLocker(fMutex_Structure); + ZXLib::SetFont(fDisplay, inGC, fFont->fid); + } + +void ZXServer::DrawString(Drawable inDrawable, GC inGC, int inLocationH, int inLocationV, const char* inText, size_t inTextLength) + { + ZMutexLocker structureLocker(fMutex_Structure); + ZXLib::DrawString(fDisplay, inDrawable, inGC, inLocationH, inLocationV, inText, inTextLength); + } + +int ZXServer::TextWidth(const ZDCFont& inFont, const char* inText, size_t inTextLength) + { + ZMutexLocker structureLocker(fMutex_Structure); + return ZXLib::TextWidth(fFont, inText, inTextLength); + } + +void ZXServer::GetFontInfo(const ZDCFont& inFont, short& outAscent, short& outDescent, short& outLeading) + { + ZMutexLocker structureLocker(fMutex_Structure); + outAscent = fFont->ascent; + outDescent = fFont->descent; + outLeading = 0; + } + +Window ZXServer::CreateWindow(Window inParent, int inLocationH, int inLocationV, unsigned int inSizeH, unsigned int inSizeV, unsigned int inBorderWidth, + int inDepth, unsigned int inClass, Visual* inVisual, unsigned long inValueMask, XSetWindowAttributes* inAttributes) + { + inVisual = fVisualInfo.visual; + inDepth = fVisualInfo.depth; + inAttributes->colormap = fColormap; + Window result = ZXLib::CreateWindow(fDisplay, inParent, inLocationH, inLocationV, inSizeH, inSizeV, inBorderWidth, + inDepth, inClass, inVisual, inValueMask, inAttributes); + + this->Sync(false); + return result; + } + +Window ZXServer::CreateSimpleWindow(Window inParent, int inLocationH, int inLocationV, unsigned int inSizeH, unsigned int inSizeV, + unsigned int inBorderWidth, unsigned long inBorderPixel, unsigned long inBackgroundPixel) + { + return ZXLib::CreateSimpleWindow(fDisplay, inParent, inLocationH, inLocationV, inSizeH, inSizeV, + inBorderWidth, inBorderPixel, inBackgroundPixel); + } + +void ZXServer::SelectInput(Window inWindow, long inEventMask) + { + ZXLib::SelectInput(fDisplay, inWindow, inEventMask); + } + +Pixmap ZXServer::CreateBitmapFromData(Drawable inDrawable, char* inData, int inSizeH, int inSizeV) + { + return ZXLib::CreateBitmapFromData(fDisplay, inDrawable, inData, inSizeH, inSizeV); + } + +Pixmap ZXServer::CreatePixmap(Drawable inDrawable, unsigned int inSizeH, unsigned int inSizeV, unsigned int inDepth) + { + return ZXLib::CreatePixmap(fDisplay, inDrawable, inSizeH, inSizeV, inDepth); + } + +Pixmap ZXServer::CreatePixmapFromDCPixmap(Drawable inDrawable, const ZDCPixmap& inDCPixmap) + { + ZMutexLocker locker(ZXLib::sMutex); + + ZPoint pixmapSize = inDCPixmap.Size(); + + Pixmap thePixmap = ZXLib::CreatePixmap(fDisplay, inDrawable, pixmapSize.h, pixmapSize.v, fVisualInfo.depth); + XGCValues values; + values.graphics_exposures = 0; + GC theGC = ::XCreateGC(fDisplay, thePixmap, GCGraphicsExposures, &values); + this->DrawDCPixmap(thePixmap, theGC, ZPoint(0, 0), inDCPixmap, ZRect(inDCPixmap.Size())); + ZXLib::FreeGC(fDisplay, theGC); + return thePixmap; + } + +Pixmap ZXServer::CreateBitmapFromDCPixmap(Drawable inDrawable, const ZDCPixmap& inDCPixmap, const ZRect& inSourceBounds, bool inInvert) + { + if (inSourceBounds.IsEmpty() || !inDCPixmap) + return None; + + ZMutexLocker locker(ZXLib::sMutex); + + size_t rowBytes = ((inSourceBounds.Width() + 7) / 8); + vector<char> theData(rowBytes * inSourceBounds.Height()); + inDCPixmap.CopyTo(ZPoint(0, 0), + &theData[0], + ZDCPixmapNS::RasterDesc(ZDCPixmapNS::PixvalDesc(1, false), rowBytes, inSourceBounds.Height(), false), + ZDCPixmapNS::PixelDesc(1, 0), + inSourceBounds); + + if (inInvert) + { + for (vector<char>::iterator i = theData.begin(); i != theData.end(); ++i) + *i = 0xFF ^ *i; + } + + return this->CreateBitmapFromData(inDrawable, &theData[0], inSourceBounds.Width(), inSourceBounds.Height()); + } + +void ZXServer::FreePixmap(Pixmap inPixmap) + { + ZXLib::FreePixmap(fDisplay, inPixmap); + } + +void ZXServer::DrawDCPixmap(Drawable inDrawable, GC inGC, ZPoint inLocation, const ZDCPixmap& inSourcePixmap, const ZRect& inSourceBounds) + { + ZMutexLocker locker(ZXLib::sMutex); + + for (int32 y = 0; y < inSourceBounds.Height(); y += fImageHeight) + { + int32 currentHeight = min(inSourceBounds.Height() - y, fImageHeight); + for (int32 x = 0; x < inSourceBounds.Width(); x += fImageWidth) + { + int32 currentWidth = min(inSourceBounds.Width() - x, fImageWidth); + int32 imageH, imageV; + size_t imageIndex = this->pSetupImage(currentWidth, currentHeight, imageH, imageV); + XImage* theXImage = fImages[imageIndex].first; + + ZDCPixmapNS::RasterDesc theRasterDesc; + theRasterDesc.fPixvalDesc.fDepth = theXImage->bits_per_pixel; + if (theXImage->depth > 8) + theRasterDesc.fPixvalDesc.fBigEndian = (theXImage->byte_order == MSBFirst); + else + theRasterDesc.fPixvalDesc.fBigEndian = (theXImage->bitmap_bit_order == MSBFirst); + theRasterDesc.fRowBytes = theXImage->bytes_per_line; + theRasterDesc.fRowCount = theXImage->height; + theRasterDesc.fFlipped = false; + + ZRect sourceBounds(currentWidth, currentHeight); + sourceBounds += ZPoint(inSourceBounds.left + x, inSourceBounds.top + y); + + inSourcePixmap.CopyTo(ZPoint(imageH, imageV), + theXImage->data, + theRasterDesc, + fPixelDesc, + ZRect(inSourceBounds.left + x, inSourceBounds.top + y, inSourceBounds.left + x + currentWidth, inSourceBounds.top + y + currentHeight)); + + if (fImages[imageIndex].second) + { + ::XShmPutImage(fDisplay, inDrawable, inGC, theXImage, imageH, imageV, + inLocation.h + x, inLocation.v + y, currentWidth, currentHeight, False); + } + else + { + ::XPutImage(fDisplay, inDrawable, inGC, theXImage, imageH, imageV, + inLocation.h + x, inLocation.v + y, currentWidth, currentHeight); + } + } + } + } + +GC ZXServer::CreateGC(Drawable inDrawable, unsigned long inValueMask, XGCValues* inValues) + { + return ZXLib::CreateGC(fDisplay, inDrawable, inValueMask, inValues); + } + +void ZXServer::FreeGC(GC inGC) + { + ZXLib::FreeGC(fDisplay, inGC); + } + +void ZXServer::SetWMProperties(Window a1, XTextProperty* a2, XTextProperty* a3, char** a4, int a5, XSizeHints* a6, XWMHints* a7, XClassHint* a8) + { + ZMutexLocker locker(ZXLib::sMutex); + ZXLib::SetWMProperties(fDisplay, a1, a2, a3, a4, a5, a6, a7, a8); + } + +size_t ZXServer::pGetNextImage() + { + if (fCurrentImageIndex == fImages.size()) + { + ::XSync(fDisplay, False); + fCurrentImageIndex = 0; + fHorizV = fImageHeight; + fVertH = fImageWidth; + fTileH = fImageWidth; + fTileV1 = fImageHeight; + fTileV2 = fImageHeight; + } + return fCurrentImageIndex++; + } + +size_t ZXServer::pSetupImage(int32 inWidth, int32 inHeight, int32& outLocationH, int32& outLocationV) + { + size_t imageIndex; + if (inWidth >= fImageWidth / 2) + { + if (inHeight >= fImageHeight / 2) + { + imageIndex = this->pGetNextImage(); + outLocationH = 0; + outLocationV = 0; + } + else + { + if (inHeight + fHorizV > fImageHeight) + { + fHorizIndex = this->pGetNextImage(); + fHorizV = 0; + } + imageIndex = fHorizIndex; + outLocationH = 0; + outLocationV = fHorizV; + fHorizV += inHeight; + } + } + else + { + if (inHeight >= fImageHeight / 2) + { + if (inWidth + fVertH > fImageWidth) + { + fVertIndex = this->pGetNextImage(); + fVertH = 0; + } + imageIndex = fVertIndex; + outLocationH = fVertH; + outLocationV = 0; + fVertH += (inWidth + 7) & (~8); + } + else + { + if (inWidth + fTileH > fImageWidth) + { + fTileV1 = fTileV2; + fTileH = 0; + } + if (inHeight + fTileV1 > fImageHeight) + { + fTileIndex = this->pGetNextImage(); + fTileH = 0; + fTileV1 = 0; + fTileV2 = 0; + } + if (fTileV2 < inHeight + fTileV1) + fTileV2 = inHeight + fTileV1; + imageIndex = fTileIndex; + outLocationH = fTileH; + outLocationV = fTileV1; + fTileH += (inWidth + 7) & (~8); + } + } + return imageIndex; + } + +unsigned long ZXServer::pLookupColor(const ZRGBColor& inColor) + { return fPixelDesc.AsPixval(inColor); } + +// ================================================================================================= + +static const char* sVisualNames[] = + { + "StaticGray", + "GrayScale", + "StaticColor", + "PseudoColor", + "TrueColor", + "DirectColor", + }; + +static uint32 sScoreVisual(const XVisualInfo& inVisual, bool isDefaultVisual) + { + uint32 quality = 0; + uint32 speed = 1; + if (inVisual.c_class == TrueColor || inVisual.c_class == DirectColor) + { + if (inVisual.depth == 24) + { + // Should test for MSB visual here, and set speed if so. + quality = 9; + } + else if (inVisual.depth == 16) + quality = 8; + else if (inVisual.depth == 15) + quality = 7; + else if (inVisual.depth == 8) + quality = 4; + } + else if (inVisual.c_class == PseudoColor || inVisual.c_class == StaticColor) + { + if (inVisual.depth == 8) + quality = 4; + else if (inVisual.depth == 4) + quality = 2; + else if (inVisual.depth == 1) + quality = 1; + } + else if (inVisual.c_class == StaticGray || inVisual.c_class == GrayScale) + { + if (inVisual.depth == 8) + quality = 4; + else if (inVisual.depth == 4) + quality = 2; + else if (inVisual.depth == 1) + quality = 1; +// quality = 10; //## + } + + if (quality == 0) + return 0; + + uint32 sys = isDefaultVisual ? 1 : 0; + + uint32 pseudo = 0; + if (inVisual.c_class == TrueColor || inVisual.c_class == PseudoColor) + pseudo = 1; + + uint32 score = (quality << 12) | (speed << 8) | (sys << 4) | pseudo; + + ZDebugPrintf(kDebug_XHeavy, ("Visual 0x%x, class = %s, depth = %d, %x:%x:%x%s; score=%x\n", + inVisual.visualid, + sVisualNames[inVisual.c_class], + inVisual.depth, + inVisual.red_mask, + inVisual.green_mask, + inVisual.blue_mask, + isDefaultVisual ? " (system)" : "", + score)); + return score; + } + +static bool sTryColormap(int32 inCountRed, int32 inCountGreen, int32 inCountBlue, + Display* inDisplay, const XVisualInfo& inVisualInfo, Colormap inColormap, + ZDCPixmapNS::PixelDesc& outPixelDesc) + { + ZAssertStop(0, inVisualInfo.colormap_size <= 256); + + const int32 colorsToAllocate = inCountRed * inCountGreen * inCountBlue; + ZAssertStop(0, colorsToAllocate <= 256); + + // Grab the list of colors that already exist in the color map + vector<XColor> vectorXColors(inVisualInfo.colormap_size); + vector<int32> vectorXColorUseCounts(inVisualInfo.colormap_size); + for (size_t x = 0; x < inVisualInfo.colormap_size; ++x) + { + vectorXColors[x].pixel = x; + vectorXColorUseCounts[x] = 0; + } + ::XQueryColors(inDisplay, inColormap, &vectorXColors[0], vectorXColors.size()); + + // For each color we're wanting to get a pixVal for, keep track of the index into vectorXColors + // that best matches, and what distance it lies from what we really want. + vector<size_t> bestPixValIndex; + vector<int32> bestPixValDistance; + for (size_t x = 0; x < colorsToAllocate; ++x) + { + bestPixValIndex.push_back(0); + bestPixValDistance.push_back(0x7FFFFFFF); + } + + // Walk vectorXColors. + int32 colorsNeeded = colorsToAllocate; + for (size_t x = 0; x < vectorXColors.size(); ++x) + { + // Quantize the color to the resolution implied by inCountRed etc. + int32 actualRed = vectorXColors[x].red >> 8; + int32 actualGreen = vectorXColors[x].green >> 8; + int32 actualBlue = vectorXColors[x].blue >> 8; + int32 indexRed = (actualRed * (inCountRed - 1) + 128) >> 8; + int32 indexGreen = (actualGreen * (inCountGreen - 1) + 128) >> 8; + int32 indexBlue = (actualBlue * (inCountBlue - 1) + 128) >> 8; + int32 quantRed = indexRed * 255 / (inCountRed - 1); + int32 quantGreen = indexGreen * 255 / (inCountGreen - 1); + int32 quantBlue = indexBlue * 255 / (inCountBlue - 1); + int32 index = (indexRed * inCountGreen + indexGreen) * inCountBlue + indexBlue; + int32 distance = (quantRed - actualRed) * (quantRed - actualRed) + + (quantGreen - actualGreen) * (quantGreen - actualGreen) + + (quantBlue - actualBlue) * (quantBlue - actualBlue); + ZDebugPrintf(kDebug_XHeavy, ("pixVal %d/%d, found #%02X%02X%02X, useCount=%d, quantized #%02X%02X%02X, index=%d, distance=%d", + x, vectorXColors[x].pixel, + actualRed, actualGreen, actualBlue, + vectorXColorUseCounts[x], + quantRed, quantGreen, quantBlue, + index, + distance)); + if (bestPixValDistance[index] != 0x7FFFFFFF) + { + ZDebugPrintf(kDebug_XHeavy, (", best pixVal so far is %d/%d with distance %d and useCount %d", + bestPixValIndex[index], + vectorXColors[bestPixValIndex[index]].pixel, + bestPixValDistance[index], + vectorXColorUseCounts[bestPixValIndex[index]])); + } + ZDebugPrintf(kDebug_XHeavy, ("\n")); + if (bestPixValDistance[index] > distance && 1000 > distance) + { + ZDebugPrintf(kDebug_XHeavy, ("At %d, using pixVal %d\n", x, vectorXColors[x].pixel)); + if (bestPixValDistance[index] != 0x7FFFFFFF) + { + ZAssertStop(0, vectorXColorUseCounts[bestPixValIndex[index]] > 0); + if (--vectorXColorUseCounts[bestPixValIndex[index]] == 0) + { + unsigned long temp = vectorXColors[bestPixValIndex[index]].pixel; + ZDebugPrintf(kDebug_XHeavy, ("Freeing pixVal %d\n", x, temp)); + ::XFreeColors(inDisplay, inColormap, &temp, 1, 0); + } + } + else + { + --colorsNeeded; + } + bestPixValIndex[index] = x; + bestPixValDistance[index] = distance; + if (++vectorXColorUseCounts[x] == 1) + { + ZDebugPrintf(kDebug_XHeavy, ("Allocating pixVal %d\n", x, vectorXColors[x].pixel)); + if (!::XAllocColor(inDisplay, inColormap, &vectorXColors[x])) + { + ZDebugStopf(kDebug_XHeavy, ("Failed to allocate pix val %d", vectorXColors[x].pixel)); + } + } + + } + } + + if (colorsNeeded) + { + ZDebugPrintf(kDebug_XHeavy, ("%d colors could not be mapped to existing colors\n", colorsNeeded)); + vector<unsigned long> junk(colorsNeeded); + if (!::XAllocColorCells(inDisplay, inColormap, false, 0, 0, &junk[0], colorsNeeded)) + { + ZDebugPrintf(kDebug_XHeavy, ("Couldn't get necessary writable cells\n", colorsNeeded)); + vector<unsigned long> temp; + for (size_t x = 0; x < vectorXColors.size(); ++x) + { + if (vectorXColorUseCounts[x]) + temp.push_back(vectorXColors[x].pixel); + } + ZAssertStop(0, temp.size() == colorsToAllocate - colorsNeeded); + ::XFreeColors(inDisplay, inColormap, &temp[0], temp.size(), 0); + return false; + } + ::XFreeColors(inDisplay, inColormap, &junk[0], junk.size(), 0); + } + + vector<ZRGBColor> colors; + vector<uint32> pixVals; + size_t index = 0; + for (size_t indexRed = 0; indexRed < inCountRed; ++indexRed) + { + for (size_t indexGreen = 0; indexGreen < inCountGreen; ++indexGreen) + { + for (size_t indexBlue = 0; indexBlue < inCountBlue; ++indexBlue, ++index) + { + ZDebugPrintf(kDebug_XHeavy, ("Index %d", index)); + ZRGBColor theRGBColor; + + if (bestPixValDistance[index] == 0x7FFFFFFF) + { + const unsigned int componentRed = indexRed * 0xFFFFU / (inCountRed - 1); + const unsigned int componentGreen = indexGreen * 0xFFFFU / (inCountGreen - 1); + const unsigned int componentBlue = indexBlue * 0xFFFFU / (inCountBlue - 1); + theRGBColor = ZRGBColor(componentRed, componentGreen, componentBlue); + XColor anXColor = theRGBColor; + + anXColor.flags = 0; + if (!::XAllocColor(inDisplay, inColormap, &anXColor)) + { + ZDebugLogf(kDebug_XHeavy, (" Failed to allocate pix val")); + } + else + { + ZDebugPrintf(kDebug_XHeavy, (" pixVal %d (newly allocated)", anXColor.pixel)); + } + theRGBColor = anXColor; // Hmm. Why? + pixVals.push_back(anXColor.pixel); + } + else + { + ZDebugPrintf(kDebug_XHeavy, (" pixVal %d", vectorXColors[bestPixValIndex[index]].pixel)); + theRGBColor = vectorXColors[bestPixValIndex[index]]; + pixVals.push_back(vectorXColors[bestPixValIndex[index]].pixel); + } + colors.push_back(theRGBColor); + ZDebugPrintf(kDebug_XHeavy, (" color #%02X%02X%02X\n", theRGBColor.red >> 8, theRGBColor.green >> 8, theRGBColor.blue >> 8)); + } + } + } + + outPixelDesc = new ZDCPixmapNS::PixelDescRep_Indexed(&colors[0], &pixVals[0], colors.size()); + return true; + } + +static struct + { + int32 fRed; + int32 fGreen; + int32 fBlue; + } sCompCounts[] = + { + { 6, 6, 6}, + { 6, 6, 5}, + { 6, 6, 4}, + { 5, 5, 5}, + { 5, 5, 4}, + { 4, 4, 4}, + { 4, 4, 3}, + { 3, 3, 3}, + { 3, 3, 2}, + { 2, 2, 2}, + { 0, 0, 0}, + }; + +static void sDoColormaps(Display* inDisplay, const XVisualInfo& inVisualInfo, Colormap inColormap, ZDCPixmapNS::PixelDesc& outPixelDesc) + { + ZDebugPrintf(kDebug_XHeavy, ("\nsDoColormaps\n")); + for (size_t x = 0; sCompCounts[x].fRed != 0; ++x) + { + ZDebugPrintf(kDebug_XHeavy, ("Trying with r=%d, g=%d, b=%d\n", sCompCounts[x].fRed, sCompCounts[x].fGreen, sCompCounts[x].fBlue)); + if (sTryColormap(sCompCounts[x].fRed, sCompCounts[x].fGreen, sCompCounts[x].fBlue, inDisplay, inVisualInfo, inColormap, outPixelDesc)) + { + ZDebugPrintf(kDebug_XHeavy, ("Using r=%d, g=%d, b=%d\n", sCompCounts[x].fRed, sCompCounts[x].fGreen, sCompCounts[x].fBlue)); + return; + } + } + ZDebugStopf(0, ("sDoColormaps, couldn't get the colors needed\n")); + } + +extern "C" int XShmGetEventBase(Display*); + +void ZXServer::InitGraphics() + { + _XPrivDisplay privDisplay = reinterpret_cast<_XPrivDisplay>(fDisplay); + + ZDebugPrintf(kDebug_X, ("fd: %d\n", pri... [truncated message content] |
From: <ag...@us...> - 2010-02-19 21:18:13
|
Revision: 1175 http://zoolib.svn.sourceforge.net/zoolib/?rev=1175&view=rev Author: agreen Date: 2010-02-19 21:18:06 +0000 (Fri, 19 Feb 2010) Log Message: ----------- Doxygen. Added Paths: ----------- trunk/zoolib/source/cxx/Doxyfile trunk/zoolib/source/cxx/DoxygenMainPage.txt Added: trunk/zoolib/source/cxx/Doxyfile =================================================================== --- trunk/zoolib/source/cxx/Doxyfile (rev 0) +++ trunk/zoolib/source/cxx/Doxyfile 2010-02-19 21:18:06 UTC (rev 1175) @@ -0,0 +1,1256 @@ +# Doxyfile 1.4.7 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = ZooLib + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = 0.9 + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = ./ + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, +# Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese, +# Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian, +# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, +# Swedish, and Ukrainian. + +OUTPUT_LANGUAGE = English + +# This tag can be used to specify the encoding used in the generated output. +# The encoding is not always determined by the language that is chosen, +# but also whether or not the output is meant for Windows or non-Windows users. +# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES +# forces the Windows encoding (this is the default for the Windows binary), +# whereas setting the tag to NO uses a Unix-style encoding (the default for +# all platforms other than Windows). + +USE_WINDOWS_ENCODING = NO + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = NO + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like the Qt-style comments (thus requiring an +# explicit @brief command for a brief description. + +JAVADOC_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the DETAILS_AT_TOP tag is set to YES then Doxygen +# will output the detailed description near the top, like JavaDoc. +# If set to NO, the detailed description appears after the member +# documentation. + +DETAILS_AT_TOP = YES + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for Java. +# For instance, namespaces will be presented as packages, qualified scopes +# will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to +# include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = YES + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = YES + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = YES + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = NO + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = NO + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is NO. + +SHOW_DIRECTORIES = NO + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from the +# version control system). Doxygen will invoke the program by executing (via +# popen()) the command <command> <input-file>, where <command> is the value of +# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +#INPUT = ./zoolib/ZStrim.cpp ./zoolib/ZStrim.h ./zoolib/ZML.cpp ./zoolib/ZML.h \ + +INPUT = DoxygenMainPage.txt ./zoolib/ \ + +#INPUT = DoxygenMainPage.txt + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx +# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py + +FILE_PATTERNS = + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = NO + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command <filter> <input-file>, where <filter> +# is the value of the INPUT_FILTER tag, and <input-file> is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# is applied to all files. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES (the default) +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = YES + +# If the REFERENCES_RELATION tag is set to YES (the default) +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = YES + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. Otherwise they will link to the documentstion. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = NO + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be +# generated containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, +# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are +# probably better off using the HTML help feature. + +GENERATE_TREEVIEW = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = NO + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = NO + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = SKIPOMPARSE + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse +# the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option is superseded by the HAVE_DOT option below. This is only a +# fallback. It is recommended to install and use dot, since it yields more +# powerful graphs. + +CLASS_DIAGRAMS = YES + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will +# generate a call dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable call graphs for selected +# functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then doxygen will +# generate a caller dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable caller graphs for selected +# functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, jpg, or gif +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. + +MAX_DOT_GRAPH_WIDTH = 1024 + +# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. + +MAX_DOT_GRAPH_HEIGHT = 1024 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that a graph may be further truncated if the graph's +# image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH +# and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default), +# the graph is not depth-constrained. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, which results in a white background. +# Warning: Depending on the platform used, enabling this option may lead to +# badly anti-aliased labels on the edges of a graph (i.e. they become hard to +# read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = NO + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- + +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. + +SEARCHENGINE = NO Added: trunk/zoolib/source/cxx/DoxygenMainPage.txt =================================================================== --- trunk/zoolib/source/cxx/DoxygenMainPage.txt (rev 0) +++ trunk/zoolib/source/cxx/DoxygenMainPage.txt 2010-02-19 21:18:06 UTC (rev 1175) @@ -0,0 +1,186 @@ +/** +\mainpage +Some words for the main page +*/ + +/** +\defgroup NamingConvention Naming Convention + +\section ScopePrefixes Prefixes Designate Scope +Most of my confusion when reading unfamiliar C++ is determining from which scope a name is drawn. + +We've got local and instance variables, parameters, and class, file and namespace statics to +distinguish. ZooLib uses name prefixes to make distinct the scope in which a name is defined. + +- \c f - instance variables. (\c f stands for 'field', cf MacApp/Taligent/Object Pascal). + +- \c s - static variables and functions. These are class or namespace static, and are publicly +accessible. + +- \c sp - static private variables and functions. If file static then obviously they're not publicly +visible. If class static, then they're in the private section, are not publicly accessible and +are intended for use by subclasses. + +- \c i - input parameter. This is the most common type of parameter and probably conforms most closely +to the classic definition of a parameter. Its value at entry will very likely affect what the +function does. Its value in the calling scope will not be changed by the functions's execution. +If the function cannot operate without its value, then it's a compulsory parameter and is passed by +value or const reference. If the parameter is optional it's passed by const pointer, so the caller +can pass nullptr indicating that no value is available. + +- \c o - output parameter. Output parameters allow more than one value to be returned by a function. +Its value on entry will not affect the function's execution and the function takes full +responsibility for giving it an appropriate value before returning. If the parameter is compulsory +it is passed by non-const reference. If optional, by non-const pointer. + +- \c io - input/output parameter. An input/output parameter's value at entry may/will affect the +function's execution and should thus have a sensible value. Its value in the calling scope +may/will be changed by the function's execution. If compulsory, pass by non-const reference. If +optional by non-const pointer, just as with output parameters. + +- \c e - enumeration value. Enumerations are sufficiently rare that we don't bother encoding the +scope in the name. + +- \c E - enumeration type + +\section Names Names +Types are nouns or noun phrases; functions are verbs or verb phrases. + +Names that are phrases are 'intra cased', each word in the phrase has its first letter upper cased. +If there is a prefix, the prefix is lower cased and the 'meat' starts with an upper case letter, the +remainder being intra cased. + +For non-class types I'll usually use a \c _t suffix, and for template types/classes/functions a +\c _T suffix. + +Classes and method names have an upper case initial letter. + +Local variables have a lower case initial letter. I often use a \c the prefix, but the rule is to +use whatever reads best. + +Pretty much everything else has a scope prefix. + +\section CompoundNames Compound Names + +This may be the most controversial stylistic decision, but I've found it helpful. + +Much of ZooLib +consists of abstract interfaces and a suite of concrete implementations. In such situations the +base is named with a noun or noun phrase (intra cased of course). Concrete implementations are +named with the base name, an underscore, and a distinguishing noun or noun phrase. This somewhat +Germanic approach keeps hierarchies together when their members are sorted lexicographically. In +addition it provides a strong hint of a type's likely compatibility -- if you see an \c Xxxx_Yyyy +it can generally be passed to a function expecting an \c Xxxx. + +For types that are related but not type-compatible I use reverse English order noun phrases, so +\c XxxxYyyy and \c XxxxZzzz are probably part of an \c Xxxx package. + +The goal is not to be rigidly prescriptive, but to make several hundreds of names somewhat +predictable and intelligible. +*/ + +/** +\defgroup CodePhilosophy Code Philosophy + +This is not gospel. These are the ideas and approaches +that work for me, and seem to work for code I respect. + +There's a couple of ways to write code. We can regard it as simply the input to a compiler +or interpreter, and hence is written to take advantage of language features, to maximize +the efficiency of object code and to minimize keystrokes and working space requirements. +<em>We do not do this</em>. + +Instead we expect each line to be read and modified by unknown other people many times. They'll be +unfamiliar with the code and working under pressure with many other responsibilities . So we write +code to clearly express our intent, to lead the reader through the task at hand, to educate them +about the problem space and our understanding of it. We might even strive to write code so that +reading it is a pleasurable and invigorating experience. + +When we sit down at the keyboard we expect what we write to be published in some journal, with +no prior opportunity for revision, so we want to be proud of it. Obviously we don't all write code +the same way. Our experiences and individual predelictions shape what we write, whether it be code +or prose. + +We're careful when working with code that's collaborative, because the clear vision laid down +by the initial author is blurred with each incremental change. Sometimes that code's clarity +declines to the point that it must be rewritten, not because it doesn't work but because it's +no longer clearly intelligible, and thus ceases to be comprehensible for use or as a basis +for extension. + + +\section Guidelines Guidelines + +Some development communities have rigid rules about low-level formatting and high-level +organization. I think dogmatic rules are neither necessary nor sufficient for intelligent and +experienced professionals. But these are the guidelines I use for myself. + + +\subsection Kindness + +Code is communication from your present state of mind to other people and to your future self. +Be kind to them. + + +\subsection Whitespace + +Different text editing environments use different fonts, styles, tab stops and +space widths. The only line-to-line alignment that you can count on is whitespace at the start of +a line. Creating a regular, intelligible and generally pleasing appearance by using embedded tabs +or spaces will create code that looks like its been through a shredder on most other people's +machines. Find some other way to make your code readable. + +The rules of the language dictate that there are some things that +are going t... [truncated message content] |
From: <ag...@us...> - 2010-03-30 18:40:52
|
Revision: 1217 http://zoolib.svn.sourceforge.net/zoolib/?rev=1217&view=rev Author: agreen Date: 2010-03-30 18:40:45 +0000 (Tue, 30 Mar 2010) Log Message: ----------- Change prefix on static private entities to be 'sp'. Modified Paths: -------------- trunk/zoolib/source/cxx/Doxyfile trunk/zoolib/source/cxx/DoxygenMainPage.txt trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerryServer.cpp trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry_Client.cpp trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry_OSXUSB.cpp trunk/zoolib/source/cxx/more/zoolib/blackberry/ZBlackBerry_Streamer.cpp trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Guest.cpp trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Guest.h trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_GuestFactory.cpp trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Guest_Std.cpp trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host.cpp trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host.h trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host_Mac.cpp trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host_Std.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTB.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBServer.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBServer.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTSWatcherMUX.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTSWatcherMUX.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTSWatcherServer.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTSWatcherServerAsync.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTSWatcher_AutoReconnect.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTSWatcher_AutoReconnect.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTSWatcher_Client.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleIndex_String.cpp trunk/zoolib/source/cxx/old/zoolib/ZDC_GDI.cpp trunk/zoolib/source/cxx/old/zoolib/ZDC_QD.cpp trunk/zoolib/source/cxx/zoolib/ZBigRegion.cpp trunk/zoolib/source/cxx/zoolib/ZBlockStore_PhaseTree.cpp trunk/zoolib/source/cxx/zoolib/ZCompare.cpp trunk/zoolib/source/cxx/zoolib/ZDCPixmapCoder_BMP.cpp trunk/zoolib/source/cxx/zoolib/ZDCPixmapCoder_GIF.cpp trunk/zoolib/source/cxx/zoolib/ZDCPixmapCoder_JPEGLib.cpp trunk/zoolib/source/cxx/zoolib/ZDCPixmapCoder_PNG.cpp trunk/zoolib/source/cxx/zoolib/ZDCPixmapNS.cpp trunk/zoolib/source/cxx/zoolib/ZDebug.cpp trunk/zoolib/source/cxx/zoolib/ZFileFormat_IFF.cpp trunk/zoolib/source/cxx/zoolib/ZFileFormat_JPEG.cpp trunk/zoolib/source/cxx/zoolib/ZFile_POSIX.cpp trunk/zoolib/source/cxx/zoolib/ZFile_Win.cpp trunk/zoolib/source/cxx/zoolib/ZFunctionChain.h trunk/zoolib/source/cxx/zoolib/ZGRgn.cpp trunk/zoolib/source/cxx/zoolib/ZHTTP.cpp trunk/zoolib/source/cxx/zoolib/ZLog.cpp trunk/zoolib/source/cxx/zoolib/ZML.cpp trunk/zoolib/source/cxx/zoolib/ZMain.cpp trunk/zoolib/source/cxx/zoolib/ZNet_Internet_Socket.cpp trunk/zoolib/source/cxx/zoolib/ZNet_Internet_WinSock.cpp trunk/zoolib/source/cxx/zoolib/ZNet_Local_Socket.cpp trunk/zoolib/source/cxx/zoolib/ZNet_Socket.cpp trunk/zoolib/source/cxx/zoolib/ZStdIO.cpp trunk/zoolib/source/cxx/zoolib/ZStream.cpp trunk/zoolib/source/cxx/zoolib/ZStreamMUX.cpp trunk/zoolib/source/cxx/zoolib/ZStreamRWCon_SSL_Win.cpp trunk/zoolib/source/cxx/zoolib/ZStreamRWCon_SSL_Win.h trunk/zoolib/source/cxx/zoolib/ZStreamW_HexStrim.cpp trunk/zoolib/source/cxx/zoolib/ZStream_Base64.cpp trunk/zoolib/source/cxx/zoolib/ZStream_CRLF.cpp trunk/zoolib/source/cxx/zoolib/ZStream_Compressed.cpp trunk/zoolib/source/cxx/zoolib/ZStream_POSIX.cpp trunk/zoolib/source/cxx/zoolib/ZStream_SHA1.cpp trunk/zoolib/source/cxx/zoolib/ZStream_Win.cpp trunk/zoolib/source/cxx/zoolib/ZStreamerCopier.cpp trunk/zoolib/source/cxx/zoolib/ZStrim.cpp trunk/zoolib/source/cxx/zoolib/ZStrimU_StreamUTF8Buffered.cpp trunk/zoolib/source/cxx/zoolib/ZStrim_CRLF.cpp trunk/zoolib/source/cxx/zoolib/ZStrim_Escaped.cpp trunk/zoolib/source/cxx/zoolib/ZStrim_Stream.cpp trunk/zoolib/source/cxx/zoolib/ZTName.cpp trunk/zoolib/source/cxx/zoolib/ZTextCoder.cpp trunk/zoolib/source/cxx/zoolib/ZTextCoder_ICU.cpp trunk/zoolib/source/cxx/zoolib/ZTextCoder_Mac.cpp trunk/zoolib/source/cxx/zoolib/ZTextCoder_Std.cpp trunk/zoolib/source/cxx/zoolib/ZTextCoder_Unicode.cpp trunk/zoolib/source/cxx/zoolib/ZTextCoder_Win.cpp trunk/zoolib/source/cxx/zoolib/ZTextCoder_iconv.cpp trunk/zoolib/source/cxx/zoolib/ZTextCollator_ASCII.cpp trunk/zoolib/source/cxx/zoolib/ZThread.cpp trunk/zoolib/source/cxx/zoolib/ZTrail.cpp trunk/zoolib/source/cxx/zoolib/ZTypes.cpp trunk/zoolib/source/cxx/zoolib/ZUSB_OSX.cpp trunk/zoolib/source/cxx/zoolib/ZUnicode_Normalize_Win.cpp trunk/zoolib/source/cxx/zoolib/ZUtil_Debug.cpp trunk/zoolib/source/cxx/zoolib/ZUtil_Strim.cpp trunk/zoolib/source/cxx/zoolib/ZUtil_TS.cpp trunk/zoolib/source/cxx/zoolib/ZUtil_Time.cpp trunk/zoolib/source/cxx/zoolib/ZVal_Any.cpp trunk/zoolib/source/cxx/zoolib/ZWinService.cpp trunk/zoolib/source/cxx/zoolib/ZYad_Bencode.cpp Modified: trunk/zoolib/source/cxx/Doxyfile =================================================================== --- trunk/zoolib/source/cxx/Doxyfile 2010-03-30 03:42:58 UTC (rev 1216) +++ trunk/zoolib/source/cxx/Doxyfile 2010-03-30 18:40:45 UTC (rev 1217) @@ -1,4 +1,4 @@ -# Doxyfile 1.4.7 +# Doxyfile 1.6.1 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project @@ -14,539 +14,681 @@ # Project related configuration options #--------------------------------------------------------------------------- -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# http://www.gnu.org/software/libiconv for the list of possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = ZooLib -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = 0.9 -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = ./ -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of -# source files, where putting all generated files in the same directory would +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, -# Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese, -# Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian, -# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, -# Swedish, and Ukrainian. +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, +# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English +# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, +# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, +# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. OUTPUT_LANGUAGE = English -# This tag can be used to specify the encoding used in the generated output. -# The encoding is not always determined by the language that is chosen, -# but also whether or not the output is meant for Windows or non-Windows users. -# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES -# forces the Windows encoding (this is the default for the Windows binary), -# whereas setting the tag to NO uses a Unix-style encoding (the default for -# all platforms other than Windows). - -USE_WINDOWS_ENCODING = NO - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is -# used as the annotated text. Otherwise, the brief description is used as-is. -# If left blank, the following values are used ("$name" is automatically -# replaced with the name of the entity): "The $name class" "The $name widget" -# "The $name file" "is" "provides" "specifies" "contains" +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" -ABBREVIATE_BRIEF = +ABBREVIATE_BRIEF = -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = NO -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the # path to strip. -STRIP_FROM_PATH = +STRIP_FROM_PATH = -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. -STRIP_FROM_INC_PATH = +STRIP_FROM_INC_PATH = -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful is your file systems +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like the Qt-style comments (thus requiring an -# explicit @brief command for a brief description. +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = NO -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO -# If the DETAILS_AT_TOP tag is set to YES then Doxygen -# will output the detailed description near the top, like JavaDoc. -# If set to NO, the detailed description appears after the member -# documentation. - -DETAILS_AT_TOP = YES - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce -# a new page for each member. If set to NO, the documentation of a member will +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO -# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 4 -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. -ALIASES = +ALIASES = -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C -# sources only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = NO -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java -# sources only. Doxygen will then generate output that is more tailored for Java. -# For instance, namespaces will be presented as packages, qualified scopes -# will look different, etc. +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified +# scopes will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to -# include (a tag file for) the STL sources as input, then you should -# set this tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. -# func(std::string) {}). This also make the inheritance and collaboration +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for +# Fortran. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for +# VHDL. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it parses. +# With this tag you can assign which parser to use for a given extension. +# Doxygen has a built-in mapping, but you can override or extend it using this tag. +# The format is ext=language, where ext is a file extension, and language is one of +# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP, +# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat +# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran), +# use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = YES -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate getter +# and setter methods for a property. Setting this option to YES (the default) +# will make doxygen to replace the get and set methods by a property in the +# documentation. This will only work if the methods are indeed getting or +# setting a simple type. If this is not the case, or you want to show the +# methods anyway, you should set this option to NO. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. + +TYPEDEF_HIDES_STRUCT = NO + +# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to +# determine which symbols to keep in memory and which to flush to disk. +# When the cache is full, less often used symbols will be written to disk. +# For small to medium size projects (<1000 input files) the default value is +# probably good enough. For larger projects a too small cache size can cause +# doxygen to be busy swapping symbols to and from disk most of the time +# causing a significant performance penality. +# If the system has enough physical memory increasing the cache will improve the +# performance by keeping more symbols in memory. Note that the value works on +# a logarithmic scale so increasing the size by one will rougly double the +# memory usage. The cache size is given by this formula: +# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols + +SYMBOL_CACHE_SIZE = 0 + #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES +###EXTRACT_ALL = YES EXTRACT_ALL = NO -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO -# If the EXTRACT_STATIC tag is set to YES all static members of a file +# If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = NO -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespace are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = YES -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = YES -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = YES -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = NO -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = NO -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) +# the group names will appear in their defined order. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the +# Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES -# The ENABLED_SECTIONS tag can be used to enable conditional +# The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. -ENABLED_SECTIONS = +ENABLED_SECTIONS = -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or define consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and defines in the -# documentation can be controlled using \showinitializer or \hideinitializer +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES -# If the sources in your project are distributed over multiple directories -# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # in the documentation. The default is NO. SHOW_DIRECTORIES = NO -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from the -# version control system). Doxygen will invoke the program by executing (via -# popen()) the command <command> <input-file>, where <command> is the value of -# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file -# provided by doxygen. Whatever the program writes to standard output +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. +# This will remove the Files entry from the Quick Index and from the +# Folder Tree View (if specified). The default is YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the +# Namespaces page. +# This will remove the Namespaces entry from the Quick Index +# and from the Folder Tree View (if specified). The default is YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command <command> <input-file>, where <command> is the value of +# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file +# provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. -FILE_VERSION_FILTER = +FILE_VERSION_FILTER = +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by +# doxygen. The layout file controls the global structure of the generated output files +# in an output format independent way. The create the layout file that represents +# doxygen's defaults, run doxygen with the -l option. You can optionally specify a +# file name after the option, if omitted DoxygenLayout.xml will be used as the name +# of the layout file. + +LAYOUT_FILE = + #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- -# The QUIET tag can be used to turn on/off the messages that are generated +# The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES -# This WARN_NO_PARAMDOC option can be abled to get warnings for -# functions that are documented, but have no documentation for their parameters -# or return value. If set to NO (the default) doxygen will only warn about -# wrong or incomplete parameter documentation, but not about the absence of +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = NO -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. Optionally the format may contain -# $version, which will be replaced by the version of the file (if it could +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written # to stderr. -WARN_LOGFILE = +WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories # with spaces. -#INPUT = ./zoolib/ZStrim.cpp ./zoolib/ZStrim.h ./zoolib/ZML.cpp ./zoolib/ZML.h \ +INPUT = DoxygenMainPage.txt \ + ./more/zoolib/netscape/ \ + ./more/zoolib/photoshop/ \ + ./zoolib/ \ -INPUT = DoxygenMainPage.txt ./zoolib/ \ +INPUT_DIS2 = DoxygenMainPage.txt \ + ./more/zoolib/photoshop/ \ + ./zoolib/ZValAccessors.h \ + ./zoolib/ZAny.cpp \ + ./zoolib/ZAny.h \ + ./zoolib/ZVal_AppleEvent.cpp \ + ./zoolib/ZVal_AppleEvent.h \ + ./zoolib/ZVal_CFType.cpp \ + ./zoolib/ZVal_CFType.h \ + ./zoolib/ZVal.cpp \ + ./zoolib/ZVal.h \ + ./zoolib/ZYad.cpp \ + ./zoolib/ZYad.h -#INPUT = DoxygenMainPage.txt +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# the list of possible encodings. -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx -# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py +INPUT_ENCODING = UTF-8 -FILE_PATTERNS = +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx +# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. +FILE_PATTERNS = + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = NO -# The EXCLUDE tag can be used to specify files and/or directories that should -# excluded from the INPUT source files. This way you can easily exclude a +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. -EXCLUDE = +EXCLUDE = -# The EXCLUDE_SYMLINKS tag can be used select whether or not files or -# directories that are symbolic links (a Unix filesystem feature) are excluded +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. Note that the wildcards are matched -# against the file with absolute path, so to exclude all test directories +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* -EXCLUDE_PATTERNS = +EXCLUDE_PATTERNS = -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see # the \include command). -EXAMPLE_PATH = +EXAMPLE_PATH = -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left # blank all files are included. -EXAMPLE_PATTERNS = +EXAMPLE_PATTERNS = -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see # the \image command). -IMAGE_PATH = +IMAGE_PATH = -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command <filter> <input-file>, where <filter> -# is the value of the INPUT_FILTER tag, and <input-file> is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. If FILTER_PATTERNS is specified, this tag will be +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command <filter> <input-file>, where <filter> +# is the value of the INPUT_FILTER tag, and <input-file> is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. +# If FILTER_PATTERNS is specified, this tag will be # ignored. -INPUT_FILTER = +INPUT_FILTER = -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. +# Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. +# The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER # is applied to all files. -FILTER_PATTERNS = +FILTER_PATTERNS = -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO @@ -555,32 +697,32 @@ # configuration options related to source browsing #--------------------------------------------------------------------------- -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = YES -# Setting the INLINE_SOURCES tag to YES will include the body +# Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES -# If the REFERENCED_BY_RELATION tag is set to YES (the default) -# then for each documented function all documented +# If the REFERENCED_BY_RELATION tag is set to YES +# then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = YES -# If the REFERENCES_RELATION tag is set to YES (the default) -# then for each documented function all documented entities +# If the REFERENCES_RELATION tag is set to YES +# then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = YES @@ -588,20 +730,21 @@ # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will -# link to the source code. Otherwise they will link to the documentstion. +# link to the source code. +# Otherwise they will link to the documentation. REFERENCES_LINK_SOURCE = YES -# If the USE_HTAGS tag is set to YES then the references to source code -# will point to the HTML generated by the htags(1) tool instead of doxygen -# built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES @@ -610,279 +753,393 @@ # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = NO -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. -IGNORE_PREFIX = +IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a # standard header. -HTML_HEADER = +HTML_HEADER = -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a +# The HTML_FOOTER... [truncated message content] |
From: <ag...@us...> - 2010-03-30 20:09:14
|
Revision: 1218 http://zoolib.svn.sourceforge.net/zoolib/?rev=1218&view=rev Author: agreen Date: 2010-03-30 20:09:06 +0000 (Tue, 30 Mar 2010) Log Message: ----------- More s-->sp changes. Modified Paths: -------------- trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Guest.cpp trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Guest.h trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_GuestEntry.cpp trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host.cpp trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host.h trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host_Mac.cpp trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Optimize.cpp trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_TQLConvert.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTB.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBQuery.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBQuery.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBRep_Client.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBRep_TS.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBServer.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBSpec.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTSWatcherServer.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTSWatcherServer.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTS_DB.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTS_DB.h trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTupleQuisitioner.cpp trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZUtil_Strim_TBSpec.cpp trunk/zoolib/source/cxx/old/zoolib/ZASCompiler.cpp trunk/zoolib/source/cxx/old/zoolib/ZASParser.cpp trunk/zoolib/source/cxx/old/zoolib/ZAsset_Std.cpp trunk/zoolib/source/cxx/old/zoolib/ZDC.cpp trunk/zoolib/source/cxx/old/zoolib/ZDC.h trunk/zoolib/source/cxx/old/zoolib/ZDCGlyphServer_Asset.cpp trunk/zoolib/source/cxx/old/zoolib/ZDCInk.cpp trunk/zoolib/source/cxx/old/zoolib/ZDCPixmap_Asset_BMP.cpp trunk/zoolib/source/cxx/old/zoolib/ZDCRgn.cpp trunk/zoolib/source/cxx/old/zoolib/ZDC_GDI.cpp trunk/zoolib/source/cxx/old/zoolib/ZDC_QD.cpp trunk/zoolib/source/cxx/old/zoolib/ZDC_X.cpp trunk/zoolib/source/cxx/old/zoolib/ZDC_ZooLib.cpp trunk/zoolib/source/cxx/old/zoolib/ZNodeRep_Wrapper.cpp trunk/zoolib/source/cxx/old/zoolib/ZNode_FS.cpp trunk/zoolib/source/cxx/old/zoolib/ZUtil_Asset.cpp trunk/zoolib/source/cxx/old/zoolib/ZUtil_Mac_HL.cpp trunk/zoolib/source/cxx/old/zoolib/ZUtil_Win_UI.cpp trunk/zoolib/source/cxx/old/zoolib/ZWebDAV.cpp trunk/zoolib/source/cxx/zoolib/ZDebug.cpp trunk/zoolib/source/cxx/zoolib/ZFileFormat_IFF.cpp trunk/zoolib/source/cxx/zoolib/ZHTTP.cpp trunk/zoolib/source/cxx/zoolib/ZNet_Internet_MacOT_OSX.cpp trunk/zoolib/source/cxx/zoolib/ZStackCrawl.cpp trunk/zoolib/source/cxx/zoolib/ZStream_POSIX.cpp trunk/zoolib/source/cxx/zoolib/ZStream_Win.cpp trunk/zoolib/source/cxx/zoolib/ZTextCollator_ICU.cpp trunk/zoolib/source/cxx/zoolib/ZUtil_CFType.cpp trunk/zoolib/source/cxx/zoolib/ZUtil_CarbonEvents.cpp trunk/zoolib/source/cxx/zoolib/ZUtil_Win.cpp trunk/zoolib/source/cxx/zoolib/ZVal_ZooLib.cpp Modified: trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Guest.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Guest.cpp 2010-03-30 18:40:45 UTC (rev 1217) +++ trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Guest.cpp 2010-03-30 20:09:06 UTC (rev 1218) @@ -49,17 +49,17 @@ #pragma mark - #pragma mark * NPPSetter -NPP NPPSetter::sNPP; +NPP NPPSetter::spNPP; NPPSetter::NPPSetter(NPP iNPP) -: fPrior(sNPP) - { sNPP = iNPP; } +: fPrior(spNPP) + { spNPP = iNPP; } NPPSetter::~NPPSetter() - { sNPP = fPrior; } + { spNPP = fPrior; } NPP NPPSetter::sCurrent() - { return sNPP; } + { return spNPP; } // ================================================================================================= #pragma mark - @@ -494,19 +494,19 @@ oPluginFuncs->size = sizeof(NPPluginFuncs); oPluginFuncs->version = 11; - oPluginFuncs->newp = sNew; - oPluginFuncs->destroy = sDestroy; - oPluginFuncs->setwindow = sSetWindow; - oPluginFuncs->newstream = sNewStream; - oPluginFuncs->destroystream = sDestroyStream; - oPluginFuncs->asfile = sStreamAsFile; - oPluginFuncs->writeready = (NPP_WriteReadyProcPtr)sWriteReady; - oPluginFuncs->write = (NPP_WriteProcPtr)sWrite; - oPluginFuncs->print = sPrint; - oPluginFuncs->event = sHandleEvent; - oPluginFuncs->urlnotify = sURLNotify; - oPluginFuncs->getvalue = sGetValue; - oPluginFuncs->setvalue = sSetValue; + oPluginFuncs->newp = spNew; + oPluginFuncs->destroy = spDestroy; + oPluginFuncs->setwindow = spSetWindow; + oPluginFuncs->newstream = spNewStream; + oPluginFuncs->destroystream = spDestroyStream; + oPluginFuncs->asfile = spStreamAsFile; + oPluginFuncs->writeready = (NPP_WriteReadyProcPtr)spWriteReady; + oPluginFuncs->write = (NPP_WriteProcPtr)spWrite; + oPluginFuncs->print = spPrint; + oPluginFuncs->event = spHandleEvent; + oPluginFuncs->urlnotify = spURLNotify; + oPluginFuncs->getvalue = spGetValue; + oPluginFuncs->setvalue = spSetValue; return NPERR_NO_ERROR; } @@ -750,7 +750,7 @@ return false; } -NPError GuestMeister::sNew( +NPError GuestMeister::spNew( NPMIMEType pluginType, NPP npp, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved) { @@ -759,21 +759,21 @@ ZNETSCAPE_AFTER_NPERROR } -NPError GuestMeister::sDestroy(NPP npp, NPSavedData** save) +NPError GuestMeister::spDestroy(NPP npp, NPSavedData** save) { ZNETSCAPE_BEFORE_GUESTMEISTER(npp) return sGet()->Destroy(npp, save); ZNETSCAPE_AFTER_NPERROR } -NPError GuestMeister::sSetWindow(NPP npp, NPWindow* window) +NPError GuestMeister::spSetWindow(NPP npp, NPWindow* window) { ZNETSCAPE_BEFORE_GUESTMEISTER(npp) return sGet()->SetWindow(npp, window); ZNETSCAPE_AFTER_NPERROR } -NPError GuestMeister::sNewStream( +NPError GuestMeister::spNewStream( NPP npp, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype) { ZNETSCAPE_BEFORE_GUESTMEISTER(npp) @@ -781,56 +781,56 @@ ZNETSCAPE_AFTER_NPERROR } -NPError GuestMeister::sDestroyStream(NPP npp, NPStream* stream, NPReason reason) +NPError GuestMeister::spDestroyStream(NPP npp, NPStream* stream, NPReason reason) { ZNETSCAPE_BEFORE_GUESTMEISTER(npp) return sGet()->DestroyStream(npp, stream, reason); ZNETSCAPE_AFTER_NPERROR } -int32 GuestMeister::sWriteReady(NPP npp, NPStream* stream) +int32 GuestMeister::spWriteReady(NPP npp, NPStream* stream) { ZNETSCAPE_BEFORE_GUESTMEISTER(npp) return sGet()->WriteReady(npp, stream); ZNETSCAPE_AFTER_RETURN(0) } -int32 GuestMeister::sWrite(NPP npp, NPStream* stream, int32_t offset, int32_t len, void* buffer) +int32 GuestMeister::spWrite(NPP npp, NPStream* stream, int32_t offset, int32_t len, void* buffer) { ZNETSCAPE_BEFORE_GUESTMEISTER(npp) return sGet()->Write(npp, stream, offset, len, buffer); ZNETSCAPE_AFTER_RETURN(0) } -void GuestMeister::sStreamAsFile(NPP npp, NPStream* stream, const char* fname) +void GuestMeister::spStreamAsFile(NPP npp, NPStream* stream, const char* fname) { ZNETSCAPE_BEFORE_GUESTMEISTER(npp) return sGet()->StreamAsFile(npp, stream, fname); ZNETSCAPE_AFTER_VOID } -void GuestMeister::sPrint(NPP npp, NPPrint* platformPrint) +void GuestMeister::spPrint(NPP npp, NPPrint* platformPrint) { ZNETSCAPE_BEFORE_GUESTMEISTER(npp) return sGet()->Print(npp, platformPrint); ZNETSCAPE_AFTER_VOID } -int16 GuestMeister::sHandleEvent(NPP npp, void* event) +int16 GuestMeister::spHandleEvent(NPP npp, void* event) { ZNETSCAPE_BEFORE_GUESTMEISTER(npp) return sGet()->HandleEvent(npp, event); ZNETSCAPE_AFTER_RETURN(0) } -void GuestMeister::sURLNotify(NPP npp, const char* url, NPReason reason, void* notifyData) +void GuestMeister::spURLNotify(NPP npp, const char* url, NPReason reason, void* notifyData) { ZNETSCAPE_BEFORE_GUESTMEISTER(npp) return sGet()->URLNotify(npp, url, reason, notifyData); ZNETSCAPE_AFTER_VOID } -jref GuestMeister::sGetJavaClass() +jref GuestMeister::spGetJavaClass() { ZNETSCAPE_BEFORE return sGet()->GetJavaClass(); @@ -848,9 +848,9 @@ // 420 do not retain returned NPObjects automatically; plug-ins are required to retain them // before returning from NPP_GetValue(), as in other browsers. - static bool sChecked = false; - static bool sUsesOldWebKit = false; - if (!sChecked) + static bool spChecked = false; + static bool spUsesOldWebKit = false; + if (!spChecked) { if (const char* userAgent = GuestMeister::sGet()->Host_UserAgent(npp)) { @@ -860,16 +860,16 @@ versionString += strlen(prefix); int webKitVersion = atoi(versionString); if (webKitVersion && webKitVersion < 420) - sUsesOldWebKit = true; + spUsesOldWebKit = true; } } - sChecked = true; + spChecked = true; } - return sUsesOldWebKit; + return spUsesOldWebKit; } -NPError GuestMeister::sGetValue(NPP npp, NPPVariable variable, void *value) +NPError GuestMeister::spGetValue(NPP npp, NPPVariable variable, void *value) { ZNETSCAPE_BEFORE_GUESTMEISTER(npp) NPError result = sGet()->GetValue(npp, variable, value); @@ -887,7 +887,7 @@ ZNETSCAPE_AFTER_NPERROR } -NPError GuestMeister::sSetValue(NPP npp, NPNVariable variable, void *value) +NPError GuestMeister::spSetValue(NPP npp, NPNVariable variable, void *value) { ZNETSCAPE_BEFORE_GUESTMEISTER(npp) return sGet()->SetValue(npp, variable, value); Modified: trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Guest.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Guest.h 2010-03-30 18:40:45 UTC (rev 1217) +++ trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Guest.h 2010-03-30 20:09:06 UTC (rev 1218) @@ -46,7 +46,7 @@ { private: NPP fPrior; - static NPP sNPP; + static NPP spNPP; public: NPPSetter(NPP iNPP); @@ -319,36 +319,36 @@ virtual NPError SetValue(NPP npp, NPNVariable variable, void *value) = 0; private: - static NPError sNew( + static NPError spNew( NPMIMEType pluginType, NPP npp, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved); - static NPError sDestroy(NPP npp, NPSavedData** save); + static NPError spDestroy(NPP npp, NPSavedData** save); - static NPError sSetWindow(NPP npp, NPWindow* window); + static NPError spSetWindow(NPP npp, NPWindow* window); - static NPError sNewStream(NPP npp, + static NPError spNewStream(NPP npp, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype); - static NPError sDestroyStream(NPP npp, NPStream* stream, NPReason reason); + static NPError spDestroyStream(NPP npp, NPStream* stream, NPReason reason); - static int32 sWriteReady(NPP npp, NPStream* stream); + static int32 spWriteReady(NPP npp, NPStream* stream); - static int32 sWrite(NPP npp, NPStream* stream, int32_t offset, int32_t len, void* buffer); + static int32 spWrite(NPP npp, NPStream* stream, int32_t offset, int32_t len, void* buffer); - static void sStreamAsFile(NPP npp, NPStream* stream, const char* fname); + static void spStreamAsFile(NPP npp, NPStream* stream, const char* fname); - static void sPrint(NPP npp, NPPrint* platformPrint); + static void spPrint(NPP npp, NPPrint* platformPrint); - static int16 sHandleEvent(NPP npp, void* event); + static int16 spHandleEvent(NPP npp, void* event); - static void sURLNotify(NPP npp, const char* url, NPReason reason, void* notifyData); + static void spURLNotify(NPP npp, const char* url, NPReason reason, void* notifyData); - static jref sGetJavaClass(); + static jref spGetJavaClass(); - static NPError sGetValue(NPP npp, NPPVariable variable, void *value); + static NPError spGetValue(NPP npp, NPPVariable variable, void *value); - static NPError sSetValue(NPP npp, NPNVariable variable, void *value); + static NPError spSetValue(NPP npp, NPNVariable variable, void *value); NPNetscapeFuncs_Z fNPNF; Modified: trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_GuestEntry.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_GuestEntry.cpp 2010-03-30 18:40:45 UTC (rev 1217) +++ trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_GuestEntry.cpp 2010-03-30 20:09:06 UTC (rev 1218) @@ -69,9 +69,9 @@ #if __MACH__ && ZCONFIG(Processor, PPC) - static vector<char> sGlue_NPNF; - static vector<char> sGlue_PluginFuncs; - static vector<char> sGlue_Shutdown; + static vector<char> spGlue_NPNF; + static vector<char> spGlue_PluginFuncs; + static vector<char> spGlue_Shutdown; // We're MachO on PPC, but main has been called. We have to assume that // the caller is expecting CFM function pointers. @@ -85,7 +85,7 @@ ZUtil_MacOSX::sCreateThunks_MachOCalledByCFM( &localNPNF.geturl, (localNPNF.size - offsetof(NPNetscapeFuncs, geturl)) / sizeof(void*), - sGlue_NPNF); + spGlue_NPNF); // And pass the munged local structure to NP_Initialize. result = NP_Initialize(&localNPNF); @@ -97,10 +97,10 @@ ZUtil_MacOSX::sCreateThunks_CFMCalledByMachO( &oPluginFuncs->newp, (oPluginFuncs->size - offsetof(NPPluginFuncs, newp)) / sizeof(void*), - sGlue_PluginFuncs); + spGlue_PluginFuncs); *oShutdownFunc = (NPP_ShutdownProcPtr)NP_Shutdown; - ZUtil_MacOSX::sCreateThunks_CFMCalledByMachO(&oShutdownFunc, 1, sGlue_Shutdown); + ZUtil_MacOSX::sCreateThunks_CFMCalledByMachO(&oShutdownFunc, 1, spGlue_Shutdown); #else Modified: trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host.cpp 2010-03-30 18:40:45 UTC (rev 1217) +++ trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host.cpp 2010-03-30 20:09:06 UTC (rev 1218) @@ -392,66 +392,66 @@ oNPNF.size = sizeof(oNPNF); - oNPNF.geturl = sGetURL; - oNPNF.posturl = sPostURL; - oNPNF.requestread = sRequestRead; - oNPNF.newstream = sNewStream; - oNPNF.write = sWrite; - oNPNF.destroystream = sDestroyStream; - oNPNF.status = sStatus; - oNPNF.uagent = sUserAgent; - oNPNF.memalloc = sMemAlloc; - oNPNF.memfree = sMemFree; - oNPNF.memflush = sMemFlush; - oNPNF.reloadplugins = sReloadPlugins; + oNPNF.geturl = spGetURL; + oNPNF.posturl = spPostURL; + oNPNF.requestread = spRequestRead; + oNPNF.newstream = spNewStream; + oNPNF.write = spWrite; + oNPNF.destroystream = spDestroyStream; + oNPNF.status = spStatus; + oNPNF.uagent = spUserAgent; + oNPNF.memalloc = spMemAlloc; + oNPNF.memfree = spMemFree; + oNPNF.memflush = spMemFlush; + oNPNF.reloadplugins = spReloadPlugins; // Mozilla return value is a JRIEnv #if defined(NewNPN_GetJavaEnvProc) - oNPNF.getJavaEnv = (NPN_GetJavaEnvUPP)sGetJavaEnv; + oNPNF.getJavaEnv = (NPN_GetJavaEnvUPP)spGetJavaEnv; #else - oNPNF.getJavaEnv = (NPN_GetJavaEnvProcPtr)sGetJavaEnv; + oNPNF.getJavaEnv = (NPN_GetJavaEnvProcPtr)spGetJavaEnv; #endif // Mozilla return value is a jref #if defined(NewNPN_GetJavaPeerProc) - oNPNF.getJavaPeer = (NPN_GetJavaPeerUPP)sGetJavaPeer; + oNPNF.getJavaPeer = (NPN_GetJavaPeerUPP)spGetJavaPeer; #else - oNPNF.getJavaPeer = (NPN_GetJavaPeerProcPtr)sGetJavaPeer; + oNPNF.getJavaPeer = (NPN_GetJavaPeerProcPtr)spGetJavaPeer; #endif - oNPNF.geturlnotify = sGetURLNotify; - oNPNF.posturlnotify = sPostURLNotify; - oNPNF.getvalue = sGetValue; - oNPNF.setvalue = sSetValue; - oNPNF.invalidaterect = sInvalidateRect; - oNPNF.invalidateregion = sInvalidateRegion; - oNPNF.forceredraw = sForceRedraw; + oNPNF.geturlnotify = spGetURLNotify; + oNPNF.posturlnotify = spPostURLNotify; + oNPNF.getvalue = spGetValue; + oNPNF.setvalue = spSetValue; + oNPNF.invalidaterect = spInvalidateRect; + oNPNF.invalidateregion = spInvalidateRegion; + oNPNF.forceredraw = spForceRedraw; - oNPNF.getstringidentifier = sGetStringIdentifier; - oNPNF.getstringidentifiers = sGetStringIdentifiers; - oNPNF.getintidentifier = sGetIntIdentifier; - oNPNF.identifierisstring = sIdentifierIsString; - oNPNF.utf8fromidentifier = sUTF8FromIdentifier; + oNPNF.getstringidentifier = spGetStringIdentifier; + oNPNF.getstringidentifiers = spGetStringIdentifiers; + oNPNF.getintidentifier = spGetIntIdentifier; + oNPNF.identifierisstring = spIdentifierIsString; + oNPNF.utf8fromidentifier = spUTF8FromIdentifier; // WebKit/10.4 return value is (incorrectly) an NPIdentifier. #if defined(NewNPN_IntFromIdentifierProc) - oNPNF.intfromidentifier = sIntFromIdentifier; + oNPNF.intfromidentifier = spIntFromIdentifier; #else - oNPNF.intfromidentifier = (NPN_IntFromIdentifierProcPtr)sIntFromIdentifier; + oNPNF.intfromidentifier = (NPN_IntFromIdentifierProcPtr)spIntFromIdentifier; #endif - oNPNF.createobject = sCreateObject; - oNPNF.retainobject = sRetainObject; - oNPNF.releaseobject = sReleaseObject; - oNPNF.invoke = sInvoke; - oNPNF.invokeDefault = sInvokeDefault; - oNPNF.evaluate = sEvaluate; - oNPNF.getproperty = sGetProperty; - oNPNF.setproperty = sSetProperty; - oNPNF.removeproperty = sRemoveProperty; - oNPNF.hasproperty = sHasProperty; - oNPNF.hasmethod = sHasMethod; - oNPNF.releasevariantvalue = sReleaseVariantValue; + oNPNF.createobject = spCreateObject; + oNPNF.retainobject = spRetainObject; + oNPNF.releaseobject = spReleaseObject; + oNPNF.invoke = spInvoke; + oNPNF.invokeDefault = spInvokeDefault; + oNPNF.evaluate = spEvaluate; + oNPNF.getproperty = spGetProperty; + oNPNF.setproperty = spSetProperty; + oNPNF.removeproperty = spRemoveProperty; + oNPNF.hasproperty = spHasProperty; + oNPNF.hasmethod = spHasMethod; + oNPNF.releasevariantvalue = spReleaseVariantValue; // I'm disabling setexception for now -- it's defined as taking // NPString* or UTF8* in different versions of headers, and I @@ -460,21 +460,21 @@ // Mozilla return value is a bool #if defined(NewNPN_PushPopupsEnabledStateProc) - oNPNF.pushpopupsenabledstate = (NPN_PushPopupsEnabledStateUPP)sPushPopupsEnabledState; + oNPNF.pushpopupsenabledstate = (NPN_PushPopupsEnabledStateUPP)spPushPopupsEnabledState; #else - oNPNF.pushpopupsenabledstate = sPushPopupsEnabledState; + oNPNF.pushpopupsenabledstate = spPushPopupsEnabledState; #endif // Mozilla return value is a bool #if defined(NewNPN_PopPopupsEnabledStateProc) - oNPNF.poppopupsenabledstate = (NPN_PopPopupsEnabledStateUPP)sPopPopupsEnabledState; + oNPNF.poppopupsenabledstate = (NPN_PopPopupsEnabledStateUPP)spPopPopupsEnabledState; #else - oNPNF.poppopupsenabledstate = sPopPopupsEnabledState; + oNPNF.poppopupsenabledstate = spPopPopupsEnabledState; #endif - oNPNF.enumerate = sEnumerate; - oNPNF.pluginthreadasynccall = sPluginThreadAsyncCall; - oNPNF.construct = sConstruct; + oNPNF.enumerate = spEnumerate; + oNPNF.pluginthreadasynccall = spPluginThreadAsyncCall; + oNPNF.construct = spConstruct; } HostMeister::HostMeister() @@ -500,14 +500,14 @@ return result; } -NPError HostMeister::sGetURL(NPP npp, const char* URL, const char* window) +NPError HostMeister::spGetURL(NPP npp, const char* URL, const char* window) { ZNETSCAPE_BEFORE return sGet()->GetURL(npp, URL, window); ZNETSCAPE_AFTER_NPERROR } -NPError HostMeister::sPostURL(NPP npp, +NPError HostMeister::spPostURL(NPP npp, const char* URL, const char* window, uint32 len, const char* buf, NPBool file) { ZNETSCAPE_BEFORE @@ -515,14 +515,14 @@ ZNETSCAPE_AFTER_NPERROR } -NPError HostMeister::sRequestRead(NPStream* stream, NPByteRange* rangeList) +NPError HostMeister::spRequestRead(NPStream* stream, NPByteRange* rangeList) { ZNETSCAPE_BEFORE return sGet()->RequestRead(stream, rangeList); ZNETSCAPE_AFTER_NPERROR } -NPError HostMeister::sNewStream(NPP npp, +NPError HostMeister::spNewStream(NPP npp, NPMIMEType type, const char* window, NPStream** stream) { ZNETSCAPE_BEFORE @@ -530,77 +530,77 @@ ZNETSCAPE_AFTER_NPERROR } -int32 HostMeister::sWrite(NPP npp, NPStream* stream, int32 len, void* buffer) +int32 HostMeister::spWrite(NPP npp, NPStream* stream, int32 len, void* buffer) { ZNETSCAPE_BEFORE return sGet()->Write(npp, stream, len, buffer); ZNETSCAPE_AFTER_RETURN(-1) } -NPError HostMeister::sDestroyStream(NPP npp, NPStream* stream, NPReason reason) +NPError HostMeister::spDestroyStream(NPP npp, NPStream* stream, NPReason reason) { ZNETSCAPE_BEFORE return sGet()->DestroyStream(npp, stream, reason); ZNETSCAPE_AFTER_NPERROR } -void HostMeister::sStatus(NPP npp, const char* message) +void HostMeister::spStatus(NPP npp, const char* message) { ZNETSCAPE_BEFORE return sGet()->Status(npp, message); ZNETSCAPE_AFTER_VOID } -const char* HostMeister::sUserAgent(NPP npp) +const char* HostMeister::spUserAgent(NPP npp) { ZNETSCAPE_BEFORE return sGet()->UserAgent(npp); ZNETSCAPE_AFTER_RETURN_NIL } -void* HostMeister::sMemAlloc(uint32 size) +void* HostMeister::spMemAlloc(uint32 size) { ZNETSCAPE_BEFORE return sGet()->MemAlloc(size); ZNETSCAPE_AFTER_RETURN_NIL } -void HostMeister::sMemFree(void* ptr) +void HostMeister::spMemFree(void* ptr) { ZNETSCAPE_BEFORE sGet()->MemFree(ptr); ZNETSCAPE_AFTER_VOID } -uint32 HostMeister::sMemFlush(uint32 size) +uint32 HostMeister::spMemFlush(uint32 size) { ZNETSCAPE_BEFORE return sGet()->MemFlush(size); ZNETSCAPE_AFTER_RETURN(0) } -void HostMeister::sReloadPlugins(NPBool reloadPages) +void HostMeister::spReloadPlugins(NPBool reloadPages) { ZNETSCAPE_BEFORE sGet()->ReloadPlugins(reloadPages); ZNETSCAPE_AFTER_VOID } -void* HostMeister::sGetJavaEnv() +void* HostMeister::spGetJavaEnv() { ZNETSCAPE_BEFORE return sGet()->GetJavaEnv(); ZNETSCAPE_AFTER_RETURN_NIL } -void* HostMeister::sGetJavaPeer(NPP npp) +void* HostMeister::spGetJavaPeer(NPP npp) { ZNETSCAPE_BEFORE return sGet()->GetJavaPeer(npp); ZNETSCAPE_AFTER_RETURN_NIL } -NPError HostMeister::sGetURLNotify(NPP npp, +NPError HostMeister::spGetURLNotify(NPP npp, const char* URL, const char* window, void* notifyData) { ZNETSCAPE_BEFORE @@ -608,7 +608,7 @@ ZNETSCAPE_AFTER_NPERROR } -NPError HostMeister::sPostURLNotify(NPP npp, +NPError HostMeister::spPostURLNotify(NPP npp, const char* URL, const char* window, uint32 len, const char* buf, NPBool file, void* notifyData) { @@ -617,49 +617,49 @@ ZNETSCAPE_AFTER_NPERROR } -NPError HostMeister::sGetValue(NPP npp, NPNVariable variable, void* ret_value) +NPError HostMeister::spGetValue(NPP npp, NPNVariable variable, void* ret_value) { ZNETSCAPE_BEFORE return sGet()->GetValue(npp, variable, ret_value); ZNETSCAPE_AFTER_NPERROR } -NPError HostMeister::sSetValue(NPP npp, NPPVariable variable, void* value) +NPError HostMeister::spSetValue(NPP npp, NPPVariable variable, void* value) { ZNETSCAPE_BEFORE return sGet()->SetValue(npp, variable, value); ZNETSCAPE_AFTER_NPERROR } -void HostMeister::sInvalidateRect(NPP npp, NPRect* rect) +void HostMeister::spInvalidateRect(NPP npp, NPRect* rect) { ZNETSCAPE_BEFORE return sGet()->InvalidateRect(npp, rect); ZNETSCAPE_AFTER_VOID } -void HostMeister::sInvalidateRegion(NPP npp, NPRegion region) +void HostMeister::spInvalidateRegion(NPP npp, NPRegion region) { ZNETSCAPE_BEFORE return sGet()->InvalidateRegion(npp, region); ZNETSCAPE_AFTER_VOID } -void HostMeister::sForceRedraw(NPP npp) +void HostMeister::spForceRedraw(NPP npp) { ZNETSCAPE_BEFORE return sGet()->ForceRedraw(npp); ZNETSCAPE_AFTER_VOID } -NPIdentifier HostMeister::sGetStringIdentifier(const NPUTF8* name) +NPIdentifier HostMeister::spGetStringIdentifier(const NPUTF8* name) { ZNETSCAPE_BEFORE return sGet()->GetStringIdentifier(name); ZNETSCAPE_AFTER_RETURN_NIL } -void HostMeister::sGetStringIdentifiers( +void HostMeister::spGetStringIdentifiers( const NPUTF8** names, int32_t nameCount, NPIdentifier* identifiers) { ZNETSCAPE_BEFORE @@ -667,56 +667,56 @@ ZNETSCAPE_AFTER_VOID } -NPIdentifier HostMeister::sGetIntIdentifier(int32_t intid) +NPIdentifier HostMeister::spGetIntIdentifier(int32_t intid) { ZNETSCAPE_BEFORE return sGet()->GetIntIdentifier(intid); ZNETSCAPE_AFTER_RETURN_NIL } -bool HostMeister::sIdentifierIsString(NPIdentifier identifier) +bool HostMeister::spIdentifierIsString(NPIdentifier identifier) { ZNETSCAPE_BEFORE return sGet()->IdentifierIsString(identifier); ZNETSCAPE_AFTER_RETURN_FALSE } -NPUTF8* HostMeister::sUTF8FromIdentifier(NPIdentifier identifier) +NPUTF8* HostMeister::spUTF8FromIdentifier(NPIdentifier identifier) { ZNETSCAPE_BEFORE return sGet()->UTF8FromIdentifier(identifier); ZNETSCAPE_AFTER_RETURN_NIL } -int32_t HostMeister::sIntFromIdentifier(NPIdentifier identifier) +int32_t HostMeister::spIntFromIdentifier(NPIdentifier identifier) { ZNETSCAPE_BEFORE return sGet()->IntFromIdentifier(identifier); ZNETSCAPE_AFTER_RETURN(0xFFFFFFFF) } -NPObject* HostMeister::sCreateObject(NPP npp, NPClass* aClass) +NPObject* HostMeister::spCreateObject(NPP npp, NPClass* aClass) { ZNETSCAPE_BEFORE return sGet()->CreateObject(npp, aClass); ZNETSCAPE_AFTER_RETURN_NIL } -NPObject* HostMeister::sRetainObject(NPObject* obj) +NPObject* HostMeister::spRetainObject(NPObject* obj) { ZNETSCAPE_BEFORE return sGet()->RetainObject(obj); ZNETSCAPE_AFTER_RETURN_NIL } -void HostMeister::sReleaseObject(NPObject* obj) +void HostMeister::spReleaseObject(NPObject* obj) { ZNETSCAPE_BEFORE sGet()->ReleaseObject(obj); ZNETSCAPE_AFTER_VOID } -bool HostMeister::sInvoke(NPP npp, +bool HostMeister::spInvoke(NPP npp, NPObject* obj, NPIdentifier methodName, const NPVariant* args, unsigned argCount, NPVariant* result) { @@ -725,7 +725,7 @@ ZNETSCAPE_AFTER_RETURN_FALSE } -bool HostMeister::sInvokeDefault(NPP npp, +bool HostMeister::spInvokeDefault(NPP npp, NPObject* obj, const NPVariant* args, unsigned argCount, NPVariant* result) { ZNETSCAPE_BEFORE @@ -733,7 +733,7 @@ ZNETSCAPE_AFTER_RETURN_FALSE } -bool HostMeister::sEvaluate(NPP npp, +bool HostMeister::spEvaluate(NPP npp, NPObject* obj, NPString* script, NPVariant* result) { ZNETSCAPE_BEFORE @@ -741,7 +741,7 @@ ZNETSCAPE_AFTER_RETURN_FALSE } -bool HostMeister::sGetProperty(NPP npp, +bool HostMeister::spGetProperty(NPP npp, NPObject* obj, NPIdentifier propertyName, NPVariant* result) { ZNETSCAPE_BEFORE @@ -749,7 +749,7 @@ ZNETSCAPE_AFTER_RETURN_FALSE } -bool HostMeister::sSetProperty(NPP npp, +bool HostMeister::spSetProperty(NPP npp, NPObject* obj, NPIdentifier propertyName, const NPVariant* value) { ZNETSCAPE_BEFORE @@ -757,63 +757,63 @@ ZNETSCAPE_AFTER_RETURN_FALSE } -bool HostMeister::sRemoveProperty(NPP npp, NPObject* obj, NPIdentifier propertyName) +bool HostMeister::spRemoveProperty(NPP npp, NPObject* obj, NPIdentifier propertyName) { ZNETSCAPE_BEFORE return sGet()->RemoveProperty(npp, obj, propertyName); ZNETSCAPE_AFTER_RETURN_FALSE } -bool HostMeister::sHasProperty(NPP npp, NPObject* npobj, NPIdentifier propertyName) +bool HostMeister::spHasProperty(NPP npp, NPObject* npobj, NPIdentifier propertyName) { ZNETSCAPE_BEFORE return sGet()->HasProperty(npp, npobj, propertyName); ZNETSCAPE_AFTER_RETURN_FALSE } -bool HostMeister::sHasMethod(NPP npp, NPObject* npobj, NPIdentifier methodName) +bool HostMeister::spHasMethod(NPP npp, NPObject* npobj, NPIdentifier methodName) { ZNETSCAPE_BEFORE return sGet()->HasMethod(npp, npobj, methodName); ZNETSCAPE_AFTER_RETURN_FALSE } -void HostMeister::sReleaseVariantValue(NPVariant* variant) +void HostMeister::spReleaseVariantValue(NPVariant* variant) { ZNETSCAPE_BEFORE sGet()->ReleaseVariantValue(variant); ZNETSCAPE_AFTER_VOID } -void HostMeister::sSetException(NPObject* obj, const NPUTF8* message) +void HostMeister::spSetException(NPObject* obj, const NPUTF8* message) { ZNETSCAPE_BEFORE sGet()->SetException(obj, message); ZNETSCAPE_AFTER_VOID } -void HostMeister::sSetExceptionNPString(NPObject* obj, NPString* message) +void HostMeister::spSetExceptionNPString(NPObject* obj, NPString* message) { ZNETSCAPE_BEFORE sGet()->SetException(obj, sNPStringChars(*message)); ZNETSCAPE_AFTER_VOID } -void HostMeister::sPushPopupsEnabledState(NPP npp, NPBool enabled) +void HostMeister::spPushPopupsEnabledState(NPP npp, NPBool enabled) { ZNETSCAPE_BEFORE sGet()->PushPopupsEnabledState(npp, enabled); ZNETSCAPE_AFTER_VOID } -void HostMeister::sPopPopupsEnabledState(NPP npp) +void HostMeister::spPopPopupsEnabledState(NPP npp) { ZNETSCAPE_BEFORE sGet()->PopPopupsEnabledState(npp); ZNETSCAPE_AFTER_VOID } -bool HostMeister::sEnumerate +bool HostMeister::spEnumerate (NPP npp, NPObject *npobj, NPIdentifier **identifier, uint32_t *count) { ZNETSCAPE_BEFORE @@ -821,15 +821,15 @@ ZNETSCAPE_AFTER_RETURN_FALSE } -void HostMeister::sPluginThreadAsyncCall +void HostMeister::spPluginThreadAsyncCall (NPP npp, void (*func)(void *), void *userData) { ZNETSCAPE_BEFORE - sGet()->sPluginThreadAsyncCall(npp, func, userData); + sGet()->PluginThreadAsyncCall(npp, func, userData); ZNETSCAPE_AFTER_VOID } -bool HostMeister::sConstruct +bool HostMeister::spConstruct (NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result) { ZNETSCAPE_BEFORE Modified: trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host.h 2010-03-30 18:40:45 UTC (rev 1217) +++ trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host.h 2010-03-30 20:09:06 UTC (rev 1218) @@ -269,110 +269,110 @@ (NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result) = 0; private: - static NPError sGetURL(NPP npp, const char* URL, const char* window); + static NPError spGetURL(NPP npp, const char* URL, const char* window); - static NPError sPostURL(NPP npp, + static NPError spPostURL(NPP npp, const char* URL, const char* window, uint32 len, const char* buf, NPBool file); - static NPError sRequestRead(NPStream* stream, NPByteRange* rangeList); + static NPError spRequestRead(NPStream* stream, NPByteRange* rangeList); - static NPError sNewStream(NPP npp, + static NPError spNewStream(NPP npp, NPMIMEType type, const char* window, NPStream** stream); - static int32 sWrite(NPP npp, NPStream* stream, int32 len, void* buffer); + static int32 spWrite(NPP npp, NPStream* stream, int32 len, void* buffer); - static NPError sDestroyStream(NPP npp, NPStream* stream, NPReason reason); + static NPError spDestroyStream(NPP npp, NPStream* stream, NPReason reason); - static void sStatus(NPP npp, const char* message); + static void spStatus(NPP npp, const char* message); - static const char* sUserAgent(NPP npp); + static const char* spUserAgent(NPP npp); - static void* sMemAlloc(uint32 size); + static void* spMemAlloc(uint32 size); - static void sMemFree(void* ptr); + static void spMemFree(void* ptr); - static uint32 sMemFlush(uint32 size); + static uint32 spMemFlush(uint32 size); - static void sReloadPlugins(NPBool reloadPages); + static void spReloadPlugins(NPBool reloadPages); - static void* sGetJavaEnv(); + static void* spGetJavaEnv(); - static void* sGetJavaPeer(NPP npp); + static void* spGetJavaPeer(NPP npp); - static NPError sGetURLNotify(NPP npp, + static NPError spGetURLNotify(NPP npp, const char* URL, const char* window, void* notifyData); - static NPError sPostURLNotify(NPP npp, + static NPError spPostURLNotify(NPP npp, const char* URL, const char* window, uint32 len, const char* buf, NPBool file, void* notifyData); - static NPError sGetValue(NPP npp, NPNVariable variable, void* ret_value); + static NPError spGetValue(NPP npp, NPNVariable variable, void* ret_value); - static NPError sSetValue(NPP npp, NPPVariable variable, void* value); + static NPError spSetValue(NPP npp, NPPVariable variable, void* value); - static void sInvalidateRect(NPP npp, NPRect* rect); + static void spInvalidateRect(NPP npp, NPRect* rect); - static void sInvalidateRegion(NPP npp, NPRegion region); + static void spInvalidateRegion(NPP npp, NPRegion region); - static void sForceRedraw(NPP npp); + static void spForceRedraw(NPP npp); - static NPIdentifier sGetStringIdentifier(const NPUTF8* name); + static NPIdentifier spGetStringIdentifier(const NPUTF8* name); - static void sGetStringIdentifiers( + static void spGetStringIdentifiers( const NPUTF8** names, int32_t nameCount, NPIdentifier* identifiers); - static NPIdentifier sGetIntIdentifier(int32_t intid); + static NPIdentifier spGetIntIdentifier(int32_t intid); - static bool sIdentifierIsString(NPIdentifier identifier); + static bool spIdentifierIsString(NPIdentifier identifier); - static NPUTF8* sUTF8FromIdentifier(NPIdentifier identifier); + static NPUTF8* spUTF8FromIdentifier(NPIdentifier identifier); - static int32_t sIntFromIdentifier(NPIdentifier identifier); + static int32_t spIntFromIdentifier(NPIdentifier identifier); - static NPObject* sCreateObject(NPP npp, NPClass* aClass); + static NPObject* spCreateObject(NPP npp, NPClass* aClass); - static NPObject* sRetainObject(NPObject* obj); + static NPObject* spRetainObject(NPObject* obj); - static void sReleaseObject(NPObject* obj); + static void spReleaseObject(NPObject* obj); - static bool sInvoke(NPP npp, + static bool spInvoke(NPP npp, NPObject* obj, NPIdentifier methodName, const NPVariant* args, unsigned argCount, NPVariant* result); - static bool sInvokeDefault(NPP npp, + static bool spInvokeDefault(NPP npp, NPObject* obj, const NPVariant* args, unsigned argCount, NPVariant* result); - static bool sEvaluate(NPP npp, + static bool spEvaluate(NPP npp, NPObject* obj, NPString* script, NPVariant* result); - static bool sGetProperty(NPP npp, + static bool spGetProperty(NPP npp, NPObject* obj, NPIdentifier propertyName, NPVariant* result); - static bool sSetProperty(NPP npp, + static bool spSetProperty(NPP npp, NPObject* obj, NPIdentifier propertyName, const NPVariant* value); - static bool sRemoveProperty(NPP npp, NPObject* obj, NPIdentifier propertyName); + static bool spRemoveProperty(NPP npp, NPObject* obj, NPIdentifier propertyName); - static bool sHasProperty(NPP npp, NPObject* npobj, NPIdentifier propertyName); + static bool spHasProperty(NPP npp, NPObject* npobj, NPIdentifier propertyName); - static bool sHasMethod(NPP npp, NPObject* npobj, NPIdentifier methodName); + static bool spHasMethod(NPP npp, NPObject* npobj, NPIdentifier methodName); - static void sReleaseVariantValue(NPVariant* variant); + static void spReleaseVariantValue(NPVariant* variant); - static void sSetException(NPObject* obj, const NPUTF8* message); - static void sSetExceptionNPString(NPObject* obj, NPString* message); + static void spSetException(NPObject* obj, const NPUTF8* message); + static void spSetExceptionNPString(NPObject* obj, NPString* message); - static void sPushPopupsEnabledState(NPP npp, NPBool enabled); + static void spPushPopupsEnabledState(NPP npp, NPBool enabled); - static void sPopPopupsEnabledState(NPP npp); + static void spPopPopupsEnabledState(NPP npp); - static bool sEnumerate + static bool spEnumerate (NPP npp, NPObject *npobj, NPIdentifier **identifier, uint32_t *count); - static void sPluginThreadAsyncCall + static void spPluginThreadAsyncCall (NPP npp, void (*func)(void *), void *userData); - static bool sConstruct + static bool spConstruct (NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result); }; Modified: trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host_Mac.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host_Mac.cpp 2010-03-30 18:40:45 UTC (rev 1217) +++ trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_Host_Mac.cpp 2010-03-30 20:09:06 UTC (rev 1218) @@ -326,7 +326,7 @@ fEventTargetRef_Window = ::GetWindowEventTarget(fWindowRef); - static const EventTypeSpec sEvents_Window[] = + static const EventTypeSpec spEvents_Window[] = { { kEventClassWindow, kEventWindowActivated }, { kEventClassWindow, kEventWindowDeactivated }, @@ -352,7 +352,7 @@ }; ::InstallEventHandler(fEventTargetRef_Window, sEventHandlerUPP_Window, - countof(sEvents_Window), sEvents_Window, + countof(spEvents_Window), spEvents_Window, this, &fEventHandlerRef_Window); } @@ -610,7 +610,7 @@ fEventTargetRef_View = ::GetControlEventTarget(fHIViewRef); - static const EventTypeSpec sEvents_View[] = + static const EventTypeSpec spEvents_View[] = { { kEventClassKeyboard, kEventRawKeyDown }, { kEventClassKeyboard, kEventRawKeyRepeat }, @@ -640,7 +640,7 @@ }; ::InstallEventHandler(fEventTargetRef_View, sEventHandlerUPP_View, - countof(sEvents_View), sEvents_View, + countof(spEvents_View), spEvents_View, this, &fEventHandlerRef_View); } Modified: trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Optimize.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Optimize.cpp 2010-03-30 18:40:45 UTC (rev 1217) +++ trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Optimize.cpp 2010-03-30 20:09:06 UTC (rev 1218) @@ -27,7 +27,7 @@ // ================================================================================================= #pragma mark - -#pragma mark * ZTQL, sConvertSelect +#pragma mark * ZTQL, spConvertSelect // Turns a Select into a tree of Restrict and Union. @@ -36,7 +36,7 @@ typedef vector<ZValCondition> CondSect; typedef vector<CondSect> CondUnion; -static void sCrossMultiply(const CondUnion& iLeft, const CondUnion& iRight, CondUnion& oResult) +static void spCrossMultiply(const CondUnion& iLeft, const CondUnion& iRight, CondUnion& oResult) { for (CondUnion::const_iterator iterLeft = iLeft.begin(); iterLeft != iLeft.end(); ++iterLeft) @@ -51,24 +51,24 @@ } } -static void sGather(ZRef<ZExprRep_Logical> iRep, CondUnion& oResult) +static void spGather(ZRef<ZExprRep_Logical> iRep, CondUnion& oResult) { ZAssert(oResult.empty()); if (ZRef<ZExprRep_Logical_And> lo = ZRefDynamicCast<ZExprRep_Logical_And>(iRep)) { CondUnion left; - sGather(lo->GetLHS(), left); + spGather(lo->GetLHS(), left); CondUnion right; - sGather(lo->GetRHS(), right); - sCrossMultiply(left, right, oResult); + spGather(lo->GetRHS(), right); + spCrossMultiply(left, right, oResult); } else if (ZRef<ZExprRep_Logical_Or> lo = ZRefDynamicCast<ZExprRep_Logical_Or>(iRep)) { CondUnion left; - sGather(lo->GetLHS(), left); + spGather(lo->GetLHS(), left); CondUnion right; - sGather(lo->GetRHS(), right); + spGather(lo->GetRHS(), right); oResult = left; oResult.insert(oResult.end(), right.begin(), right.end()); } @@ -96,14 +96,14 @@ } } -static ZRef<ZExprRep_Relation> sConvertSelect( +static ZRef<ZExprRep_Relation> spConvertSelect( ZRef<ZExprRep_Relation> iRelational, ZRef<ZExprRep_Logical> iLogical) { if (!iRelational) return ZRef<ZExprRep_Relation>(); CondUnion resultLogical; - sGather(iLogical, resultLogical); + spGather(iLogical, resultLogical); ZRef<ZExprRep_Relation> resultRelational; for (CondUnion::const_iterator iterUnion = resultLogical.begin(); @@ -139,7 +139,7 @@ ZRef<ZExprRep_Relation> Optimize::Transform_Select(ZRef<ZExprRep_Select> iRep) { ZRef<ZExprRep_Relation> newRep = this->Transform(iRep->GetExpr_Relation()); - return sConvertSelect(newRep, iRep->GetExpr_Logical()); + return spConvertSelect(newRep, iRep->GetExpr_Logical()); } } // anonymous namespace Modified: trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_TQLConvert.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_TQLConvert.cpp 2010-03-30 18:40:45 UTC (rev 1217) +++ trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_TQLConvert.cpp 2010-03-30 20:09:06 UTC (rev 1218) @@ -42,7 +42,7 @@ static const string sIDName = "$ID$"; -static Spec sAsTSpec(const ZTBSpec& iTBSpec) +static Spec spAsTSpec(const ZTBSpec& iTBSpec) { const ZTBSpec::CriterionUnion theCU = iTBSpec.GetCriterionUnion(); bool uisfirst = true; @@ -113,7 +113,7 @@ case the RelHead is [*iName]. The tuples returned have been filtered by iFilter, if any. */ -static Query sConvert(ZRef<ZTBQueryNode> iNode, const string* iName, Spec* iFilter, bool iVerbose) +static Query spConvert(ZRef<ZTBQueryNode> iNode, const string* iName, Spec* iFilter, bool iVerbose) { if (ZRefDynamicCast<ZTBQueryNode_All>(iNode)) { @@ -163,7 +163,7 @@ { const ZTBQueryNode_Combo::Intersection& theIntersection = *i; - Spec theFilter = sAsTSpec(theIntersection.fFilter); + Spec theFilter = spAsTSpec(theIntersection.fFilter); if (iFilter) theFilter &= *iFilter; @@ -174,7 +174,7 @@ iterNodes = theIntersection.fNodes.begin(), theEnd = theIntersection.fNodes.end(); iterNodes != theEnd; ++iterNodes) { - Query innermostQ = sConvert(*iterNodes, iName, &theFilter, iVerbose); + Query innermostQ = spConvert(*iterNodes, iName, &theFilter, iVerbose); if (isFirst) { innerQ = innermostQ; @@ -255,7 +255,7 @@ const string sourcePropName = theNode_ID_FromSource->GetSourcePropName(); // Get the source tuples' sourcePropName - Query theQ = sConvert(sourceNode, &sourcePropName, nullptr, iVerbose); + Query theQ = spConvert(sourceNode, &sourcePropName, nullptr, iVerbose); // Rename it to sIDName. theQ = sRename(sourcePropName, sIDName, theQ); @@ -307,7 +307,7 @@ const string thePropName = theNode_Property->GetPropName(); // Get the source tuples' IDs. - Query theQ = sConvert(sourceNode, nullptr, nullptr, iVerbose); + Query theQ = spConvert(sourceNode, nullptr, nullptr, iVerbose); // Renamed to thePropName; theQ = sRename(sIDName, thePropName, theQ); @@ -368,7 +368,7 @@ Query sConvert(const ZTBQuery& iTBQuery, bool iVerbose) { - return sConvert(iTBQuery.GetNode(), nullptr, nullptr, iVerbose); + return spConvert(iTBQuery.GetNode(), nullptr, nullptr, iVerbose); } } // namespace ZUtil_TQLConvert Modified: trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTB.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTB.cpp 2010-03-30 18:40:45 UTC (rev 1217) +++ trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTB.cpp 2010-03-30 20:09:06 UTC (rev 1218) @@ -402,7 +402,7 @@ static_cast<Callback_GetTuple_t*>(iRefcon)->fSem.Signal(); } -static ZTuple sGetTuple(ZTBRepTransaction* iTBRepTransaction, uint64 iID) +static ZTuple spGetTuple(ZTBRepTransaction* iTBRepTransaction, uint64 iID) { Callback_GetTuple_t theStruct; iTBRepTransaction->GetTuples(1, &iID, spCallback_GetTuple, &theStruct); @@ -423,7 +423,7 @@ static_cast<Callback_Count_t*>(iRefcon)->fSem.Signal(); } -static size_t sCount(ZTBRepTransaction* iTBRepTransaction, const ZTBQuery& iQuery) +static size_t spCount(ZTBRepTransaction* iTBRepTransaction, const ZTBQuery& iQuery) { Callback_Count_t theStruct; iTBRepTransaction->Count(iQuery, spCallback_Count, &theStruct); @@ -493,13 +493,13 @@ ZTuple ZTB::Get(const ZTxn& iTxn, uint64 iID) { ZTBRepTransaction* theTBRepTransaction = fTBRep->FindOrCreateTransaction(iTxn); - return sGetTuple(theTBRepTransaction, iID); + return spGetTuple(theTBRepTransaction, iID); } size_t ZTB::Count(const ZTxn& iTxn, const ZTBQuery& iQuery) { ZTBRepTransaction* theTBRepTransaction = fTBRep->FindOrCreateTransaction(iTxn); - return sCount(theTBRepTransaction, iQuery); + return spCount(theTBRepTransaction, iQuery); } ZRef<ZTBRep> ZTB::GetTBRep() const @@ -558,12 +558,12 @@ ZTuple ZTBTxn::Get(uint64 iID) const { - return sGetTuple(fTBRepTransaction, iID); + return spGetTuple(fTBRepTransaction, iID); } size_t ZTBTxn::Count(const ZTBQuery& iQuery) const { - return sCount(fTBRepTransaction, iQuery); + return spCount(fTBRepTransaction, iQuery); } ZTBRepTransaction* ZTBTxn::GetTBRepTransaction() const @@ -576,8 +576,6 @@ class ZTBIterRep : public ZRefCounted { public: - static inline bool sCheckAccessEnabled() { return false; } - ZTBIterRep(ZTBRepTransaction* iTransaction, const ZTBQuery& iQuery); virtual ~ZTBIterRep(); @@ -697,7 +695,7 @@ ZTuple ZTBIter::Get() const { if (fRep && fIndex < fRep->fIDs.size()) - return sGetTuple(fRep->fTransaction, fRep->fIDs[fIndex]); + return spGetTuple(fRep->fTransaction, fRep->fIDs[fIndex]); return ZTuple(); } @@ -715,7 +713,7 @@ if (oID) *oID = fRep->fIDs[fIndex]; if (oTuple) - *oTuple = sGetTuple(fRep->fTransaction, fRep->fIDs[fIndex]); + *oTuple = spGetTuple(fRep->fTransaction, fRep->fIDs[fIndex]); } else { Modified: trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBQuery.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBQuery.cpp 2010-03-30 18:40:45 UTC (rev 1217) +++ trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBQuery.cpp 2010-03-30 20:09:06 UTC (rev 1218) @@ -33,20 +33,20 @@ NAMESPACE_ZOOLIB_BEGIN -static ZTuple sTupleFromNode(const ZRef<ZTBQueryNode>& iNode); -static ZRef<ZTBQueryNode> sNodeFromTuple(const ZTuple& iTuple); +static ZTuple spTupleFromNode(const ZRef<ZTBQueryNode>& iNode); +static ZRef<ZTBQueryNode> spNodeFromTuple(const ZTuple& iTuple); -static ZRef<ZTBQueryNode> sNodeFromStream(const ZStreamR& iStreamR); -static void sNodeToStream(const ZStreamW& iStreamW, const ZRef<ZTBQueryNode>& iNode); +static ZRef<ZTBQueryNode> spNodeFromStream(const ZStreamR& iStreamR); +static void spNodeToStream(const ZStreamW& iStreamW, const ZRef<ZTBQueryNode>& iNode); // ================================================================================================= #pragma mark - #pragma mark * Helper functions -static inline void sWriteCount(const ZStreamW& iStreamW, uint32 iCount) +static inline void spWriteCount(const ZStreamW& iStreamW, uint32 iCount) { iStreamW.WriteCount(iCount); } -static inline uint32 sReadCount(const ZStreamR& iStreamR) +static inline uint32 spReadCount(const ZStreamR& iStreamR) { return iStreamR.ReadCount(); } // ================================================================================================= @@ -158,11 +158,11 @@ {} ZTBQuery::ZTBQuery(const ZTuple& iTuple) -: fNode(sNodeFromTuple(iTuple)) +: fNode(spNodeFromTuple(iTuple)) {} ZTBQuery::ZTBQuery(const ZStreamR& iStreamR) -: fNode(sNodeFromStream(iStreamR)) +: fNode(spNodeFromStream(iStreamR)) {} ZTBQuery::ZTBQuery(uint64 iID) @@ -233,7 +233,7 @@ void ZTBQuery::ToStream(const ZStreamW& iStreamW) const { - sNodeToStream(iStreamW, fNode); + spNodeToStream(iStreamW, fNode); } /** @@ -603,11 +603,11 @@ ZTBQueryNode_Combo::Intersection::Intersection(const ZStreamR& iStreamR) { fFilter = ZTBSpec(iStreamR); - if (uint32 theCount = sReadCount(iStreamR)) + if (uint32 theCount = spReadCount(iStreamR)) { fNodes.reserve(theCount); while (theCount--) - fNodes.push_back(sNodeFromStream(iStreamR)); + fNodes.push_back(spNodeFromStream(iStreamR)); } } @@ -617,7 +617,7 @@ const vector<ZTValue>& nodes = iTuple.Get("Nodes").GetSeq().GetVector(); for (vector<ZTValue>::const_iterator i = nodes.begin(); i != nodes.end(); ++i) { - if (ZRef<ZTBQueryNode> aNode = sNodeFromTuple((*i).GetTuple())) + if (ZRef<ZTBQueryNode> aNode = spNodeFromTuple((*i).GetTuple())) fNodes.push_back(aNode); } } @@ -628,7 +628,7 @@ result.SetTuple("Filter", fFilter.AsTuple()); vector<ZTValue>& destVec = result.SetMutableVector("Nodes"); for (vector<ZRef<ZTBQueryNode> >::const_iterator i = fNodes.begin(); i != fNodes.end(); ++i) - destVec.push_back(sTupleFromNode(*i)); + destVec.push_back(spTupleFromNode(*i)); return result; } @@ -636,9 +636,9 @@ { fFilter.ToStream(iStreamW); - sWriteCount(iStreamW, fNodes.size()); + spWriteCount(iStreamW, fNodes.size()); for (vector<ZRef<ZTBQueryNode> >::const_iterator i = fNodes.begin(); i != fNodes.end(); ++i) - sNodeToStream(iStreamW, *i); + spNodeToStream(iStreamW, *i); } int ZTBQueryNode_Combo::Intersection::Compare(const Intersection& iOther) const @@ -653,7 +653,7 @@ #pragma mark - #pragma mark * ZTBQueryNode_Combo -static void sSimplify(vector<ZTBQueryNode_Combo::Intersection>& ioIntersections) +static void spSimplify(vector<ZTBQueryNode_Combo::Intersection>& ioIntersections) { bool gotSimpleOnes = false; ZTBSpec simpleFilter; @@ -698,14 +698,14 @@ ZTBQueryNode_Combo::ZTBQueryNode_Combo(const ZStreamR& iStreamR) { - if (uint32 theCount = sReadCount(iStreamR)) + if (uint32 theCount = spReadCount(iStreamR)) { fSort.reserve(theCount); while (theCount--) fSort.push_back(ZTBQuery::SortSpec(iStreamR)); } - if (uint32 theCount = sReadCount(iStreamR)) + if (uint32 theCount = spReadCount(iStreamR)) { fIntersections.reserve(theCount); while (theCount--) @@ -718,7 +718,7 @@ { fSort.swap(ioSort), fIntersections.swap(ioIntersections); - sSimplify(fIntersections); + spSimplify(fIntersections); } ZTBQueryNode_Combo::~ZTBQueryNode_Combo() @@ -753,11 +753,11 @@ { iStreamW.WriteUInt8(2); - sWriteCount(iStreamW, fSort.size()); + spWriteCount(iStreamW, fSort.size()); for (vector<ZTBQuery::SortSpec>::iterator i = fSort.begin(); i != fSort.end(); ++i) (*i).ToStream(iStreamW); - sWriteCount(iStreamW, fIntersections.size()); + spWriteCount(iStreamW, fIntersections.size()); for (vector<Intersection>::iterator i = fIntersections.begin(); i != fIntersections.end(); ++i) (*i).ToStream(iStreamW); } @@ -779,8 +779,8 @@ inline ZTBQueryNode_Difference::ZTBQueryNode_Difference(const ZStreamR& iStreamR) { - fLeftNode = sNodeFromStream(iStreamR); - fRightNode = sNodeFromStream(iStreamR); + fLeftNode = spNodeFromStream(iStreamR); + fRightNode = spNodeFromStream(iStreamR); } ZTBQueryNode_Difference::ZTBQueryNode_Difference( @@ -806,8 +806,8 @@ void ZTBQueryNode_Difference::ToStream(const ZStreamW& iStreamW) { iStreamW.WriteUInt8(3); - sNodeToStream(iStreamW, fLeftNode); - sNodeToStream(iStreamW, fRightNode); + spNodeToStream(iStreamW, fLeftNode); + spNodeToStream(iStreamW, fRightNode); } int ZTBQueryNode_Difference::pRevCompare(ZTBQueryNode* iOther) @@ -827,7 +827,7 @@ ZTBQueryNode_First::ZTBQueryNode_First(const ZStreamR& iStreamR) : fPropName(iStreamR), - fSourceNode(sNodeFromStream(iStreamR)) + fSourceNode(spNodeFromStream(iStreamR)) {} ZTBQueryNode_First::ZTBQueryNode_First( @@ -853,7 +853,7 @@ { iStreamW.WriteUInt8(4); fPropName.ToStream(iStreamW); - sNodeToStream(iStreamW, fSourceNode); + spNodeToStream(iStreamW, fSourceNode); } int ZTBQueryNode_First::pRevCompare(ZTBQueryNode* iOther) @@ -873,7 +873,7 @@ ZTBQueryNode_ID_Constant::ZTBQueryNode_ID_Constant(const ZStreamR& iStreamR) { - if (uint32 theCount = sReadCount(iStreamR)) + if (uint32 theCount = spReadCount(iStreamR)) { fIDs.reserve(theCount); while (theCount--) @@ -921,7 +921,7 @@ void ZTBQueryNode_ID_Constant::ToStream(const ZStreamW& iStreamW) { iStreamW.WriteUInt8(5); - sWriteCount(iStreamW, fIDs.size()); + spWriteCount(iStreamW, fIDs.size()); for (vector<uint64>::iterator i = fIDs.begin(), theEnd = fIDs.end(); i != theEnd; ++i) { @@ -941,7 +941,7 @@ inline ZTBQueryNode_ID_FromSource::ZTBQueryNode_ID_FromSource(const ZStreamR& iStreamR) : fSourcePropName(iStreamR), - fSourceNode(sNodeFromStream(iStreamR)) + fSourceNode(spNodeFromStream(iStreamR)) {} ZTBQueryNode_ID_FromSource::ZTBQueryNode_ID_FromSource( @@ -967,7 +967,7 @@ { iStreamW.WriteUInt8(6); fSourcePropName.ToStream(iStreamW); - sNodeToStream(iStreamW, fSourceNode); + spNodeToStream(iStreamW, fSourceNode); } int ZTBQueryNode_ID_FromSource::pRevCompare(ZTBQueryNode* iOther) @@ -987,7 +987,7 @@ inline ZTBQueryNode_Property::ZTBQueryNode_Property(const ZStreamR& iStreamR) : fPropName(iStreamR), - fSourceNode(sNodeFromStream(iStreamR)) + fSourceNode(spNodeFromStream(iStreamR)) {} ZTBQueryNode_Property::ZTBQueryNode_Property( @@ -1013,7 +1013,7 @@ { iStreamW.WriteUInt8(7); fPropName.ToStream(iStreamW); - sNodeToStream(iStreamW, fSourceNode); + spNodeToStream(iStreamW, fSourceNode); } int ZTBQueryNode_Property::pRevCompare(ZTBQueryNode* iOther) @@ -1031,14 +1031,14 @@ #pragma mark - #pragma mark * Helper functions -static ZTuple sTupleFromNode(const ZRef<ZTBQueryNode>& iNode) +static ZTuple spTupleFromNode(const ZRef<ZTBQueryNode>& iNode) { if (iNode) return iNode->AsTuple(); return ZTuple(); } -static ZRef<ZTBQueryNode> sNodeFromTuple(const ZTuple& iTuple) +static ZRef<ZTBQueryNode> spNodeFromTuple(const ZTuple& iTuple) { string nodeKind = iTuple.GetString("Kind"); if (false) @@ -1067,14 +1067,14 @@ } else if (nodeKind == "Difference") { - ZRef<ZTBQueryNode> leftNode = sNodeFromTuple(iTuple.GetTuple("LeftNode")); - ZRef<ZTBQueryNode> rightNode = sNodeFromTuple(iTuple.GetTuple("RightNode")); + ZRef<ZTBQueryNode> leftNode = spNodeFromTuple(iTuple.GetTuple("LeftNode")); + ZRef<ZTBQueryNode> rightNode = spNodeFromTuple(iTuple.GetTuple("RightNode")); return new ZTBQueryNode_Difference(leftNode, rightNode); } else if (nodeKind == "First") { string propName = iTuple.GetString("PropName"); - ZRef<ZTBQueryNode> sourceNode = sNodeFromTuple(iTuple.GetTuple("SourceNode")); + ZRef<ZTBQueryNode> sourceNode = spNodeFromTuple(iTuple.GetTuple("SourceNode")); return new ZTBQueryNode_First(ZTName(propName), sourceNode); } else if (nodeKind == "ID_Constant") @@ -1085,20 +1085,20 @@ } else if (nodeKind == "ID_FromSource") { - ZRef<ZTBQueryNode> sourceNode = sNodeFromTuple(iTuple.GetTuple("SourceNode")); + ZRef<ZTBQueryNode> sourceNode = spNodeFromTuple(iTuple.GetTuple("SourceNode")); string sourcePropName = iTuple.GetString("SourcePropName"); return new ZTBQueryNode_ID_FromSource(sourceNode, ZTName(sourcePropName)); } else if (nodeKind == "Property") { string propName = iTuple.GetString("PropName"); - ZRef<ZTBQueryNode> sourceNode = sNodeFromTuple(iTuple.GetTuple("SourceNode")); + ZRef<ZTBQueryNode> sourceNode = spNodeFromTuple(iTuple.GetTuple("SourceNode")); return new ZTBQueryNode_Property(ZTName(propName), sourceNode); } - throw std::runtime_error(string("ZTBQuery, sNodeFromTuple, unknown nodeKind: " + nodeKind)); + throw std::runtime_error(string("ZTBQuery, spNodeFromTuple, unknown nodeKind: " + nodeKind)); } -static ZRef<ZTBQueryNode> sNodeFromStream(const ZStreamR& iStreamR) +static ZRef<ZTBQueryNode> spNodeFromStream(const ZStreamR& iStreamR) { uint8 theType = iStreamR.ReadUInt8(); switch (theType) @@ -1112,10 +1112,10 @@ case 6: return new ZTBQueryNode_ID_FromSource(iStreamR); case 7: return new ZTBQueryNode_Property(iStreamR); } - throw std::runtime_error("ZTBQuery, sNodeFromStream, unknown node type"); + throw std::runtime_error("ZTBQuery, spNodeFromStream, unknown node type"); } -static void sNodeToStream(const ZStreamW& iStreamW, const ZRef<ZTBQueryNode>& iNode) +static void spNodeToStream(const ZStreamW& iStreamW, const ZRef<ZTBQueryNode>& iNode) { if (iNode) iNode->ToStream(iStreamW); Modified: trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBQuery.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBQuery.h 2010-03-30 18:40:45 UTC (rev 1217) +++ trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBQuery.h 2010-03-30 20:09:06 UTC (rev 1218) @@ -222,8 +222,6 @@ ZTBQueryNode(); public: - static bool sCheckAccessEnabled() { return false; } - virtual ~ZTBQueryNode(); int Compare(const ZRef<ZTBQueryNode>& iOther); Modified: trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBRep_Client.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBRep_Client.cpp 2010-03-30 18:40:45 UTC (rev 1217) +++ trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBRep_Client.cpp 2010-03-30 20:09:06 UTC (rev 1218) @@ -1037,7 +1037,7 @@ } } -static void sSend(ZMutexLocker& iLocker, const ZStreamW& iStream, const ZTuple& iTuple) +static void spSend(ZMutexLocker& iLocker, const ZStreamW& iStream, const ZTuple& iTuple) { iLocker.Release(); @@ -1061,7 +1061,7 @@ fPingRequested = false; ZTuple response; response.SetString("What", "Pong"); - sSend(locker, iStream, response); + spSend(locker, iStream, response); didAnything = true; } @@ -1070,7 +1070,7 @@ fPingSent = true; ZTuple req; req.SetString("What", "Ping"); - sSend(locker, iStream, req); + spSend(locker, iStream, req); didAnything = true; } @@ -1080,7 +1080,7 @@ reqTuple.SetString("What", "AllocateIDs"); reqTuple.SetInt32("Count", fIDsNeeded); fIDsNeeded = 0; - sSend(locker, iStream, reqTuple); + spSend(locker, iStream, reqTuple); didAnything = true; } @@ -1112,7 +1112,7 @@ if (!vectorTransactionIDs.empty()) { reqTuple.Set("ClientIDs", theSeq); - sSend(locker, iStream, reqTuple); + spSend(locker, iStream, reqTuple); didAnything = true; } } @@ -1144,7 +1144,7 @@ if (!vectorServerIDs.empty()) { reqTuple.Set("ServerIDs", theSeq); - sSend(locker, iStream, reqTuple); + spSend(locker, iStream, reqTuple); didAnything = true; } } @@ -1178,7 +1178,7 @@ } reqTuple.Set("ServerIDs", theSeq); - sSend(locker, iStream, reqTuple); + spSend(locker, iStream, reqTuple); } didAnything = true; } @@ -1211,7 +1211,7 @@ if (!vectorServerIDs.empty()) { reqTuple.Set("ServerIDs", theSeq); - sSend(locker, iStream, reqTuple); + spSend(locker, iStream, reqTuple); didAnything = true; } } @@ -1322,19 +1322,19 @@ if (actionsTuple) { - sSend(locker, iStream, actionsTuple); + spSend(locker, iStream, actionsTuple); didAnything = true; } if (searchesTuple) { - sSend(locker, iStream, searchesTuple); + spSend(locker, iStream, searchesTuple); didAnything = true; } if (countsTuple) { - sSend(locker, iStream, countsTuple); + spSend(locker, iStream, countsTuple); didAnything = true; } Modified: trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBRep_TS.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBRep_TS.cpp 2010-03-30 18:40:45 UTC (rev 1217) +++ trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBRep_TS.cpp 2010-03-30 20:09:06 UTC (rev 1218) @@ -757,7 +757,7 @@ delete iTransaction; } -static void sLatestStartEarliestEnd( +static void spLatestStartEarliestEnd( const MapTransTuple_t& iTransTuples, uint64& oLatestStart, uint64& ioEarliestEnd) { oLatestStart = 0; @@ -797,7 +797,7 @@ { uint64 latestStart; uint64 earliestEnd = fClock; - sLatestStartEarliestEnd(iTransaction->fTransTuples, latestStart, earliestEnd); + spLatestStartEarliestEnd(iTransaction->fTransTuples, latestStart, earliestEnd); vector<uint64> storedIDs; vector<ZTuple> storedTuples; @@ -922,7 +922,7 @@ // Check that all our reads have an intersection. uint64 latestStart; uint64 earliestEnd = fClock; - sLatestStartEarliestEnd(iTransaction->fTransTuples, latestStart, earliestEnd); + spLatestStartEarliestEnd(iTransaction->fTransTuples, latestStart, earliestEnd); if (latestStart > earliestEnd) { Modified: trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBServer.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBServer.cpp 2010-03-30 18:40:45 UTC (rev 1217) +++ trunk/zoolib/source/cxx/more/zoolib/tuplebase/ZTBServer.cpp 2010-03-30 20:09:06 UTC (rev 1218) @@ -51,7 +51,7 @@ // ================================================================================================= -static void sDumpRequest(const string& iLogFacility, ZTBServer* iServer, const ZTuple& iTuple) +static void spDumpRequest(const string& iLogFacility, ZTBServer* iServer, const ZTuple& iTu... [truncated message content] |
From: <ag...@us...> - 2010-04-06 18:12:46
|
Revision: 1243 http://zoolib.svn.sourceforge.net/zoolib/?rev=1243&view=rev Author: agreen Date: 2010-04-06 18:12:39 +0000 (Tue, 06 Apr 2010) Log Message: ----------- Reorg of tql stuff. Bite the bullet and use the moniker "ZQL". Make a clean separation between ZQL-related stuff, and generic ZValCondition stuff. Modified Paths: -------------- trunk/zoolib/source/cxx/more/zoolib/tql/ZTQLTest.cpp trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Optimize.cpp trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Optimize.h Added Paths: ----------- trunk/zoolib/source/cxx/more/zoolib/zql/ trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Physical.cpp trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Physical.h trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Query.cpp trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Query.h trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Relation.cpp trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Relation.h trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Restrict.h trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Restrict_T.h trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Select.cpp trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Select.h trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Util_Strim_Query.cpp trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Util_Strim_Query.h trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Relation_ToStrim.cpp trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Relation_ToStrim.h trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Restrict_ToStrim.cpp trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Restrict_ToStrim.h trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Select_ToStrim.cpp trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Select_ToStrim.h trunk/zoolib/source/cxx/zoolib/ZUtil_Strim_RelHead.cpp trunk/zoolib/source/cxx/zoolib/ZUtil_Strim_RelHead.h trunk/zoolib/source/cxx/zoolib/ZUtil_Strim_ValCondition.cpp trunk/zoolib/source/cxx/zoolib/ZUtil_Strim_ValCondition.h trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_Logical_ToStrim.cpp trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_Logical_ToStrim.h trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_ToStrim.cpp trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_ToStrim.h trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_ValCondition_ToStrim.cpp trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_ValCondition_ToStrim.h Removed Paths: ------------- trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL.cpp trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL.h trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL_Query.cpp trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL_Query.h trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL_Spec.cpp trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL_Spec.h trunk/zoolib/source/cxx/zoolib/ZExpr_Physical.cpp trunk/zoolib/source/cxx/zoolib/ZExpr_Physical.h trunk/zoolib/source/cxx/zoolib/ZExpr_Query.cpp trunk/zoolib/source/cxx/zoolib/ZExpr_Query.h trunk/zoolib/source/cxx/zoolib/ZExpr_Relation.cpp trunk/zoolib/source/cxx/zoolib/ZExpr_Relation.h trunk/zoolib/source/cxx/zoolib/ZExpr_Restrict_T.h trunk/zoolib/source/cxx/zoolib/ZExpr_Select.cpp trunk/zoolib/source/cxx/zoolib/ZExpr_Select.h Modified: trunk/zoolib/source/cxx/more/zoolib/tql/ZTQLTest.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tql/ZTQLTest.cpp 2010-04-06 18:10:16 UTC (rev 1242) +++ trunk/zoolib/source/cxx/more/zoolib/tql/ZTQLTest.cpp 2010-04-06 18:12:39 UTC (rev 1243) @@ -1,8 +1,9 @@ #include "zoolib/tql/ZTQL_Optimize.h" -#include "zoolib/ZExpr_Query.h" +#include "zoolib/zql/ZQL_Expr_Query.h" -#include "zoolib/tql/ZUtil_Strim_TQL_Query.h" -#include "zoolib/tql/ZUtil_TQLConvert.h" +#include "zoolib/zql/ZQL_Util_Strim_Query.h" + +//#include "zoolib/tql/ZUtil_TQLConvert.h" #include "zoolib/ZExpr_ValCondition.h" #include "zoolib/ZUtil_Strim_Tuple.h" @@ -24,13 +25,13 @@ NAMESPACE_ZOOLIB_USING -using namespace ZTQL; +using namespace ZQL; using std::set; using std::string; typedef ZExpr_Logical Spec; -typedef ZExpr_Relation Query; +typedef Expr_Relation Query; typedef ZMap_Expr Map; typedef ZRelHead RelHead; typedef ZVal_Expr Val; @@ -269,17 +270,18 @@ static void sDumpQuery(const ZStrimW& s, Query iQuery) { s << "ZTQL::Query equivalent -----------------------\n"; - ZUtil_Strim_TQL::sToStrim(iQuery, s); + Util_Strim_Query::sToStrim(iQuery, s); s << "\nZTQL::Query optimized -----------------------\n"; - ZExpr_Relation theNode = sOptimize(iQuery); + Expr_Relation theNode = sOptimize(iQuery); - ZUtil_Strim_TQL::sToStrim(theNode, s); + Util_Strim_Query::sToStrim(theNode, s); s << "\n"; } +#if 0 static void sTestOne(const string& iLabel, const ZStrimW& s, const ZTBQuery& iTBQ) { const Query query = ZUtil_TQLConvert::sConvert(iTBQ, false); @@ -288,7 +290,7 @@ sDumpQuery(s, query); } - +#endif void sTestQL(const ZStrimW& s); void sTestQL2(const ZStrimW& s) { @@ -320,6 +322,12 @@ void sTestQL3(const ZStrimW& s) { + Spec theSpec = CVar("TestVar1") == CConst(1) | CVar("TestVar2") == CConst(2); + Expr_Relation theExp = sSelect(theSpec, sAll(ZRelHead(true))); + sDumpQuery(s, theExp); + + sDumpQuery(s, theExp * theExp); + ZMap_Expr theMap; theMap.Set("name", ZMap_Expr().Set("last", string("fred"))); // Spec theSpec = CTrail("name/last") < CConst("fred1"); @@ -334,15 +342,14 @@ else s << "Doesn't\n"; - ZExpr_Relation theExp = sSelect(CVar("TestVar1") == CConst(1) & CVar("TestVar2") == CConst(2), sAll(ZRelHead(true))); - sDumpQuery(s, theExp); - // return; // Query theQuery = sAllID("$ID$") & theSpec; // sDumpQuery(s, theQuery); - sDumpQuery(s, sQuery()); + +//## sDumpQuery(s, sQuery()); +#if 0 // sDumpQuery(s, sQueryNoHead()); // sDumpQuery(s, ZUtil_TQLConvert::sConvert(sTBQuery(), false)); @@ -376,6 +383,7 @@ // Query query = sQuery(); // ZUtil_StrimTQL::sToStrim(s, query); // s << "\n"; +#endif } @@ -398,8 +406,8 @@ ZExpr_Logical theCondition = CName("Disc Number") == CConst(int32(2)) & CName("Track Number") > CConst(int32(10)); - const ZVal_Any theVal = sFromYadR(ZVal_Any(), theYadR); - theYadR = sMakeYadR(theVal); +// const ZVal_Any theVal = sFromYadR(ZVal_Any(), theYadR); +// theYadR = sMakeYadR(theVal); theYadR = ZUtil_Yad::sWalk(theYadR, "Tracks"); if (ZRef<ZYadMapR> theYadMapR = theYadR.DynamicCast<ZYadMapR>()) { @@ -414,9 +422,8 @@ if (sMatches(theCondition, theVal)) { ZYad_ZooLibStrim::sToStrim(0, theYadOptions, sMakeYadR(theVal), s); + s << "\n"; } } } - - } Modified: trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Optimize.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Optimize.cpp 2010-04-06 18:10:16 UTC (rev 1242) +++ trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Optimize.cpp 2010-04-06 18:12:39 UTC (rev 1243) @@ -20,14 +20,15 @@ #include "zoolib/tql/ZTQL_Optimize.h" -#include "zoolib/ZExpr_Query.h" +#include "zoolib/zql/ZQL_Expr_Query.h" #include "zoolib/ZExpr_ValCondition.h" NAMESPACE_ZOOLIB_BEGIN +using namespace ZQL; // ================================================================================================= #pragma mark - -#pragma mark * ZTQL, spConvertSelect +#pragma mark * ZQL, spConvertSelect // Turns a Select into a tree of Restrict and Union. @@ -96,28 +97,28 @@ } } -static ZRef<ZExprRep_Relation> spConvertSelect( - ZRef<ZExprRep_Relation> iRelational, ZRef<ZExprRep_Logical> iLogical) +static ZRef<ExprRep_Relation> spConvertSelect( + ZRef<ExprRep_Relation> iRelational, ZRef<ZExprRep_Logical> iLogical) { if (!iRelational) - return ZRef<ZExprRep_Relation>(); + return ZRef<ExprRep_Relation>(); CondUnion resultLogical; spGather(iLogical, resultLogical); - ZRef<ZExprRep_Relation> resultRelational; + ZRef<ExprRep_Relation> resultRelational; for (CondUnion::const_iterator iterUnion = resultLogical.begin(); iterUnion != resultLogical.end(); ++iterUnion) { - ZRef<ZExprRep_Relation> current = iRelational; + ZRef<ExprRep_Relation> current = iRelational; for (CondSect::const_iterator iterSect = iterUnion->begin(); iterSect != iterUnion->end(); ++iterSect) { - current = new ZExprRep_Restrict(*iterSect, current); + current = new ExprRep_Restrict(*iterSect, current); } if (resultRelational) - resultRelational = new ZExprRep_Relation_Union(current, resultRelational); + resultRelational = new ExprRep_Relation_Union(current, resultRelational); else resultRelational = current; } @@ -126,25 +127,28 @@ // ================================================================================================= #pragma mark - -#pragma mark * ZTQL +#pragma mark * ZQL namespace ZANONYMOUS { -class Optimize : public ZQueryTransformer +class Optimize : public QueryTransformer { public: - virtual ZRef<ZExprRep_Relation> Transform_Select(ZRef<ZExprRep_Select> iRep); + virtual ZRef<ExprRep_Relation> Transform_Select(ZRef<ExprRep_Select> iRep); }; -ZRef<ZExprRep_Relation> Optimize::Transform_Select(ZRef<ZExprRep_Select> iRep) +ZRef<ExprRep_Relation> Optimize::Transform_Select(ZRef<ExprRep_Select> iRep) { - ZRef<ZExprRep_Relation> newRep = this->Transform(iRep->GetExpr_Relation()); - return spConvertSelect(newRep, iRep->GetExpr_Logical()); + ZRef<ExprRep_Relation> newRep = this->Transform(iRep->GetExprRep_Relation()); + return spConvertSelect(newRep, iRep->GetExprRep_Logical()); } } // anonymous namespace -ZRef<ZExprRep_Relation> ZTQL::sOptimize(ZRef<ZExprRep_Relation> iRep) +namespace ZQL { + +ZRef<ExprRep_Relation> sOptimize(ZRef<ExprRep_Relation> iRep) { return Optimize().Transform(iRep); } +} // namespace ZQL NAMESPACE_ZOOLIB_END Modified: trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Optimize.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Optimize.h 2010-04-06 18:10:16 UTC (rev 1242) +++ trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Optimize.h 2010-04-06 18:12:39 UTC (rev 1243) @@ -22,7 +22,7 @@ #define __ZTQL_Optimize__ 1 #include "zconfig.h" -#include "zoolib/ZExpr_Relation.h" +#include "zoolib/zql/ZQL_Expr_Relation.h" NAMESPACE_ZOOLIB_BEGIN @@ -30,9 +30,9 @@ #pragma mark - #pragma mark * ZTQL -namespace ZTQL { +namespace ZQL { -ZRef<ZExprRep_Relation> sOptimize(ZRef<ZExprRep_Relation> iRep); +ZRef<ExprRep_Relation> sOptimize(ZRef<ExprRep_Relation> iRep); } // namespace ZTQL Deleted: trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL.cpp 2010-04-06 18:10:16 UTC (rev 1242) +++ trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL.cpp 2010-04-06 18:12:39 UTC (rev 1243) @@ -1,64 +0,0 @@ -/* ------------------------------------------------------------------------------------------------- -Copyright (c) 2007 Andrew Green and Learning in Motion, Inc. -http://www.zoolib.org - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software -and associated documentation files (the "Software"), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, merge, publish, distribute, -sublicense, and/or sell copies of the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING -BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES -OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------------------------- */ - -#include "zoolib/ZYad_ZooLibStrim.h" -#include "zoolib/tql/ZUtil_Strim_TQL.h" - -NAMESPACE_ZOOLIB_BEGIN - -// ================================================================================================= -#pragma mark - -#pragma mark * ZUtil_Strim_TQL - -namespace ZUtil_Strim_TQL { - -using std::set; -using std::string; - -void sWrite_PropName(const string& iName, const ZStrimW& s) - { - s.Write("@"); - ZYad_ZooLibStrim::sWrite_PropName(iName, s); - } - -void sWrite_RelHead(const ZRelHead& iRelHead, const ZStrimW& s) - { - bool universal; - set<string> names; - iRelHead.GetNames(universal, names); - - s.Write("["); - if (universal) - s.Write("~"); - - bool isFirst = true; - for (set<string>::iterator i = names.begin(); i != names.end(); ++i) - { - if (!isFirst) - s.Write(", "); - isFirst = false; - sWrite_PropName(*i, s); - } - s.Write("]"); - } - -} // namespace ZUtil_Strim_TQL - -NAMESPACE_ZOOLIB_END Deleted: trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL.h 2010-04-06 18:10:16 UTC (rev 1242) +++ trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL.h 2010-04-06 18:12:39 UTC (rev 1243) @@ -1,43 +0,0 @@ -/* ------------------------------------------------------------------------------------------------- -Copyright (c) 2007 Andrew Green and Learning in Motion, Inc. -http://www.zoolib.org - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software -and associated documentation files (the "Software"), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, merge, publish, distribute, -sublicense, and/or sell copies of the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING -BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES -OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------------------------- */ - -#ifndef __ZUtil_Strim_TQL__ -#define __ZUtil_Strim_TQL__ -#include "zconfig.h" - -#include "zoolib/ZRelHead.h" -#include "zoolib/ZStrim.h" - -NAMESPACE_ZOOLIB_BEGIN - -namespace ZUtil_Strim_TQL { - -// ================================================================================================= -#pragma mark - -#pragma mark * ZUtil_Strim_TQL - -void sWrite_PropName(const std::string& iName, const ZStrimW& s); -void sWrite_RelHead(const ZRelHead& iRelHead, const ZStrimW& s); - -} // namespace ZUtil_Strim_TQL - -NAMESPACE_ZOOLIB_END - -#endif // __ZUtil_Strim_TQL__ Deleted: trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL_Query.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL_Query.cpp 2010-04-06 18:10:16 UTC (rev 1242) +++ trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL_Query.cpp 2010-04-06 18:12:39 UTC (rev 1243) @@ -1,287 +0,0 @@ -/* ------------------------------------------------------------------------------------------------- -Copyright (c) 2007 Andrew Green and Learning in Motion, Inc. -http://www.zoolib.org - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software -and associated documentation files (the "Software"), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, merge, publish, distribute, -sublicense, and/or sell copies of the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING -BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES -OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------------------------- */ - -#include "zoolib/tql/ZUtil_Strim_TQL.h" -#include "zoolib/tql/ZUtil_Strim_TQL_Query.h" -#include "zoolib/tql/ZUtil_Strim_TQL_Spec.h" - -NAMESPACE_ZOOLIB_BEGIN - -namespace ZUtil_Strim_TQL { - -using std::set; -using std::string; -using std::vector; - -// ================================================================================================= -#pragma mark - -#pragma mark * Options - -Options::Options() -: fEOLString("\n"), - fIndentString(" ") - {} - -namespace ZANONYMOUS { - -// ================================================================================================= -#pragma mark - -#pragma mark * Static helpers - -static void spWrite(const string& iString, const ZStrimW& s) - { s.Write(iString); } - -static void spWrite(const UTF8* iString, const ZStrimW& s) - { s.Write(iString); } - -static void spWrite_Indent(size_t iCount, const Options& iOptions, const ZStrimW& iStrimW) - { - while (iCount--) - spWrite(iOptions.fIndentString, iStrimW); - } - -static void spWrite_LFIndent(size_t iCount, const Options& iOptions, const ZStrimW& iStrimW) - { - spWrite(iOptions.fEOLString, iStrimW); - spWrite_Indent(iCount, iOptions, iStrimW); - } - -// ================================================================================================= -#pragma mark - -#pragma mark * Writer - -class Writer -: public ZVisitor_ExprRep_Query -, public ZVisitor_ExprRep_Restrict -, public ZVisitor_ExprRep_Select - { -public: - Writer(size_t iIndent, const Options& iOptions, const ZStrimW& iStrimW); - -// From NodeVisitor - virtual bool Visit_Difference(ZRef<ZExprRep_Relation_Difference> iRep); - virtual bool Visit_Intersect(ZRef<ZExprRep_Relation_Intersect> iRep); - virtual bool Visit_Join(ZRef<ZExprRep_Relation_Join> iRep); - virtual bool Visit_Project(ZRef<ZExprRep_Relation_Project> iRep); - virtual bool Visit_Rename(ZRef<ZExprRep_Relation_Rename> iRep); - virtual bool Visit_Union(ZRef<ZExprRep_Relation_Union> iRep); - -// From ZVisitor_ExprRep_Query - virtual bool Visit_All(ZRef<ZExprRep_Query_All> iRep); - virtual bool Visit_Explicit(ZRef<ZExprRep_Query_Explicit> iRep); - -// From ZVisitor_ExprRep_Restrict - virtual bool Visit_Restrict(ZRef<ZExprRep_Restrict> iRep); - -// From ZVisitor_ExprRep_Select - virtual bool Visit_Select(ZRef<ZExprRep_Select> iRep); - -private: - bool pWriteDyadic(const string& iFunctionName, ZRef<ZExprRep_Relation_Dyadic> iRep); - - size_t fIndent; - const Options& fOptions; - const ZStrimW& fStrimW; - }; - -static void spWrite_EffectiveRelHeadComment(ZRef<ZExprRep_Relation> iRep, const ZStrimW& s) - { - s.Write(" // "); - ZUtil_Strim_TQL::sWrite_RelHead(iRep->GetRelHead(), s); - } - -static void spWrite(size_t iIndent, const Options& iOptions, - ZRef<ZExprRep_Relation> iRep, - const ZStrimW& s) - { - spWrite_LFIndent(iIndent, iOptions, s); - Writer theWriter(iIndent, iOptions, s); - iRep->Accept(theWriter); - } - -Writer::Writer(size_t iIndent, const Options& iOptions, const ZStrimW& iStrimW) -: fIndent(iIndent), - fOptions(iOptions), - fStrimW(iStrimW) - {} - -bool Writer::Visit_Difference(ZRef<ZExprRep_Relation_Difference> iRep) - { return this->pWriteDyadic("Difference", iRep); } - -bool Writer::Visit_Intersect(ZRef<ZExprRep_Relation_Intersect> iRep) - { return this->pWriteDyadic("Intersect", iRep); } - -bool Writer::Visit_Join(ZRef<ZExprRep_Relation_Join> iRep) - { - ZRef<ZExprRep_Relation> theLHS = iRep->GetLHS(); - ZRef<ZExprRep_Relation> theRHS = iRep->GetRHS(); - - const ZRelHead joinOn = theLHS->GetRelHead() - & theRHS->GetRelHead(); - - spWrite("Join", fStrimW); - spWrite_EffectiveRelHeadComment(iRep, fStrimW); - spWrite_LFIndent(fIndent + 1, fOptions, fStrimW); - spWrite("( // Join on: ", fStrimW); - sWrite_RelHead(joinOn, fStrimW); - spWrite(fIndent + 1, fOptions, theLHS, fStrimW); - spWrite(", ", fStrimW); - spWrite(fIndent + 1, fOptions, theRHS, fStrimW); - spWrite_LFIndent(fIndent + 1, fOptions, fStrimW); - spWrite(")", fStrimW); - return true; - } - -bool Writer::Visit_Project(ZRef<ZExprRep_Relation_Project> iRep) - { - spWrite("Project", fStrimW); - spWrite_EffectiveRelHeadComment(iRep, fStrimW); - spWrite_LFIndent(fIndent + 1, fOptions, fStrimW); - spWrite("(", fStrimW); - spWrite_LFIndent(fIndent + 1, fOptions, fStrimW); - sWrite_RelHead(iRep->GetProjectRelHead(), fStrimW); - spWrite(",", fStrimW); - spWrite(fIndent + 1, fOptions, iRep->GetExpr(), fStrimW); - spWrite_LFIndent(fIndent + 1, fOptions, fStrimW); - spWrite(")", fStrimW); - return true; - } - -bool Writer::Visit_Rename(ZRef<ZExprRep_Relation_Rename> iRep) - { - spWrite("Rename", fStrimW); - spWrite_EffectiveRelHeadComment(iRep, fStrimW); - spWrite_LFIndent(fIndent + 1, fOptions, fStrimW); - spWrite("(", fStrimW); - spWrite_LFIndent(fIndent + 1, fOptions, fStrimW); - sWrite_PropName(iRep->GetOld(), fStrimW); - spWrite(", ", fStrimW); - sWrite_PropName(iRep->GetNew(), fStrimW); - spWrite(",", fStrimW); - spWrite(fIndent + 1, fOptions, iRep->GetExpr(), fStrimW); - spWrite_LFIndent(fIndent + 1, fOptions, fStrimW); - spWrite(")", fStrimW); - return true; - } - -bool Writer::Visit_Union(ZRef<ZExprRep_Relation_Union> iRep) - { return this->pWriteDyadic("Union", iRep); } - -bool Writer::Visit_All(ZRef<ZExprRep_Query_All> iRep) - { - const string theIDPropName = iRep->GetIDPropName(); - if (theIDPropName.empty()) - { - spWrite("All(", fStrimW); - } - else - { - spWrite("AID(", fStrimW); - sWrite_PropName(theIDPropName, fStrimW); - spWrite(", ", fStrimW); - } - sWrite_RelHead(iRep->GetAllRelHead(), fStrimW); - spWrite(")", fStrimW); - return true; - } - -bool Writer::Visit_Explicit(ZRef<ZExprRep_Query_Explicit> iRep) - { - spWrite("Explicit(", fStrimW); - bool isFirst = true; - const vector<ZVal_Expr> theVals = iRep->GetVals(); - for (vector<ZVal_Expr>::const_iterator i = theVals.begin(); i != theVals.end(); ++i) - { - if (!isFirst) - spWrite(", ", fStrimW); - isFirst = false; - - ZUtil_Strim_TQL::sWrite(*i, fStrimW); - } - spWrite(")", fStrimW); - return true; - } - -bool Writer::Visit_Restrict(ZRef<ZExprRep_Restrict> iRep) - { - spWrite("Restrict", fStrimW); - spWrite_EffectiveRelHeadComment(iRep, fStrimW); - spWrite_LFIndent(fIndent + 1, fOptions, fStrimW); - spWrite("(", fStrimW); - spWrite_LFIndent(fIndent + 1, fOptions, fStrimW); - sToStrim(iRep->GetValCondition(), fStrimW); - spWrite(",", fStrimW); - spWrite(fIndent + 1, fOptions, iRep->GetExpr(), fStrimW); - spWrite_LFIndent(fIndent + 1, fOptions, fStrimW); - spWrite(")", fStrimW); - return true; - } - -bool Writer::Visit_Select(ZRef<ZExprRep_Select> iRep) - { - spWrite("Select", fStrimW); - spWrite_EffectiveRelHeadComment(iRep, fStrimW); - spWrite_LFIndent(fIndent + 1, fOptions, fStrimW); - spWrite("(", fStrimW); - spWrite_LFIndent(fIndent + 1, fOptions, fStrimW); - sToStrim(iRep->GetExpr_Logical(), fStrimW); - spWrite(",", fStrimW); - spWrite(fIndent + 1, fOptions, iRep->GetExpr_Relation(), fStrimW); - spWrite_LFIndent(fIndent + 1, fOptions, fStrimW); - spWrite(")", fStrimW); - return true; - } - -bool Writer::pWriteDyadic(const string& iFunctionName, ZRef<ZExprRep_Relation_Dyadic> iRep) - { - spWrite(iFunctionName, fStrimW); - - spWrite_EffectiveRelHeadComment(iRep, fStrimW); - - spWrite_LFIndent(fIndent + 1, fOptions, fStrimW); - spWrite("(", fStrimW); - - spWrite(fIndent + 1, fOptions, iRep->GetLHS(), fStrimW); - spWrite(", ", fStrimW); - - spWrite(fIndent + 1, fOptions, iRep->GetRHS(), fStrimW); - spWrite_LFIndent(fIndent + 1, fOptions, fStrimW); - - spWrite(")", fStrimW); - return true; - } - -} // anonymous namespace - -// ================================================================================================= -#pragma mark - -#pragma mark * ZUtil_Strim_TQL - -void sToStrim(const ZRef<ZExprRep_Relation>& iRep, const ZStrimW& s) - { sToStrim(0, Options(), iRep, s); } - -void sToStrim(size_t iInitialIndent, const Options& iOptions, - const ZRef<ZExprRep_Relation>& iRep, - const ZStrimW& s) - { spWrite(iInitialIndent, iOptions, iRep, s); } - -} // namespace ZUtil_Strim_TQL - -NAMESPACE_ZOOLIB_END Deleted: trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL_Query.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL_Query.h 2010-04-06 18:10:16 UTC (rev 1242) +++ trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL_Query.h 2010-04-06 18:12:39 UTC (rev 1243) @@ -1,54 +0,0 @@ -/* ------------------------------------------------------------------------------------------------- -Copyright (c) 2007 Andrew Green and Learning in Motion, Inc. -http://www.zoolib.org - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software -and associated documentation files (the "Software"), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, merge, publish, distribute, -sublicense, and/or sell copies of the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING -BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES -OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------------------------- */ - -#ifndef __ZUtil_Strim_TQL_Query__ -#define __ZUtil_Strim_TQL_Query__ -#include "zconfig.h" - -#include "zoolib/ZStrim.h" -#include "zoolib/ZExpr_Query.h" - -NAMESPACE_ZOOLIB_BEGIN - -namespace ZUtil_Strim_TQL { - -// ================================================================================================= -#pragma mark - -#pragma mark * ZUtil_Strim_TQL - -struct Options - { - Options(); - - std::string fEOLString; - std::string fIndentString; - }; - -void sToStrim(const ZRef<ZExprRep_Relation>& iRep, const ZStrimW& s); - -void sToStrim(size_t iInitialIndent, const Options& iOptions, - const ZRef<ZExprRep_Relation>& iRep, - const ZStrimW& s); - -} // namespace ZUtil_Strim_TQL - -NAMESPACE_ZOOLIB_END - -#endif // __ZUtil_Strim_TQL_Query__ Deleted: trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL_Spec.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL_Spec.cpp 2010-04-06 18:10:16 UTC (rev 1242) +++ trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL_Spec.cpp 2010-04-06 18:12:39 UTC (rev 1243) @@ -1,228 +0,0 @@ -/* ------------------------------------------------------------------------------------------------- -Copyright (c) 2007 Andrew Green and Learning in Motion, Inc. -http://www.zoolib.org - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software -and associated documentation files (the "Software"), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, merge, publish, distribute, -sublicense, and/or sell copies of the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING -BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES -OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------------------------- */ - -#include "zoolib/ZYad_Any.h" -#include "zoolib/ZYad_CFType.h" -#include "zoolib/ZYad_ZooLib.h" -#include "zoolib/ZYad_ZooLibStrim.h" - -#include "zoolib/tql/ZUtil_Strim_TQL.h" -#include "zoolib/tql/ZUtil_Strim_TQL_Spec.h" - -NAMESPACE_ZOOLIB_BEGIN - -namespace ZUtil_Strim_TQL { - -typedef ZVal_Expr Val; - -// ================================================================================================= -#pragma mark - -#pragma mark * Static helper functions - -static void spToStrim(const ZRef<ZValCondition_T<ZVal_Expr>::ComparandRep>& iCR, const ZStrimW& s) - { - if (!iCR) - { - s << "!!Null Comparand!!"; - } - else if (ZRef<ZValComparandRep_Trail_T<ZVal_Expr> > cr = ZRefDynamicCast<ZValComparandRep_Trail_T<ZVal_Expr> >(iCR)) - { - const ZTrail& theTrail = cr->GetTrail(); - if (theTrail.Count() == 1) - ZUtil_Strim_TQL::sWrite_PropName(theTrail.At(0), s); - else - ZUtil_Strim_TQL::sWrite_PropName("/" + theTrail.AsString(), s); - } - else if (ZRef<ZValComparandRep_Var_T<ZVal_Expr> > cr = ZRefDynamicCast<ZValComparandRep_Var_T<ZVal_Expr> >(iCR)) - { - s << "$"; - ZYad_ZooLibStrim::sWrite_PropName(cr->GetVarName(), s); - } - else if (ZRef<ZValComparandRep_Const_T<ZVal_Expr> > cr = ZRefDynamicCast<ZValComparandRep_Const_T<ZVal_Expr> >(iCR)) - { - ZUtil_Strim_TQL::sWrite(cr->GetVal(), s); - } - else - { - s << "!!Unknown Comparand!!"; - } - } - -static void spToStrim(const ZRef<ZValCondition_T<ZVal_Expr>::ComparatorRep>& iCR, const ZStrimW& s) - { - if (!iCR) - { - s << "!!Null Comparator!!"; - } - else if (ZRef<ZValComparatorRep_Simple_T<ZVal_Expr> > cr = ZRefDynamicCast<ZValComparatorRep_Simple_T<ZVal_Expr> >(iCR)) - { - switch (cr->GetEComparator()) - { - case ZValComparatorRep_Simple_T<ZVal_Expr>::eLT: - { - s << " < "; - break; - } - case ZValComparatorRep_Simple_T<ZVal_Expr>::eLE: - { - s << " <= "; - break; - } - case ZValComparatorRep_Simple_T<ZVal_Expr>::eEQ: - { - s << " == "; - break; - } - case ZValComparatorRep_Simple_T<ZVal_Expr>::eGE: - { - s << " >= "; - break; - } - case ZValComparatorRep_Simple_T<ZVal_Expr>::eGT: - { - s << " > "; - break; - } - } - } - else - { - s << "!!Unknown Comparator!!"; - } - } - -// ================================================================================================= -#pragma mark - -#pragma mark * Writer - -namespace ZANONYMOUS { - -class Writer : public ZVisitor_ExprRep_ValCondition_T<ZVal_Expr> - { -public: - typedef ZExprRep_ValCondition_T<ZVal_Expr> ExprRep_ValCondition; - - Writer(const ZStrimW& iStrimW); - -// From ZVisitor_ExprRep - virtual bool Visit_ExprRep(ZRef<ZExprRep> iRep); - -// From ZVisitor_ExprRep_Logical via ZVisitor_ExprRep_ValCondition_T - virtual bool Visit_Logical_True(ZRef<ZExprRep_Logical_True> iRep); - virtual bool Visit_Logical_False(ZRef<ZExprRep_Logical_False> iRep); - virtual bool Visit_Logical_Not(ZRef<ZExprRep_Logical_Not> iRep); - virtual bool Visit_Logical_And(ZRef<ZExprRep_Logical_And> iRep); - virtual bool Visit_Logical_Or(ZRef<ZExprRep_Logical_Or> iRep); - -// From Visitor_ExprRep_Condition - virtual bool Visit_ValCondition(ZRef<ExprRep_ValCondition> iRep); - -private: - const ZStrimW& fStrimW; - }; - -} // anonymous namespace - -Writer::Writer(const ZStrimW& iStrimW) -: fStrimW(iStrimW) - {} - -bool Writer::Visit_ExprRep(ZRef<ZExprRep> iRep) - { - fStrimW << "/*unknown expr*/"; - return true; - } - -bool Writer::Visit_Logical_True(ZRef<ZExprRep_Logical_True> iRep) - { - fStrimW << "any"; - return true; - } - -bool Writer::Visit_Logical_False(ZRef<ZExprRep_Logical_False> iRep) - { - fStrimW << "none"; - return true; - } - -bool Writer::Visit_Logical_Not(ZRef<ZExprRep_Logical_Not> iRep) - { - fStrimW << "!("; - sToStrim(iRep->GetOperand(), fStrimW); - fStrimW << ")"; - return true; - } - -bool Writer::Visit_Logical_And(ZRef<ZExprRep_Logical_And> iRep) - { - fStrimW << "("; - sToStrim(iRep->GetLHS(), fStrimW); - fStrimW << " & "; - sToStrim(iRep->GetRHS(), fStrimW); - fStrimW << ")"; - return true; - } - -bool Writer::Visit_Logical_Or(ZRef<ZExprRep_Logical_Or> iRep) - { - fStrimW << "("; - sToStrim(iRep->GetLHS(), fStrimW); - fStrimW << " | "; - sToStrim(iRep->GetRHS(), fStrimW); - fStrimW << ")"; - return true; - } - -bool Writer::Visit_ValCondition(ZRef<ExprRep_ValCondition> iRep) - { - ZUtil_Strim_TQL::sToStrim(iRep->GetValCondition(), fStrimW); - return true; - } - -// ================================================================================================= -#pragma mark - -#pragma mark * ZUtil_Strim_TQL - -void sToStrim(const ZValCondition& iValCondition, const ZStrimW& s) - { - spToStrim(iValCondition.GetLHS(), s); - spToStrim(iValCondition.GetComparator(), s); - spToStrim(iValCondition.GetRHS(), s); - } - -void sToStrim(const ZRef<ZExprRep_Logical>& iRep, const ZStrimW& s) - { - if (iRep) - { - Writer theWriter(s); - iRep->Accept(theWriter); - } - else - { - s << "none"; - } - } - -void sWrite(const Val& iVal, const ZStrimW& s) - { ZYad_ZooLibStrim::sToStrim(sMakeYadR(iVal), s); } - -} // namespace ZUtil_Strim_TQL - -NAMESPACE_ZOOLIB_END Deleted: trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL_Spec.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL_Spec.h 2010-04-06 18:10:16 UTC (rev 1242) +++ trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_Strim_TQL_Spec.h 2010-04-06 18:12:39 UTC (rev 1243) @@ -1,46 +0,0 @@ -/* ------------------------------------------------------------------------------------------------- -Copyright (c) 2007 Andrew Green and Learning in Motion, Inc. -http://www.zoolib.org - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software -and associated documentation files (the "Software"), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, merge, publish, distribute, -sublicense, and/or sell copies of the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING -BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES -OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------------------------- */ - -#ifndef __ZUtil_Strim_TQL_Spec__ -#define __ZUtil_Strim_TQL_Spec__ -#include "zconfig.h" - -#include "zoolib/ZExpr_ValCondition.h" -#include "zoolib/ZValCondition.h" - -NAMESPACE_ZOOLIB_BEGIN - -class ZStrimW; - -namespace ZUtil_Strim_TQL { - -// ================================================================================================= -#pragma mark - -#pragma mark * ZUtil_Strim_TQL - -void sToStrim(const ZValCondition& iValCondition, const ZStrimW& iStrimW); -void sToStrim(const ZRef<ZExprRep_Logical>& iRep, const ZStrimW& iStrimW); -void sWrite(const ZVal_Expr& iVal, const ZStrimW& s); - -} // namespace ZUtil_Strim_TQL - -NAMESPACE_ZOOLIB_END - -#endif // __ZUtil_Strim_TQL_Spec__ Added: trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Physical.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Physical.cpp (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Physical.cpp 2010-04-06 18:12:39 UTC (rev 1243) @@ -0,0 +1,59 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2010 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#include "zoolib/zql/ZQL_Expr_Physical.h" + +NAMESPACE_ZOOLIB_BEGIN +namespace ZQL { + +// ================================================================================================= +#pragma mark - +#pragma mark * ExprRep_Physical + +ExprRep_Physical::ExprRep_Physical() + {} + +ExprRep_Physical::~ExprRep_Physical() + {} + +bool ExprRep_Physical::Accept(Visitor_ExprRep_Relation& iVisitor) + { + if (Visitor_ExprRep_Physical* theVisitor = + dynamic_cast<Visitor_ExprRep_Physical*>(&iVisitor)) + { + return this->Accept(*theVisitor); + } + else + { + return ExprRep_Relation::Accept(iVisitor); + } + } + +// ================================================================================================= +#pragma mark - +#pragma mark * Visitor_ExprRep_Physical + +bool Visitor_ExprRep_Physical::Visit_Physical(ZRef<ExprRep_Physical> iRep) + { + return Visitor_ExprRep_Relation::Visit_ExprRep(iRep); + } + +} // namespace ZQL +NAMESPACE_ZOOLIB_END Added: trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Physical.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Physical.h (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Physical.h 2010-04-06 18:12:39 UTC (rev 1243) @@ -0,0 +1,59 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2010 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#ifndef __ZQL_Expr_Physical__ +#define __ZQL_Expr_Physical__ 1 +#include "zconfig.h" + +#include "zoolib/zql/ZQL_Expr_Relation.h" + +NAMESPACE_ZOOLIB_BEGIN +namespace ZQL { + +// ================================================================================================= +#pragma mark - +#pragma mark * ExprRep_Physical + +class ExprRep_Physical : public ExprRep_Relation + { +protected: + ExprRep_Physical(); + +public: + virtual ~ExprRep_Physical(); + +// From ZExprRep_Relation + virtual bool Accept(Visitor_ExprRep_Relation& iVisitor); + }; + +// ================================================================================================= +#pragma mark - +#pragma mark * Visitor_ExprRep_Physical + +class Visitor_ExprRep_Physical : public virtual Visitor_ExprRep_Relation + { +public: + virtual bool Visit_Physical(ZRef<ExprRep_Physical> iRep); + }; + +} // namespace ZQL +NAMESPACE_ZOOLIB_END + +#endif // __ZQL_Expr_Physical__ Added: trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Query.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Query.cpp (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Query.cpp 2010-04-06 18:12:39 UTC (rev 1243) @@ -0,0 +1,332 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2010 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#include "zoolib/ZExpr_ValCondition.h" +#include "zoolib/zql/ZQL_Expr_Query.h" + +using std::string; +using std::vector; + +NAMESPACE_ZOOLIB_BEGIN +namespace ZQL { + +// ================================================================================================= +#pragma mark - +#pragma mark * ExprRep_Query + +ExprRep_Query::ExprRep_Query() + {} + +bool ExprRep_Query::Accept(Visitor_ExprRep_Relation& iVisitor) + { + if (Visitor_ExprRep_Query* theVisitor = + dynamic_cast<Visitor_ExprRep_Query*>(&iVisitor)) + { + return this->Accept(*theVisitor); + } + else + { + return ExprRep_Relation::Accept(iVisitor); + } + } + +// ================================================================================================= +#pragma mark - +#pragma mark * ExprRep_Query_All + +ExprRep_Query_All::ExprRep_Query_All(const string& iIDPropName) +: fIDPropName(iIDPropName) + {} + +ExprRep_Query_All::ExprRep_Query_All(const ZRelHead& iRelHead) +: fRelHead(iRelHead) + {} + +ExprRep_Query_All::ExprRep_Query_All(const string& iIDPropName, const ZRelHead& iRelHead) +: fIDPropName(iIDPropName) +, fRelHead(iRelHead) + {} + +ExprRep_Query_All::~ExprRep_Query_All() + {} + +ZRelHead ExprRep_Query_All::GetRelHead() + { + ZRelHead result = fRelHead; + if (!fIDPropName.empty()) + result |= fIDPropName; + return result; + } + +bool ExprRep_Query_All::Accept(Visitor_ExprRep_Query& iVisitor) + { return iVisitor.Visit_All(this); } + +const string& ExprRep_Query_All::GetIDPropName() + { return fIDPropName; } + +const ZRelHead& ExprRep_Query_All::GetAllRelHead() + { return fRelHead; } + +// ================================================================================================= +#pragma mark - +#pragma mark * ExprRep_Query_Explicit + +ExprRep_Query_Explicit::ExprRep_Query_Explicit(const ZVal_Expr* iVals, size_t iCount) +: fVals(iVals, iVals + iCount) + {} + +ExprRep_Query_Explicit::ExprRep_Query_Explicit(const vector<ZVal_Expr>& iVals) +: fVals(iVals) + {} + +ExprRep_Query_Explicit::~ExprRep_Query_Explicit() + {} + +ZRelHead ExprRep_Query_Explicit::GetRelHead() + { return ZRelHead(); } + +bool ExprRep_Query_Explicit::Accept(Visitor_ExprRep_Query& iVisitor) + { return iVisitor.Visit_Explicit(this); } + +const vector<ZVal_Expr>& ExprRep_Query_Explicit::GetVals() + { return fVals; } + +// ================================================================================================= +#pragma mark - +#pragma mark * Visitor_ExprRep_Query + +bool Visitor_ExprRep_Query::Visit_All(ZRef<ExprRep_Query_All> iRep) + { return Visitor_ExprRep_Relation::Visit_ExprRep(iRep); } + +bool Visitor_ExprRep_Query::Visit_Explicit(ZRef<ExprRep_Query_Explicit> iRep) + { return Visitor_ExprRep_Relation::Visit_ExprRep(iRep); } + +// ================================================================================================= +#pragma mark - +#pragma mark * Expr_Query + +Expr_Query::Expr_Query() + {} + +Expr_Query::Expr_Query(const Expr_Query& iOther) +: inherited(iOther) + {} + +Expr_Query::~Expr_Query() + {} + +Expr_Query& Expr_Query::operator=(const Expr_Query& iOther) + { + inherited::operator=(iOther); + return *this; + } + +Expr_Query::Expr_Query(const ZRef<ExprRep_Query>& iRep) +: inherited(iRep) + {} + +Expr_Query::operator ZRef<ExprRep_Query>() const + { return this->StaticCast<ExprRep_Query>(); } + +// ================================================================================================= +#pragma mark - +#pragma mark * Query operators + +Expr_Query sAll(const ZRelHead& iRelHead) + { return Expr_Query(new ExprRep_Query_All(iRelHead)); } + +Expr_Query sAllID(const string& iIDName) + { return Expr_Query(new ExprRep_Query_All(iIDName)); } + +Expr_Query sAllID(const string& iIDName, const ZRelHead& iRelHead) + { return Expr_Query(new ExprRep_Query_All(iIDName, iRelHead)); } + +Expr_Query sExplicit(const ZVal_Expr* iVals, size_t iCount) + { return Expr_Query(new ExprRep_Query_Explicit(iVals, iCount)); } + +Expr_Query sExplicit(const vector<ZVal_Expr>& iVals) + { return Expr_Query(new ExprRep_Query_Explicit(iVals)); } + +// ================================================================================================= +#pragma mark - +#pragma mark * QueryTransformer + +bool QueryTransformer::Visit_Difference(ZRef<ExprRep_Relation_Difference> iRep) + { + fResult = this->Transform_Difference(iRep); + return true; + } + +bool QueryTransformer::Visit_Intersect(ZRef<ExprRep_Relation_Intersect> iRep) + { + fResult = this->Transform_Intersect(iRep); + return true; + } + +bool QueryTransformer::Visit_Join(ZRef<ExprRep_Relation_Join> iRep) + { + fResult = this->Transform_Join(iRep); + return true; + } + +bool QueryTransformer::Visit_Project(ZRef<ExprRep_Relation_Project> iRep) + { + fResult = this->Transform_Project(iRep); + return true; + } + +bool QueryTransformer::Visit_Rename(ZRef<ExprRep_Relation_Rename> iRep) + { + fResult = this->Transform_Rename(iRep); + return true; + } + +bool QueryTransformer::Visit_Union(ZRef<ExprRep_Relation_Union> iRep) + { + fResult = this->Transform_Union(iRep); + return true; + } + +bool QueryTransformer::Visit_All(ZRef<ExprRep_Query_All> iRep) + { + fResult = this->Transform_All(iRep); + return true; + } + +bool QueryTransformer::Visit_Explicit(ZRef<ExprRep_Query_Explicit> iRep) + { + fResult = this->Transform_Explicit(iRep); + return true; + } + +bool QueryTransformer::Visit_Restrict(ZRef<ExprRep_Restrict> iRep) + { + fResult = this->Transform_Restrict(iRep); + return true; + } + +bool QueryTransformer::Visit_Select(ZRef<ExprRep_Select> iRep) + { + fResult = this->Transform_Select(iRep); + return true; + } + +ZRef<ExprRep_Relation> QueryTransformer::Transform(ZRef<ExprRep_Relation> iRep) + { + if (iRep) + { + iRep->Accept(*this); + return fResult; + } + return iRep; + } + +ZRef<ExprRep_Relation> QueryTransformer::Transform_All(ZRef<ExprRep_Query_All> iRep) + { return iRep; } + +ZRef<ExprRep_Relation> QueryTransformer::Transform_Difference( + ZRef<ExprRep_Relation_Difference> iRep) + { + ZRef<ExprRep_Relation> oldLHS = iRep->GetLHS(); + ZRef<ExprRep_Relation> oldRHS = iRep->GetRHS(); + ZRef<ExprRep_Relation> newLHS = this->Transform(oldLHS); + ZRef<ExprRep_Relation> newRHS = this->Transform(oldRHS); + if (oldLHS == newLHS && oldRHS == newRHS) + return iRep; + return new ExprRep_Relation_Difference(newLHS, newRHS); + } + +ZRef<ExprRep_Relation> QueryTransformer::Transform_Explicit(ZRef<ExprRep_Query_Explicit> iRep) + { return iRep; } + +ZRef<ExprRep_Relation> QueryTransformer::Transform_Intersect( + ZRef<ExprRep_Relation_Intersect> iRep) + { + ZRef<ExprRep_Relation> oldLHS = iRep->GetLHS(); + ZRef<ExprRep_Relation> oldRHS = iRep->GetRHS(); + ZRef<ExprRep_Relation> newLHS = this->Transform(oldLHS); + ZRef<ExprRep_Relation> newRHS = this->Transform(oldRHS); + if (oldLHS == newLHS && oldRHS == newRHS) + return iRep; + return new ExprRep_Relation_Intersect(newLHS, newRHS); + } + +ZRef<ExprRep_Relation> QueryTransformer::Transform_Join(ZRef<ExprRep_Relation_Join> iRep) + { + ZRef<ExprRep_Relation> oldLHS = iRep->GetLHS(); + ZRef<ExprRep_Relation> oldRHS = iRep->GetRHS(); + ZRef<ExprRep_Relation> newLHS = this->Transform(oldLHS); + ZRef<ExprRep_Relation> newRHS = this->Transform(oldRHS); + if (oldLHS == newLHS && oldRHS == newRHS) + return iRep; + return new ExprRep_Relation_Join(newLHS, newRHS); + } + +ZRef<ExprRep_Relation> QueryTransformer::Transform_Project( + ZRef<ExprRep_Relation_Project> iRep) + { + ZRef<ExprRep_Relation> oldRep = iRep->GetExprRep(); + ZRef<ExprRep_Relation> newRep = this->Transform(oldRep); + if (oldRep == newRep) + return iRep; + return new ExprRep_Relation_Project(newRep, iRep->GetRelHead()); + } + +ZRef<ExprRep_Relation> QueryTransformer::Transform_Rename( + ZRef<ExprRep_Relation_Rename> iRep) + { + ZRef<ExprRep_Relation> oldRep = iRep->GetExprRep(); + ZRef<ExprRep_Relation> newRep = this->Transform(oldRep); + if (oldRep == newRep) + return iRep; + return new ExprRep_Relation_Rename(newRep, iRep->GetOld(), iRep->GetNew()); + } + +ZRef<ExprRep_Relation> QueryTransformer::Transform_Restrict(ZRef<ExprRep_Restrict> iRep) + { + ZRef<ExprRep_Relation> oldRep = iRep->GetExprRep(); + ZRef<ExprRep_Relation> newRep = this->Transform(oldRep); + if (oldRep == newRep) + return iRep; + return new ExprRep_Restrict(iRep->GetValCondition(), newRep); + } + +ZRef<ExprRep_Relation> QueryTransformer::Transform_Select(ZRef<ExprRep_Select> iRep) + { + ZRef<ExprRep_Relation> oldRep = iRep->GetExprRep_Relation(); + ZRef<ExprRep_Relation> newRep = this->Transform(oldRep); + if (oldRep == newRep) + return iRep; + return new ExprRep_Select(iRep->GetExprRep_Logical(), newRep); + } + +ZRef<ExprRep_Relation> QueryTransformer::Transform_Union(ZRef<ExprRep_Relation_Union> iRep) + { + ZRef<ExprRep_Relation> oldLHS = iRep->GetLHS(); + ZRef<ExprRep_Relation> oldRHS = iRep->GetRHS(); + ZRef<ExprRep_Relation> newLHS = this->Transform(oldLHS); + ZRef<ExprRep_Relation> newRHS = this->Transform(oldRHS); + if (oldLHS == newLHS && oldRHS == newRHS) + return iRep; + return new ExprRep_Relation_Union(newLHS, newRHS); + } + +} // namespace ZQL +NAMESPACE_ZOOLIB_END Added: trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Query.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Query.h (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Query.h 2010-04-06 18:12:39 UTC (rev 1243) @@ -0,0 +1,206 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2010 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#ifndef __ZQL_Expr_Query__ +#define __ZQL_Expr_Query__ 1 +#include "zconfig.h" + +#include "zoolib/ZValCondition.h" + +#include "zoolib/zql/ZQL_Expr_Relation.h" +#include "zoolib/zql/ZQL_Expr_Restrict_T.h" +#include "zoolib/zql/ZQL_Expr_Select.h" + +NAMESPACE_ZOOLIB_BEGIN +namespace ZQL { + +typedef Expr_Restrict_T<ZVal_Expr> Expr_Restrict; +typedef ExprRep_Restrict_T<ZVal_Expr> ExprRep_Restrict; +typedef Visitor_ExprRep_Restrict_T<ZVal_Expr> Visitor_ExprRep_Restrict; + +class Visitor_ExprRep_Query; + +// ================================================================================================= +#pragma mark - +#pragma mark * ExprRep_Query + +class ExprRep_Query : public ExprRep_Relation + { +protected: + ExprRep_Query(); + +public: +// From ExprRep_Relation + virtual bool Accept(Visitor_ExprRep_Relation& iVisitor); + +// Our protocol + virtual bool Accept(Visitor_ExprRep_Query& iVisitor) = 0; + }; + +// ================================================================================================= +#pragma mark - +#pragma mark * ExprRep_Query_All + +class ExprRep_Query_All : public ExprRep_Query + { +public: + ExprRep_Query_All(const std::string& iIDPropName); + ExprRep_Query_All(const ZRelHead& iRelHead); + ExprRep_Query_All(const std::string& iIDPropName, const ZRelHead& iRelHead); + + virtual ~ExprRep_Query_All(); + +// From ExprRep_Relation via ExprRep_Query + virtual ZRelHead GetRelHead(); + +// From ExprRep_Query + virtual bool Accept(Visitor_ExprRep_Query& iVisitor); + +// Our protocol + const std::string& GetIDPropName(); + const ZRelHead& GetAllRelHead(); + +private: + const std::string fIDPropName; + const ZRelHead fRelHead; + }; + +// ================================================================================================= +#pragma mark - +#pragma mark * ExprRep_Query_Explicit + +class ExprRep_Query_Explicit : public ExprRep_Query + { +public: + ExprRep_Query_Explicit(const ZVal_Expr* iVals, size_t iCount); + ExprRep_Query_Explicit(const std::vector<ZVal_Expr>& iVals); + + virtual ~ExprRep_Query_Explicit(); + +// From ExprRep_Relation via ExprRep_Query + virtual ZRelHead GetRelHead(); + +// From ExprRep_Query + virtual bool Accept(Visitor_ExprRep_Query& iVisitor); + +// Our protocol + const std::vector<ZVal_Expr>& GetVals(); + +private: + const std::vector<ZVal_Expr> fVals; + }; + +// ================================================================================================= +#pragma mark - +#pragma mark * Visitor_ExprRep_Query + +class Visitor_ExprRep_Query : public virtual Visitor_ExprRep_Relation + { +public: + virtual bool Visit_All(ZRef<ExprRep_Query_All> iRep); + virtual bool Visit_Explicit(ZRef<ExprRep_Query_Explicit> iRep); + }; + +// ================================================================================================= +#pragma mark - +#pragma mark * Expr_Query + +class Expr_Query : public Expr_Relation + { + typedef Expr_Relation inherited; + + Expr_Query operator=(const Expr_Relation&); + Expr_Query operator=(const ZRef<ExprRep_Relation>&); + +public: + Expr_Query(); + Expr_Query(const Expr_Query& iOther); + ~Expr_Query(); + Expr_Query& operator=(const Expr_Query& iOther); + + Expr_Query(const ZRef<ExprRep_Query>& iRep); + + operator ZRef<ExprRep_Query>() const; + }; + +// ================================================================================================= +#pragma mark - +#pragma mark * Query operators + +Expr_Query sAll(const ZRelHead& iRelHead); + +Expr_Query sAllID(const std::string& iIDName); + +Expr_Query sAllID(const std::string& iIDName, const ZRelHead& iRelHead); + +Expr_Query sExplicit(const ZVal_Expr* iVals, size_t iCount); + +Expr_Query sExplicit(const std::vector<ZVal_Expr>& iVals); + +// ================================================================================================= +#pragma mark - +#pragma mark * QueryTransformer + +class QueryTransformer +: public Visitor_ExprRep_Query +, public Visitor_ExprRep_Restrict +, public Visitor_ExprRep_Select + { +public: +// From Visitor_ExprRep_Relation via Visitor_ExprRep_Query + virtual bool Visit_Difference(ZRef<ExprRep_Relation_Difference> iRep); + virtual bool Visit_Intersect(ZRef<ExprRep_Relation_Intersect> iRep); + virtual bool Visit_Join(ZRef<ExprRep_Relation_Join> iRep); + virtual bool Visit_Project(ZRef<ExprRep_Relation_Project> iRep); + virtual bool Visit_Rename(ZRef<ExprRep_Relation_Rename> iRep); + virtual bool Visit_Union(ZRef<ExprRep_Relation_Union> iRep); + +// From Visitor_ExprRep_Query + virtual bool Visit_All(ZRef<ExprRep_Query_All> iRep); + virtual bool Visit_Explicit(ZRef<ExprRep_Query_Explicit> iRep); + +// From Visitor_ExprRep_Restrict + virtual bool Visit_Restrict(ZRef<ExprRep_Restrict> iRep); + +// From Visitor_ExprRep_Select + virtual bool Visit_Select(ZRef<ExprRep_Select> iRep); + +// Our protocol + ZRef<ExprRep_Relation> Transform(ZRef<ExprRep_Relation> iRep); + + virtual ZRef<ExprRep_Relation> Transform_All(ZRef<ExprRep_Query_All> iRep); + virtual ZRef<ExprRep_Relation> Transform_Difference(ZRef<ExprRep_Relation_Difference> iRep); + virtual ZRef<ExprRep_Relation> Transform_Explicit(ZRef<ExprRep_Query_Explicit> iRep); + virtual ZRef<ExprRep_Relation> Transform_Intersect(ZRef<ExprRep_Relation_Intersect> iRep); + virtual ZRef<ExprRep_Relation> Transform_Join(ZRef<ExprRep_Relation_Join> iRep); + virtual ZRef<ExprRep_Relation> Transform_Project(ZRef<ExprRep_Relation_Project> iRep); + virtual ZRef<ExprRep_Relation> Transform_Rename(ZRef<ExprRep_Relation_Rename> iRep); + virtual ZRef<ExprRep_Relation> Transform_Restrict(ZRef<ExprRep_Restrict> iRep); + virtual ZRef<ExprRep_Relation> Transform_Select(ZRef<ExprRep_Select> iRep); + virtual ZRef<ExprRep_Relation> Transform_Union(ZRef<ExprRep_Relation_Union> iRep); + +private: + ZRef<ExprRep_Relation> fResult; + }; + +}// namespace ZQL +NAMESPACE_ZOOLIB_END + +#endif // __ZQL_Expr_Query__ Added: trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Relation.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Exp... [truncated message content] |
From: <ag...@us...> - 2010-04-06 22:27:23
|
Revision: 1245 http://zoolib.svn.sourceforge.net/zoolib/?rev=1245&view=rev Author: agreen Date: 2010-04-06 22:27:15 +0000 (Tue, 06 Apr 2010) Log Message: ----------- Add ToStrim and Transform visitors. Logical --> Logic (as we're using Relation not Relational). Modified Paths: -------------- trunk/zoolib/source/cxx/more/zoolib/tql/ZTQLTest.cpp trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Optimize.cpp trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_TQLConvert.cpp trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Select.cpp trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Select.h trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Util_Strim_Query.cpp trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Relation_ToStrim.cpp trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Relation_ToStrim.h trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Select_ToStrim.cpp trunk/zoolib/source/cxx/zoolib/ZExpr_ValCondition.h trunk/zoolib/source/cxx/zoolib/ZExpr_ValCondition_T.h trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_ToStrim.cpp trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_ValCondition_ToStrim.cpp trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_ValCondition_ToStrim.h Added Paths: ----------- trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_All.cpp trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_All.h trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Relation_Transform.cpp trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Relation_Transform.h trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Restrict_Transform.cpp trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Restrict_Transform.h trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Select_Transform.cpp trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Select_Transform.h trunk/zoolib/source/cxx/zoolib/ZExpr_Logic.cpp trunk/zoolib/source/cxx/zoolib/ZExpr_Logic.h trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_Logic_ToStrim.cpp trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_Logic_ToStrim.h trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_Logic_Transform.cpp trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_Logic_Transform.h trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_Transform.cpp trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_Transform.h Removed Paths: ------------- trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Query.cpp trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Query.h trunk/zoolib/source/cxx/zoolib/ZExpr_Logical.cpp trunk/zoolib/source/cxx/zoolib/ZExpr_Logical.h trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_Logical_ToStrim.cpp trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_Logical_ToStrim.h Modified: trunk/zoolib/source/cxx/more/zoolib/tql/ZTQLTest.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tql/ZTQLTest.cpp 2010-04-06 19:12:48 UTC (rev 1244) +++ trunk/zoolib/source/cxx/more/zoolib/tql/ZTQLTest.cpp 2010-04-06 22:27:15 UTC (rev 1245) @@ -1,5 +1,7 @@ #include "zoolib/tql/ZTQL_Optimize.h" -#include "zoolib/zql/ZQL_Expr_Query.h" +#include "zoolib/zql/ZQL_Expr_All.h" +#include "zoolib/zql/ZQL_Expr_Restrict.h" +#include "zoolib/zql/ZQL_Expr_Select.h" #include "zoolib/zql/ZQL_Util_Strim_Query.h" @@ -30,7 +32,7 @@ using std::set; using std::string; -typedef ZExpr_Logical Spec; +typedef ZExpr_Logic Spec; typedef Expr_Relation Query; typedef ZMap_Expr Map; typedef ZRelHead RelHead; @@ -50,11 +52,11 @@ //static Query D(const Query& iQuery1, const Query& iQuery2) // { return sDifference(iQuery1, iQuery2); } -static Query E(const Val* iVals, size_t iCount) - { return sExplicit(iVals, iCount); } +//static Query E(const Val* iVals, size_t iCount) +// { return sExplicit(iVals, iCount); } -static Query E(const std::vector<Val>& iVals) - { return sExplicit(iVals); } +//static Query E(const std::vector<Val>& iVals) +// { return sExplicit(iVals); } static Query I(const Query& iQuery1, const Query& iQuery2) { return sIntersect(iQuery1, iQuery2); } @@ -404,7 +406,7 @@ ZYadOptions theYadOptions(true); - ZExpr_Logical theCondition = CName("Disc Number") == CConst(int32(2)) & CName("Track Number") > CConst(int32(10)); + ZExpr_Logic theCondition = CName("Disc Number") == CConst(int32(2)) & CName("Track Number") > CConst(int32(10)); // const ZVal_Any theVal = sFromYadR(ZVal_Any(), theYadR); // theYadR = sMakeYadR(theVal); Modified: trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Optimize.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Optimize.cpp 2010-04-06 19:12:48 UTC (rev 1244) +++ trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Optimize.cpp 2010-04-06 22:27:15 UTC (rev 1245) @@ -20,7 +20,9 @@ #include "zoolib/tql/ZTQL_Optimize.h" -#include "zoolib/zql/ZQL_Expr_Query.h" +//#include "zoolib/zql/ZQL_Expr_Query.h" +#include "zoolib/zql/ZQL_Expr_Restrict.h" +#include "zoolib/zql/ZQL_Visitor_ExprRep_Select_Transform.h" #include "zoolib/ZExpr_ValCondition.h" NAMESPACE_ZOOLIB_BEGIN @@ -52,11 +54,11 @@ } } -static void spGather(ZRef<ZExprRep_Logical> iRep, CondUnion& oResult) +static void spGather(ZRef<ZExprRep_Logic> iRep, CondUnion& oResult) { ZAssert(oResult.empty()); - if (ZRef<ZExprRep_Logical_And> lo = ZRefDynamicCast<ZExprRep_Logical_And>(iRep)) + if (ZRef<ZExprRep_Logic_And> lo = ZRefDynamicCast<ZExprRep_Logic_And>(iRep)) { CondUnion left; spGather(lo->GetLHS(), left); @@ -64,7 +66,7 @@ spGather(lo->GetRHS(), right); spCrossMultiply(left, right, oResult); } - else if (ZRef<ZExprRep_Logical_Or> lo = ZRefDynamicCast<ZExprRep_Logical_Or>(iRep)) + else if (ZRef<ZExprRep_Logic_Or> lo = ZRefDynamicCast<ZExprRep_Logic_Or>(iRep)) { CondUnion left; spGather(lo->GetLHS(), left); @@ -78,11 +80,11 @@ oResult.resize(1); oResult[0].push_back(lo->GetValCondition()); } - else if (ZRef<ZExprRep_Logical_True> lo = ZRefDynamicCast<ZExprRep_Logical_True>(iRep)) + else if (ZRef<ZExprRep_Logic_True> lo = ZRefDynamicCast<ZExprRep_Logic_True>(iRep)) { oResult.resize(1); } - else if (ZRef<ZExprRep_Logical_False> lo = ZRefDynamicCast<ZExprRep_Logical_False>(iRep)) + else if (ZRef<ZExprRep_Logic_False> lo = ZRefDynamicCast<ZExprRep_Logic_False>(iRep)) { // Do nothing. } @@ -98,31 +100,31 @@ } static ZRef<ExprRep_Relation> spConvertSelect( - ZRef<ExprRep_Relation> iRelational, ZRef<ZExprRep_Logical> iLogical) + ZRef<ExprRep_Relation> iRelation, ZRef<ZExprRep_Logic> iLogical) { - if (!iRelational) + if (!iRelation) return ZRef<ExprRep_Relation>(); CondUnion resultLogical; spGather(iLogical, resultLogical); - ZRef<ExprRep_Relation> resultRelational; + ZRef<ExprRep_Relation> resultRelation; for (CondUnion::const_iterator iterUnion = resultLogical.begin(); iterUnion != resultLogical.end(); ++iterUnion) { - ZRef<ExprRep_Relation> current = iRelational; + ZRef<ExprRep_Relation> current = iRelation; for (CondSect::const_iterator iterSect = iterUnion->begin(); iterSect != iterUnion->end(); ++iterSect) { current = new ExprRep_Restrict(*iterSect, current); } - if (resultRelational) - resultRelational = new ExprRep_Relation_Union(current, resultRelational); + if (resultRelation) + resultRelation = new ExprRep_Relation_Union(current, resultRelation); else - resultRelational = current; + resultRelation = current; } - return resultRelational; + return resultRelation; } // ================================================================================================= @@ -131,16 +133,19 @@ namespace ZANONYMOUS { -class Optimize : public QueryTransformer +class Optimize +: public virtual Visitor_ExprRep_Select_Transform { public: - virtual ZRef<ExprRep_Relation> Transform_Select(ZRef<ExprRep_Select> iRep); +// From Visitor_ExprRep_Select + virtual bool Visit_Select(ZRef<ExprRep_Select> iRep); }; -ZRef<ExprRep_Relation> Optimize::Transform_Select(ZRef<ExprRep_Select> iRep) +bool Optimize::Visit_Select(ZRef<ExprRep_Select> iRep) { - ZRef<ExprRep_Relation> newRep = this->Transform(iRep->GetExprRep_Relation()); - return spConvertSelect(newRep, iRep->GetExprRep_Logical()); + ZRef<ExprRep_Relation> newRep = this->Transform(iRep->GetExprRep_Relation()).DynamicCast<ExprRep_Relation>(); + fResult = spConvertSelect(newRep, iRep->GetExprRep_Logic()); + return true; } } // anonymous namespace @@ -148,7 +153,7 @@ namespace ZQL { ZRef<ExprRep_Relation> sOptimize(ZRef<ExprRep_Relation> iRep) - { return Optimize().Transform(iRep); } + { return Optimize().Transform(iRep).DynamicCast<ExprRep_Relation>(); } } // namespace ZQL NAMESPACE_ZOOLIB_END Modified: trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_TQLConvert.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_TQLConvert.cpp 2010-04-06 19:12:48 UTC (rev 1244) +++ trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_TQLConvert.cpp 2010-04-06 22:27:15 UTC (rev 1245) @@ -24,7 +24,7 @@ NAMESPACE_ZOOLIB_BEGIN -typedef ZExpr_Logical Spec; +typedef ZExpr_Logic Spec; typedef ZExpr_Relation Query; typedef ZMap_Expr Map; typedef ZRelHead RelHead; @@ -86,7 +86,7 @@ if (sisfirst) { sisfirst = false; - sect = ZExpr_Logical(new ZExprRep_ValCondition(theCondition)); + sect = ZExpr_Logic(new ZExprRep_ValCondition(theCondition)); } else { Added: trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_All.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_All.cpp (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_All.cpp 2010-04-06 22:27:15 UTC (rev 1245) @@ -0,0 +1,96 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2010 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#include "zoolib/zql/ZQL_Expr_All.h" + +NAMESPACE_ZOOLIB_BEGIN +namespace ZQL { + +using std::string; + +// ================================================================================================= +#pragma mark - +#pragma mark * ExprRep_All + +ExprRep_All::ExprRep_All(const string& iIDPropName) +: fIDPropName(iIDPropName) + {} + +ExprRep_All::ExprRep_All(const ZRelHead& iRelHead) +: fRelHead(iRelHead) + {} + +ExprRep_All::ExprRep_All(const string& iIDPropName, const ZRelHead& iRelHead) +: fIDPropName(iIDPropName) +, fRelHead(iRelHead) + {} + +ExprRep_All::~ExprRep_All() + {} + +bool ExprRep_All::Accept(Visitor_ExprRep_Relation& iVisitor) + { + if (Visitor_ExprRep_All* theVisitor = + dynamic_cast<Visitor_ExprRep_All*>(&iVisitor)) + { + return theVisitor->Visit_All(this); + } + else + { + return ExprRep_Relation::Accept(iVisitor); + } + } + +ZRelHead ExprRep_All::GetRelHead() + { + ZRelHead result = fRelHead; + if (!fIDPropName.empty()) + result |= fIDPropName; + return result; + } + +const string& ExprRep_All::GetIDPropName() + { return fIDPropName; } + +const ZRelHead& ExprRep_All::GetAllRelHead() + { return fRelHead; } + +// ================================================================================================= +#pragma mark - +#pragma mark * Visitor_ExprRep_All + +bool Visitor_ExprRep_All::Visit_All(ZRef<ExprRep_All> iRep) + { return Visitor_ExprRep_Relation::Visit_ExprRep(iRep); } + +// ================================================================================================= +#pragma mark - +#pragma mark * Query operators + +Expr_Relation sAll(const ZRelHead& iRelHead) + { return Expr_Relation(new ExprRep_All(iRelHead)); } + +Expr_Relation sAllID(const string& iIDName) + { return Expr_Relation(new ExprRep_All(iIDName)); } + +Expr_Relation sAllID(const string& iIDName, const ZRelHead& iRelHead) + { return Expr_Relation(new ExprRep_All(iIDName, iRelHead)); } + +} // namespace ZQL +NAMESPACE_ZOOLIB_END Added: trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_All.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_All.h (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_All.h 2010-04-06 22:27:15 UTC (rev 1245) @@ -0,0 +1,80 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2010 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#ifndef __ZQL_Expr_All__ +#define __ZQL_Expr_All__ 1 +#include "zconfig.h" + +#include "zoolib/zql/ZQL_Expr_Relation.h" + +NAMESPACE_ZOOLIB_BEGIN +namespace ZQL { + +// ================================================================================================= +#pragma mark - +#pragma mark * ExprRep_All + +class ExprRep_All : public ExprRep_Relation + { +public: + ExprRep_All(const std::string& iIDPropName); + ExprRep_All(const ZRelHead& iRelHead); + ExprRep_All(const std::string& iIDPropName, const ZRelHead& iRelHead); + + virtual ~ExprRep_All(); + +// From ExprRep_Relation + virtual bool Accept(Visitor_ExprRep_Relation& iVisitor); + + virtual ZRelHead GetRelHead(); + +// Our protocol + const std::string& GetIDPropName(); + const ZRelHead& GetAllRelHead(); + +private: + const std::string fIDPropName; + const ZRelHead fRelHead; + }; + +// ================================================================================================= +#pragma mark - +#pragma mark * Visitor_ExprRep_All + +class Visitor_ExprRep_All : public virtual Visitor_ExprRep_Relation + { +public: + virtual bool Visit_All(ZRef<ExprRep_All> iRep); + }; + +// ================================================================================================= +#pragma mark - +#pragma mark * Query operators + +Expr_Relation sAll(const ZRelHead& iRelHead); + +Expr_Relation sAllID(const std::string& iIDName); + +Expr_Relation sAllID(const std::string& iIDName, const ZRelHead& iRelHead); + +}// namespace ZQL +NAMESPACE_ZOOLIB_END + +#endif // __ZQL_Expr_All__ Deleted: trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Query.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Query.cpp 2010-04-06 19:12:48 UTC (rev 1244) +++ trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Query.cpp 2010-04-06 22:27:15 UTC (rev 1245) @@ -1,332 +0,0 @@ -/* ------------------------------------------------------------------------------------------------- -Copyright (c) 2010 Andrew Green -http://www.zoolib.org - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software -and associated documentation files (the "Software"), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, merge, publish, distribute, -sublicense, and/or sell copies of the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING -BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES -OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------------------------- */ - -#include "zoolib/ZExpr_ValCondition.h" -#include "zoolib/zql/ZQL_Expr_Query.h" - -using std::string; -using std::vector; - -NAMESPACE_ZOOLIB_BEGIN -namespace ZQL { - -// ================================================================================================= -#pragma mark - -#pragma mark * ExprRep_Query - -ExprRep_Query::ExprRep_Query() - {} - -bool ExprRep_Query::Accept(Visitor_ExprRep_Relation& iVisitor) - { - if (Visitor_ExprRep_Query* theVisitor = - dynamic_cast<Visitor_ExprRep_Query*>(&iVisitor)) - { - return this->Accept(*theVisitor); - } - else - { - return ExprRep_Relation::Accept(iVisitor); - } - } - -// ================================================================================================= -#pragma mark - -#pragma mark * ExprRep_Query_All - -ExprRep_Query_All::ExprRep_Query_All(const string& iIDPropName) -: fIDPropName(iIDPropName) - {} - -ExprRep_Query_All::ExprRep_Query_All(const ZRelHead& iRelHead) -: fRelHead(iRelHead) - {} - -ExprRep_Query_All::ExprRep_Query_All(const string& iIDPropName, const ZRelHead& iRelHead) -: fIDPropName(iIDPropName) -, fRelHead(iRelHead) - {} - -ExprRep_Query_All::~ExprRep_Query_All() - {} - -ZRelHead ExprRep_Query_All::GetRelHead() - { - ZRelHead result = fRelHead; - if (!fIDPropName.empty()) - result |= fIDPropName; - return result; - } - -bool ExprRep_Query_All::Accept(Visitor_ExprRep_Query& iVisitor) - { return iVisitor.Visit_All(this); } - -const string& ExprRep_Query_All::GetIDPropName() - { return fIDPropName; } - -const ZRelHead& ExprRep_Query_All::GetAllRelHead() - { return fRelHead; } - -// ================================================================================================= -#pragma mark - -#pragma mark * ExprRep_Query_Explicit - -ExprRep_Query_Explicit::ExprRep_Query_Explicit(const ZVal_Expr* iVals, size_t iCount) -: fVals(iVals, iVals + iCount) - {} - -ExprRep_Query_Explicit::ExprRep_Query_Explicit(const vector<ZVal_Expr>& iVals) -: fVals(iVals) - {} - -ExprRep_Query_Explicit::~ExprRep_Query_Explicit() - {} - -ZRelHead ExprRep_Query_Explicit::GetRelHead() - { return ZRelHead(); } - -bool ExprRep_Query_Explicit::Accept(Visitor_ExprRep_Query& iVisitor) - { return iVisitor.Visit_Explicit(this); } - -const vector<ZVal_Expr>& ExprRep_Query_Explicit::GetVals() - { return fVals; } - -// ================================================================================================= -#pragma mark - -#pragma mark * Visitor_ExprRep_Query - -bool Visitor_ExprRep_Query::Visit_All(ZRef<ExprRep_Query_All> iRep) - { return Visitor_ExprRep_Relation::Visit_ExprRep(iRep); } - -bool Visitor_ExprRep_Query::Visit_Explicit(ZRef<ExprRep_Query_Explicit> iRep) - { return Visitor_ExprRep_Relation::Visit_ExprRep(iRep); } - -// ================================================================================================= -#pragma mark - -#pragma mark * Expr_Query - -Expr_Query::Expr_Query() - {} - -Expr_Query::Expr_Query(const Expr_Query& iOther) -: inherited(iOther) - {} - -Expr_Query::~Expr_Query() - {} - -Expr_Query& Expr_Query::operator=(const Expr_Query& iOther) - { - inherited::operator=(iOther); - return *this; - } - -Expr_Query::Expr_Query(const ZRef<ExprRep_Query>& iRep) -: inherited(iRep) - {} - -Expr_Query::operator ZRef<ExprRep_Query>() const - { return this->StaticCast<ExprRep_Query>(); } - -// ================================================================================================= -#pragma mark - -#pragma mark * Query operators - -Expr_Query sAll(const ZRelHead& iRelHead) - { return Expr_Query(new ExprRep_Query_All(iRelHead)); } - -Expr_Query sAllID(const string& iIDName) - { return Expr_Query(new ExprRep_Query_All(iIDName)); } - -Expr_Query sAllID(const string& iIDName, const ZRelHead& iRelHead) - { return Expr_Query(new ExprRep_Query_All(iIDName, iRelHead)); } - -Expr_Query sExplicit(const ZVal_Expr* iVals, size_t iCount) - { return Expr_Query(new ExprRep_Query_Explicit(iVals, iCount)); } - -Expr_Query sExplicit(const vector<ZVal_Expr>& iVals) - { return Expr_Query(new ExprRep_Query_Explicit(iVals)); } - -// ================================================================================================= -#pragma mark - -#pragma mark * QueryTransformer - -bool QueryTransformer::Visit_Difference(ZRef<ExprRep_Relation_Difference> iRep) - { - fResult = this->Transform_Difference(iRep); - return true; - } - -bool QueryTransformer::Visit_Intersect(ZRef<ExprRep_Relation_Intersect> iRep) - { - fResult = this->Transform_Intersect(iRep); - return true; - } - -bool QueryTransformer::Visit_Join(ZRef<ExprRep_Relation_Join> iRep) - { - fResult = this->Transform_Join(iRep); - return true; - } - -bool QueryTransformer::Visit_Project(ZRef<ExprRep_Relation_Project> iRep) - { - fResult = this->Transform_Project(iRep); - return true; - } - -bool QueryTransformer::Visit_Rename(ZRef<ExprRep_Relation_Rename> iRep) - { - fResult = this->Transform_Rename(iRep); - return true; - } - -bool QueryTransformer::Visit_Union(ZRef<ExprRep_Relation_Union> iRep) - { - fResult = this->Transform_Union(iRep); - return true; - } - -bool QueryTransformer::Visit_All(ZRef<ExprRep_Query_All> iRep) - { - fResult = this->Transform_All(iRep); - return true; - } - -bool QueryTransformer::Visit_Explicit(ZRef<ExprRep_Query_Explicit> iRep) - { - fResult = this->Transform_Explicit(iRep); - return true; - } - -bool QueryTransformer::Visit_Restrict(ZRef<ExprRep_Restrict> iRep) - { - fResult = this->Transform_Restrict(iRep); - return true; - } - -bool QueryTransformer::Visit_Select(ZRef<ExprRep_Select> iRep) - { - fResult = this->Transform_Select(iRep); - return true; - } - -ZRef<ExprRep_Relation> QueryTransformer::Transform(ZRef<ExprRep_Relation> iRep) - { - if (iRep) - { - iRep->Accept(*this); - return fResult; - } - return iRep; - } - -ZRef<ExprRep_Relation> QueryTransformer::Transform_All(ZRef<ExprRep_Query_All> iRep) - { return iRep; } - -ZRef<ExprRep_Relation> QueryTransformer::Transform_Difference( - ZRef<ExprRep_Relation_Difference> iRep) - { - ZRef<ExprRep_Relation> oldLHS = iRep->GetLHS(); - ZRef<ExprRep_Relation> oldRHS = iRep->GetRHS(); - ZRef<ExprRep_Relation> newLHS = this->Transform(oldLHS); - ZRef<ExprRep_Relation> newRHS = this->Transform(oldRHS); - if (oldLHS == newLHS && oldRHS == newRHS) - return iRep; - return new ExprRep_Relation_Difference(newLHS, newRHS); - } - -ZRef<ExprRep_Relation> QueryTransformer::Transform_Explicit(ZRef<ExprRep_Query_Explicit> iRep) - { return iRep; } - -ZRef<ExprRep_Relation> QueryTransformer::Transform_Intersect( - ZRef<ExprRep_Relation_Intersect> iRep) - { - ZRef<ExprRep_Relation> oldLHS = iRep->GetLHS(); - ZRef<ExprRep_Relation> oldRHS = iRep->GetRHS(); - ZRef<ExprRep_Relation> newLHS = this->Transform(oldLHS); - ZRef<ExprRep_Relation> newRHS = this->Transform(oldRHS); - if (oldLHS == newLHS && oldRHS == newRHS) - return iRep; - return new ExprRep_Relation_Intersect(newLHS, newRHS); - } - -ZRef<ExprRep_Relation> QueryTransformer::Transform_Join(ZRef<ExprRep_Relation_Join> iRep) - { - ZRef<ExprRep_Relation> oldLHS = iRep->GetLHS(); - ZRef<ExprRep_Relation> oldRHS = iRep->GetRHS(); - ZRef<ExprRep_Relation> newLHS = this->Transform(oldLHS); - ZRef<ExprRep_Relation> newRHS = this->Transform(oldRHS); - if (oldLHS == newLHS && oldRHS == newRHS) - return iRep; - return new ExprRep_Relation_Join(newLHS, newRHS); - } - -ZRef<ExprRep_Relation> QueryTransformer::Transform_Project( - ZRef<ExprRep_Relation_Project> iRep) - { - ZRef<ExprRep_Relation> oldRep = iRep->GetExprRep(); - ZRef<ExprRep_Relation> newRep = this->Transform(oldRep); - if (oldRep == newRep) - return iRep; - return new ExprRep_Relation_Project(newRep, iRep->GetRelHead()); - } - -ZRef<ExprRep_Relation> QueryTransformer::Transform_Rename( - ZRef<ExprRep_Relation_Rename> iRep) - { - ZRef<ExprRep_Relation> oldRep = iRep->GetExprRep(); - ZRef<ExprRep_Relation> newRep = this->Transform(oldRep); - if (oldRep == newRep) - return iRep; - return new ExprRep_Relation_Rename(newRep, iRep->GetOld(), iRep->GetNew()); - } - -ZRef<ExprRep_Relation> QueryTransformer::Transform_Restrict(ZRef<ExprRep_Restrict> iRep) - { - ZRef<ExprRep_Relation> oldRep = iRep->GetExprRep(); - ZRef<ExprRep_Relation> newRep = this->Transform(oldRep); - if (oldRep == newRep) - return iRep; - return new ExprRep_Restrict(iRep->GetValCondition(), newRep); - } - -ZRef<ExprRep_Relation> QueryTransformer::Transform_Select(ZRef<ExprRep_Select> iRep) - { - ZRef<ExprRep_Relation> oldRep = iRep->GetExprRep_Relation(); - ZRef<ExprRep_Relation> newRep = this->Transform(oldRep); - if (oldRep == newRep) - return iRep; - return new ExprRep_Select(iRep->GetExprRep_Logical(), newRep); - } - -ZRef<ExprRep_Relation> QueryTransformer::Transform_Union(ZRef<ExprRep_Relation_Union> iRep) - { - ZRef<ExprRep_Relation> oldLHS = iRep->GetLHS(); - ZRef<ExprRep_Relation> oldRHS = iRep->GetRHS(); - ZRef<ExprRep_Relation> newLHS = this->Transform(oldLHS); - ZRef<ExprRep_Relation> newRHS = this->Transform(oldRHS); - if (oldLHS == newLHS && oldRHS == newRHS) - return iRep; - return new ExprRep_Relation_Union(newLHS, newRHS); - } - -} // namespace ZQL -NAMESPACE_ZOOLIB_END Deleted: trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Query.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Query.h 2010-04-06 19:12:48 UTC (rev 1244) +++ trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Query.h 2010-04-06 22:27:15 UTC (rev 1245) @@ -1,206 +0,0 @@ -/* ------------------------------------------------------------------------------------------------- -Copyright (c) 2010 Andrew Green -http://www.zoolib.org - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software -and associated documentation files (the "Software"), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, merge, publish, distribute, -sublicense, and/or sell copies of the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING -BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES -OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------------------------- */ - -#ifndef __ZQL_Expr_Query__ -#define __ZQL_Expr_Query__ 1 -#include "zconfig.h" - -#include "zoolib/ZValCondition.h" - -#include "zoolib/zql/ZQL_Expr_Relation.h" -#include "zoolib/zql/ZQL_Expr_Restrict_T.h" -#include "zoolib/zql/ZQL_Expr_Select.h" - -NAMESPACE_ZOOLIB_BEGIN -namespace ZQL { - -typedef Expr_Restrict_T<ZVal_Expr> Expr_Restrict; -typedef ExprRep_Restrict_T<ZVal_Expr> ExprRep_Restrict; -typedef Visitor_ExprRep_Restrict_T<ZVal_Expr> Visitor_ExprRep_Restrict; - -class Visitor_ExprRep_Query; - -// ================================================================================================= -#pragma mark - -#pragma mark * ExprRep_Query - -class ExprRep_Query : public ExprRep_Relation - { -protected: - ExprRep_Query(); - -public: -// From ExprRep_Relation - virtual bool Accept(Visitor_ExprRep_Relation& iVisitor); - -// Our protocol - virtual bool Accept(Visitor_ExprRep_Query& iVisitor) = 0; - }; - -// ================================================================================================= -#pragma mark - -#pragma mark * ExprRep_Query_All - -class ExprRep_Query_All : public ExprRep_Query - { -public: - ExprRep_Query_All(const std::string& iIDPropName); - ExprRep_Query_All(const ZRelHead& iRelHead); - ExprRep_Query_All(const std::string& iIDPropName, const ZRelHead& iRelHead); - - virtual ~ExprRep_Query_All(); - -// From ExprRep_Relation via ExprRep_Query - virtual ZRelHead GetRelHead(); - -// From ExprRep_Query - virtual bool Accept(Visitor_ExprRep_Query& iVisitor); - -// Our protocol - const std::string& GetIDPropName(); - const ZRelHead& GetAllRelHead(); - -private: - const std::string fIDPropName; - const ZRelHead fRelHead; - }; - -// ================================================================================================= -#pragma mark - -#pragma mark * ExprRep_Query_Explicit - -class ExprRep_Query_Explicit : public ExprRep_Query - { -public: - ExprRep_Query_Explicit(const ZVal_Expr* iVals, size_t iCount); - ExprRep_Query_Explicit(const std::vector<ZVal_Expr>& iVals); - - virtual ~ExprRep_Query_Explicit(); - -// From ExprRep_Relation via ExprRep_Query - virtual ZRelHead GetRelHead(); - -// From ExprRep_Query - virtual bool Accept(Visitor_ExprRep_Query& iVisitor); - -// Our protocol - const std::vector<ZVal_Expr>& GetVals(); - -private: - const std::vector<ZVal_Expr> fVals; - }; - -// ================================================================================================= -#pragma mark - -#pragma mark * Visitor_ExprRep_Query - -class Visitor_ExprRep_Query : public virtual Visitor_ExprRep_Relation - { -public: - virtual bool Visit_All(ZRef<ExprRep_Query_All> iRep); - virtual bool Visit_Explicit(ZRef<ExprRep_Query_Explicit> iRep); - }; - -// ================================================================================================= -#pragma mark - -#pragma mark * Expr_Query - -class Expr_Query : public Expr_Relation - { - typedef Expr_Relation inherited; - - Expr_Query operator=(const Expr_Relation&); - Expr_Query operator=(const ZRef<ExprRep_Relation>&); - -public: - Expr_Query(); - Expr_Query(const Expr_Query& iOther); - ~Expr_Query(); - Expr_Query& operator=(const Expr_Query& iOther); - - Expr_Query(const ZRef<ExprRep_Query>& iRep); - - operator ZRef<ExprRep_Query>() const; - }; - -// ================================================================================================= -#pragma mark - -#pragma mark * Query operators - -Expr_Query sAll(const ZRelHead& iRelHead); - -Expr_Query sAllID(const std::string& iIDName); - -Expr_Query sAllID(const std::string& iIDName, const ZRelHead& iRelHead); - -Expr_Query sExplicit(const ZVal_Expr* iVals, size_t iCount); - -Expr_Query sExplicit(const std::vector<ZVal_Expr>& iVals); - -// ================================================================================================= -#pragma mark - -#pragma mark * QueryTransformer - -class QueryTransformer -: public Visitor_ExprRep_Query -, public Visitor_ExprRep_Restrict -, public Visitor_ExprRep_Select - { -public: -// From Visitor_ExprRep_Relation via Visitor_ExprRep_Query - virtual bool Visit_Difference(ZRef<ExprRep_Relation_Difference> iRep); - virtual bool Visit_Intersect(ZRef<ExprRep_Relation_Intersect> iRep); - virtual bool Visit_Join(ZRef<ExprRep_Relation_Join> iRep); - virtual bool Visit_Project(ZRef<ExprRep_Relation_Project> iRep); - virtual bool Visit_Rename(ZRef<ExprRep_Relation_Rename> iRep); - virtual bool Visit_Union(ZRef<ExprRep_Relation_Union> iRep); - -// From Visitor_ExprRep_Query - virtual bool Visit_All(ZRef<ExprRep_Query_All> iRep); - virtual bool Visit_Explicit(ZRef<ExprRep_Query_Explicit> iRep); - -// From Visitor_ExprRep_Restrict - virtual bool Visit_Restrict(ZRef<ExprRep_Restrict> iRep); - -// From Visitor_ExprRep_Select - virtual bool Visit_Select(ZRef<ExprRep_Select> iRep); - -// Our protocol - ZRef<ExprRep_Relation> Transform(ZRef<ExprRep_Relation> iRep); - - virtual ZRef<ExprRep_Relation> Transform_All(ZRef<ExprRep_Query_All> iRep); - virtual ZRef<ExprRep_Relation> Transform_Difference(ZRef<ExprRep_Relation_Difference> iRep); - virtual ZRef<ExprRep_Relation> Transform_Explicit(ZRef<ExprRep_Query_Explicit> iRep); - virtual ZRef<ExprRep_Relation> Transform_Intersect(ZRef<ExprRep_Relation_Intersect> iRep); - virtual ZRef<ExprRep_Relation> Transform_Join(ZRef<ExprRep_Relation_Join> iRep); - virtual ZRef<ExprRep_Relation> Transform_Project(ZRef<ExprRep_Relation_Project> iRep); - virtual ZRef<ExprRep_Relation> Transform_Rename(ZRef<ExprRep_Relation_Rename> iRep); - virtual ZRef<ExprRep_Relation> Transform_Restrict(ZRef<ExprRep_Restrict> iRep); - virtual ZRef<ExprRep_Relation> Transform_Select(ZRef<ExprRep_Select> iRep); - virtual ZRef<ExprRep_Relation> Transform_Union(ZRef<ExprRep_Relation_Union> iRep); - -private: - ZRef<ExprRep_Relation> fResult; - }; - -}// namespace ZQL -NAMESPACE_ZOOLIB_END - -#endif // __ZQL_Expr_Query__ Modified: trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Select.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Select.cpp 2010-04-06 19:12:48 UTC (rev 1244) +++ trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Select.cpp 2010-04-06 22:27:15 UTC (rev 1245) @@ -31,8 +31,8 @@ #pragma mark * ExprRep_Select ExprRep_Select::ExprRep_Select( - const ZRef<ZExprRep_Logical>& iExprRep_Logical, const ZRef<ExprRep_Relation>& iExprRep_Relation) -: fExprRep_Logical(iExprRep_Logical) + const ZRef<ZExprRep_Logic>& iExprRep_Logic, const ZRef<ExprRep_Relation>& iExprRep_Relation) +: fExprRep_Logic(iExprRep_Logic) , fExprRep_Relation(iExprRep_Relation) {} @@ -53,13 +53,13 @@ } ZRelHead ExprRep_Select::GetRelHead() - { return sGetRelHead(fExprRep_Logical) | fExprRep_Relation->GetRelHead(); } + { return sGetRelHead(fExprRep_Logic) | fExprRep_Relation->GetRelHead(); } bool ExprRep_Select::Accept(Visitor_ExprRep_Select& iVisitor) { return iVisitor.Visit_Select(this); } -ZRef<ZExprRep_Logical> ExprRep_Select::GetExprRep_Logical() - { return fExprRep_Logical; } +ZRef<ZExprRep_Logic> ExprRep_Select::GetExprRep_Logic() + { return fExprRep_Logic; } ZRef<ExprRep_Relation> ExprRep_Select::GetExprRep_Relation() { return fExprRep_Relation; } @@ -73,9 +73,9 @@ if (!Visitor_ExprRep_Relation::Visit_ExprRep(iRep)) return false; - if (ZRef<ZExprRep_Logical> theExpr_Logical = iRep->GetExprRep_Logical()) + if (ZRef<ZExprRep_Logic> theExpr_Logic = iRep->GetExprRep_Logic()) { - if (!theExpr_Logical->Accept(*this)) + if (!theExpr_Logic->Accept(*this)) return false; } @@ -119,14 +119,14 @@ #pragma mark - #pragma mark * -Expr_Select sSelect(const ZExpr_Logical& iExpr_Logical, const Expr_Relation& iExpr_Relation) - { return Expr_Select(new ExprRep_Select(iExpr_Logical, iExpr_Relation)); } +Expr_Select sSelect(const ZExpr_Logic& iExpr_Logic, const Expr_Relation& iExpr_Relation) + { return Expr_Select(new ExprRep_Select(iExpr_Logic, iExpr_Relation)); } -Expr_Select operator&(const ZExpr_Logical& iExpr_Logical, const Expr_Relation& iExpr_Relation) - { return Expr_Select(new ExprRep_Select(iExpr_Logical, iExpr_Relation)); } +Expr_Select operator&(const ZExpr_Logic& iExpr_Logic, const Expr_Relation& iExpr_Relation) + { return Expr_Select(new ExprRep_Select(iExpr_Logic, iExpr_Relation)); } -Expr_Select operator&(const Expr_Relation& iExpr_Relation, const ZExpr_Logical& iExpr_Logical) - { return Expr_Select(new ExprRep_Select(iExpr_Logical, iExpr_Relation)); } +Expr_Select operator&(const Expr_Relation& iExpr_Relation, const ZExpr_Logic& iExpr_Logic) + { return Expr_Select(new ExprRep_Select(iExpr_Logic, iExpr_Relation)); } } // namespace ZQL NAMESPACE_ZOOLIB_END Modified: trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Select.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Select.h 2010-04-06 19:12:48 UTC (rev 1244) +++ trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Select.h 2010-04-06 22:27:15 UTC (rev 1245) @@ -22,7 +22,7 @@ #define __ZQL_Expr_Select__ 1 #include "zconfig.h" -#include "zoolib/ZExpr_Logical.h" +#include "zoolib/ZExpr_Logic.h" #include "zoolib/zql/ZQL_Expr_Relation.h" NAMESPACE_ZOOLIB_BEGIN @@ -38,7 +38,7 @@ { public: ExprRep_Select( - const ZRef<ZExprRep_Logical>& iExprRep_Logical, + const ZRef<ZExprRep_Logic>& iExprRep_Logic, const ZRef<ExprRep_Relation>& iExprRep_Relation); virtual ~ExprRep_Select(); @@ -51,11 +51,11 @@ // Our protocol virtual bool Accept(Visitor_ExprRep_Select& iVisitor); - ZRef<ZExprRep_Logical> GetExprRep_Logical(); + ZRef<ZExprRep_Logic> GetExprRep_Logic(); ZRef<ExprRep_Relation> GetExprRep_Relation(); private: - const ZRef<ZExprRep_Logical> fExprRep_Logical; + const ZRef<ZExprRep_Logic> fExprRep_Logic; const ZRef<ExprRep_Relation> fExprRep_Relation; }; @@ -95,11 +95,11 @@ #pragma mark - #pragma mark * Query operators -Expr_Select sSelect(const ZExpr_Logical& iExpr_Logical, const Expr_Relation& iExpr_Relation); +Expr_Select sSelect(const ZExpr_Logic& iExpr_Logic, const Expr_Relation& iExpr_Relation); -Expr_Select operator&(const ZExpr_Logical& iExpr_Logical, const Expr_Relation& iExpr_Relation); +Expr_Select operator&(const ZExpr_Logic& iExpr_Logic, const Expr_Relation& iExpr_Relation); -Expr_Select operator&(const Expr_Relation& iExpr_Relation, const ZExpr_Logical& iExpr_Logical); +Expr_Select operator&(const Expr_Relation& iExpr_Relation, const ZExpr_Logic& iExpr_Logic); } // namespace ZQL NAMESPACE_ZOOLIB_END Modified: trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Util_Strim_Query.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Util_Strim_Query.cpp 2010-04-06 19:12:48 UTC (rev 1244) +++ trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Util_Strim_Query.cpp 2010-04-06 22:27:15 UTC (rev 1245) @@ -45,7 +45,7 @@ Visitor_Query_ToStrim::Visitor_Query_ToStrim(const Options& iOptions, const ZStrimW& iStrimW) : ZVisitor_ExprRep_ToStrim(iOptions, iStrimW) -, ZVisitor_ExprRep_Logical_ToStrim(iOptions, iStrimW) +, ZVisitor_ExprRep_Logic_ToStrim(iOptions, iStrimW) , ZVisitor_ExprRep_ValCondition_ToStrim(iOptions, iStrimW) , Visitor_ExprRep_Relation_ToStrim(iOptions, iStrimW) , Visitor_ExprRep_Restrict_ToStrim(iOptions, iStrimW) Modified: trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Relation_ToStrim.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Relation_ToStrim.cpp 2010-04-06 19:12:48 UTC (rev 1244) +++ trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Relation_ToStrim.cpp 2010-04-06 22:27:15 UTC (rev 1245) @@ -151,7 +151,8 @@ bool Visitor_ExprRep_Relation_ToStrim::Visit_Union(ZRef<ExprRep_Relation_Union> iRep) { return this->pWriteDyadic("Union", iRep); } -bool Visitor_ExprRep_Relation_ToStrim::pWriteDyadic(const string& iFunctionName, ZRef<ExprRep_Relation_Dyadic> iRep) +bool Visitor_ExprRep_Relation_ToStrim::pWriteDyadic( + const string& iFunctionName, ZRef<ExprRep_Relation_Dyadic> iRep) { spWrite(iFunctionName, fStrimW); Modified: trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Relation_ToStrim.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Relation_ToStrim.h 2010-04-06 19:12:48 UTC (rev 1244) +++ trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Relation_ToStrim.h 2010-04-06 22:27:15 UTC (rev 1245) @@ -48,8 +48,6 @@ virtual bool Visit_Rename(ZRef<ExprRep_Relation_Rename> iRep); virtual bool Visit_Union(ZRef<ExprRep_Relation_Union> iRep); -// Our protocol - private: bool pWriteDyadic(const std::string& iFunctionName, ZRef<ExprRep_Relation_Dyadic> iRep); }; Added: trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Relation_Transform.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Relation_Transform.cpp (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Relation_Transform.cpp 2010-04-06 22:27:15 UTC (rev 1245) @@ -0,0 +1,105 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2010 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#include "zoolib/ZUtil_Strim_RelHead.h" + +#include "zoolib/zql/ZQL_Visitor_ExprRep_Relation_Transform.h" + +NAMESPACE_ZOOLIB_BEGIN +namespace ZQL { + +// ================================================================================================= +#pragma mark - +#pragma mark * Visitor_ExprRep_Relation_Transform + +bool Visitor_ExprRep_Relation_Transform::Visit_Difference(ZRef<ExprRep_Relation_Difference> iRep) + { + ZRef<ExprRep_Relation> newLHS, newRHS; + if (this->pTransformDyadic(iRep, newLHS, newRHS)) + fResult = iRep; + else + fResult = new ExprRep_Relation_Difference(newLHS, newRHS); + return true; + } + +bool Visitor_ExprRep_Relation_Transform::Visit_Intersect(ZRef<ExprRep_Relation_Intersect> iRep) + { + ZRef<ExprRep_Relation> newLHS, newRHS; + if (this->pTransformDyadic(iRep, newLHS, newRHS)) + fResult = iRep; + else + fResult = new ExprRep_Relation_Intersect(newLHS, newRHS); + return true; + } + +bool Visitor_ExprRep_Relation_Transform::Visit_Join(ZRef<ExprRep_Relation_Join> iRep) + { + ZRef<ExprRep_Relation> newLHS, newRHS; + if (this->pTransformDyadic(iRep, newLHS, newRHS)) + fResult = iRep; + else + fResult = new ExprRep_Relation_Join(newLHS, newRHS); + return true; + } + +bool Visitor_ExprRep_Relation_Transform::Visit_Project(ZRef<ExprRep_Relation_Project> iRep) + { + ZRef<ExprRep_Relation> oldRep = iRep->GetExprRep(); + ZRef<ExprRep_Relation> newRep = this->Transform(oldRep).DynamicCast<ExprRep_Relation>(); + if (oldRep == newRep) + fResult = iRep; + else + fResult = new ExprRep_Relation_Project(newRep, iRep->GetRelHead()); + return true; + } + +bool Visitor_ExprRep_Relation_Transform::Visit_Rename(ZRef<ExprRep_Relation_Rename> iRep) + { + ZRef<ExprRep_Relation> oldRep = iRep->GetExprRep(); + ZRef<ExprRep_Relation> newRep = this->Transform(oldRep).DynamicCast<ExprRep_Relation>(); + if (oldRep == newRep) + fResult = iRep; + else + fResult = new ExprRep_Relation_Rename(newRep, iRep->GetOld(), iRep->GetNew()); + return true; + } + +bool Visitor_ExprRep_Relation_Transform::Visit_Union(ZRef<ExprRep_Relation_Union> iRep) + { + ZRef<ExprRep_Relation> newLHS, newRHS; + if (this->pTransformDyadic(iRep, newLHS, newRHS)) + fResult = iRep; + else + fResult = new ExprRep_Relation_Union(newLHS, newRHS); + return true; + } + +bool Visitor_ExprRep_Relation_Transform::pTransformDyadic(ZRef<ExprRep_Relation_Dyadic> iRep, + ZRef<ExprRep_Relation>& oNewLHS, ZRef<ExprRep_Relation>& oNewRHS) + { + ZRef<ExprRep_Relation> oldLHS = iRep->GetLHS(); + ZRef<ExprRep_Relation> oldRHS = iRep->GetRHS(); + oNewLHS = this->Transform(oldLHS).DynamicCast<ExprRep_Relation>(); + oNewRHS = this->Transform(oldRHS).DynamicCast<ExprRep_Relation>(); + return oldLHS == oNewLHS && oldRHS == oNewRHS; + } + +} // namespace ZQL +NAMESPACE_ZOOLIB_END Added: trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Relation_Transform.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Relation_Transform.h (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Relation_Transform.h 2010-04-06 22:27:15 UTC (rev 1245) @@ -0,0 +1,57 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2010 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#ifndef __ZQL_Visitor_ExprRep_Relation_Transform__ +#define __ZQL_Visitor_ExprRep_Relation_Transform__ +#include "zconfig.h" + +#include "zoolib/ZVisitor_ExprRep_Transform.h" + +#include "zoolib/zql/ZQL_Expr_Relation.h" + +NAMESPACE_ZOOLIB_BEGIN +namespace ZQL { + +// ================================================================================================= +#pragma mark - +#pragma mark * Visitor_Query_Transform + +class Visitor_ExprRep_Relation_Transform +: public virtual ZVisitor_ExprRep_Transform +, public virtual Visitor_ExprRep_Relation + { +public: +// From Visitor_ExprRep_Relation + virtual bool Visit_Difference(ZRef<ExprRep_Relation_Difference> iRep); + virtual bool Visit_Intersect(ZRef<ExprRep_Relation_Intersect> iRep); + virtual bool Visit_Join(ZRef<ExprRep_Relation_Join> iRep); + virtual bool Visit_Project(ZRef<ExprRep_Relation_Project> iRep); + virtual bool Visit_Rename(ZRef<ExprRep_Relation_Rename> iRep); + virtual bool Visit_Union(ZRef<ExprRep_Relation_Union> iRep); + +private: + bool pTransformDyadic(ZRef<ExprRep_Relation_Dyadic> iRep, + ZRef<ExprRep_Relation>& oNewLHS, ZRef<ExprRep_Relation>& oNewRHS); + }; + +} // namespace ZQL +NAMESPACE_ZOOLIB_END + +#endif // __ZQL_Visitor_ExprRep_Relation_Transform__ Added: trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Restrict_Transform.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Restrict_Transform.cpp (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Restrict_Transform.cpp 2010-04-06 22:27:15 UTC (rev 1245) @@ -0,0 +1,42 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2010 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#include "zoolib/zql/ZQL_Visitor_ExprRep_Restrict_Transform.h" + +NAMESPACE_ZOOLIB_BEGIN +namespace ZQL { + +// ================================================================================================= +#pragma mark - +#pragma mark * Visitor_ExprRep_Restrict_Transform + +bool Visitor_ExprRep_Restrict_Transform::Visit_Restrict(ZRef<ExprRep_Restrict> iRep) + { + ZRef<ExprRep_Relation> oldRep = iRep->GetExprRep(); + ZRef<ExprRep_Relation> newRep = this->Transform(oldRep).DynamicCast<ExprRep_Relation>(); + if (oldRep == newRep) + fResult = iRep; + else + fResult = new ExprRep_Restrict(iRep->GetValCondition(), newRep); + return true; + } + +} // namespace ZQL +NAMESPACE_ZOOLIB_END Added: trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Restrict_Transform.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Restrict_Transform.h (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Restrict_Transform.h 2010-04-06 22:27:15 UTC (rev 1245) @@ -0,0 +1,47 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2010 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#ifndef __ZQL_Visitor_ExprRep_Restrict_Transform__ +#define __ZQL_Visitor_ExprRep_Restrict_Transform__ +#include "zconfig.h" + +#include "zoolib/ZVisitor_ExprRep_Transform.h" +#include "zoolib/zql/ZQL_Expr_Restrict.h" + +NAMESPACE_ZOOLIB_BEGIN +namespace ZQL { + +// ================================================================================================= +#pragma mark - +#pragma mark * Visitor_ExprRep_Restrict_Transform + +class Visitor_ExprRep_Restrict_Transform +: public virtual ZVisitor_ExprRep_Transform +, public virtual Visitor_ExprRep_Restrict + { +public: +// From Visitor_ExprRep_Restrict + virtual bool Visit_Restrict(ZRef<ExprRep_Restrict> iRep); + }; + +} // namespace ZQL +NAMESPACE_ZOOLIB_END + +#endif // __ZQL_Visitor_ExprRep_Restrict_Transform__ Modified: trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Select_ToStrim.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Select_ToStrim.cpp 2010-04-06 19:12:48 UTC (rev 1244) +++ trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Select_ToStrim.cpp 2010-04-06 22:27:15 UTC (rev 1245) @@ -59,7 +59,7 @@ this->pWriteLFIndent(); fStrimW << "("; this->pWriteLFIndent(); - this->Write(iRep->GetExprRep_Logical()); + this->Write(iRep->GetExprRep_Logic()); fStrimW << ","; this->pWriteLFIndent(); Added: trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Select_Transform.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Select_Transform.cpp (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Select_Transform.cpp 2010-04-06 22:27:15 UTC (rev 1245) @@ -0,0 +1,45 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2010 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#include "zoolib/zql/ZQL_Visitor_ExprRep_Select_Transform.h" + +NAMESPACE_ZOOLIB_BEGIN +namespace ZQL { + +// ================================================================================================= +#pragma mark - +#pragma mark * Visitor_ExprRep_Select_Transform + +bool Visitor_ExprRep_Select_Transform::Visit_Select(ZRef<ExprRep_Select> iRep) + { + ZRef<ZExprRep_Logic> oldLogical = iRep->GetExprRep_Logic(); + ZRef<ExprRep_Relation> oldRelation = iRep->GetExprRep_Relation(); + ZRef<ZExprRep_Logic> newLogical = this->Transform(oldLogical).DynamicCast<ZExprRep_Logic>(); + ZRef<ExprRep_Relation> newRelation = this->Transform(oldRelation).DynamicCast<ExprRep_Relation>(); + if (oldLogical == newLogical && oldRelation == newRelation) + fResult = iRep; + else + fResult = new ExprRep_Select(newLogical, newRelation); + + return true; + } + +} // namespace ZQL +NAMESPACE_ZOOLIB_END Added: trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Select_Transform.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Select_Transform.h (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Select_Transform.h 2010-04-06 22:27:15 UTC (rev 1245) @@ -0,0 +1,47 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2010 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#ifndef __ZQL_Visitor_ExprRep_Select_Transform__ +#define __ZQL_Visitor_ExprRep_Select_Transform__ +#include "zconfig.h" + +#include "zoolib/zql/ZQL_Visitor_ExprRep_Relation_Transform.h" +#include "zoolib/zql/ZQL_Expr_Select.h" + +NAMESPACE_ZOOLIB_BEGIN +namespace ZQL { + +// ================================================================================================= +#pragma mark - +#pragma mark * Visitor_ExprRep_Select_Transform + +class Visitor_ExprRep_Select_Transform +: public virtual Visitor_ExprRep_Relation_Transform +, public virtual Visitor_ExprRep_Select + { +public: +// From Visitor_ExprRep_Select + virtual bool Visit_Select(ZRef<ExprRep_Select> iRep); + }; + +} // namespace ZQL +NAMESPACE_ZOOLIB_END + +#endif // __ZQL_Visitor_ExprRep_Select_Transform__ Added: trunk/zoolib/source/cxx/zoolib/ZExpr_Logic.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZExpr_Logic.cpp (rev 0) +++ trunk/zoolib/source/cxx/zoolib/ZExpr_Logic.cpp 2010-04-06 22:27:15 UTC (rev 1245) @@ -0,0 +1,250 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2010 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +T... [truncated message content] |
From: <ag...@us...> - 2010-04-07 03:54:54
|
Revision: 1246 http://zoolib.svn.sourceforge.net/zoolib/?rev=1246&view=rev Author: agreen Date: 2010-04-07 03:54:46 +0000 (Wed, 07 Apr 2010) Log Message: ----------- First steps towards actually doing queries. Modified Paths: -------------- trunk/zoolib/source/cxx/more/zoolib/tql/ZTQLTest.cpp trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Optimize.cpp trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Util_Strim_Query.cpp trunk/zoolib/source/cxx/zoolib/ZExpr_Logic.cpp trunk/zoolib/source/cxx/zoolib/ZExpr_Logic.h trunk/zoolib/source/cxx/zoolib/ZExpr_ValCondition_T.h Added Paths: ----------- trunk/zoolib/source/cxx/more/zoolib/valbase/ trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_Any.cpp trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_Any.h trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_SQLite.cpp trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_SQLite.h trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_YadSeqRPos.cpp trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_YadSeqRPos.h trunk/zoolib/source/cxx/more/zoolib/zqe/ trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Iterator.cpp trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Iterator.h trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Iterator_Any.cpp trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Iterator_Any.h trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Result.cpp trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Result.h trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Result_Any.cpp trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Result_Any.h trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Visitor_ExprRep_MakeIterator.cpp trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Visitor_ExprRep_MakeIterator.h trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Concrete.cpp trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Concrete.h trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_Logic_Eval.cpp trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_Logic_Eval.h trunk/zoolib/source/cxx/zoolib/ZYadSeqR_ExprRep_Logic.cpp trunk/zoolib/source/cxx/zoolib/ZYadSeqR_ExprRep_Logic.h Removed Paths: ------------- trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Physical.cpp trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Physical.h Modified: trunk/zoolib/source/cxx/more/zoolib/tql/ZTQLTest.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tql/ZTQLTest.cpp 2010-04-06 22:27:15 UTC (rev 1245) +++ trunk/zoolib/source/cxx/more/zoolib/tql/ZTQLTest.cpp 2010-04-07 03:54:46 UTC (rev 1246) @@ -25,6 +25,12 @@ #include "zoolib/ZYad_Any.h" #include "zoolib/ZYad_MapAsSeq.h" +#include "zoolib/valbase/ZValBase_Any.h" +#include "zoolib/valbase/ZValBase_YadSeqRPos.h" + +#include "zoolib/ZYadSeqR_ExprRep_Logic.h" +#include "zoolib/zqe/ZQE_Result_Any.h" + NAMESPACE_ZOOLIB_USING using namespace ZQL; @@ -322,6 +328,47 @@ int res4 = sCompare_T(val1, val1); } +void sTestQL4(const ZStrimW& s) + { + ZSeq_Any theSeq; + for (int x = 0; x < 20; ++x) + { + ZMap_Any innerMap; + innerMap.Set("field", x); + ZMap_Any outerMap; + outerMap.Set("inner", innerMap); + theSeq.Append(outerMap); + } + + Expr_Relation thePhys(new ZValBase_Any::ExprRep_Concrete(theSeq)); +// ZExpr_ValCondition theSpec1 = CVal() > CConst(10); +// Spec theSpec = Spec(false) | (CVal() > CConst(10)); +// Spec theSpec = (); + Spec theSpec = ZExpr_ValCondition(CTrail("inner/field") < CConst(10)); + thePhys = thePhys & theSpec; + + Util_Strim_Query::sToStrim(thePhys, s); + s << "\n"; + + thePhys = Expr_Relation(sOptimize(thePhys)); + + ZRef<ZQE::Iterator> theIterator = + ZValBase_Any::Visitor_ExprRep_Concrete_MakeIterator().MakeIterator(thePhys); + + for (;;) + { + if (ZRef<ZQE::Result> theResult = theIterator->ReadInc()) + { + s.Writef("%08X, ", theResult.Get()); + } + else + { + break; + } + } + + } + void sTestQL3(const ZStrimW& s) { Spec theSpec = CVar("TestVar1") == CConst(1) | CVar("TestVar2") == CConst(2); @@ -403,19 +450,71 @@ ZRef<ZML::StrimmerU> theStrimmerU_ML = new ZML::StrimmerU(theStrimmerU_Unreader); ZRef<ZYadR> theYadR = ZYad_XMLPList::sMakeYadR(theStrimmerU_ML); + theYadR = ZUtil_Yad::sWalk(theYadR, "Tracks"); ZYadOptions theYadOptions(true); - - ZExpr_Logic theCondition = CName("Disc Number") == CConst(int32(2)) & CName("Track Number") > CConst(int32(10)); -// const ZVal_Any theVal = sFromYadR(ZVal_Any(), theYadR); -// theYadR = sMakeYadR(theVal); - theYadR = ZUtil_Yad::sWalk(theYadR, "Tracks"); + ZExpr_Logic theCondition = + CName("Disc Number") == CConst(int32(2)) & CName("Track Number") > CConst(int32(10)); + + ZRef<ZYadSeqR> theYadSeqR; if (ZRef<ZYadMapR> theYadMapR = theYadR.DynamicCast<ZYadMapR>()) + theYadSeqR = sMapAsSeq("Dummy", theYadMapR); + + ZTime start = ZTime::sNow(); +#if 1 + if (theYadSeqR) { - ZRef<ZYadSeqR> theYadSeqR = sMapAsSeq("Dummy", theYadMapR); + const ZSeq_Any theSeq = sFromYadR(ZVal_Any(), theYadSeqR).GetSeq(); + + s.Writef("\nElapsed, read: %gms\n", 1000.0 * (ZTime::sNow() - start)); + + start = ZTime::sNow(); + Expr_Relation thePhys(new ZValBase_YadSeqRPos::ExprRep_Concrete(sMakeYadR(theSeq).DynamicCast<ZYadSeqRPos>())); +// Expr_Relation thePhys(new ZValBase_Any::ExprRep_Concrete(theSeq)); + thePhys = thePhys & theCondition; + + Util_Strim_Query::sToStrim(thePhys, s); + s << "\n"; + +// thePhys = Expr_Relation(sOptimize(thePhys)); + + ZRef<ZQE::Iterator> theIterator = + ZValBase_YadSeqRPos::Visitor_ExprRep_Concrete_MakeIterator().MakeIterator(thePhys); +// ZValBase_Any::Visitor_ExprRep_Concrete_MakeIterator().MakeIterator(thePhys); + for (;;) { + if (ZRef<ZQE::Result> theZQEResult = theIterator->ReadInc()) + { + if (ZRef<ZQE::Result_Any> theResult = theZQEResult.DynamicCast<ZQE::Result_Any>()) + { +// ZYad_ZooLibStrim::sToStrim(0, theYadOptions, sMakeYadR(theResult->GetVal()), s); +// s << "\n"; + } + else + { + s.Writef("%08X, ", theZQEResult.Get()); + } + } + else + { + break; + } + } + } +#elif 1 + if (theYadSeqR) + { + theYadSeqR = new ZYadSeqR_ExprRep_Logic(theYadSeqR, theCondition); + theYadSeqR->SkipAll(); +// ZYad_ZooLibStrim::sToStrim(0, theYadOptions, theYadSeqR, s); + } +#elif 0 + if (theYadSeqR) + { + for (;;) + { ZRef<ZYadR> inner = theYadSeqR->ReadInc(); if (!inner) break; @@ -423,9 +522,11 @@ if (sMatches(theCondition, theVal)) { - ZYad_ZooLibStrim::sToStrim(0, theYadOptions, sMakeYadR(theVal), s); - s << "\n"; +// ZYad_ZooLibStrim::sToStrim(0, theYadOptions, sMakeYadR(theVal), s); +// s << "\n"; } } } +#endif + s.Writef("\nElapsed: %gms\n", 1000.0 * (ZTime::sNow() - start)); } Modified: trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Optimize.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Optimize.cpp 2010-04-06 22:27:15 UTC (rev 1245) +++ trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Optimize.cpp 2010-04-07 03:54:46 UTC (rev 1246) @@ -18,28 +18,29 @@ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ------------------------------------------------------------------------------------------------- */ +#include "zoolib/ZExpr_ValCondition.h" +#include "zoolib/ZVisitor_ExprRep_Logic_Transform.h" #include "zoolib/tql/ZTQL_Optimize.h" - -//#include "zoolib/zql/ZQL_Expr_Query.h" #include "zoolib/zql/ZQL_Expr_Restrict.h" #include "zoolib/zql/ZQL_Visitor_ExprRep_Select_Transform.h" -#include "zoolib/ZExpr_ValCondition.h" NAMESPACE_ZOOLIB_BEGIN using namespace ZQL; +// Turns a Select into a tree of Restrict and Union. + // ================================================================================================= #pragma mark - -#pragma mark * ZQL, spConvertSelect +#pragma mark * Local stuff -// Turns a Select into a tree of Restrict and Union. - using std::vector; +namespace ZANONYMOUS { + typedef vector<ZValCondition> CondSect; typedef vector<CondSect> CondUnion; -static void spCrossMultiply(const CondUnion& iLeft, const CondUnion& iRight, CondUnion& oResult) +void spCrossMultiply(const CondUnion& iLeft, const CondUnion& iRight, CondUnion& oResult) { for (CondUnion::const_iterator iterLeft = iLeft.begin(); iterLeft != iLeft.end(); ++iterLeft) @@ -54,52 +55,88 @@ } } -static void spGather(ZRef<ZExprRep_Logic> iRep, CondUnion& oResult) +void spGather(ZRef<ZExprRep_Logic> iRep, CondUnion& oResult); + +class Gather +: public virtual ZVisitor_ExprRep_Logic_Transform +, public virtual ZVisitor_ExprRep_ValCondition { - ZAssert(oResult.empty()); +public: + Gather(CondUnion& oResult); - if (ZRef<ZExprRep_Logic_And> lo = ZRefDynamicCast<ZExprRep_Logic_And>(iRep)) - { - CondUnion left; - spGather(lo->GetLHS(), left); - CondUnion right; - spGather(lo->GetRHS(), right); - spCrossMultiply(left, right, oResult); - } - else if (ZRef<ZExprRep_Logic_Or> lo = ZRefDynamicCast<ZExprRep_Logic_Or>(iRep)) - { - CondUnion left; - spGather(lo->GetLHS(), left); - CondUnion right; - spGather(lo->GetRHS(), right); - oResult = left; - oResult.insert(oResult.end(), right.begin(), right.end()); - } - else if (ZRef<ZExprRep_ValCondition> lo = ZRefDynamicCast<ZExprRep_ValCondition>(iRep)) - { - oResult.resize(1); - oResult[0].push_back(lo->GetValCondition()); - } - else if (ZRef<ZExprRep_Logic_True> lo = ZRefDynamicCast<ZExprRep_Logic_True>(iRep)) - { - oResult.resize(1); - } - else if (ZRef<ZExprRep_Logic_False> lo = ZRefDynamicCast<ZExprRep_Logic_False>(iRep)) - { - // Do nothing. - } - else if (iRep) - { - // Unknown LogOp - ZUnimplemented(); - } - else - { - // Nil LogOp is equivalent to false. - } +// From ZVisitor_ExprRep_Logic_Transform + virtual bool Visit_Logic_True(ZRef<ZExprRep_Logic_True> iRep); + virtual bool Visit_Logic_False(ZRef<ZExprRep_Logic_False> iRep); + virtual bool Visit_Logic_Not(ZRef<ZExprRep_Logic_Not> iRep); + virtual bool Visit_Logic_And(ZRef<ZExprRep_Logic_And> iRep); + virtual bool Visit_Logic_Or(ZRef<ZExprRep_Logic_Or> iRep); + +// From ZVisitor_ExprRep_ValCondition + virtual bool Visit_ValCondition(ZRef<ZExprRep_ValCondition> iRep); + +private: + CondUnion& fResult; + }; + +Gather::Gather(CondUnion& oResult) +: fResult(oResult) + {} + +bool Gather::Visit_Logic_True(ZRef<ZExprRep_Logic_True> iRep) + { + fResult.resize(1); + return true; } -static ZRef<ExprRep_Relation> spConvertSelect( +bool Gather::Visit_Logic_False(ZRef<ZExprRep_Logic_False> iRep) + { + ZAssert(fResult.empty()); +// fResult.clear(); + return true; + } + +bool Gather::Visit_Logic_Not(ZRef<ZExprRep_Logic_Not> iRep) + { + ZUnimplemented(); + return true; + } + +bool Gather::Visit_Logic_And(ZRef<ZExprRep_Logic_And> iRep) + { + CondUnion left; + spGather(iRep->GetLHS(), left); + CondUnion right; + spGather(iRep->GetRHS(), right); + spCrossMultiply(left, right, fResult); + return true; + } + +bool Gather::Visit_Logic_Or(ZRef<ZExprRep_Logic_Or> iRep) + { + CondUnion left; + spGather(iRep->GetLHS(), left); + CondUnion right; + spGather(iRep->GetRHS(), right); + fResult.swap(left); + fResult.insert(fResult.end(), right.begin(), right.end()); + return true; + } + +bool Gather::Visit_ValCondition(ZRef<ZExprRep_ValCondition> iRep) + { + fResult.resize(1); + fResult[0].push_back(iRep->GetValCondition()); + return true; + } + +void spGather(ZRef<ZExprRep_Logic> iRep, CondUnion& oResult) + { + ZAssert(oResult.empty()); + Gather theGather(oResult); + iRep->Accept(theGather); + } + +ZRef<ExprRep_Relation> spConvertSelect( ZRef<ExprRep_Relation> iRelation, ZRef<ZExprRep_Logic> iLogical) { if (!iRelation) @@ -127,12 +164,6 @@ return resultRelation; } -// ================================================================================================= -#pragma mark - -#pragma mark * ZQL - -namespace ZANONYMOUS { - class Optimize : public virtual Visitor_ExprRep_Select_Transform { Added: trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_Any.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_Any.cpp (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_Any.cpp 2010-04-07 03:54:46 UTC (rev 1246) @@ -0,0 +1,96 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2010 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#include "zoolib/zqe/ZQE_Iterator_Any.h" +#include "zoolib/zqe/ZQE_Result_Any.h" +#include "zoolib/valbase/ZValBase_Any.h" + +NAMESPACE_ZOOLIB_BEGIN +namespace ZValBase_Any { + +// ================================================================================================= +#pragma mark - +#pragma mark * ExprRep_Concrete + +ExprRep_Concrete::ExprRep_Concrete(const ZSeq_Any& iSeq) +: fSeq(iSeq) + {} + +ZRelHead ExprRep_Concrete::GetRelHead() + { return ZRelHead(true); } + +const ZSeq_Any& ExprRep_Concrete::GetSeq() + { return fSeq; } + +// ================================================================================================= +#pragma mark - +#pragma mark * Visitor_ExprRep_Concrete_MakeIterator + +bool Visitor_ExprRep_Concrete_MakeIterator::Visit_Concrete(ZRef<ZQL::ExprRep_Concrete> iRep) + { + if (ZRef<ExprRep_Concrete> theRep = iRep.DynamicCast<ExprRep_Concrete>()) + { + fIterator = new Iterator(theRep->GetSeq()); + return true; + } + return Visitor_ExprRep_Concrete::Visit_Concrete(iRep); + } + +bool Visitor_ExprRep_Concrete_MakeIterator::Visit_Restrict(ZRef<ZQL::ExprRep_Restrict> iRep) + { + // Could specialize here if we discover that theIterator is ours. + if (ZRef<ZQE::Iterator> theIterator = this->MakeIterator(iRep->GetExprRep())) + fIterator = new ZQE::Iterator_Any_Restrict(iRep->GetValCondition(), theIterator); + + return true; + } + +bool Visitor_ExprRep_Concrete_MakeIterator::Visit_Select(ZRef<ZQL::ExprRep_Select> iRep) + { + if (ZRef<ZQE::Iterator> theIterator = this->MakeIterator(iRep->GetExprRep_Relation())) + fIterator = new ZQE::Iterator_Any_Select(iRep->GetExprRep_Logic(), theIterator); + + return true; + } + +// ================================================================================================= +#pragma mark - +#pragma mark * Iterator + +Iterator::Iterator(const ZSeq_Any& iSeq) +: fSeq(iSeq) +, fIndex(0) + {} + +Iterator::~Iterator() + {} + +ZRef<ZQE::Result> Iterator::ReadInc() + { + if (fIndex < fSeq.Count()) + return new ZQE::Result_Any(fSeq.Get(fIndex++)); + return ZRef<ZQE::Result>(); + } + +void Iterator::Rewind() + { fIndex = 0; } + +} // namespace ZValBase_Seq +NAMESPACE_ZOOLIB_END Added: trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_Any.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_Any.h (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_Any.h 2010-04-07 03:54:46 UTC (rev 1246) @@ -0,0 +1,96 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2010 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#ifndef __ZValBase_Any__ +#define __ZValBase_Any__ 1 +#include "zconfig.h" + +#include "zoolib/ZVal_Any.h" +#include "zoolib/zqe/ZQE_Iterator.h" +#include "zoolib/zqe/ZQE_Visitor_ExprRep_MakeIterator.h" +#include "zoolib/zql/ZQL_Expr_Concrete.h" +#include "zoolib/zql/ZQL_Expr_Restrict.h" +#include "zoolib/zql/ZQL_Expr_Select.h" + +NAMESPACE_ZOOLIB_BEGIN +namespace ZValBase_Any { + +// ================================================================================================= +#pragma mark - +#pragma mark * ExprRep_Concrete + +class ExprRep_Concrete : public ZQL::ExprRep_Concrete + { +public: + ExprRep_Concrete(const ZSeq_Any& iSeq); + +// From ExprRep_Relation via ExprRep_Concrete + virtual ZRelHead GetRelHead(); + +// Our protocol + const ZSeq_Any& GetSeq(); + +private: + const ZSeq_Any fSeq; + }; + +// ================================================================================================= +#pragma mark - +#pragma mark * Visitor_ExprRep_Concrete_MakeIterator + +class Visitor_ExprRep_Concrete_MakeIterator +: public virtual ZQL::Visitor_ExprRep_Concrete +, public virtual ZQL::Visitor_ExprRep_Restrict +, public virtual ZQL::Visitor_ExprRep_Select +, public virtual ZQE::Visitor_ExprRep_MakeIterator + { +public: +// From Visitor_ExprRep_Concrete + virtual bool Visit_Concrete(ZRef<ZQL::ExprRep_Concrete> iRep); + +// From Visitor_ExprRep_Restrict + virtual bool Visit_Restrict(ZRef<ZQL::ExprRep_Restrict> iRep); + +// From Visitor_ExprRep_Select + virtual bool Visit_Select(ZRef<ZQL::ExprRep_Select> iRep); + }; + +// ================================================================================================= +#pragma mark - +#pragma mark * Iterator + +class Iterator : public ZQE::Iterator + { +public: + Iterator(const ZSeq_Any& iSeq); + virtual ~Iterator(); + + virtual ZRef<ZQE::Result> ReadInc(); + virtual void Rewind(); + +protected: + const ZSeq_Any fSeq; + size_t fIndex; + }; + +} // namespace ZValBase_Any +NAMESPACE_ZOOLIB_END + +#endif // __ZValBase_Any__ Added: trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_SQLite.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_SQLite.cpp (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_SQLite.cpp 2010-04-07 03:54:46 UTC (rev 1246) @@ -0,0 +1,26 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2010 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#include "zoolib/valbase/ZValBase_SQLite.h" + +NAMESPACE_ZOOLIB_BEGIN + + +NAMESPACE_ZOOLIB_END Added: trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_SQLite.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_SQLite.h (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_SQLite.h 2010-04-07 03:54:46 UTC (rev 1246) @@ -0,0 +1,51 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2010 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#ifndef __ZValBase_SQLite__ +#define __ZValBase_SQLite__ 1 +#include "zconfig.h" + +#include <sqlite.h> + +NAMESPACE_ZOOLIB_BEGIN + +// ================================================================================================= +#pragma mark - +#pragma mark * ZValBase_SQLite + +class ZValBase_SQLite + { +public: + ZValBase_SQLite(sqlite* iDB); + + // Get list of ZExprRep_Physicals representing tables? + // get list of table names?, then be able to get a ZExprRep_Physical for the table? + + // then again, we probably want to transform the expr-tree into an sql statement, + // to be passed to sqlite. + +private: + sqlite* fDB; + }; + + +NAMESPACE_ZOOLIB_END + +#endif // __ZValBase_SQLite__ Added: trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_YadSeqRPos.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_YadSeqRPos.cpp (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_YadSeqRPos.cpp 2010-04-07 03:54:46 UTC (rev 1246) @@ -0,0 +1,97 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2010 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#include "zoolib/ZYad_Any.h" +#include "zoolib/valbase/ZValBase_YadSeqRPos.h" +#include "zoolib/zqe/ZQE_Iterator_Any.h" +#include "zoolib/zqe/ZQE_Result_Any.h" + +NAMESPACE_ZOOLIB_BEGIN +namespace ZValBase_YadSeqRPos { + +// ================================================================================================= +#pragma mark - +#pragma mark * ExprRep_Concrete + +ExprRep_Concrete::ExprRep_Concrete(ZRef<ZYadSeqRPos> iYadSeqRPos) +: fYadSeqRPos(iYadSeqRPos) + {} + +ZRelHead ExprRep_Concrete::GetRelHead() + { return ZRelHead(true); } + +ZRef<ZYadSeqRPos> ExprRep_Concrete::GetYadSeqRPos() + { return fYadSeqRPos; } + +// ================================================================================================= +#pragma mark - +#pragma mark * Visitor_ExprRep_Concrete_MakeIterator + +bool Visitor_ExprRep_Concrete_MakeIterator::Visit_Concrete(ZRef<ZQL::ExprRep_Concrete> iRep) + { + if (ZRef<ExprRep_Concrete> theRep = iRep.DynamicCast<ExprRep_Concrete>()) + { + fIterator = new Iterator(theRep->GetYadSeqRPos()); + return true; + } + return Visitor_ExprRep_Concrete::Visit_Concrete(iRep); + } + +bool Visitor_ExprRep_Concrete_MakeIterator::Visit_Restrict(ZRef<ZQL::ExprRep_Restrict> iRep) + { + // Could specialize here if we discover that theIterator is ours. + if (ZRef<ZQE::Iterator> theIterator = this->MakeIterator(iRep->GetExprRep())) + fIterator = new ZQE::Iterator_Any_Restrict(iRep->GetValCondition(), theIterator); + + return true; + } + +bool Visitor_ExprRep_Concrete_MakeIterator::Visit_Select(ZRef<ZQL::ExprRep_Select> iRep) + { + if (ZRef<ZQE::Iterator> theIterator = this->MakeIterator(iRep->GetExprRep_Relation())) + fIterator = new ZQE::Iterator_Any_Select(iRep->GetExprRep_Logic(), theIterator); + + return true; + } + +// ================================================================================================= +#pragma mark - +#pragma mark * Iterator + +Iterator::Iterator(const ZRef<ZYadSeqRPos>& iYadSeqRPos) +: fYadSeqRPos_Model(iYadSeqRPos) +, fYadSeqRPos(fYadSeqRPos_Model->Clone()) + {} + +Iterator::~Iterator() + {} + +ZRef<ZQE::Result> Iterator::ReadInc() + { + if (ZRef<ZYadR> theYadR = fYadSeqRPos->ReadInc()) + return new ZQE::Result_Any(sFromYadR(ZVal_Any(), theYadR)); + return ZRef<ZQE::Result>(); + } + +void Iterator::Rewind() + { fYadSeqRPos = fYadSeqRPos_Model->Clone(); } + +} // namespace ZValBase_YadSeqRPos +NAMESPACE_ZOOLIB_END Added: trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_YadSeqRPos.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_YadSeqRPos.h (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_YadSeqRPos.h 2010-04-07 03:54:46 UTC (rev 1246) @@ -0,0 +1,95 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2010 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#ifndef __ZValBase_YadSeqRPos__ +#define __ZValBase_YadSeqRPos__ 1 +#include "zconfig.h" + +#include "zoolib/ZYad.h" +#include "zoolib/zqe/ZQE_Visitor_ExprRep_MakeIterator.h" +#include "zoolib/zql/ZQL_Expr_Concrete.h" +#include "zoolib/zql/ZQL_Expr_Restrict.h" +#include "zoolib/zql/ZQL_Expr_Select.h" + +NAMESPACE_ZOOLIB_BEGIN +namespace ZValBase_YadSeqRPos { + +// ================================================================================================= +#pragma mark - +#pragma mark * ExprRep_Concrete + +class ExprRep_Concrete : public ZQL::ExprRep_Concrete + { +public: + ExprRep_Concrete(ZRef<ZYadSeqRPos> iYadSeqRPos); + +// From ExprRep_Relation via ExprRep_Concrete + virtual ZRelHead GetRelHead(); + +// Our protocol + ZRef<ZYadSeqRPos> GetYadSeqRPos(); + +private: + ZRef<ZYadSeqRPos> fYadSeqRPos; + }; + +// ================================================================================================= +#pragma mark - +#pragma mark * Visitor_ExprRep_Concrete_MakeIterator + +class Visitor_ExprRep_Concrete_MakeIterator +: public virtual ZQL::Visitor_ExprRep_Concrete +, public virtual ZQL::Visitor_ExprRep_Restrict +, public virtual ZQL::Visitor_ExprRep_Select +, public virtual ZQE::Visitor_ExprRep_MakeIterator + { +public: +// From Visitor_ExprRep_Concrete + virtual bool Visit_Concrete(ZRef<ZQL::ExprRep_Concrete> iRep); + +// From Visitor_ExprRep_Restrict + virtual bool Visit_Restrict(ZRef<ZQL::ExprRep_Restrict> iRep); + +// From Visitor_ExprRep_Select + virtual bool Visit_Select(ZRef<ZQL::ExprRep_Select> iRep); + }; + +// ================================================================================================= +#pragma mark - +#pragma mark * Iterator + +class Iterator : public ZQE::Iterator + { +public: + Iterator(const ZRef<ZYadSeqRPos>& iYadSeqRPos); + virtual ~Iterator(); + + virtual ZRef<ZQE::Result> ReadInc(); + virtual void Rewind(); + +protected: + ZRef<ZYadSeqRPos> fYadSeqRPos_Model; + ZRef<ZYadSeqRPos> fYadSeqRPos; + }; + +} // namespace ZValBase_YadSeqRPos +NAMESPACE_ZOOLIB_END + +#endif // __ZValBase_YadSeqRPos__ Added: trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Iterator.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Iterator.cpp (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Iterator.cpp 2010-04-07 03:54:46 UTC (rev 1246) @@ -0,0 +1,150 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2010 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#include "zoolib/zqe/ZQE_Iterator.h" + +NAMESPACE_ZOOLIB_BEGIN +namespace ZQE { + +// ================================================================================================= +#pragma mark - +#pragma mark * Iterator + +Iterator::Iterator() + {} + +Iterator::~Iterator() + {} + +// ================================================================================================= +#pragma mark - +#pragma mark * Iterator_Intersect + +Iterator_Intersect::Iterator_Intersect(ZRef<Iterator> iIterator_LHS, ZRef<Iterator> iIterator_RHS) +: fIterator_LHS(iIterator_LHS) +, fIterator_RHS(iIterator_RHS) + {} + +ZRef<Result> Iterator_Intersect::ReadInc() + { + for (;;) + { + if (ZRef<Result> theLHS = fIterator_LHS->ReadInc()) + { + for (;;) + { + if (ZRef<Result> theRHS = fIterator_RHS->ReadInc()) + { + if (theLHS->SameAs(theRHS)) + { + fIterator_RHS->Rewind(); + return theLHS; + } + } + else + { + fIterator_RHS->Rewind(); + break; + } + } + } + else + { + return ZRef<Result>(); + } + } + } + +void Iterator_Intersect::Rewind() + { + fIterator_LHS->Rewind(); + fIterator_RHS->Rewind(); + } + +// ================================================================================================= +#pragma mark - +#pragma mark * Iterator_Join + +Iterator_Join::Iterator_Join(ZRef<Iterator> iIterator_LHS, ZRef<Iterator> iIterator_RHS) +: fIterator_LHS(iIterator_LHS) +, fIterator_RHS(iIterator_RHS) + {} + +ZRef<Result> Iterator_Join::ReadInc() + { + for (;;) + { + if (!fResult_LHS) + { + fResult_LHS = fIterator_LHS->ReadInc(); + if (!fResult_LHS) + return ZRef<Result>(); + } + + for (;;) + { + if (ZRef<Result> theRHS_Result = fIterator_RHS->ReadInc()) + { + if (ZRef<Result> joinedResult = fResult_LHS->JoinedWith(theRHS_Result)) + return joinedResult; + continue; + } + fIterator_RHS->Rewind(); + fResult_LHS.Clear(); + break; + } + } + } + +void Iterator_Join::Rewind() + { + fIterator_LHS->Rewind(); + fIterator_RHS->Rewind(); + fResult_LHS.Clear(); + } + +// ================================================================================================= +#pragma mark - +#pragma mark * Iterator_Union + +Iterator_Union::Iterator_Union(ZRef<Iterator> iIterator_LHS, ZRef<Iterator> iIterator_RHS) +: fIterator_LHS(iIterator_LHS) +, fIterator_RHS(iIterator_RHS) + {} + +ZRef<Result> Iterator_Union::ReadInc() + { + if (ZRef<Result> result = fIterator_LHS->ReadInc()) + return result; + + if (ZRef<Result> result = fIterator_LHS->ReadInc()) + return result; + + return ZRef<Result>(); + } + +void Iterator_Union::Rewind() + { + fIterator_LHS->Rewind(); + fIterator_RHS->Rewind(); + } + +} // namespace ZQE +NAMESPACE_ZOOLIB_END Added: trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Iterator.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Iterator.h (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Iterator.h 2010-04-07 03:54:46 UTC (rev 1246) @@ -0,0 +1,102 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2010 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#ifndef __ZQE_Iterator__ +#define __ZQE_Iterator__ 1 +#include "zconfig.h" + +#include "zoolib/zqe/ZQE_Result.h" + +NAMESPACE_ZOOLIB_BEGIN +namespace ZQE { + +// ================================================================================================= +#pragma mark - +#pragma mark * Iterator + +class Iterator : public ZRefCountedWithFinalize + { +protected: + Iterator(); + +public: + virtual ~Iterator(); + + virtual ZRef<Result> ReadInc() = 0; + virtual void Rewind() = 0; + }; + +// ================================================================================================= +#pragma mark - +#pragma mark * Iterator_Intersect + +class Iterator_Intersect : public Iterator + { +public: + Iterator_Intersect(ZRef<Iterator> iIterator_LHS, ZRef<Iterator> iIterator_RHS); + + virtual ZRef<Result> ReadInc(); + virtual void Rewind(); + +private: + ZRef<Iterator> fIterator_LHS; + ZRef<Iterator> fIterator_RHS; + }; + +// ================================================================================================= +#pragma mark - +#pragma mark * Iterator_Join + +class Iterator_Join : public Iterator + { +public: + Iterator_Join(ZRef<Iterator> iIterator_LHS, ZRef<Iterator> iIterator_RHS); + + virtual ZRef<Result> ReadInc(); + virtual void Rewind(); + +private: + ZRef<Iterator> fIterator_LHS; + ZRef<Iterator> fIterator_RHS; + ZRef<Result> fResult_LHS; + }; + +// ================================================================================================= +#pragma mark - +#pragma mark * Iterator_Union + +class Iterator_Union : public Iterator + { +public: + Iterator_Union(ZRef<Iterator> iIterator_LHS, ZRef<Iterator> iIterator_RHS); + + virtual ZRef<Result> ReadInc(); + virtual void Rewind(); + +private: + ZRef<Iterator> fIterator_LHS; + ZRef<Iterator> fIterator_RHS; + }; + + +} // namespace ZQE +NAMESPACE_ZOOLIB_END + +#endif // __ZQE_Iterator__ Added: trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Iterator_Any.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Iterator_Any.cpp (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Iterator_Any.cpp 2010-04-07 03:54:46 UTC (rev 1246) @@ -0,0 +1,96 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2010 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#include "zoolib/ZExpr_ValCondition.h" +#include "zoolib/zqe/ZQE_Iterator_Any.h" +#include "zoolib/zqe/ZQE_Result_Any.h" + +NAMESPACE_ZOOLIB_BEGIN +namespace ZQE { + +// ================================================================================================= +#pragma mark - +#pragma mark * Iterator_Any_Restrict + +Iterator_Any_Restrict::Iterator_Any_Restrict( + const ZValCondition& iValCondition, ZRef<Iterator> iIterator) +: fValCondition(iValCondition) +, fIterator(iIterator) + {} + +ZRef<ZQE::Result> Iterator_Any_Restrict::ReadInc() + { + for (;;) + { + if (ZRef<ZQE::Result> theZQEResult = fIterator->ReadInc()) + { + if (ZRef<ZQE::Result_Any> theResult = + theZQEResult.DynamicCast<ZQE::Result_Any>()) + { + ZValContext theContext; + if (fValCondition.Matches(theContext, theResult->GetVal())) + return theResult; + } + } + else + { + return ZRef<ZQE::Result>(); + } + } + } + +void Iterator_Any_Restrict::Rewind() + { fIterator->Rewind(); } + +// ================================================================================================= +#pragma mark - +#pragma mark * Iterator_Any_Select + +Iterator_Any_Select::Iterator_Any_Select( + ZRef<ZExprRep_Logic> iExprRep_Logic, ZRef<ZQE::Iterator> iIterator) +: fExprRep_Logic(iExprRep_Logic) +, fIterator(iIterator) + {} + +ZRef<ZQE::Result> Iterator_Any_Select::ReadInc() + { + for (;;) + { + if (ZRef<ZQE::Result> theZQEResult = fIterator->ReadInc()) + { + if (ZRef<ZQE::Result_Any> theResult = + theZQEResult.DynamicCast<ZQE::Result_Any>()) + { + if (sMatches(fExprRep_Logic, theResult->GetVal())) + return theResult; + } + } + else + { + return ZRef<ZQE::Result>(); + } + } + } + +void Iterator_Any_Select::Rewind() + { fIterator->Rewind(); } + +} // namespace ZQE +NAMESPACE_ZOOLIB_END Added: trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Iterator_Any.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Iterator_Any.h (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Iterator_Any.h 2010-04-07 03:54:46 UTC (rev 1246) @@ -0,0 +1,69 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2010 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#ifndef __ZQE_Iterator_Any__ +#define __ZQE_Iterator_Any__ 1 +#include "zconfig.h" + +#include "zoolib/ZExpr_Logic.h" +#include "zoolib/ZValCondition.h" +#include "zoolib/zqe/ZQE_Iterator.h" + +NAMESPACE_ZOOLIB_BEGIN +namespace ZQE { + +// ================================================================================================= +#pragma mark - +#pragma mark * Iterator_Any_Restrict + +class Iterator_Any_Restrict : public ZQE::Iterator + { +public: + Iterator_Any_Restrict(const ZValCondition& iValCondition, ZRef<ZQE::Iterator> iIterator); + + virtual ZRef<ZQE::Result> ReadInc(); + virtual void Rewind(); + +private: + ZValCondition fValCondition; + ZRef<Iterator> fIterator; + }; + +// ================================================================================================= +#pragma mark - +#pragma mark * Iterator_Any_Select + +class Iterator_Any_Select : public ZQE::Iterator + { +public: + Iterator_Any_Select(ZRef<ZExprRep_Logic> iExprRep_Logic, ZRef<ZQE::Iterator> iIterator); + + virtual ZRef<ZQE::Result> ReadInc(); + virtual void Rewind(); + +private: + ZRef<ZExprRep_Logic> fExprRep_Logic; + ZRef<Iterator> fIterator; + }; + +} // namespace ZQE +NAMESPACE_ZOOLIB_END + +#endif // __ZQE_Iterator_Any__ Added: trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Result.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Result.cpp (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Result.cpp 2010-04-07 03:54:46 UTC (rev 1246) @@ -0,0 +1,40 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2010 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#include "zoolib/ZLog.h" +#include "zoolib/zqe/ZQE_Result.h" + +NAMESPACE_ZOOLIB_BEGIN +namespace ZQE { + +bool Result::SameAs(ZRef<Result> iOther) + { + ZLOGFUNCTION(eDebug); + return this == iOther; + } + +ZRef<Result> Result::JoinedWith(ZRef<Result> iOther) + { + ZLOGFUNCTION(eDebug); + return this; + } + +} // namespace ZQE +NAMESPACE_ZOOLIB_END Added: trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Result.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Result.h (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Result.h 2010-04-07 03:54:46 UTC (rev 1246) @@ -0,0 +1,45 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2010 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#ifndef __ZQE_Result__ +#define __ZQE_Result__ 1 +#include "zconfig.h" + +#include "zoolib/ZRef_Counted.h" +#include "zoolib/ZValCondition.h" + +NAMESPACE_ZOOLIB_BEGIN +namespace ZQE { + +// ================================================================================================= +#pragma mark - +#pragma mark * Result + +class Result : public ZRefCountedWithFinalize + { +public: + virtual bool SameAs(ZRef<Result> iOther); + virtual ZRef<Result> JoinedWith(ZRef<Result> iOther); + }; + +} // namespace ZQE +NAMESPACE_ZOOLIB_END + +#endif // __ZQE_Result__ Added: trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Result_Any.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Result_Any.cpp (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Result_Any.cpp 2010-04-07 03:54:46 UTC (rev 1246) @@ -0,0 +1,38 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2010 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#include "zoolib/zqe/ZQE_Result_Any.h" + +NAMESPACE_ZOOLIB_BEGIN +namespace ZQE { + +// ================================================================================================= +#pragma mark - +#pragma mark * Result_Any + +Result_Any::Result_Any(const ZVal_Any& iVal) +: fVal(iVal) + {} + +const ZVal_Any& Result_Any::GetVal() + { return fVal; } + +} // namespace ZQE +NAMESPACE_ZOOLIB_END Added: trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Result_Any.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Result_Any.h (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Result_Any.h 2010-04-07 03:54:46 UTC (rev 1246) @@ -0,0 +1,50 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2010 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#ifndef __ZQE_Result_Any__ +#define __ZQE_Result_Any__ 1 +#include "zconfig.h" + +#include "zoolib/ZVal_Any.h" +#include "zoolib/zqe/ZQE_Result.h" + +NAMESPACE_ZOOLIB_BEGIN +namespace ZQE { + +// ================================================================================================= +#pragma mark - +#pragma mark * Result + +class Result_Any : public Result + { +public: + Result_Any(const ZVal_Any& iVal); + +// Our protocol + const ZVal_Any& GetVal(); + +private: + const ZVal_Any fVal; + }; + +} // namespace ZQE +NAMESPACE_ZOOLIB_END + +#endif // __ZQE_Result_Val_Any__ Added: trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Visitor_ExprRep_MakeIterator.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Visitor_ExprRep_MakeIterator.cpp (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Visitor_ExprRep_MakeIterator.cpp 2010-04-07 03:54:46 UTC (rev 1246) @@ -0,0 +1,89 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2010 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#include "zoolib/zqe/ZQE_Visitor_ExprRep_MakeIterator.h" + +NAMESPACE_ZOOLIB_BEGIN +namespace ZQE { + +// ================================================================================================= +#pragma mark - +#pragma mark * Visitor_ExprRep_MakeIterator + +ZRef<Iterator> Visitor_ExprRep_MakeIterator::MakeIterator(ZRef<ZExprRep> iExprRep) + { + ZRef<Iterator> theIterator; + if (iExprRep) + { + iExprRep->Accept(*this); + theIterator.swap(fIterator); + } + return theIterator; + } + +bool Visitor_ExprRep_MakeIterator::Visit_Difference(ZRef<ExprRep_Relation_Difference> iRep) + { + return true; + } + +bool Visitor_ExprRep_MakeIterator::Visit_Intersect(ZRef<ExprRep_Relation_Intersect> iRep) + { + if (ZRef<Iterator> lhs = this->MakeIterator(iRep->GetLHS())) + { + if (ZRef<Iterator> rhs = this->MakeIterator(iRep->GetRHS())) + fIterator = new Iterator_Intersect(lhs, rhs); + } + return true; + } + +bool Visitor_ExprRep_MakeIterator::Visit_Join(ZRef<ExprRep_Relation_Join> iRep) + { + if (ZRef<Iterator> lhs = this->MakeIterator(iRep->GetLHS())) + { + if (ZRef<Iterator> rhs = this->MakeIterator(iRep->GetRHS())) + fIterator = new Iterator_Join(lhs, rhs); + } + return true; + } + +bool Visitor_ExprRep_MakeIterator::Visit_Project(ZRef<ExprRep_Relation_Project> iRep) + { + return true; + } + +bool Visitor_ExprRep_MakeIterator::Visit_Rename(ZRef<ExprRep_Relation_Rename> iRep) + { + return true; + } + +bool Visitor_ExprRep_MakeIterator::Visit_Union(ZRef<ExprRep_Relation_Union> iRep) + { + if (ZRef<Iterator> lhs = this->MakeIterator(iRep->GetLHS())) + { + if (ZRef<Iterator> rhs = this->MakeIterator(iRep->GetRHS())) + fIterator = new Iterator_Union(lhs, rhs); + else + fIterator = lhs; + } + return true; + } + +} // namespace ZQE +NAMESPACE_ZOOLIB_END Added: trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Visitor_ExprRep_MakeIterator.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Visitor_ExprRep_MakeIterator.h (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Visitor_ExprRep_MakeIterator.h 2010-04-07 03:54:46 UTC (rev 1246) @@ -0,0 +1,60 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2010 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#ifndef __ZQE_Visitor_ExprRep_MakeIterator__ +#define __ZQE_Visitor_ExprRep_MakeIterator__ 1 +#include "zconfig.h" + +#include "zoolib/ZExpr.h" +#include "zoolib/zqe/ZQE_Iterator.h" +#include "zoolib/zql/ZQL_Expr_Relation.h" + +NAMESPACE_ZOOLIB_BEGIN +namespace ZQE { + +using namespace ZQL; + +// ================================================================================================= +#pragma mark - +#pragma mark * Visitor_ExprRep_MakeIterator + +class Visitor_ExprRep_MakeIterator +: public virtual Visitor_ExprRep_Relation + { +public: +// From Visitor_ExprRep_Relation + virtual bool Visit_Difference(ZRef<ExprRep_Relation_Difference> iRep); + virtual bool Visit_Intersect(ZRef<ExprRep_Relation_Intersect> iRep); + virtual bool Visit_Join(ZRef<ExprRep_Relation_Join> iRep); + virtual bool Visit_Project(ZRef<ExprRep_Relation_Project> iRep); + virtual bool Visit_Rename(ZRef<ExprRep_Relation_Rename> iRep); + virtual bool Visit_Union(ZRef<ExprRep_Relation_Union> iRep); + +// Our protocol + ZRef<Iterator> MakeIterator(ZRef<ZExprRep> iExprRep); + +protected: + ZRef<Iterator> fIterator; + }; + +} // namespace ZQE +NAMESPACE_ZOOLIB_END + +#endif // __ZQE_Visitor_ExprRep_MakeIterator__ Added: trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Concrete.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Concrete.cpp (... [truncated message content] |
From: <ag...@us...> - 2010-04-07 22:14:39
|
Revision: 1255 http://zoolib.svn.sourceforge.net/zoolib/?rev=1255&view=rev Author: agreen Date: 2010-04-07 22:14:33 +0000 (Wed, 07 Apr 2010) Log Message: ----------- Rework ZYadR_ExprRep_Logic to also support RPos sequences. Also add ZYadSeqR_ApplyID and ZYadSeqRPos_ApplyID. Modified Paths: -------------- trunk/zoolib/source/cxx/more/zoolib/tql/ZTQLTest.cpp Added Paths: ----------- trunk/zoolib/source/cxx/zoolib/ZYadSeq_ApplyID.cpp trunk/zoolib/source/cxx/zoolib/ZYadSeq_ApplyID.h trunk/zoolib/source/cxx/zoolib/ZYadSeq_ExprRep_Logic.cpp trunk/zoolib/source/cxx/zoolib/ZYadSeq_ExprRep_Logic.h Removed Paths: ------------- trunk/zoolib/source/cxx/zoolib/ZYadSeqR_ExprRep_Logic.cpp trunk/zoolib/source/cxx/zoolib/ZYadSeqR_ExprRep_Logic.h Modified: trunk/zoolib/source/cxx/more/zoolib/tql/ZTQLTest.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tql/ZTQLTest.cpp 2010-04-07 21:34:51 UTC (rev 1254) +++ trunk/zoolib/source/cxx/more/zoolib/tql/ZTQLTest.cpp 2010-04-07 22:14:33 UTC (rev 1255) @@ -29,7 +29,7 @@ #include "zoolib/valbase/ZValBase_YadSeqR.h" #include "zoolib/valbase/ZValBase_YadSeqRPos.h" -#include "zoolib/ZYadSeqR_ExprRep_Logic.h" +#include "zoolib/ZYadSeq_ExprRep_Logic.h" #include "zoolib/zqe/ZQE_Result_Any.h" NAMESPACE_ZOOLIB_USING Deleted: trunk/zoolib/source/cxx/zoolib/ZYadSeqR_ExprRep_Logic.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZYadSeqR_ExprRep_Logic.cpp 2010-04-07 21:34:51 UTC (rev 1254) +++ trunk/zoolib/source/cxx/zoolib/ZYadSeqR_ExprRep_Logic.cpp 2010-04-07 22:14:33 UTC (rev 1255) @@ -1,57 +0,0 @@ -/* ------------------------------------------------------------------------------------------------- -Copyright (c) 2010 Andrew Green -http://www.zoolib.org - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software -and associated documentation files (the "Software"), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, merge, publish, distribute, -sublicense, and/or sell copies of the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING -BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES -OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------------------------- */ - -#include "zoolib/ZExpr_ValCondition.h" -#include "zoolib/ZYad_Any.h" -#include "zoolib/ZYadSeqR_ExprRep_Logic.h" - -NAMESPACE_ZOOLIB_BEGIN - -// ================================================================================================= -#pragma mark - -#pragma mark * ZYadSeqR_ExprRep_Logic - -ZYadSeqR_ExprRep_Logic::ZYadSeqR_ExprRep_Logic( - ZRef<ZYadSeqR> iYadSeqR, ZRef<ZExprRep_Logic> iExprRep_Logic) -: fYadSeqR(iYadSeqR) -, fExprRep_Logic(iExprRep_Logic) - {} - -ZYadSeqR_ExprRep_Logic::~ZYadSeqR_ExprRep_Logic() - {} - -ZRef<ZYadR> ZYadSeqR_ExprRep_Logic::ReadInc() - { - for (;;) - { - if (ZRef<ZYadR> theYadR = fYadSeqR->ReadInc()) - { - const ZVal_Any theVal = sFromYadR(ZVal_Any(), theYadR); - if (sMatches(fExprRep_Logic, theVal)) - return sMakeYadR(theVal); - } - else - { - return ZRef<ZYadR>(); - } - } - } - -NAMESPACE_ZOOLIB_END Deleted: trunk/zoolib/source/cxx/zoolib/ZYadSeqR_ExprRep_Logic.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZYadSeqR_ExprRep_Logic.h 2010-04-07 21:34:51 UTC (rev 1254) +++ trunk/zoolib/source/cxx/zoolib/ZYadSeqR_ExprRep_Logic.h 2010-04-07 22:14:33 UTC (rev 1255) @@ -1,50 +0,0 @@ -/* ------------------------------------------------------------------------------------------------- -Copyright (c) 2010 Andrew Green -http://www.zoolib.org - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software -and associated documentation files (the "Software"), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, merge, publish, distribute, -sublicense, and/or sell copies of the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING -BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES -OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------------------------- */ - -#ifndef __ZYadSeqR_ExprRep_Logic__ -#define __ZYadSeqR_ExprRep_Logic__ 1 -#include "zconfig.h" - -#include "zoolib/ZExpr_Logic.h" -#include "zoolib/ZYad.h" - -NAMESPACE_ZOOLIB_BEGIN - -// ================================================================================================= -#pragma mark - -#pragma mark * ZYadSeqR_ExprRep_Logic - -class ZYadSeqR_ExprRep_Logic : public ZYadSeqR - { -public: - ZYadSeqR_ExprRep_Logic(ZRef<ZYadSeqR> iYadSeqR, ZRef<ZExprRep_Logic> iExprRep_Logic); - virtual ~ZYadSeqR_ExprRep_Logic(); - -// From ZYadSeqR - virtual ZRef<ZYadR> ReadInc(); - -private: - ZRef<ZYadSeqR> fYadSeqR; - ZRef<ZExprRep_Logic> fExprRep_Logic; - }; - -NAMESPACE_ZOOLIB_END - -#endif // __ZYadSeqR_Logic__ Added: trunk/zoolib/source/cxx/zoolib/ZYadSeq_ApplyID.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZYadSeq_ApplyID.cpp (rev 0) +++ trunk/zoolib/source/cxx/zoolib/ZYadSeq_ApplyID.cpp 2010-04-07 22:14:33 UTC (rev 1255) @@ -0,0 +1,94 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2010 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#include "zoolib/ZYad_Any.h" +#include "zoolib/ZYadSeq_ApplyID.h" + +NAMESPACE_ZOOLIB_BEGIN + +// ================================================================================================= +#pragma mark - +#pragma mark * ZYadSeqR_ExprRep_Logic + +ZYadSeqR_ApplyID::ZYadSeqR_ApplyID( + ZRef<ZYadSeqR> iYadSeqR, const std::string& iIDName, const std::string& iValName) +: fYadSeqR(iYadSeqR) +, fIDName(iIDName) +, fValName(iValName) +, fNextID(1) + {} + +ZYadSeqR_ApplyID::~ZYadSeqR_ApplyID() + {} + +ZRef<ZYadR> ZYadSeqR_ApplyID::ReadInc() + { + if (ZRef<ZYadR> theYadR = fYadSeqR->ReadInc()) + { + ZMap_Any theMap; + theMap.Set(fIDName, ++fNextID); + theMap.Set(fValName, sFromYadR(ZVal_Any(), theYadR)); + return sMakeYadR(theMap); + } + + return ZRef<ZYadR>(); + } + +// ================================================================================================= +#pragma mark - +#pragma mark * ZYadSeqRPos_ApplyID + +ZYadSeqRPos_ApplyID::ZYadSeqRPos_ApplyID( + ZRef<ZYadSeqRPos> iYadSeqRPos, const std::string& iIDName, const std::string& iValName) +: fYadSeqRPos(iYadSeqRPos) +, fIDName(iIDName) +, fValName(iValName) + {} + +ZYadSeqRPos_ApplyID::~ZYadSeqRPos_ApplyID() + {} + +ZRef<ZYadR> ZYadSeqRPos_ApplyID::ReadInc() + { + const uint64 thePosition = fYadSeqRPos->GetPosition(); + if (ZRef<ZYadR> theYadR = fYadSeqRPos->ReadInc()) + { + ZMap_Any theMap; + theMap.Set(fIDName, thePosition); + theMap.Set(fValName, sFromYadR(ZVal_Any(), theYadR)); + return sMakeYadR(theMap); + } + + return ZRef<ZYadR>(); + } + +ZRef<ZYadSeqRPos> ZYadSeqRPos_ApplyID::Clone() + { return new ZYadSeqRPos_ApplyID(fYadSeqRPos->Clone(), fIDName, fValName); } + +uint64 ZYadSeqRPos_ApplyID::GetPosition() + { return fYadSeqRPos->GetPosition(); } + +void ZYadSeqRPos_ApplyID::SetPosition(uint64 iPosition) + { fYadSeqRPos->SetPosition(iPosition); } + +uint64 ZYadSeqRPos_ApplyID::GetSize() + { return fYadSeqRPos->GetSize(); } + +NAMESPACE_ZOOLIB_END Added: trunk/zoolib/source/cxx/zoolib/ZYadSeq_ApplyID.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZYadSeq_ApplyID.h (rev 0) +++ trunk/zoolib/source/cxx/zoolib/ZYadSeq_ApplyID.h 2010-04-07 22:14:33 UTC (rev 1255) @@ -0,0 +1,82 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2010 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#ifndef __ZYadSeqR_ApplyID__ +#define __ZYadSeqR_ApplyID__ 1 +#include "zconfig.h" + +#include "zoolib/ZYad.h" + +NAMESPACE_ZOOLIB_BEGIN + +// ================================================================================================= +#pragma mark - +#pragma mark * ZYadSeqR_ApplyID + +class ZYadSeqR_ApplyID : public ZYadSeqR + { +public: + ZYadSeqR_ApplyID( + ZRef<ZYadSeqR> iYadSeqR, const std::string& iIDName, const std::string& iValName); + + virtual ~ZYadSeqR_ApplyID(); + +// From ZYadSeqR + virtual ZRef<ZYadR> ReadInc(); + +private: + ZRef<ZYadSeqR> fYadSeqR; + const std::string fIDName; + const std::string fValName; + uint64 fNextID; + }; + +// ================================================================================================= +#pragma mark - +#pragma mark * ZYadSeqRPos_ApplyID + +class ZYadSeqRPos_ApplyID : public ZYadSeqRPos + { +public: + ZYadSeqRPos_ApplyID( + ZRef<ZYadSeqRPos> iYadSeqRPos, const std::string& iIDName, const std::string& iValName); + + virtual ~ZYadSeqRPos_ApplyID(); + +// From ZYadSeqR via ZYadSeqRPos + virtual ZRef<ZYadR> ReadInc(); + +// From ZYadSeqRPos + virtual ZRef<ZYadSeqRPos> Clone(); + + virtual uint64 GetPosition(); + virtual void SetPosition(uint64 iPosition); + + virtual uint64 GetSize(); + +private: + ZRef<ZYadSeqRPos> fYadSeqRPos; + const std::string fIDName; + const std::string fValName; + }; + +NAMESPACE_ZOOLIB_END + +#endif // __ZYadSeqR_Logic__ Added: trunk/zoolib/source/cxx/zoolib/ZYadSeq_ExprRep_Logic.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZYadSeq_ExprRep_Logic.cpp (rev 0) +++ trunk/zoolib/source/cxx/zoolib/ZYadSeq_ExprRep_Logic.cpp 2010-04-07 22:14:33 UTC (rev 1255) @@ -0,0 +1,99 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2010 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#include "zoolib/ZExpr_ValCondition.h" +#include "zoolib/ZYad_Any.h" +#include "zoolib/ZYadSeq_ExprRep_Logic.h" + +NAMESPACE_ZOOLIB_BEGIN + +// ================================================================================================= +#pragma mark - +#pragma mark * ZYadSeqR_ExprRep_Logic + +ZYadSeqR_ExprRep_Logic::ZYadSeqR_ExprRep_Logic( + ZRef<ZYadSeqR> iYadSeqR, ZRef<ZExprRep_Logic> iExprRep_Logic) +: fYadSeqR(iYadSeqR) +, fExprRep_Logic(iExprRep_Logic) + {} + +ZYadSeqR_ExprRep_Logic::~ZYadSeqR_ExprRep_Logic() + {} + +ZRef<ZYadR> ZYadSeqR_ExprRep_Logic::ReadInc() + { + for (;;) + { + if (ZRef<ZYadR> theYadR = fYadSeqR->ReadInc()) + { + const ZVal_Any theVal = sFromYadR(ZVal_Any(), theYadR); + if (sMatches(fExprRep_Logic, theVal)) + return sMakeYadR(theVal); + } + else + { + return ZRef<ZYadR>(); + } + } + } + +// ================================================================================================= +#pragma mark - +#pragma mark * ZYadSeqRPos_ExprRep_Logic + +ZYadSeqRPos_ExprRep_Logic::ZYadSeqRPos_ExprRep_Logic( + ZRef<ZYadSeqRPos> iYadSeqRPos, ZRef<ZExprRep_Logic> iExprRep_Logic) +: fYadSeqRPos(iYadSeqRPos) +, fExprRep_Logic(iExprRep_Logic) + {} + +ZYadSeqRPos_ExprRep_Logic::~ZYadSeqRPos_ExprRep_Logic() + {} + +ZRef<ZYadR> ZYadSeqRPos_ExprRep_Logic::ReadInc() + { + for (;;) + { + if (ZRef<ZYadR> theYadR = fYadSeqRPos->ReadInc()) + { + const ZVal_Any theVal = sFromYadR(ZVal_Any(), theYadR); + if (sMatches(fExprRep_Logic, theVal)) + return sMakeYadR(theVal); + } + else + { + return ZRef<ZYadR>(); + } + } + } + +ZRef<ZYadSeqRPos> ZYadSeqRPos_ExprRep_Logic::Clone() + { return new ZYadSeqRPos_ExprRep_Logic(fYadSeqRPos->Clone(), fExprRep_Logic); } + +uint64 ZYadSeqRPos_ExprRep_Logic::GetPosition() + { return fYadSeqRPos->GetPosition(); } + +void ZYadSeqRPos_ExprRep_Logic::SetPosition(uint64 iPosition) + { fYadSeqRPos->SetPosition(iPosition); } + +uint64 ZYadSeqRPos_ExprRep_Logic::GetSize() + { return fYadSeqRPos->GetSize(); } + +NAMESPACE_ZOOLIB_END Added: trunk/zoolib/source/cxx/zoolib/ZYadSeq_ExprRep_Logic.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZYadSeq_ExprRep_Logic.h (rev 0) +++ trunk/zoolib/source/cxx/zoolib/ZYadSeq_ExprRep_Logic.h 2010-04-07 22:14:33 UTC (rev 1255) @@ -0,0 +1,76 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2010 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#ifndef __ZYadSeq_ExprRep_Logic__ +#define __ZYadSeq_ExprRep_Logic__ 1 +#include "zconfig.h" + +#include "zoolib/ZExpr_Logic.h" +#include "zoolib/ZYad.h" + +NAMESPACE_ZOOLIB_BEGIN + +// ================================================================================================= +#pragma mark - +#pragma mark * ZYadSeqR_ExprRep_Logic + +class ZYadSeqR_ExprRep_Logic : public ZYadSeqR + { +public: + ZYadSeqR_ExprRep_Logic(ZRef<ZYadSeqR> iYadSeqR, ZRef<ZExprRep_Logic> iExprRep_Logic); + virtual ~ZYadSeqR_ExprRep_Logic(); + +// From ZYadSeqR + virtual ZRef<ZYadR> ReadInc(); + +private: + ZRef<ZYadSeqR> fYadSeqR; + ZRef<ZExprRep_Logic> fExprRep_Logic; + }; + +// ================================================================================================= +#pragma mark - +#pragma mark * ZYadSeqRPos_ExprRep_Logic + +class ZYadSeqRPos_ExprRep_Logic : public ZYadSeqRPos + { +public: + ZYadSeqRPos_ExprRep_Logic(ZRef<ZYadSeqRPos> iYadSeqRPos, ZRef<ZExprRep_Logic> iExprRep_Logic); + virtual ~ZYadSeqRPos_ExprRep_Logic(); + +// From ZYadSeqR via ZYadSeqRPos + virtual ZRef<ZYadR> ReadInc(); + +// From ZYadSeqRPos + virtual ZRef<ZYadSeqRPos> Clone(); + + virtual uint64 GetPosition(); + virtual void SetPosition(uint64 iPosition); + + virtual uint64 GetSize(); + +private: + ZRef<ZYadSeqRPos> fYadSeqRPos; + ZRef<ZExprRep_Logic> fExprRep_Logic; + }; + +NAMESPACE_ZOOLIB_END + +#endif // __ZYadSeq_ExprRep_Logic__ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2010-04-08 17:58:35
|
Revision: 1259 http://zoolib.svn.sourceforge.net/zoolib/?rev=1259&view=rev Author: agreen Date: 2010-04-08 17:58:27 +0000 (Thu, 08 Apr 2010) Log Message: ----------- The value-based wrapper around ZRef<ZExprRep> turns out to be more trouble than it's worth. A simple typedef is sufficient. Modified Paths: -------------- trunk/zoolib/source/cxx/more/zoolib/tql/ZTQLTest.cpp trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Optimize.cpp trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Optimize.h trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_TQLConvert.cpp trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_TQLConvert.h trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_Any.cpp trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_Any.h trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_SQLite.h trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_YadSeqR.cpp trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_YadSeqR.h trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_YadSeqRPos.cpp trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_YadSeqRPos.h trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Iterator_Any.cpp trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Iterator_Any.h trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Util_Strim_Query.cpp trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Util_Strim_Query.h trunk/zoolib/source/cxx/zoolib/ZYadSeq_ExprRep_Logic.cpp trunk/zoolib/source/cxx/zoolib/ZYadSeq_ExprRep_Logic.h Added Paths: ----------- trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase.cpp trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase.h trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Visitor_ExprRep_DoMakeIterator.cpp trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Visitor_ExprRep_DoMakeIterator.h trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_ExprRep_Relation.cpp trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_ExprRep_Relation.h trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_ExprRep_Relation_Concrete.cpp trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_ExprRep_Relation_Concrete.h trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_ExprRep_Relation_Restrict.h trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_ExprRep_Relation_Restrict_T.h trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_ExprRep_Relation_Select.cpp trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_ExprRep_Relation_Select.h trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Relation_DoToStrim.cpp trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Relation_DoToStrim.h trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Relation_DoTransform.cpp trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Relation_DoTransform.h trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Relation_Restrict_DoToStrim.cpp trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Relation_Restrict_DoToStrim.h trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Relation_Restrict_DoTransform.cpp trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Relation_Restrict_DoTransform.h trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Relation_Select_DoToStrim.cpp trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Relation_Select_DoToStrim.h trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Relation_Select_DoTransform.cpp trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Relation_Select_DoTransform.h trunk/zoolib/source/cxx/zoolib/ZExprRep.cpp trunk/zoolib/source/cxx/zoolib/ZExprRep.h trunk/zoolib/source/cxx/zoolib/ZExprRep_Logic.cpp trunk/zoolib/source/cxx/zoolib/ZExprRep_Logic.h trunk/zoolib/source/cxx/zoolib/ZExprRep_Logic_ValCondition.h trunk/zoolib/source/cxx/zoolib/ZExprRep_Logic_ValCondition_T.h trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_DoToStrim.cpp trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_DoToStrim.h trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_DoTransform.cpp trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_DoTransform.h trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_Logic_DoEval.cpp trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_Logic_DoEval.h trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_Logic_DoToStrim.cpp trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_Logic_DoToStrim.h trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_Logic_DoTransform.cpp trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_Logic_DoTransform.h trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_Logic_ValCondition_DoToStrim.cpp trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_Logic_ValCondition_DoToStrim.h Removed Paths: ------------- trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Visitor_ExprRep_MakeIterator.cpp trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Visitor_ExprRep_MakeIterator.h trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_All.cpp trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_All.h trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Concrete.cpp trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Concrete.h trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Relation.cpp trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Relation.h trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Restrict.h trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Restrict_T.h trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Select.cpp trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Expr_Select.h trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Relation_ToStrim.cpp trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Relation_ToStrim.h trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Relation_Transform.cpp trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Relation_Transform.h trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Restrict_ToStrim.cpp trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Restrict_ToStrim.h trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Restrict_Transform.cpp trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Restrict_Transform.h trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Select_ToStrim.cpp trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Select_ToStrim.h trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Select_Transform.cpp trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_Visitor_ExprRep_Select_Transform.h trunk/zoolib/source/cxx/zoolib/ZExpr.cpp trunk/zoolib/source/cxx/zoolib/ZExpr.h trunk/zoolib/source/cxx/zoolib/ZExpr_Logic.cpp trunk/zoolib/source/cxx/zoolib/ZExpr_Logic.h trunk/zoolib/source/cxx/zoolib/ZExpr_ValCondition.h trunk/zoolib/source/cxx/zoolib/ZExpr_ValCondition_T.h trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_Logic_Eval.cpp trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_Logic_Eval.h trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_Logic_ToStrim.cpp trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_Logic_ToStrim.h trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_Logic_Transform.cpp trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_Logic_Transform.h trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_ToStrim.cpp trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_ToStrim.h trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_Transform.cpp trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_Transform.h trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_ValCondition_ToStrim.cpp trunk/zoolib/source/cxx/zoolib/ZVisitor_ExprRep_ValCondition_ToStrim.h Modified: trunk/zoolib/source/cxx/more/zoolib/tql/ZTQLTest.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tql/ZTQLTest.cpp 2010-04-08 03:11:21 UTC (rev 1258) +++ trunk/zoolib/source/cxx/more/zoolib/tql/ZTQLTest.cpp 2010-04-08 17:58:27 UTC (rev 1259) @@ -1,12 +1,11 @@ #include "zoolib/tql/ZTQL_Optimize.h" -#include "zoolib/zql/ZQL_Expr_All.h" -#include "zoolib/zql/ZQL_Expr_Restrict.h" -#include "zoolib/zql/ZQL_Expr_Select.h" +#include "zoolib/zql/ZQL_ExprRep_Relation_Restrict.h" +#include "zoolib/zql/ZQL_ExprRep_Relation_Select.h" #include "zoolib/zql/ZQL_Util_Strim_Query.h" #include "zoolib/tql/ZUtil_TQLConvert.h" -#include "zoolib/ZExpr_ValCondition.h" +#include "zoolib/ZExprRep_Logic_ValCondition.h" #include "zoolib/ZUtil_Strim_Tuple.h" @@ -41,6 +40,10 @@ using std::set; using std::string; + +typedef ZRef<ZExprRep_Logic> ZExpr_Logic; +typedef ZRef<ZQL::ExprRep_Relation> Expr_Relation; + typedef ZExpr_Logic Spec; typedef Expr_Relation Query; typedef ZMap_Expr Map; @@ -48,6 +51,15 @@ typedef ZVal_Expr Val; typedef ZValCondition Condition; +ZRef<ExprRep_Relation> sAll(const ZRelHead& iRelHead) + { return ZValBase::sConcrete(); } + +ZRef<ExprRep_Relation> sAllID(const std::string& iIDName) + { return ZValBase::sConcrete(); } + +ZRef<ExprRep_Relation> sAllID(const std::string& iIDName, const ZRelHead& iRelHead) + { return ZValBase::sConcrete(); } + // ================================================================================================= #pragma mark - #pragma mark * ZTQL, test code @@ -144,7 +156,7 @@ | CName("pass") == CName("unam") ); */ - return ZExpr_ValCondition(theSpec); + return new ZExprRep_Logic_ValCondition(theSpec); } static Query badPassword() @@ -180,7 +192,7 @@ bool universal; set<string> theNames; - iQuery.GetRelHead().GetNames(universal, theNames); + iQuery->GetRelHead().GetNames(universal, theNames); for (set<string>::iterator i = theNames.begin(); i != theNames.end(); ++i) { if (iIgnore.Contains(*i)) @@ -202,7 +214,7 @@ static Query sDrop(Query iQuery, const string& iTName) { - RelHead theRelHead = iQuery.GetRelHead(); + RelHead theRelHead = iQuery->GetRelHead(); if (theRelHead.Contains(iTName)) return sProject(theRelHead - iTName, iQuery); return iQuery; @@ -280,7 +292,7 @@ static void sDumpQuery(const ZStrimW& s, Query iQuery) { - ZVisitor_ExprRep_ToStrim::Options theOptions; + ZVisitor_ExprRep_DoToStrim::Options theOptions; theOptions.fDebuggingOutput = true; s << "ZTQL::Query equivalent -----------------------\n"; @@ -350,7 +362,7 @@ // ZExpr_ValCondition theSpec1 = CVal() > CConst(10); // Spec theSpec = Spec(false) | (CVal() > CConst(10)); // Spec theSpec = (); - Spec theSpec = ZExpr_ValCondition(CTrail("inner/field") < CConst(10)); + Spec theSpec = new ZExprRep_Logic_ValCondition(CTrail("inner/field") < CConst(10)); thePhys = thePhys & theSpec; Util_Strim_Query::sToStrim(thePhys, s); @@ -386,12 +398,12 @@ theMap.Set("name", ZMap_Expr().Set("last", string("fred"))); // Spec theSpec = CTrail("name/last") < CConst("fred1"); - if (sMatches(ZExpr_ValCondition(CTrail("name/last") < CConst("fred1")), theMap)) + if (sMatches(new ZExprRep_Logic_ValCondition(CTrail("name/last") < CConst("fred1")), theMap)) s << "Matches\n"; else s << "Doesn't\n"; - if (sMatches(ZExpr_ValCondition(CTrail("name/last") >= CConst("fred1")), theMap)) + if (sMatches(new ZExprRep_Logic_ValCondition(CTrail("name/last") >= CConst("fred1")), theMap)) s << "Matches\n"; else s << "Doesn't\n"; @@ -464,8 +476,8 @@ ZRef<ZYadSeqR> yad1 = sMakeYadR(s1); ZRef<ZYadSeqR> yad2 = sMakeYadR(s2); - Expr_Concrete thePhys1 = ZValBase_YadSeqR::sConcrete(yad1); - Expr_Concrete thePhys2 = ZValBase_YadSeqR::sConcrete(yad2); + Expr_Relation thePhys1 = ZValBase_YadSeqR::sConcrete(yad1); + Expr_Relation thePhys2 = ZValBase_YadSeqR::sConcrete(yad2); // Expr_Relation sect = sJoin(thePhys1, thePhys2); Expr_Relation sect = thePhys1 * thePhys2; @@ -516,6 +528,15 @@ ZRef<ZYadR> theYadR = ZYad_ZooLibStream::sMakeYadR(theStreamerR); #endif + { + ZExpr_Logic theCondition = + CName("Disc Number") == CConst(int32(2)) & CName("Track Number") > CConst(int32(10)); + Expr_Relation thePhys = ZValBase::sConcrete() & theCondition; + Util_Strim_Query::sToStrim(thePhys, s); + s << "\n"; + } + + ZSeq_Any theSeqTracks; if (ZRef<ZYadMapR> theYadMapR = ZUtil_Yad::sWalk(theYadR, "Tracks").DynamicCast<ZYadMapR>()) theSeqTracks = sFromYadR(ZVal_Any(), sMapAsSeq("Dummy", theYadMapR)).GetSeq(); Modified: trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Optimize.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Optimize.cpp 2010-04-08 03:11:21 UTC (rev 1258) +++ trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Optimize.cpp 2010-04-08 17:58:27 UTC (rev 1259) @@ -18,11 +18,11 @@ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ------------------------------------------------------------------------------------------------- */ -#include "zoolib/ZExpr_ValCondition.h" -#include "zoolib/ZVisitor_ExprRep_Logic_Transform.h" +#include "zoolib/ZExprRep_Logic_ValCondition.h" +#include "zoolib/ZVisitor_ExprRep_Logic_DoTransform.h" #include "zoolib/tql/ZTQL_Optimize.h" -#include "zoolib/zql/ZQL_Expr_Restrict.h" -#include "zoolib/zql/ZQL_Visitor_ExprRep_Select_Transform.h" +#include "zoolib/zql/ZQL_ExprRep_Relation_Restrict.h" +#include "zoolib/zql/ZQL_Visitor_ExprRep_Relation_Select_DoTransform.h" NAMESPACE_ZOOLIB_BEGIN using namespace ZQL; @@ -58,21 +58,21 @@ void spGather(ZRef<ZExprRep_Logic> iRep, CondUnion& oResult); class Gather -: public virtual ZVisitor_ExprRep_Logic_Transform -, public virtual ZVisitor_ExprRep_ValCondition +: public virtual ZVisitor_ExprRep_Logic_DoTransform +, public virtual ZVisitor_ExprRep_Logic_ValCondition { public: Gather(CondUnion& oResult); -// From ZVisitor_ExprRep_Logic_Transform +// From ZVisitor_ExprRep_Logic_DoTransform virtual bool Visit_Logic_True(ZRef<ZExprRep_Logic_True> iRep); virtual bool Visit_Logic_False(ZRef<ZExprRep_Logic_False> iRep); virtual bool Visit_Logic_Not(ZRef<ZExprRep_Logic_Not> iRep); virtual bool Visit_Logic_And(ZRef<ZExprRep_Logic_And> iRep); virtual bool Visit_Logic_Or(ZRef<ZExprRep_Logic_Or> iRep); -// From ZVisitor_ExprRep_ValCondition - virtual bool Visit_ValCondition(ZRef<ZExprRep_ValCondition> iRep); +// From ZVisitor_ExprRep_Logic_ValCondition + virtual bool Visit_ValCondition(ZRef<ZExprRep_Logic_ValCondition> iRep); private: CondUnion& fResult; @@ -122,7 +122,7 @@ return true; } -bool Gather::Visit_ValCondition(ZRef<ZExprRep_ValCondition> iRep) +bool Gather::Visit_ValCondition(ZRef<ZExprRep_Logic_ValCondition> iRep) { fResult.resize(1); fResult[0].push_back(iRep->GetValCondition()); @@ -153,7 +153,7 @@ for (CondSect::const_iterator iterSect = iterUnion->begin(); iterSect != iterUnion->end(); ++iterSect) { - current = new ExprRep_Restrict(*iterSect, current); + current = new ExprRep_Relation_Restrict(*iterSect, current); } if (resultRelation) @@ -165,16 +165,16 @@ } class Optimize -: public virtual Visitor_ExprRep_Select_Transform +: public virtual Visitor_ExprRep_Relation_Select_DoTransform { public: -// From Visitor_ExprRep_Select - virtual bool Visit_Select(ZRef<ExprRep_Select> iRep); +// From Visitor_ExprRep_Relation_Select + virtual bool Visit_ExprRep_Relation_Select(ZRef<ExprRep_Relation_Select> iRep); }; -bool Optimize::Visit_Select(ZRef<ExprRep_Select> iRep) +bool Optimize::Visit_ExprRep_Relation_Select(ZRef<ExprRep_Relation_Select> iRep) { - ZRef<ExprRep_Relation> newRep = this->Transform(iRep->GetExprRep_Relation()).DynamicCast<ExprRep_Relation>(); + ZRef<ExprRep_Relation> newRep = this->DoTransform(iRep->GetExprRep_Relation()).DynamicCast<ExprRep_Relation>(); fResult = spConvertSelect(newRep, iRep->GetExprRep_Logic()); return true; } @@ -184,7 +184,7 @@ namespace ZQL { ZRef<ExprRep_Relation> sOptimize(ZRef<ExprRep_Relation> iRep) - { return Optimize().Transform(iRep).DynamicCast<ExprRep_Relation>(); } + { return Optimize().DoTransform(iRep).DynamicCast<ExprRep_Relation>(); } } // namespace ZQL NAMESPACE_ZOOLIB_END Modified: trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Optimize.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Optimize.h 2010-04-08 03:11:21 UTC (rev 1258) +++ trunk/zoolib/source/cxx/more/zoolib/tql/ZTQL_Optimize.h 2010-04-08 17:58:27 UTC (rev 1259) @@ -22,7 +22,7 @@ #define __ZTQL_Optimize__ 1 #include "zconfig.h" -#include "zoolib/zql/ZQL_Expr_Relation.h" +#include "zoolib/zql/ZQL_ExprRep_Relation.h" NAMESPACE_ZOOLIB_BEGIN Modified: trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_TQLConvert.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_TQLConvert.cpp 2010-04-08 03:11:21 UTC (rev 1258) +++ trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_TQLConvert.cpp 2010-04-08 17:58:27 UTC (rev 1259) @@ -19,9 +19,9 @@ ------------------------------------------------------------------------------------------------- */ #include "zoolib/tql/ZUtil_TQLConvert.h" -#include "zoolib/zql/ZQL_Expr_All.h" -#include "zoolib/zql/ZQL_Expr_Select.h" -#include "zoolib/ZExpr_ValCondition.h" +#include "zoolib/zql/ZQL_ExprRep_Relation_Select.h" +#include "zoolib/ZExprRep_Logic_ValCondition.h" +#include "zoolib/valbase/ZValBase.h" NAMESPACE_ZOOLIB_BEGIN @@ -31,8 +31,17 @@ using std::vector; using namespace ZQL; -typedef ZExpr_Logic Spec; -typedef Expr_Relation Query; +ZRef<ExprRep_Relation> sAll(const ZRelHead& iRelHead) + { return ZValBase::sConcrete(); } + +ZRef<ExprRep_Relation> sAllID(const std::string& iIDName) + { return ZValBase::sConcrete(); } + +ZRef<ExprRep_Relation> sAllID(const std::string& iIDName, const ZRelHead& iRelHead) + { return ZValBase::sConcrete(); } + +typedef ZRef<ZExprRep_Logic> Spec; +typedef ZRef<ExprRep_Relation> Query; typedef ZMap_Expr Map; typedef ZRelHead RelHead; typedef ZVal_Expr Val; @@ -88,7 +97,7 @@ if (sisfirst) { sisfirst = false; - sect = ZExpr_Logic(new ZExprRep_ValCondition(theCondition)); + sect = new ZExprRep_Logic_ValCondition(theCondition); } else { Modified: trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_TQLConvert.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_TQLConvert.h 2010-04-08 03:11:21 UTC (rev 1258) +++ trunk/zoolib/source/cxx/more/zoolib/tql/ZUtil_TQLConvert.h 2010-04-08 17:58:27 UTC (rev 1259) @@ -22,7 +22,7 @@ #define __ZUtil_TQLConvert__ #include "zconfig.h" -#include "zoolib/zql/ZQL_Expr_Relation.h" +#include "zoolib/zql/ZQL_ExprRep_Relation.h" #include "zoolib/tuplebase/ZTBQuery.h" NAMESPACE_ZOOLIB_BEGIN @@ -33,7 +33,7 @@ #pragma mark - #pragma mark * ZUtil_TQLConvert -ZQL::Expr_Relation sConvert(const ZTBQuery& iTBQuery, bool iVerbose); +ZRef<ZQL::ExprRep_Relation> sConvert(const ZTBQuery& iTBQuery, bool iVerbose); } // namespace ZUtil_TQLConvert Added: trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase.cpp (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase.cpp 2010-04-08 17:58:27 UTC (rev 1259) @@ -0,0 +1,128 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2010 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#include "zoolib/valbase/ZValBase.h" +#include "zoolib/zqe/ZQE_Iterator_Any.h" +#include "zoolib/zqe/ZQE_Result_Any.h" +#include "zoolib/zqe/ZQE_Visitor_ExprRep_DoMakeIterator.h" +#include "zoolib/zql/ZQL_ExprRep_Relation_Concrete.h" +#include "zoolib/zql/ZQL_ExprRep_Relation_Restrict.h" +#include "zoolib/zql/ZQL_ExprRep_Relation_Select.h" + +NAMESPACE_ZOOLIB_BEGIN +namespace ZValBase { + +// ================================================================================================= +#pragma mark - +#pragma mark * ExprRep_Relation_Concrete + +ExprRep_Relation_Concrete::ExprRep_Relation_Concrete() + {} + +ZRelHead ExprRep_Relation_Concrete::GetRelHead() + { return ZRelHead(true); } + +// ================================================================================================= +#pragma mark - +#pragma mark * Visitor_DoMakeIterator + +namespace ZANONYMOUS { + +class Visitor_DoMakeIterator +: public virtual ZQL::Visitor_ExprRep_Relation_Concrete +, public virtual ZQL::Visitor_ExprRep_Relation_Restrict +, public virtual ZQL::Visitor_ExprRep_Relation_Select +, public virtual ZQE::Visitor_ExprRep_DoMakeIterator + { +public: +// From Visitor_ExprRep_Relation_Concrete + virtual bool Visit_ExprRep_Relation_Concrete(ZRef<ZQL::ExprRep_Relation_Concrete> iRep); + +// From Visitor_ExprRep_Relation_Restrict + virtual bool Visit_ExprRep_Relation_Restrict(ZRef<ZQL::ExprRep_Relation_Restrict> iRep); + +// From Visitor_ExprRep_Relation_Select + virtual bool Visit_ExprRep_Relation_Select(ZRef<ZQL::ExprRep_Relation_Select> iRep); + }; + +bool Visitor_DoMakeIterator::Visit_ExprRep_Relation_Concrete(ZRef<ZQL::ExprRep_Relation_Concrete> iRep) + { + if (ZRef<ExprRep_Relation_Concrete> theRep = iRep.DynamicCast<ExprRep_Relation_Concrete>()) + { + fIterator = theRep->MakeIterator(); + return true; + } + return Visitor_ExprRep_Relation_Concrete::Visit_ExprRep_Relation_Concrete(iRep); + } + +bool Visitor_DoMakeIterator::Visit_ExprRep_Relation_Restrict(ZRef<ZQL::ExprRep_Relation_Restrict> iRep) + { + if (ZRef<ZQE::Iterator> theIterator = this->DoMakeIterator(iRep->GetExprRep())) + fIterator = new ZQE::Iterator_Any_Restrict(iRep->GetValCondition(), theIterator); + + return true; + } + +bool Visitor_DoMakeIterator::Visit_ExprRep_Relation_Select(ZRef<ZQL::ExprRep_Relation_Select> iRep) + { + if (ZRef<ZQE::Iterator> theIterator = this->DoMakeIterator(iRep->GetExprRep_Relation())) + fIterator = new ZQE::Iterator_Any_Select(iRep->GetExprRep_Logic(), theIterator); + + return true; + } + +} // anonymous namespace + +// ================================================================================================= +#pragma mark - +#pragma mark * ExprRep_Relation_Concrete_Dummy + +class ExprRep_Relation_Concrete_Dummy : public ZQL::ExprRep_Relation_Concrete + { +public: + ExprRep_Relation_Concrete_Dummy(); + +// From ExprRep_Relation via ExprRep_Relation_Concrete + virtual ZRelHead GetRelHead(); + }; + +ExprRep_Relation_Concrete_Dummy::ExprRep_Relation_Concrete_Dummy() + {} + +ZRelHead ExprRep_Relation_Concrete_Dummy::GetRelHead() + { return ZRelHead(true); } + +// ================================================================================================= +#pragma mark - +#pragma mark * ZValBase pseudo constructors + +ZRef<ZQL::ExprRep_Relation> sConcrete() + { + // Take a ZRelHead as a param? + // Put this outside of ZValBase? Perhaps over in ZQL? + // Need to return an Expr_Relation_Concrete that can be handled by ZQL::Util_Strim_Query::Visitor_Query_DoToStrim + return new ExprRep_Relation_Concrete_Dummy; + } + +ZRef<ZQE::Iterator> sIterator(ZRef<ZQL::ExprRep_Relation> iExprRep) + { return Visitor_DoMakeIterator().DoMakeIterator(iExprRep); } + +} // namespace ZValBase_YadSeqR +NAMESPACE_ZOOLIB_END Added: trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase.h (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase.h 2010-04-08 17:58:27 UTC (rev 1259) @@ -0,0 +1,59 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2010 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#ifndef __ZValBase__ +#define __ZValBase__ 1 +#include "zconfig.h" + +#include "zoolib/zqe/ZQE_Iterator.h" +#include "zoolib/zql/ZQL_ExprRep_Relation_Concrete.h" + +NAMESPACE_ZOOLIB_BEGIN +namespace ZValBase { + +// ================================================================================================= +#pragma mark - +#pragma mark * ExprRep_Relation_Concrete + +class ExprRep_Relation_Concrete : public ZQL::ExprRep_Relation_Concrete + { +protected: + ExprRep_Relation_Concrete(); + +public: +// From ExprRep_Relation via ExprRep_Relation_Concrete + virtual ZRelHead GetRelHead(); + +// Our protocol + virtual ZRef<ZQE::Iterator> MakeIterator() = 0; + }; + +// ================================================================================================= +#pragma mark - +#pragma mark * ZValBase pseudo constructors + +ZRef<ZQL::ExprRep_Relation> sConcrete(); + +ZRef<ZQE::Iterator> sIterator(ZRef<ZQL::ExprRep_Relation> iExprRep); + +} // namespace __ZValBase__ +NAMESPACE_ZOOLIB_END + +#endif // __ZValBase__ Modified: trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_Any.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_Any.cpp 2010-04-08 03:11:21 UTC (rev 1258) +++ trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_Any.cpp 2010-04-08 17:58:27 UTC (rev 1259) @@ -22,6 +22,7 @@ #include "zoolib/valbase/ZValBase.h" #include "zoolib/valbase/ZValBase_Any.h" #include "zoolib/zqe/ZQE_Result_Any.h" +#include "zoolib/zql/ZQL_ExprRep_Relation_Concrete.h" NAMESPACE_ZOOLIB_BEGIN namespace ZValBase_Any { @@ -71,36 +72,36 @@ // ================================================================================================= #pragma mark - -#pragma mark * ExprRep_Concrete +#pragma mark * ExprRep_Relation_Concrete -class ExprRep_Concrete : public ZValBase::ExprRep_Concrete +class ExprRep_Relation_Concrete : public ZValBase::ExprRep_Relation_Concrete { public: - ExprRep_Concrete(const ZSeq_Any& iSeq); + ExprRep_Relation_Concrete(const ZSeq_Any& iSeq); -// From ZValBase::ExprRep_Concrete +// From ZValBase::ExprRep_Relation_Concrete virtual ZRef<ZQE::Iterator> MakeIterator(); private: const ZSeq_Any fSeq; }; -ExprRep_Concrete::ExprRep_Concrete(const ZSeq_Any& iSeq) +ExprRep_Relation_Concrete::ExprRep_Relation_Concrete(const ZSeq_Any& iSeq) : fSeq(iSeq) {} -ZRef<ZQE::Iterator> ExprRep_Concrete::MakeIterator() +ZRef<ZQE::Iterator> ExprRep_Relation_Concrete::MakeIterator() { return new Iterator(fSeq); } // ================================================================================================= #pragma mark - #pragma mark * ZValBase_Any pseudo constructors -ZQL::Expr_Concrete sConcrete(const ZSeq_Any& iSeq) +ZRef<ZQL::ExprRep_Relation> sConcrete(const ZSeq_Any& iSeq) { // Could do a dynamic cast on iYadSeqR to see if it's really a ZYadSeqRPos, // in which case returning a ZValBase_YadSeqRPos::Iterator would be a win. - return ZQL::Expr_Concrete(new ExprRep_Concrete(iSeq)); + return new ExprRep_Relation_Concrete(iSeq); } } // namespace ZValBase_YadSeqR Modified: trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_Any.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_Any.h 2010-04-08 03:11:21 UTC (rev 1258) +++ trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_Any.h 2010-04-08 17:58:27 UTC (rev 1259) @@ -23,7 +23,7 @@ #include "zconfig.h" #include "zoolib/ZVal_Any.h" -#include "zoolib/zql/ZQL_Expr_Concrete.h" +#include "zoolib/zql/ZQL_ExprRep_Relation.h" NAMESPACE_ZOOLIB_BEGIN namespace ZValBase_Any { @@ -32,7 +32,7 @@ #pragma mark - #pragma mark * ZValBase_Any pseudo constructors -ZQL::Expr_Concrete sConcrete(const ZSeq_Any& iSeq); +ZRef<ZQL::ExprRep_Relation> sConcrete(const ZSeq_Any& iSeq); } // namespace ZValBase_Any NAMESPACE_ZOOLIB_END Modified: trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_SQLite.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_SQLite.h 2010-04-08 03:11:21 UTC (rev 1258) +++ trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_SQLite.h 2010-04-08 17:58:27 UTC (rev 1259) @@ -26,10 +26,26 @@ NAMESPACE_ZOOLIB_BEGIN +namespace ZValBase_SQLite { + // ================================================================================================= #pragma mark - #pragma mark * ZValBase_SQLite +class Domain : public ZRefCountedWithFinalization + { +public: + +// Expr_Concrete GetConcrete + +private: + sqlite* fDB; + }; + +// ================================================================================================= +#pragma mark - +#pragma mark * ZValBase_SQLite + class ZValBase_SQLite { public: @@ -46,6 +62,7 @@ }; +} // namespace ZValBase_SQLite NAMESPACE_ZOOLIB_END #endif // __ZValBase_SQLite__ Modified: trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_YadSeqR.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_YadSeqR.cpp 2010-04-08 03:11:21 UTC (rev 1258) +++ trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_YadSeqR.cpp 2010-04-08 17:58:27 UTC (rev 1259) @@ -23,20 +23,21 @@ #include "zoolib/valbase/ZValBase.h" #include "zoolib/valbase/ZValBase_YadSeqR.h" #include "zoolib/zqe/ZQE_Result_Any.h" +#include "zoolib/zql/ZQL_ExprRep_Relation_Concrete.h" NAMESPACE_ZOOLIB_BEGIN namespace ZValBase_YadSeqR { // ================================================================================================= #pragma mark - -#pragma mark * ExprRep_Concrete declaration +#pragma mark * ExprRep_Relation_Concrete declaration -class ExprRep_Concrete : public ZValBase::ExprRep_Concrete +class ExprRep_Relation_Concrete : public ZValBase::ExprRep_Relation_Concrete { public: - ExprRep_Concrete(ZRef<ZYadSeqR> iYadSeqR); + ExprRep_Relation_Concrete(ZRef<ZYadSeqR> iYadSeqR); -// From ZValBase::ExprRep_Concrete +// From ZValBase::ExprRep_Relation_Concrete virtual ZRef<ZQE::Iterator> MakeIterator(); // Our protocol @@ -55,7 +56,7 @@ class Iterator : public ZQE::Iterator { public: - Iterator(ZRef<ExprRep_Concrete> iExprRep, size_t iIndex); + Iterator(ZRef<ExprRep_Relation_Concrete> iExprRep, size_t iIndex); virtual ~Iterator(); @@ -63,11 +64,11 @@ virtual ZRef<ZQE::Result> ReadInc(); protected: - ZRef<ExprRep_Concrete> fExprRep; + ZRef<ExprRep_Relation_Concrete> fExprRep; size_t fIndex; }; -Iterator::Iterator(ZRef<ExprRep_Concrete> iExprRep, size_t iIndex) +Iterator::Iterator(ZRef<ExprRep_Relation_Concrete> iExprRep, size_t iIndex) : fExprRep(iExprRep) , fIndex(0) {} @@ -83,16 +84,16 @@ // ================================================================================================= #pragma mark - -#pragma mark * ExprRep_Concrete definition +#pragma mark * ExprRep_Relation_Concrete definition -ExprRep_Concrete::ExprRep_Concrete(ZRef<ZYadSeqR> iYadSeqR) +ExprRep_Relation_Concrete::ExprRep_Relation_Concrete(ZRef<ZYadSeqR> iYadSeqR) : fYadSeqR(iYadSeqR) {} -ZRef<ZQE::Iterator> ExprRep_Concrete::MakeIterator() +ZRef<ZQE::Iterator> ExprRep_Relation_Concrete::MakeIterator() { return new Iterator(this, 0); } -ZRef<ZQE::Result> ExprRep_Concrete::ReadInc(size_t& ioIndex) +ZRef<ZQE::Result> ExprRep_Relation_Concrete::ReadInc(size_t& ioIndex) { ZAcqMtx acq(fMtx); @@ -118,11 +119,11 @@ #pragma mark - #pragma mark * ZValBase_YadSeqR pseudo constructors -ZQL::Expr_Concrete sConcrete(ZRef<ZYadSeqR> iYadSeqR) +ZRef<ZQL::ExprRep_Relation> sConcrete(ZRef<ZYadSeqR> iYadSeqR) { // Could do a dynamic cast on iYadSeqR to see if it's really a ZYadSeqRPos, // in which case returning a ZValBase_YadSeqRPos::Iterator would be a win. - return ZQL::Expr_Concrete(new ExprRep_Concrete(iYadSeqR)); + return new ExprRep_Relation_Concrete(iYadSeqR); } } // namespace ZValBase_YadSeqR Modified: trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_YadSeqR.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_YadSeqR.h 2010-04-08 03:11:21 UTC (rev 1258) +++ trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_YadSeqR.h 2010-04-08 17:58:27 UTC (rev 1259) @@ -23,7 +23,7 @@ #include "zconfig.h" #include "zoolib/ZYad.h" -#include "zoolib/zql/ZQL_Expr_Concrete.h" +#include "zoolib/zql/ZQL_ExprRep_Relation.h" NAMESPACE_ZOOLIB_BEGIN namespace ZValBase_YadSeqR { @@ -32,7 +32,7 @@ #pragma mark - #pragma mark * ZValBase_YadSeqR pseudo constructors -ZQL::Expr_Concrete sConcrete(ZRef<ZYadSeqR> iYadSeqR); +ZRef<ZQL::ExprRep_Relation> sConcrete(ZRef<ZYadSeqR> iYadSeqR); } // namespace ZValBase_YadSeqR NAMESPACE_ZOOLIB_END Modified: trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_YadSeqRPos.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_YadSeqRPos.cpp 2010-04-08 03:11:21 UTC (rev 1258) +++ trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_YadSeqRPos.cpp 2010-04-08 17:58:27 UTC (rev 1259) @@ -22,6 +22,7 @@ #include "zoolib/valbase/ZValBase.h" #include "zoolib/valbase/ZValBase_YadSeqRPos.h" #include "zoolib/zqe/ZQE_Result_Any.h" +#include "zoolib/zql/ZQL_ExprRep_Relation_Concrete.h" NAMESPACE_ZOOLIB_BEGIN namespace ZValBase_YadSeqRPos { @@ -62,33 +63,33 @@ // ================================================================================================= #pragma mark - -#pragma mark * ExprRep_Concrete +#pragma mark * ExprRep_Relation_Concrete -class ExprRep_Concrete : public ZValBase::ExprRep_Concrete +class ExprRep_Relation_Concrete : public ZValBase::ExprRep_Relation_Concrete { public: - ExprRep_Concrete(ZRef<ZYadSeqRPos> iYadSeqRPos); + ExprRep_Relation_Concrete(ZRef<ZYadSeqRPos> iYadSeqRPos); -// From ZValBase::ExprRep_Concrete +// From ZValBase::ExprRep_Relation_Concrete virtual ZRef<ZQE::Iterator> MakeIterator(); private: ZRef<ZYadSeqRPos> fYadSeqRPos; }; -ExprRep_Concrete::ExprRep_Concrete(ZRef<ZYadSeqRPos> iYadSeqRPos) +ExprRep_Relation_Concrete::ExprRep_Relation_Concrete(ZRef<ZYadSeqRPos> iYadSeqRPos) : fYadSeqRPos(iYadSeqRPos) {} -ZRef<ZQE::Iterator> ExprRep_Concrete::MakeIterator() +ZRef<ZQE::Iterator> ExprRep_Relation_Concrete::MakeIterator() { return new Iterator(fYadSeqRPos); } // ================================================================================================= #pragma mark - #pragma mark * ZValBase_YadSeqRPos pseudo constructors -ZQL::Expr_Concrete sConcrete(ZRef<ZYadSeqRPos> iYadSeqRPos) - { return ZQL::Expr_Concrete(new ExprRep_Concrete(iYadSeqRPos)); } +ZRef<ZQL::ExprRep_Relation> sConcrete(ZRef<ZYadSeqRPos> iYadSeqRPos) + { return new ExprRep_Relation_Concrete(iYadSeqRPos); } } // namespace ZValBase_YadSeqRPos NAMESPACE_ZOOLIB_END Modified: trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_YadSeqRPos.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_YadSeqRPos.h 2010-04-08 03:11:21 UTC (rev 1258) +++ trunk/zoolib/source/cxx/more/zoolib/valbase/ZValBase_YadSeqRPos.h 2010-04-08 17:58:27 UTC (rev 1259) @@ -23,7 +23,7 @@ #include "zconfig.h" #include "zoolib/ZYad.h" -#include "zoolib/zql/ZQL_Expr_Concrete.h" +#include "zoolib/zql/ZQL_ExprRep_Relation.h" NAMESPACE_ZOOLIB_BEGIN namespace ZValBase_YadSeqRPos { @@ -32,7 +32,7 @@ #pragma mark - #pragma mark * ZValBase_YadSeqRPos pseudo constructors -ZQL::Expr_Concrete sConcrete(ZRef<ZYadSeqRPos> iYadSeqRPos); +ZRef<ZQL::ExprRep_Relation> sConcrete(ZRef<ZYadSeqRPos> iYadSeqRPos); } // namespace ZValBase_YadSeqRPos NAMESPACE_ZOOLIB_END Modified: trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Iterator_Any.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Iterator_Any.cpp 2010-04-08 03:11:21 UTC (rev 1258) +++ trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Iterator_Any.cpp 2010-04-08 17:58:27 UTC (rev 1259) @@ -18,7 +18,7 @@ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ------------------------------------------------------------------------------------------------- */ -#include "zoolib/ZExpr_ValCondition.h" +#include "zoolib/ZExprRep_Logic_ValCondition.h" #include "zoolib/zqe/ZQE_Iterator_Any.h" #include "zoolib/zqe/ZQE_Result_Any.h" Modified: trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Iterator_Any.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Iterator_Any.h 2010-04-08 03:11:21 UTC (rev 1258) +++ trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Iterator_Any.h 2010-04-08 17:58:27 UTC (rev 1259) @@ -22,7 +22,7 @@ #define __ZQE_Iterator_Any__ 1 #include "zconfig.h" -#include "zoolib/ZExpr_Logic.h" +#include "zoolib/ZExprRep_Logic.h" #include "zoolib/ZValCondition.h" #include "zoolib/zqe/ZQE_Iterator.h" Added: trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Visitor_ExprRep_DoMakeIterator.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Visitor_ExprRep_DoMakeIterator.cpp (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Visitor_ExprRep_DoMakeIterator.cpp 2010-04-08 17:58:27 UTC (rev 1259) @@ -0,0 +1,89 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2010 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#include "zoolib/zqe/ZQE_Visitor_ExprRep_DoMakeIterator.h" + +NAMESPACE_ZOOLIB_BEGIN +namespace ZQE { + +// ================================================================================================= +#pragma mark - +#pragma mark * Visitor_ExprRep_DoMakeIterator + +bool Visitor_ExprRep_DoMakeIterator::Visit_ExprRep_Relation_Difference(ZRef<ExprRep_Relation_Difference> iRep) + { + return true; + } + +bool Visitor_ExprRep_DoMakeIterator::Visit_ExprRep_Relation_Intersect(ZRef<ExprRep_Relation_Intersect> iRep) + { + if (ZRef<Iterator> lhs = this->DoMakeIterator(iRep->GetLHS())) + { + if (ZRef<Iterator> rhs = this->DoMakeIterator(iRep->GetRHS())) + fIterator = new Iterator_Intersect(lhs, rhs); + } + return true; + } + +bool Visitor_ExprRep_DoMakeIterator::Visit_ExprRep_Relation_Join(ZRef<ExprRep_Relation_Join> iRep) + { + if (ZRef<Iterator> lhs = this->DoMakeIterator(iRep->GetLHS())) + { + if (ZRef<Iterator> rhs = this->DoMakeIterator(iRep->GetRHS())) + fIterator = new Iterator_Join(lhs, rhs); + } + return true; + } + +bool Visitor_ExprRep_DoMakeIterator::Visit_ExprRep_Relation_Project(ZRef<ExprRep_Relation_Project> iRep) + { + return true; + } + +bool Visitor_ExprRep_DoMakeIterator::Visit_ExprRep_Relation_Rename(ZRef<ExprRep_Relation_Rename> iRep) + { + return true; + } + +bool Visitor_ExprRep_DoMakeIterator::Visit_ExprRep_Relation_Union(ZRef<ExprRep_Relation_Union> iRep) + { + if (ZRef<Iterator> lhs = this->DoMakeIterator(iRep->GetLHS())) + { + if (ZRef<Iterator> rhs = this->DoMakeIterator(iRep->GetRHS())) + fIterator = new Iterator_Union(lhs, rhs); + else + fIterator = lhs; + } + return true; + } + +ZRef<Iterator> Visitor_ExprRep_DoMakeIterator::DoMakeIterator(ZRef<ZExprRep> iExprRep) + { + ZRef<Iterator> theIterator; + if (iExprRep) + { + iExprRep->Accept(*this); + theIterator.swap(fIterator); + } + return theIterator; + } + +} // namespace ZQE +NAMESPACE_ZOOLIB_END Added: trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Visitor_ExprRep_DoMakeIterator.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Visitor_ExprRep_DoMakeIterator.h (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Visitor_ExprRep_DoMakeIterator.h 2010-04-08 17:58:27 UTC (rev 1259) @@ -0,0 +1,60 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2010 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#ifndef __ZQE_Visitor_ExprRep_DoMakeIterator__ +#define __ZQE_Visitor_ExprRep_DoMakeIterator__ 1 +#include "zconfig.h" + +#include "zoolib/ZExprRep.h" +#include "zoolib/zqe/ZQE_Iterator.h" +#include "zoolib/zql/ZQL_ExprRep_Relation.h" + +NAMESPACE_ZOOLIB_BEGIN +namespace ZQE { + +using namespace ZQL; + +// ================================================================================================= +#pragma mark - +#pragma mark * Visitor_ExprRep_DoMakeIterator + +class Visitor_ExprRep_DoMakeIterator +: public virtual Visitor_ExprRep_Relation + { +public: +// From Visitor_ExprRep_Relation + virtual bool Visit_ExprRep_Relation_Difference(ZRef<ExprRep_Relation_Difference> iRep); + virtual bool Visit_ExprRep_Relation_Intersect(ZRef<ExprRep_Relation_Intersect> iRep); + virtual bool Visit_ExprRep_Relation_Join(ZRef<ExprRep_Relation_Join> iRep); + virtual bool Visit_ExprRep_Relation_Project(ZRef<ExprRep_Relation_Project> iRep); + virtual bool Visit_ExprRep_Relation_Rename(ZRef<ExprRep_Relation_Rename> iRep); + virtual bool Visit_ExprRep_Relation_Union(ZRef<ExprRep_Relation_Union> iRep); + +// Our protocol + ZRef<Iterator> DoMakeIterator(ZRef<ZExprRep> iExprRep); + +protected: + ZRef<Iterator> fIterator; + }; + +} // namespace ZQE +NAMESPACE_ZOOLIB_END + +#endif // __ZQE_Visitor_ExprRep_DoMakeIterator__ Deleted: trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Visitor_ExprRep_MakeIterator.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Visitor_ExprRep_MakeIterator.cpp 2010-04-08 03:11:21 UTC (rev 1258) +++ trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Visitor_ExprRep_MakeIterator.cpp 2010-04-08 17:58:27 UTC (rev 1259) @@ -1,89 +0,0 @@ -/* ------------------------------------------------------------------------------------------------- -Copyright (c) 2010 Andrew Green -http://www.zoolib.org - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software -and associated documentation files (the "Software"), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, merge, publish, distribute, -sublicense, and/or sell copies of the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING -BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES -OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------------------------- */ - -#include "zoolib/zqe/ZQE_Visitor_ExprRep_MakeIterator.h" - -NAMESPACE_ZOOLIB_BEGIN -namespace ZQE { - -// ================================================================================================= -#pragma mark - -#pragma mark * Visitor_ExprRep_MakeIterator - -ZRef<Iterator> Visitor_ExprRep_MakeIterator::MakeIterator(ZRef<ZExprRep> iExprRep) - { - ZRef<Iterator> theIterator; - if (iExprRep) - { - iExprRep->Accept(*this); - theIterator.swap(fIterator); - } - return theIterator; - } - -bool Visitor_ExprRep_MakeIterator::Visit_Difference(ZRef<ExprRep_Relation_Difference> iRep) - { - return true; - } - -bool Visitor_ExprRep_MakeIterator::Visit_Intersect(ZRef<ExprRep_Relation_Intersect> iRep) - { - if (ZRef<Iterator> lhs = this->MakeIterator(iRep->GetLHS())) - { - if (ZRef<Iterator> rhs = this->MakeIterator(iRep->GetRHS())) - fIterator = new Iterator_Intersect(lhs, rhs); - } - return true; - } - -bool Visitor_ExprRep_MakeIterator::Visit_Join(ZRef<ExprRep_Relation_Join> iRep) - { - if (ZRef<Iterator> lhs = this->MakeIterator(iRep->GetLHS())) - { - if (ZRef<Iterator> rhs = this->MakeIterator(iRep->GetRHS())) - fIterator = new Iterator_Join(lhs, rhs); - } - return true; - } - -bool Visitor_ExprRep_MakeIterator::Visit_Project(ZRef<ExprRep_Relation_Project> iRep) - { - return true; - } - -bool Visitor_ExprRep_MakeIterator::Visit_Rename(ZRef<ExprRep_Relation_Rename> iRep) - { - return true; - } - -bool Visitor_ExprRep_MakeIterator::Visit_Union(ZRef<ExprRep_Relation_Union> iRep) - { - if (ZRef<Iterator> lhs = this->MakeIterator(iRep->GetLHS())) - { - if (ZRef<Iterator> rhs = this->MakeIterator(iRep->GetRHS())) - fIterator = new Iterator_Union(lhs, rhs); - else - fIterator = lhs; - } - return true; - } - -} // namespace ZQE -NAMESPACE_ZOOLIB_END Deleted: trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Visitor_ExprRep_MakeIterator.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Visitor_ExprRep_MakeIterator.h 2010-04-08 03:11:21 UTC (rev 1258) +++ trunk/zoolib/source/cxx/more/zoolib/zqe/ZQE_Visitor_ExprRep_MakeIterator.h 2010-04-08 17:58:27 UTC (rev 1259) @@ -1,60 +0,0 @@ -/* ------------------------------------------------------------------------------------------------- -Copyright (c) 2010 Andrew Green -http://www.zoolib.org - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software -and associated documentation files (the "Software"), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, merge, publish, distribute, -sublicense, and/or sell copies of the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING -BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES -OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------------------------- */ - -#ifndef __ZQE_Visitor_ExprRep_MakeIterator__ -#define __ZQE_Visitor_ExprRep_MakeIterator__ 1 -#include "zconfig.h" - -#include "zoolib/ZExpr.h" -#include "zoolib/zqe/ZQE_Iterator.h" -#include "zoolib/zql/ZQL_Expr_Relation.h" - -NAMESPACE_ZOOLIB_BEGIN -namespace ZQE { - -using namespace ZQL; - -// ================================================================================================= -#pragma mark - -#pragma mark * Visitor_ExprRep_MakeIterator - -class Visitor_ExprRep_MakeIterator -: public virtual Visitor_ExprRep_Relation - { -public: -// From Visitor_ExprRep_Relation - virtual bool Visit_Difference(ZRef<ExprRep_Relation_Difference> iRep); - virtual bool Visit_Intersect(ZRef<ExprRep_Relation_Intersect> iRep); - virtual bool Visit_Join(ZRef<ExprRep_Relation_Join> iRep); - virtual bool Visit_Project(ZRef<ExprRep_Relation_Project> iRep); - virtual bool Visit_Rename(ZRef<ExprRep_Relation_Rename> iRep); - virtual bool Visit_Union(ZRef<ExprRep_Relation_Union> iRep); - -// Our protocol - ZRef<Iterator> MakeIterator(ZRef<ZExprRep> iExprRep); - -protected: - ZRef<Iterator> fIterator; - }; - -} // namespace ZQE -NAMESPACE_ZOOLIB_END - -#endif // __ZQE_Visitor_ExprRep_MakeIterator__ Added: trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_ExprRep_Relation.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_ExprRep_Relation.cpp (rev 0) +++ trunk/zoolib/source/cxx/more/zoolib/zql/ZQL_ExprRep_Relation.cpp 2010-04-08 17:58:27 UTC (rev 1259) @@ -0,0 +1,360 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2010 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#include "zoolib/zql/ZQL_ExprRep_Relation.h" + +using std::string; + +NAMESPACE_ZOOLIB_BEGIN +namespace ZQL { + +// ================================================================================================= +#pragma mark - +#pragma mark * ExprRep_Relation + +ExprRep_Relation::ExprRep_Relation() + {} + +bool ExprRep_Relation::Accept(ZVisitor_ExprRep& iVisitor) + { + if (Visitor_ExprRep_Relation* theVisitor = + dynamic_cast<Visitor_ExprRep_Relation*>(&iVisitor)) + { + return this->Accept(*theVisitor); + } + else + { + return ZExprRep::Accept(iVisitor); + } + } + +bool ExprRep_Relation::Accept(Visitor_ExprRep_Relation& iVisitor) + { return ZExprRep::Accept(iVisitor); } + +// ================================================================================================= +#pragma mark - +#pragma mark * ExprRep_Relation_Dyadic + +ExprRep_Relation_Dyadic::ExprRep_Relation_Dyadic( + ZRef<ExprRep_Relation> iLHS, ZRef<ExprRep_Relation> iRHS) +: fLHS(iLHS) +, fRHS(iRHS) + {} + +ExprRep_Relation_Dyadic::~ExprRep_Relation_Dyadic() + {} + +ZRef<ExprRep_Relation> ExprRep_Relation_Dyadic::GetLHS() + { return fLHS; } + +ZRef<ExprRep_Relation> ExprRep_Relation_Dyadic::GetRHS() + { return fRHS; } + +// ================================================================================================= +#pragma mark - +#pragma mark * ExprRep_Relation_Difference + +ExprRep_Relation_Difference::ExprRep_Relation_Difference( + ZRef<ExprRep_Relation> iLHS, ZRef<ExprRep_Relation> iRHS) +: ExprRep_Relation_Dyadic(iLHS, iRHS) + {} + +bool ExprRep_Relation_Difference::Accept(Visitor_ExprRep_Relation& iVisitor) + { return iVisitor.Visit_ExprRep_Relation_Difference(this); } + +ZRelHead ExprRep_Relation_Difference::GetRelHead() + { + ZRelHead theRelHeadA = fLHS->GetRelHead(); + ZRelHead theRelHeadB = fRHS->GetRelHead(); + + if (theRelHeadA != theRelHeadB) + return ZRelHead(); + + return theRelHeadA; + } + +// ================================================================================================= +#pragma mark - +#pragma mark * ExprRep_Relation_Intersect + +ExprRep_Relation_Intersect::ExprRep_Relation_Intersect( + ZRef<ExprRep_Relation> iLHS, ZRef<ExprRep_Relation> iRHS) +: ExprRep_Relation_Dyadic(iLHS, iRHS) + {} + +bool ExprRep_Relation_Intersect::Accept(Visitor_ExprRep_Relation& iVisitor) + { return iVisitor.Visit_ExprRep_Relation_Intersect(this); } + +ZRelHead ExprRep_Relation_Intersect::GetRelHead() + { + ZRelHead theRelHeadA = fLHS->GetRelHead(); + ZRelHead theRelHeadB = fRHS->GetRelHead(); + + if (theRelHeadA != theRelHeadB) + return ZRelHead(); + + return theRelHeadA; + } + +// ================================================================================================= +#pragma mark - +#pragma mark * ExprRep_Relation_Join + +ExprRep_Relation_Join::ExprRep_Relation_Join( + ZRef<ExprRep_Relation> iLHS, ZRef<ExprRep_Relation> iRHS) +: ExprRep_Relation_Dyadic(iLHS, iRHS) + {} + +bool ExprRep_Relation_Join::Accept(Visitor_ExprRep_Relation& iVisitor) + { return iVisitor.Visit_ExprRep_Relation_Join(this); } + +ZRelHead ExprRep_Relation_Join::GetRelHead() + { return fLHS->GetRelHead() | fRHS->GetRelHead(); } + +// ================================================================================================= +#pragma mark - +#pragma mark * ExprRep_Relation_Project + +ExprRep_Relation_Project::ExprRep_Relation_Project( + ZRef<ExprRep_Relation> iExprRep, const ZRelHead& iRelHead) +: fExprRep(iExprRep) +, fRelHead(iRelHead) + { + ZAssert(iExprRep); + } + +ExprRep_Relation_Project::~ExprRep_Relation_Project() + {} + +bool ExprRep_Relation_Project::Accept(Visitor_ExprRep_Relation& iVisitor) + { return iVisitor.Visit_ExprRep_Relation_Project(this); } + +ZRelHead ExprRep_Relation_Project::GetRelHead() + { return fExprRep->GetRelHead() & fRelHead; } + +ZRef<ExprRep_Relation> ExprRep_Relation_Project::GetExprRep() + { return fExprRep; } + +const ZRelHead& ExprRep_Relation_Project::GetProjectRelHead() + { return fRelHead; } + +// ================================================================================================= +#pragma mark - +#pragma mark * ExprRep_Relation_Rename + +ExprRep_Relation_Rename::ExprRep_Relation_Rename( + ZRef<ExprRep_Relation> iExprRep, const string& iOld, const string& iNew) +: fExprRep(iExprRep) +, fOld(iOld) +, fNew(iNew) + {} + +ExprRep_Relation_Rename::~ExprRep_Relation_Rename() + {} + +bool ExprRep_Relation_Rename::Accept(Visitor_ExprRep_Relation& iVisitor) + { return iVisitor.Visit_ExprRep_Relation_Rename(this); } + +ZRelHead ExprRep_Relation_Rename::GetRelHead() + { + ZRelHead theRelHead = fExprRep->GetRelHead(); + if (theRelHead.Contains(fOld)) + { + theRelHead -= fOld; + theRelHead |= fNew; + } + return theRelHead; + } + +ZRef<ExprRep_Relation> ExprRep_Relation_Rename::GetExprRep() + { return fExprRep; } + +const string& ExprRep_Relation_Rename::GetOld() + { return fOld; } + +const string& ExprRep_Relation_Rename::GetNew() + { return fNew; } + +// ================================================================================================= +#pragma mark - +#pragma mark * ExprRep_Relation_Union + +ExprRep_Relation_Union::ExprRep_Relation_Union( + ZRef<ExprRep_Relation> iLHS, ZRef<ExprRep_Relation> iRHS) +: ExprRep_Relation_Dyadic(iLHS, iRHS) + {} + +bool ExprRep_Relation_Union::Accept(Visitor_ExprRep_Relation& iVisitor) + { return iVisitor.Visit_ExprRep_Relation_Union(this); } + +ZRelHead ExprRep_Relation_Union::GetRelHead() + { + ZRelHead theRelHeadA = fLHS->GetRelHead(); + ZRelHead theRelHeadB = fRHS->GetRelHead(); + + if (theRelHeadA != theRelHeadB) + return ZRelHead(); + + return theRelHeadA; + } + +// ================================================================================================= +#pragma mark - +#pragma mark * Visitor_ExprRep_Relation + +bool Visitor_ExprRep_Relation::Visit_ExprRep_Relation_Difference(ZRef<ExprRep_Relation_Difference> iRep) + { + if (!ZVisitor_ExprRep::Visit_ExprRep(iRep)) + return false; + + if (ZRef<ExprRep_Relation> theLHS = iRep->GetLHS()) + { + if (!theLHS->Accept(*this)) + return false; + } + + if (ZRef<ExprRep_Relation> theRHS = iRep->GetRHS()) + { + if (!theRHS->Accept(*this)) + return false; + } + + return true; + } + +bool Visitor_ExprRep_Relation::Visit_ExprRep_Relation_Intersect(ZRef<ExprRep_Relation_Intersect> iRep) + { + if (!ZVisitor_ExprRep::Visit_ExprRep(iRep)) + return false; + + if (ZRef<ExprRep_Relation> theLHS = iRep->GetLHS()) + { + if (!theLHS->Accept(*this)) + return false; + } + + if (ZRef<ExprRep_Relation> theRHS = iRep->GetRHS()) + { + if (!theRHS->Accept(*this)) + return false; + } + + return true; + } + +bool Visitor_ExprRep_Relation::Visit_ExprRep_Relation_Join(ZRef<ExprRep_Relation_Join> iRep) + { + if (!ZVisitor_ExprRep::Visit_ExprRep(iRep)) + return false; + + if (ZRef<ExprRep_Relation> theLHS = iRep->GetLHS()) + { + if (!theLHS->Accept(*this)) + return false; + } + + if (ZRef<ExprRep_Relation> theRHS = iRep->GetRHS()) + ... [truncated message content] |