├── .editorconfig ├── .gitignore ├── CMakeProjects ├── zoolib_Core │ └── CMakeLists.txt ├── zoolib_Platform_ARM │ └── CMakeLists.txt ├── zoolib_Platform_Apple │ └── CMakeLists.txt ├── zoolib_Platform_Hashing │ └── CMakeLists.txt ├── zoolib_Platform_JNI │ └── CMakeLists.txt ├── zoolib_Platform_MAME │ └── CMakeLists.txt ├── zoolib_Platform_OpenGL │ └── CMakeLists.txt ├── zoolib_Platform_POSIX │ └── CMakeLists.txt ├── zoolib_Platform_SQLite │ └── CMakeLists.txt ├── zoolib_Platform_Zip │ └── CMakeLists.txt ├── zoolib_Platform_zlib │ └── CMakeLists.txt ├── zoolib_Portable │ └── CMakeLists.txt ├── zoolib_Project_Dataspace │ └── CMakeLists.txt ├── zoolib_Project_Expr │ └── CMakeLists.txt ├── zoolib_Project_GameEngine │ └── CMakeLists.txt ├── zoolib_Project_Pixels │ └── CMakeLists.txt ├── zoolib_Project_QueryEngine │ └── CMakeLists.txt ├── zoolib_Project_RelationalAlgebra │ └── CMakeLists.txt ├── zoolib_Project_Server │ └── CMakeLists.txt └── zoolib_Project_ValPred │ └── CMakeLists.txt ├── Config.xcconfig ├── Core └── zoolib │ ├── Any.h │ ├── AnyBase.cpp │ ├── AnyBase.h │ ├── Any_T.h │ ├── Atomic.h │ ├── ByteSwap.h │ ├── Callable.h │ ├── Callable_Macros.h │ ├── Chan.h │ ├── ChanAspect.h │ ├── ChanR.h │ ├── ChanR_Bin.h │ ├── ChanU.h │ ├── ChanW.h │ ├── ChanW_Bin.h │ ├── Chan_Bin.h │ ├── Chan_UTF.h │ ├── Compare_T.h │ ├── Compat_MSVCStaticLib.h │ ├── Compat_NonCopyable.h │ ├── Compat_algorithm.h │ ├── Compat_cmath.h │ ├── Compat_string.h │ ├── Compat_unordered_map.h │ ├── Counted.cpp │ ├── Counted.h │ ├── CountedVal.h │ ├── CountedWithoutFinalize.cpp │ ├── CountedWithoutFinalize.h │ ├── CtorDtor.h │ ├── DList.h │ ├── Default.h │ ├── Deleter.h │ ├── DeriveFrom.h │ ├── FunctionChain.h │ ├── Memory.h │ ├── Multi.h │ ├── Not.h │ ├── Promise.h │ ├── Safe.h │ ├── Singleton.h │ ├── Startable.h │ ├── Starter.h │ ├── StdInt.h │ ├── TagVal.h │ ├── ThreadVal.h │ ├── Time.h │ ├── TypeIdName.h │ ├── TypeList.h │ ├── Unicode.cpp │ ├── Unicode.h │ ├── UnicodeCU.h │ ├── UnicodeCU8.h │ ├── UnicodePriv.h │ ├── UnicodePrivB.h │ ├── UnicodeString.h │ ├── UnicodeString8.h │ ├── Util_Chan.h │ ├── Util_Relops.h │ ├── Util_STL.h │ ├── Util_STL_Base_Map.h │ ├── Util_STL_Base_MapOrSet.h │ ├── Util_STL_Base_Seq.h │ ├── Util_STL_Base_Set.h │ ├── Util_STL_deque.h │ ├── Util_STL_map.h │ ├── Util_STL_set.h │ ├── Util_STL_unordered_map.h │ ├── Util_STL_unordered_set.h │ ├── Util_STL_vector.h │ ├── ValueOnce.h │ ├── ZCONFIG_API.h │ ├── ZCONFIG_API_Definitions.h │ ├── ZCONFIG_SPI.h │ ├── ZCONFIG_SPI_Definitions.h │ ├── ZDebug.cpp │ ├── ZDebug.h │ ├── ZMACRO_FileFunctionLine.h │ ├── ZMACRO_auto.h │ ├── ZMACRO_decltype.h │ ├── ZMACRO_foreach.h │ ├── ZP.h │ ├── ZQ.h │ ├── ZThread.cpp │ ├── ZThread.h │ ├── ZTypes.h │ ├── size_t.h │ ├── zconfigd.h │ └── zconfigl.h ├── LICENSE.txt ├── Old_not_in_use └── zoolib │ ├── ZStreamRWCon_OpenSSL.cpp │ ├── ZStreamRWCon_OpenSSL.h │ ├── ZStreamRWCon_SSL_Apple.cpp │ ├── ZStreamRWCon_SSL_Apple.h │ ├── ZTextCoder_ICU.cpp │ ├── ZTextCoder_ICU.h │ ├── ZTextCollator.cpp │ ├── ZTextCollator.h │ ├── ZTextCollator_ASCII.cpp │ ├── ZTextCollator_ASCII.h │ ├── ZTextCollator_ICU.cpp │ └── ZTextCollator_ICU.h ├── Platform └── zoolib │ ├── ARM │ ├── Compat_arm.h │ ├── Matrix_armv6.cpp │ ├── Matrix_armv6.h │ ├── Matrix_armv7.cpp │ └── Matrix_armv7.h │ ├── Apple │ ├── AutoreleasePool.h │ ├── CFNotification.cpp │ ├── CFNotification.h │ ├── CGData_Channer.cpp │ ├── CGData_Channer.h │ ├── Callable_Block.h │ ├── Callable_ObjC.h │ ├── Cartesian_CG.h │ ├── Cartesian_NS.h │ ├── Chan_Bin_CFStream.cpp │ ├── Chan_Bin_CFStream.h │ ├── Chan_UTF_CFString.cpp │ ├── Chan_UTF_CFString.h │ ├── Chan_UTF_NSString.h │ ├── Chan_UTF_NSString.mm │ ├── Coerce_CF.cpp │ ├── Coerce_CF.h │ ├── Compat_NSObject.h │ ├── Data_CF.cpp │ ├── Data_CF.h │ ├── Data_NS.h │ ├── Data_NS.mm │ ├── Delegate.h │ ├── Delegate.mm │ ├── Map_CFPreferences.cpp │ ├── Map_CFPreferences.h │ ├── ObjC.h │ ├── Pixmap_CGImage.cpp │ ├── Pixmap_CGImage.h │ ├── PullPush_CF.cpp │ ├── PullPush_CF.h │ ├── PullPush_NS.h │ ├── PullPush_NS.mm │ ├── Starter_CFRunLoop.cpp │ ├── Starter_CFRunLoop.h │ ├── Util_CF.cpp │ ├── Util_CF.h │ ├── Util_CF_Any.cpp │ ├── Util_CF_Any.h │ ├── Util_CF_Context.h │ ├── Util_CF_ZZ.cpp │ ├── Util_CF_ZZ.h │ ├── Util_NS.h │ ├── Util_NS.mm │ ├── Util_NS_ZZ.h │ ├── Util_NS_ZZ.mm │ ├── Val_CF.cpp │ ├── Val_CF.h │ ├── Val_NS.h │ ├── Val_NS.mm │ ├── ZP_CF.cpp │ ├── ZP_CF.h │ ├── ZP_NS.h │ ├── ZP_NS.mm │ └── ZP_xpc.h │ ├── Hashing │ ├── ChanW_Bin_Hash.h │ ├── MD5.cpp │ ├── MD5.h │ ├── SHA1.cpp │ ├── SHA1.h │ ├── SHA256.cpp │ └── SHA256.h │ ├── JNI │ ├── Chan_JavaStream.cpp │ ├── Chan_JavaStream.h │ ├── JNI.cpp │ ├── JNI.h │ ├── JavaStream_Channer_Bin.cpp │ ├── JavaStream_Channer_Bin.h │ ├── PullPush_JNI.cpp │ └── PullPush_JNI.h │ ├── MAME │ └── Cartesian_MAME.h │ ├── OSX │ ├── Cartesian_QD.h │ ├── TextCoder_Mac.cpp │ └── TextCoder_Mac.h │ ├── OpenGL │ ├── Compat_OpenGL.h │ ├── Util.cpp │ └── Util.h │ ├── POSIX │ ├── Chan_Bin_POSIXFD.cpp │ ├── Chan_Bin_POSIXFD.h │ ├── Compat_fcntl.h │ ├── Compat_sys_socket.h │ ├── FILE_Channer.cpp │ ├── FILE_Channer.h │ ├── File_POSIX.cpp │ ├── File_POSIX.h │ ├── Net_Internet_Socket.cpp │ ├── Net_Internet_Socket.h │ ├── Net_Local_Socket.cpp │ ├── Net_Local_Socket.h │ ├── Net_Socket.cpp │ ├── Net_Socket.h │ ├── SocketWatcher.cpp │ ├── SocketWatcher.h │ ├── SubProcess_POSIX.cpp │ ├── SubProcess_POSIX.h │ ├── TextCoder_iconv.cpp │ ├── TextCoder_iconv.h │ ├── Util_POSIX.cpp │ ├── Util_POSIX.h │ ├── Util_POSIXFD.cpp │ ├── Util_POSIXFD.h │ ├── pthread_more.cpp │ └── pthread_more.h │ ├── Python │ ├── Compat_Python.h │ ├── Util_Python.cpp │ ├── Util_Python.h │ ├── ZRef_PyObject.cpp │ └── ZRef_PyObject.h │ ├── QT │ └── Cartesian_QT.h │ ├── SQLite │ ├── SQLite.cpp │ └── SQLite.h │ ├── UIKit │ ├── SectionBody_Sieve.h │ ├── SectionBody_Sieve.mm │ ├── TVCell.h │ ├── TVCell.mm │ ├── UIControl+Callable.h │ ├── UIControl+Callable.mm │ ├── UITVController_WithSections+More.h │ ├── UITVController_WithSections+More.mm │ ├── UITVController_WithSections.h │ ├── UITVController_WithSections.mm │ ├── UIViewController+Subtitle.h │ └── UIViewController+Subtitle.mm │ ├── Win │ ├── Cartesian_GDI.h │ ├── Starter_WinMessageLoop.cpp │ ├── Starter_WinMessageLoop.h │ ├── ZCompat_GdiPlus.h │ ├── ZCompat_Win.h │ ├── ZCompat_WinSock.h │ ├── ZFile_Win.cpp │ ├── ZFile_Win.h │ ├── ZNet_Internet_WinSock.cpp │ ├── ZNet_Internet_WinSock.h │ ├── ZNet_Local_Win.cpp │ ├── ZNet_Local_Win.h │ ├── ZRef_WinHANDLE.cpp │ ├── ZRef_WinHANDLE.h │ ├── ZStreamRWCon_SSL_Win.cpp │ ├── ZStreamRWCon_SSL_Win.h │ ├── ZStrimW_WinDebug.cpp │ ├── ZStrimW_WinDebug.h │ ├── ZTextCoder_Win.cpp │ ├── ZTextCoder_Win.h │ ├── ZUtil_Win.cpp │ ├── ZUtil_Win.h │ ├── ZUtil_WinFile.cpp │ ├── ZUtil_WinFile.h │ ├── ZUtil_WinFirewall.cpp │ ├── ZUtil_WinFirewall.h │ ├── ZUtil_WinSock.cpp │ ├── ZUtil_WinSock.h │ ├── ZWinCOM.cpp │ ├── ZWinCOM.h │ ├── ZWinCOM_Macros.h │ ├── ZWinRegistry_Val.cpp │ ├── ZWinRegistry_Val.h │ ├── ZWinRegistry_Yad.cpp │ ├── ZWinRegistry_Yad.h │ ├── ZWinService.cpp │ ├── ZWinService.h │ ├── ZWinWND.cpp │ ├── ZWinWND.h │ ├── ZWinWND_Dialog.cpp │ └── ZWinWND_Dialog.h │ ├── X11 │ ├── Cartesian_X.h │ └── Compat_Xlib.h │ ├── Zip │ ├── Archive_Zip.cpp │ ├── Archive_Zip.h │ ├── Archive_Zip_More.cpp │ └── Archive_Zip_More.h │ ├── libunwind │ └── Unwind_SjLj_Faster.c │ └── zlib │ ├── Chan_Bin_zlib.cpp │ └── Chan_Bin_zlib.h ├── Portable └── zoolib │ ├── Archive.cpp │ ├── Archive.h │ ├── CallByStarter.h │ ├── Callable_Bind.h │ ├── Callable_Bookend.cpp │ ├── Callable_Bookend.h │ ├── Callable_Bool.cpp │ ├── Callable_Bool.h │ ├── Callable_Cast.h │ ├── Callable_Compound.h │ ├── Callable_Const.h │ ├── Callable_Delay.h │ ├── Callable_Fallback.h │ ├── Callable_Function.h │ ├── Callable_Indirect.h │ ├── Callable_Lambda.h │ ├── Callable_PMF.h │ ├── Callable_Set.h │ ├── Callable_StarterAsync.h │ ├── Callable_StarterSync.h │ ├── Cancellable.cpp │ ├── Cancellable.h │ ├── Cartesian.h │ ├── Cartesian_Matrix.h │ ├── ChanFilter.h │ ├── ChanRPos_XX_ChanR.h │ ├── ChanRPos_XX_ChanRSize.h │ ├── ChanRPos_XX_PageBuffered.h │ ├── ChanRU_UTF_ML.cpp │ ├── ChanRU_UTF_ML.h │ ├── ChanRU_UTF_Std.cpp │ ├── ChanRU_UTF_Std.h │ ├── ChanRU_XX_Unreader.h │ ├── ChanRWCon_XX_FIFO.h │ ├── ChanRWCon_XX_MemoryPipe.h │ ├── ChanRWPos_XX_PageBuffered.h │ ├── ChanRWPos_XX_RAM.h │ ├── ChanR_Bin_HexStrim.cpp │ ├── ChanR_Bin_HexStrim.h │ ├── ChanR_Bin_More.cpp │ ├── ChanR_Bin_More.h │ ├── ChanR_UTF.cpp │ ├── ChanR_UTF.h │ ├── ChanR_XX_AbortOnSlowRead.h │ ├── ChanR_XX_Boundary.h │ ├── ChanR_XX_SkipAllOnDestroy.h │ ├── ChanR_XX_Terminated.h │ ├── ChanU_UTF.h │ ├── ChanW_Bin_HexStrim.cpp │ ├── ChanW_Bin_HexStrim.h │ ├── ChanW_Bin_More.cpp │ ├── ChanW_Bin_More.h │ ├── ChanW_UTF.cpp │ ├── ChanW_UTF.h │ ├── ChanW_UTF_InsertSeparator.cpp │ ├── ChanW_UTF_InsertSeparator.h │ ├── ChanW_UTF_ML.cpp │ ├── ChanW_UTF_ML.h │ ├── ChanW_XX_Fragmented.h │ ├── Chan_Bin_ASCIIStrim.cpp │ ├── Chan_Bin_ASCIIStrim.h │ ├── Chan_Bin_Base64.cpp │ ├── Chan_Bin_Base64.h │ ├── Chan_Bin_Data.h │ ├── Chan_Bin_FILE.cpp │ ├── Chan_Bin_FILE.h │ ├── Chan_Bin_string.cpp │ ├── Chan_Bin_string.h │ ├── Chan_Offset.h │ ├── Chan_UTF_CRLF.cpp │ ├── Chan_UTF_CRLF.h │ ├── Chan_UTF_Chan_Bin.cpp │ ├── Chan_UTF_Chan_Bin.h │ ├── Chan_UTF_Escaped.cpp │ ├── Chan_UTF_Escaped.h │ ├── Chan_UTF_TextCoder.cpp │ ├── Chan_UTF_TextCoder.h │ ├── Chan_UTF_string.cpp │ ├── Chan_UTF_string.h │ ├── Chan_XX_Buffered.h │ ├── Chan_XX_Cat.h │ ├── Chan_XX_Count.h │ ├── Chan_XX_FlushOnRead.h │ ├── Chan_XX_Limited.h │ ├── Chan_XX_Memory.h │ ├── Chan_XX_PipePair.h │ ├── Chan_XX_RateCapped.cpp │ ├── Chan_XX_RateCapped.h │ ├── Chan_XX_STL.h │ ├── Chan_XX_Tee.h │ ├── Channer.h │ ├── ChannerRWCon_XX_Wrapper.h │ ├── ChannerRW_XX_Wrapper.h │ ├── Channer_Bin.h │ ├── Channer_UTF.h │ ├── Coerce_Any.cpp │ ├── Coerce_Any.h │ ├── Cog.h │ ├── Compare_Cartesian.h │ ├── Compare_Rational.cpp │ ├── Compare_Rational.h │ ├── Compare_string.cpp │ ├── Compare_string.h │ ├── Compare_vector.h │ ├── Connection.h │ ├── CountedString.h │ ├── CountedStringUniquifier.h │ ├── Data_ZZ.cpp │ ├── Data_ZZ.h │ ├── Factory.h │ ├── Factory_Fallback.h │ ├── Factory_Race.h │ ├── Factory_Retry.h │ ├── Factory_WithFirstProduct.h │ ├── File.cpp │ ├── File.h │ ├── File_Archive.cpp │ ├── File_Archive.h │ ├── Generator.h │ ├── Log.cpp │ ├── Log.h │ ├── ML.cpp │ ├── ML.h │ ├── Map_Shared_T.h │ ├── Matrix.cpp │ ├── Matrix.h │ ├── MatrixArray.h │ ├── Name.cpp │ ├── Name.h │ ├── NamePriv.cpp │ ├── NameUniquifier.h │ ├── Net.cpp │ ├── Net.h │ ├── Net_Internet.cpp │ ├── Net_Internet.h │ ├── Net_Local.cpp │ ├── Net_Local.h │ ├── PairwiseCombiner_T.h │ ├── ParseException.h │ ├── PullPush.cpp │ ├── PullPush.h │ ├── PullPush_JSON.cpp │ ├── PullPush_JSON.h │ ├── PullPush_JSONB.cpp │ ├── PullPush_JSONB.h │ ├── PullPush_SeparatedValues.cpp │ ├── PullPush_SeparatedValues.h │ ├── PullPush_XMLPList.cpp │ ├── PullPush_XMLPList.h │ ├── PullPush_ZZ.cpp │ ├── PullPush_ZZ.h │ ├── PullTextOptions.h │ ├── Pull_Attr.h │ ├── Pull_Basic.cpp │ ├── Pull_Basic.h │ ├── Pull_Bencode.cpp │ ├── Pull_Bencode.h │ ├── Pull_ML.cpp │ ├── Pull_ML.h │ ├── Pull_XMLAttr.cpp │ ├── Pull_XMLAttr.h │ ├── Pull_bplist.cpp │ ├── Pull_bplist.h │ ├── PushTextOptions.h │ ├── Push_bplist.cpp │ ├── Push_bplist.h │ ├── SafePtrStack.h │ ├── SafeSet.h │ ├── StartOnNewThread.cpp │ ├── StartOnNewThread.h │ ├── StartScheduler.cpp │ ├── StartScheduler.h │ ├── Startable_SetName.cpp │ ├── Startable_SetName.h │ ├── Starter_EachOnNewThread.cpp │ ├── Starter_EachOnNewThread.h │ ├── Starter_EventLoopBase.cpp │ ├── Starter_EventLoopBase.h │ ├── Starter_ThreadLoop.cpp │ ├── Starter_ThreadLoop.h │ ├── StdIO.cpp │ ├── StdIO.h │ ├── Stringf.cpp │ ├── Stringf.h │ ├── TextCoder.cpp │ ├── TextCoder.h │ ├── TextCoderAliases.cpp │ ├── TextCoderAliases.h │ ├── TextCoder_Std.cpp │ ├── TextCoder_Std.h │ ├── TextCoder_Unicode.cpp │ ├── TextCoder_Unicode.h │ ├── Trail.cpp │ ├── Trail.h │ ├── Tween.h │ ├── Tween_Std.h │ ├── UTCDateTime.h │ ├── UUID.h │ ├── UniSet.h │ ├── Uniquifier.h │ ├── Util_Chan_Bin_Operators.cpp │ ├── Util_Chan_Bin_Operators.h │ ├── Util_Chan_JSON.cpp │ ├── Util_Chan_JSON.h │ ├── Util_Chan_UTF.cpp │ ├── Util_Chan_UTF.h │ ├── Util_Chan_UTF_Matrix.h │ ├── Util_Chan_UTF_MatrixArray.h │ ├── Util_Chan_UTF_Operators.cpp │ ├── Util_Chan_UTF_Operators.h │ ├── Util_Chan_UTF_Operators_string.h │ ├── Util_Channer.h │ ├── Util_Debug.cpp │ ├── Util_Debug.h │ ├── Util_File.cpp │ ├── Util_File.h │ ├── Util_Strim_Cartesian.h │ ├── Util_Time.cpp │ ├── Util_Time.h │ ├── Util_ZZ_JSON.cpp │ ├── Util_ZZ_JSON.h │ ├── Util_ZZ_JSONB.cpp │ ├── Util_ZZ_JSONB.h │ ├── Util_string.cpp │ ├── Util_string.h │ ├── Val_DB.h │ ├── Val_T.h │ ├── Val_ZZ.cpp │ ├── Val_ZZ.h │ ├── Visitor.cpp │ ├── Visitor.h │ ├── Visitor_Do_T.h │ ├── Visitor_ToStrim.cpp │ ├── Visitor_ToStrim.h │ ├── dtoa.c.incl │ └── pdesc.h ├── Project └── zoolib │ ├── Dataspace │ ├── Daton.cpp │ ├── Daton.h │ ├── Daton_Val.cpp │ ├── Daton_Val.h │ ├── Melange.h │ ├── MelangeRemoter.cpp │ ├── MelangeRemoter.h │ ├── Relater.cpp │ ├── Relater.h │ ├── Relater_Asyncify.cpp │ ├── Relater_Asyncify.h │ ├── Relater_SQLite.cpp │ ├── Relater_SQLite.h │ ├── Relater_Searcher.cpp │ ├── Relater_Searcher.h │ ├── Relater_Union.cpp │ ├── Relater_Union.h │ ├── RelsWatcher.h │ ├── RelsWatcher_Relater.cpp │ ├── RelsWatcher_Relater.h │ ├── ResultHandler.cpp │ ├── ResultHandler.h │ ├── RowBoat.cpp │ ├── RowBoat.h │ ├── Searcher.cpp │ ├── Searcher.h │ ├── Searcher_Datons.cpp │ ├── Searcher_Datons.h │ ├── Sieve_Singleton.cpp │ ├── Sieve_Singleton.h │ ├── Tests.cpp │ ├── Tests.h │ ├── Types.cpp │ ├── Types.h │ ├── Util_Strim.cpp │ ├── Util_Strim.h │ ├── Util_Strim_Daton.cpp │ ├── Util_Strim_Daton.h │ ├── Util_Strim_Result.cpp │ └── Util_Strim_Result.h │ ├── Expr │ ├── Expr.cpp │ ├── Expr.h │ ├── Expr_Bool.cpp │ ├── Expr_Bool.h │ ├── Expr_Op_T.h │ ├── Util_Expr_Bool_CNF.cpp │ ├── Util_Expr_Bool_CNF.h │ ├── Util_Strim_Expr_Bool.cpp │ ├── Util_Strim_Expr_Bool.h │ ├── Visitor_Expr_Bool_Do_Eval.cpp │ ├── Visitor_Expr_Bool_Do_Eval.h │ ├── Visitor_Expr_Bool_ToStrim.cpp │ ├── Visitor_Expr_Bool_ToStrim.h │ └── Visitor_Expr_Op_Do_Transform_T.h │ ├── GameEngine │ ├── AssetCatalog.cpp │ ├── AssetCatalog.h │ ├── CoT.cpp │ ├── CoT.h │ ├── Cog.cpp │ ├── Cog.h │ ├── Cog_Buffer.cpp │ ├── Cog_Buffer.h │ ├── Cog_Button.cpp │ ├── Cog_Button.h │ ├── Cog_Delay.cpp │ ├── Cog_Delay.h │ ├── Cog_Distribute.cpp │ ├── Cog_Distribute.h │ ├── Cog_Group.cpp │ ├── Cog_Group.h │ ├── Cog_Indirect.cpp │ ├── Cog_Indirect.h │ ├── Cog_NookScope.cpp │ ├── Cog_NookScope.h │ ├── Cog_Random.cpp │ ├── Cog_Random.h │ ├── Cog_Replicate.cpp │ ├── Cog_Replicate.h │ ├── Cog_Sound.cpp │ ├── Cog_Sound.h │ ├── Cog_Toon.cpp │ ├── Cog_Toon.h │ ├── ColorMatrix.h │ ├── DebugFlags.cpp │ ├── DebugFlags.h │ ├── DrawPreprocess.cpp │ ├── DrawPreprocess.h │ ├── Draw_GL.cpp │ ├── Draw_GL.h │ ├── Draw_GL_Shader.cpp │ ├── Draw_GL_Shader.h │ ├── FontCatalog.cpp │ ├── FontCatalog.h │ ├── Game.cpp │ ├── Game.h │ ├── Geometry.h │ ├── Geometry2D.h │ ├── Geometry3D.h │ ├── Main_Android.cpp │ ├── Main_Mac.mm │ ├── Main_iOS.mm │ ├── Nook.cpp │ ├── Nook.h │ ├── PitchAndCatch.cpp │ ├── PitchAndCatch.h │ ├── RenderGame.cpp │ ├── RenderGame.h │ ├── Rendered.cpp │ ├── Rendered.h │ ├── Sound.cpp │ ├── Sound.h │ ├── Sound_CoreAudio.cpp │ ├── Sound_CoreAudio.h │ ├── Texture.cpp │ ├── Texture.h │ ├── Texture_GL.cpp │ ├── Texture_GL.h │ ├── Toon.cpp │ ├── Toon.h │ ├── Touch.cpp │ ├── Touch.h │ ├── Tween.h │ ├── Tween_BlushGainMat.cpp │ ├── Tween_BlushGainMat.h │ ├── Tween_Geometry.h │ ├── Tween_Rat.cpp │ ├── Tween_Rat.h │ ├── Types.cpp │ ├── Types.h │ ├── UIView_Game.h │ ├── UIView_Game.mm │ ├── Util.cpp │ ├── Util.h │ ├── Util_Allocator.cpp │ ├── Util_Allocator.h │ ├── Util_AssetCatalog.cpp │ ├── Util_AssetCatalog.h │ ├── Util_Assets.cpp │ ├── Util_Assets.h │ ├── Util_FinderHider.cpp │ ├── Util_FinderHider.h │ ├── Util_GrindAssets.cpp │ ├── Util_GrindAssets.h │ ├── Util_TextData.cpp │ ├── Util_TextData.h │ ├── Val.cpp │ ├── Val.h │ ├── Visitor_Rendered_Std.cpp │ └── Visitor_Rendered_Std.h │ ├── HTTP │ ├── Connect.cpp │ ├── Connect.h │ ├── Content.cpp │ ├── Content.h │ ├── HTTP.cpp │ ├── HTTP.h │ ├── MIME.cpp │ ├── MIME.h │ ├── Requests.cpp │ └── Requests.h │ ├── Pixels │ ├── BigRegion.cpp │ ├── BigRegion.h │ ├── Blit.cpp │ ├── Blit.h │ ├── BlitPriv.h │ ├── Cartesian_Geom.h │ ├── Formats.cpp │ ├── Formats.h │ ├── Geom.h │ ├── PixelDesc.cpp │ ├── PixelDesc.h │ ├── PixelIters.h │ ├── Pixmap.cpp │ ├── Pixmap.h │ ├── PixmapCoder_PNG.cpp │ ├── PixmapCoder_PNG.h │ ├── Pixval.h │ ├── Pixval2RGBA.cpp │ ├── Pixval2RGBA.h │ ├── PixvalAccessor.cpp │ ├── PixvalAccessor.h │ ├── PixvalDesc.h │ ├── PixvalIters.cpp │ ├── PixvalIters.h │ ├── RGBA.h │ ├── RGBA2Pixval.cpp │ ├── RGBA2Pixval.h │ ├── Raster.cpp │ ├── Raster.h │ ├── RasterDesc.cpp │ ├── RasterDesc.h │ ├── RasterOperations.cpp │ └── RasterOperations.h │ ├── QueryEngine │ ├── Expr_Rel_Search.cpp │ ├── Expr_Rel_Search.h │ ├── Result.cpp │ ├── Result.h │ ├── ResultFromWalker.cpp │ ├── ResultFromWalker.h │ ├── Transform_Search.cpp │ ├── Transform_Search.h │ ├── Util_Strim_Walker.cpp │ ├── Util_Strim_Walker.h │ ├── Visitor_DoMakeWalker.cpp │ ├── Visitor_DoMakeWalker.h │ ├── Walker.cpp │ ├── Walker.h │ ├── Walker_Calc.cpp │ ├── Walker_Calc.h │ ├── Walker_Comment.cpp │ ├── Walker_Comment.h │ ├── Walker_Const.cpp │ ├── Walker_Const.h │ ├── Walker_Dee.cpp │ ├── Walker_Dee.h │ ├── Walker_Dum.cpp │ ├── Walker_Dum.h │ ├── Walker_Embed.cpp │ ├── Walker_Embed.h │ ├── Walker_Product.cpp │ ├── Walker_Product.h │ ├── Walker_Project.cpp │ ├── Walker_Project.h │ ├── Walker_Rename.cpp │ ├── Walker_Rename.h │ ├── Walker_Restrict.cpp │ ├── Walker_Restrict.h │ ├── Walker_Result.cpp │ ├── Walker_Result.h │ ├── Walker_Union.cpp │ └── Walker_Union.h │ ├── RelationalAlgebra │ ├── AsSQL.cpp │ ├── AsSQL.h │ ├── ColName.h │ ├── Expr_Rel.cpp │ ├── Expr_Rel.h │ ├── Expr_Rel_Calc.cpp │ ├── Expr_Rel_Calc.h │ ├── Expr_Rel_Comment.cpp │ ├── Expr_Rel_Comment.h │ ├── Expr_Rel_Concrete.cpp │ ├── Expr_Rel_Concrete.h │ ├── Expr_Rel_Const.cpp │ ├── Expr_Rel_Const.h │ ├── Expr_Rel_Dee.cpp │ ├── Expr_Rel_Dee.h │ ├── Expr_Rel_Difference.cpp │ ├── Expr_Rel_Difference.h │ ├── Expr_Rel_Dum.cpp │ ├── Expr_Rel_Dum.h │ ├── Expr_Rel_Embed.cpp │ ├── Expr_Rel_Embed.h │ ├── Expr_Rel_Intersect.cpp │ ├── Expr_Rel_Intersect.h │ ├── Expr_Rel_Product.cpp │ ├── Expr_Rel_Product.h │ ├── Expr_Rel_Project.cpp │ ├── Expr_Rel_Project.h │ ├── Expr_Rel_Rename.cpp │ ├── Expr_Rel_Rename.h │ ├── Expr_Rel_Restrict.cpp │ ├── Expr_Rel_Restrict.h │ ├── Expr_Rel_Union.cpp │ ├── Expr_Rel_Union.h │ ├── GetRelHead.cpp │ ├── GetRelHead.h │ ├── PseudoMap.cpp │ ├── PseudoMap.h │ ├── RelHead.cpp │ ├── RelHead.h │ ├── Transform_ConsolidateRenames.cpp │ ├── Transform_ConsolidateRenames.h │ ├── Transform_DecomposeRestricts.cpp │ ├── Transform_DecomposeRestricts.h │ ├── Transform_PushDownRestricts.cpp │ ├── Transform_PushDownRestricts.h │ ├── Util_Rel_Operators.cpp │ ├── Util_Rel_Operators.h │ ├── Util_Strim_Rel.cpp │ ├── Util_Strim_Rel.h │ ├── Util_Strim_RelHead.cpp │ └── Util_Strim_RelHead.h │ ├── Server │ ├── Roster.cpp │ ├── Roster.h │ ├── Server.cpp │ └── Server.h │ └── ValPred │ ├── Expr_Bool_ValPred.cpp │ ├── Expr_Bool_ValPred.h │ ├── Util_Expr_Bool_ValPred_Rename.cpp │ ├── Util_Expr_Bool_ValPred_Rename.h │ ├── Util_Strim_Expr_Bool_ValPred.cpp │ ├── Util_Strim_Expr_Bool_ValPred.h │ ├── Util_Strim_ValPred_DB.cpp │ ├── Util_Strim_ValPred_DB.h │ ├── ValPred.cpp │ ├── ValPred.h │ ├── ValPred_DB.cpp │ ├── ValPred_DB.h │ ├── ValPred_GetNames.cpp │ ├── ValPred_GetNames.h │ ├── ValPred_Renamed.cpp │ ├── ValPred_Renamed.h │ ├── Visitor_Expr_Bool_ValPred_DB_Do_Eval_Matches.cpp │ ├── Visitor_Expr_Bool_ValPred_DB_Do_Eval_Matches.h │ ├── Visitor_Expr_Bool_ValPred_DB_ToStrim.cpp │ ├── Visitor_Expr_Bool_ValPred_DB_ToStrim.h │ ├── Visitor_Expr_Bool_ValPred_Do_GetNames.cpp │ └── Visitor_Expr_Bool_ValPred_Do_GetNames.h ├── README.markdown ├── ZooLib.xcodeproj └── project.pbxproj ├── ZooLibAndroid ├── .gitignore ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── org │ └── zoolib │ ├── Activity_Game.java │ └── ViewModel_Game.java ├── default_config └── zconfig.h └── docs ├── Docs_BuildingZooLib.txt ├── Docs_CodePhilosophy.markdown ├── Docs_MainPage.txt └── Docs_NamingConvention.markdown /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = tab 5 | indent_size = 4 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .svn 3 | html 4 | *.iml 5 | -------------------------------------------------------------------------------- /CMakeProjects/zoolib_Platform_ARM/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.4.1) 2 | 3 | set(ZOOLIB_CXX ../..) 4 | 5 | set(SourceDir ${ZOOLIB_CXX}/Platform/zoolib/ARM) 6 | 7 | set (SourceFiles 8 | ${SourceDir}/Compat_arm.h 9 | ${SourceDir}/Matrix_armv6.cpp 10 | ${SourceDir}/Matrix_armv6.h 11 | ${SourceDir}/Matrix_armv7.cpp 12 | ${SourceDir}/Matrix_armv7.h 13 | ) 14 | 15 | source_group("" FILES ${SourceFiles}) 16 | 17 | include_directories(${ZOOLIB_CXX} ${ZOOLIB_CXX}/Core ${ZOOLIB_CXX}/Portable ${ZOOLIB_CXX}/Platform) 18 | 19 | add_library(ZooLib_Platform_ARM STATIC 20 | 21 | ${SourceFiles} 22 | ) 23 | -------------------------------------------------------------------------------- /CMakeProjects/zoolib_Platform_Hashing/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.4.1) 2 | 3 | set(ZOOLIB_CXX ../..) 4 | 5 | set(SourceDir ${ZOOLIB_CXX}/Platform/zoolib/Hashing) 6 | 7 | set (SourceFiles 8 | ${SourceDir}/ChanW_Bin_Hash.h 9 | ${SourceDir}/MD5.cpp 10 | ${SourceDir}/MD5.h 11 | ${SourceDir}/SHA1.cpp 12 | ${SourceDir}/SHA1.h 13 | ${SourceDir}/SHA256.cpp 14 | ${SourceDir}/SHA256.h 15 | ) 16 | 17 | source_group("" FILES ${SourceFiles}) 18 | 19 | include_directories(${ZOOLIB_CXX} ${ZOOLIB_CXX}/Core ${ZOOLIB_CXX}/Portable ${ZOOLIB_CXX}/Platform) 20 | 21 | add_library(ZooLib_Platform_Hashing STATIC 22 | 23 | ${SourceFiles} 24 | ) 25 | -------------------------------------------------------------------------------- /CMakeProjects/zoolib_Platform_JNI/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.4.1) 2 | 3 | set(ZOOLIB_CXX ../..) 4 | 5 | set(SourceDir ${ZOOLIB_CXX}/Platform/zoolib/JNI) 6 | 7 | set (SourceFiles 8 | ${SourceDir}/Chan_JavaStream.cpp 9 | ${SourceDir}/Chan_JavaStream.h 10 | ${SourceDir}/JavaStream_Channer_Bin.cpp 11 | ${SourceDir}/JavaStream_Channer_Bin.h 12 | ${SourceDir}/JNI.cpp 13 | ${SourceDir}/JNI.h 14 | ${SourceDir}/PullPush_JNI.cpp 15 | ${SourceDir}/PullPush_JNI.h 16 | ) 17 | 18 | source_group("" FILES ${SourceFiles}) 19 | 20 | include_directories(${ZOOLIB_CXX} ${ZOOLIB_CXX}/Core ${ZOOLIB_CXX}/Portable ${ZOOLIB_CXX}/Platform) 21 | 22 | add_library(ZooLib_Platform_JNI STATIC 23 | 24 | ${SourceFiles} 25 | ) 26 | -------------------------------------------------------------------------------- /CMakeProjects/zoolib_Platform_MAME/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.4.1) 2 | 3 | set(ZOOLIB_CXX ../..) 4 | 5 | set(SourceDir ${ZOOLIB_CXX}/Platform/zoolib/MAME) 6 | 7 | set (SourceFiles 8 | ${SourceDir}/Cartesian_MAME.h 9 | ) 10 | 11 | source_group("" FILES ${SourceFiles}) 12 | 13 | include_directories(${ZOOLIB_CXX} ${ZOOLIB_CXX}/Core ${ZOOLIB_CXX}/Portable ${ZOOLIB_CXX}/Platform) 14 | 15 | add_library(ZooLib_Platform_MAME STATIC 16 | 17 | ${SourceFiles} 18 | ) 19 | -------------------------------------------------------------------------------- /CMakeProjects/zoolib_Platform_OpenGL/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.4.1) 2 | 3 | set(ZOOLIB_CXX ../..) 4 | 5 | set(SourceDir ${ZOOLIB_CXX}/Platform/zoolib/OpenGL) 6 | 7 | set (SourceFiles 8 | ${SourceDir}/Compat_OpenGL.h 9 | ${SourceDir}/Util.cpp 10 | ${SourceDir}/Util.h 11 | ) 12 | 13 | source_group("" FILES ${SourceFiles}) 14 | 15 | include_directories(${ZOOLIB_CXX} ${ZOOLIB_CXX}/Core ${ZOOLIB_CXX}/Portable ${ZOOLIB_CXX}/Platform) 16 | 17 | add_library(ZooLib_Platform_OpenGL STATIC 18 | 19 | ${SourceFiles} 20 | ) 21 | -------------------------------------------------------------------------------- /CMakeProjects/zoolib_Platform_SQLite/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.4.1) 2 | 3 | set(ZOOLIB_CXX ../..) 4 | 5 | set(SourceDir ${ZOOLIB_CXX}/Platform/zoolib/SQLite) 6 | 7 | set (SourceFiles 8 | ${SourceDir}/SQLite.cpp 9 | ${SourceDir}/SQLite.h 10 | ) 11 | 12 | source_group("" FILES ${SourceFiles}) 13 | 14 | include_directories(${ZOOLIB_CXX} ${ZOOLIB_CXX}/Core ${ZOOLIB_CXX}/Portable ${ZOOLIB_CXX}/Platform) 15 | 16 | add_library(ZooLib_Platform_SQLite STATIC 17 | 18 | ${SourceFiles} 19 | ) 20 | -------------------------------------------------------------------------------- /CMakeProjects/zoolib_Platform_Zip/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if(NOT DEFINED ZooLib_IncludeDir_libzip) 2 | message(FATAL_ERROR "You must define ZooLib_IncludeDir_libzip") 3 | endif() 4 | 5 | set(ZOOLIB_CXX ../..) 6 | 7 | set(SourceDir ${ZOOLIB_CXX}/Platform/zoolib/Zip) 8 | 9 | set (SourceFiles 10 | ${SourceDir}/Archive_Zip.cpp 11 | ${SourceDir}/Archive_Zip.h 12 | ${SourceDir}/Archive_Zip_More.cpp 13 | ${SourceDir}/Archive_Zip_More.h 14 | ) 15 | 16 | source_group("" FILES ${SourceFiles}) 17 | 18 | include_directories(${ZOOLIB_CXX} ${ZOOLIB_CXX}/Core ${ZOOLIB_CXX}/Portable ${ZOOLIB_CXX}/Platform) 19 | 20 | include_directories(${ZooLib_IncludeDir_libzip}) 21 | 22 | add_library(ZooLib_Platform_Zip STATIC 23 | 24 | ${SourceFiles} 25 | ) 26 | -------------------------------------------------------------------------------- /CMakeProjects/zoolib_Platform_zlib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.4.1) 2 | 3 | set(ZOOLIB_CXX ../..) 4 | 5 | set(SourceDir ${ZOOLIB_CXX}/Platform/zoolib/zlib) 6 | 7 | set (SourceFiles 8 | ${SourceDir}/Chan_Bin_zlib.cpp 9 | ${SourceDir}/Chan_Bin_zlib.h 10 | ) 11 | 12 | source_group("" FILES ${SourceFiles}) 13 | 14 | include_directories(${ZOOLIB_CXX} ${ZOOLIB_CXX}/Core ${ZOOLIB_CXX}/Portable ${ZOOLIB_CXX}/Platform) 15 | 16 | add_library(ZooLib_Platform_zlib STATIC 17 | 18 | ${SourceFiles} 19 | ) 20 | -------------------------------------------------------------------------------- /CMakeProjects/zoolib_Project_Expr/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.4.1) 2 | 3 | set(ZOOLIB_CXX ../..) 4 | 5 | set(SourceDir ${ZOOLIB_CXX}/Project/zoolib/Expr) 6 | 7 | set (SourceFiles 8 | ${SourceDir}/Util_Expr_Bool_CNF.cpp 9 | ${SourceDir}/Expr_Bool.cpp 10 | ${SourceDir}/Expr_Bool.h 11 | ${SourceDir}/Expr_Op_T.h 12 | ${SourceDir}/Expr.cpp 13 | ${SourceDir}/Expr.h 14 | ${SourceDir}/Util_Expr_Bool_CNF.h 15 | ${SourceDir}/Util_Strim_Expr_Bool.cpp 16 | ${SourceDir}/Util_Strim_Expr_Bool.h 17 | ${SourceDir}/Visitor_Expr_Bool_Do_Eval.cpp 18 | ${SourceDir}/Visitor_Expr_Bool_Do_Eval.h 19 | ${SourceDir}/Visitor_Expr_Bool_ToStrim.cpp 20 | ${SourceDir}/Visitor_Expr_Bool_ToStrim.h 21 | ${SourceDir}/Visitor_Expr_Op_Do_Transform_T.h 22 | ) 23 | 24 | source_group("" FILES ${SourceFiles}) 25 | 26 | include_directories(${SourceDir}/../.. ${ZOOLIB_CXX}/Core ${ZOOLIB_CXX}/Portable ${ZOOLIB_CXX}/Project) 27 | 28 | add_library(ZooLib_Project_Expr STATIC 29 | 30 | ${SourceFiles} 31 | ) 32 | -------------------------------------------------------------------------------- /CMakeProjects/zoolib_Project_Server/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.4.1) 2 | 3 | set(ZOOLIB_CXX ../..) 4 | 5 | set(SourceDir ${ZOOLIB_CXX}/Project/zoolib/Server) 6 | 7 | set (SourceFiles 8 | ${SourceDir}/Roster.cpp 9 | ${SourceDir}/Roster.h 10 | ${SourceDir}/Server.cpp 11 | ${SourceDir}/Server.h 12 | ) 13 | 14 | source_group("" FILES ${SourceFiles}) 15 | 16 | include_directories(${SourceDir}/../.. ${ZOOLIB_CXX}/Core ${ZOOLIB_CXX}/Portable ${ZOOLIB_CXX}/Project) 17 | 18 | add_library(ZooLib_Project_Server STATIC 19 | 20 | ${SourceFiles} 21 | ) 22 | -------------------------------------------------------------------------------- /Core/zoolib/Any.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009-2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Any_h__ 4 | #define __ZooLib_Any_h__ 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Any_T.h" 8 | 9 | namespace ZooLib { 10 | 11 | // ================================================================================================= 12 | #pragma mark - Any 13 | 14 | typedef Any_T Any; 15 | 16 | } // namespace ZooLib 17 | 18 | #endif // __ZooLib_Any_h__ 19 | -------------------------------------------------------------------------------- /Core/zoolib/ChanU.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_ChanU_h__ 4 | #define __ZooLib_ChanU_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Chan.h" 8 | 9 | namespace ZooLib { 10 | 11 | // ================================================================================================= 12 | #pragma mark - 13 | 14 | template 15 | bool sUnread(const ChanU& iChanU, const EE& iElmt) 16 | { return 1 == sUnread(iChanU, &iElmt, 1); } 17 | 18 | } // namespace ZooLib 19 | 20 | #endif // __ZooLib_ChanU_h__ 21 | -------------------------------------------------------------------------------- /Core/zoolib/Chan_Bin.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Chan_Bin_h__ 4 | #define __ZooLib_Chan_Bin_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Chan.h" 8 | #include "zoolib/StdInt.h" // For byte 9 | 10 | namespace ZooLib { 11 | 12 | // ================================================================================================= 13 | #pragma mark - 14 | 15 | using ChanR_Bin = ChanR; 16 | using ChanU_Bin = ChanU; 17 | using ChanW_Bin = ChanW; 18 | 19 | using ChanRU_Bin = ChanRU; 20 | using ChanRSize_Bin = ChanRSize; 21 | using ChanRPos_Bin = ChanRPos; 22 | using ChanWPos_Bin = ChanWPos; 23 | using ChanRWPos_Bin = ChanRWPos; 24 | using ChanRW_Bin = ChanRW; 25 | using ChanRAbort_Bin = ChanRAbort; 26 | using ChanWAbort_Bin = ChanWAbort; 27 | using ChanRWAbort_Bin = ChanRWAbort; 28 | using ChanRCon_Bin = ChanRCon; 29 | using ChanWCon_Bin = ChanWCon; 30 | using ChanRWCon_Bin = ChanRWCon; 31 | 32 | } // namespace ZooLib 33 | 34 | #endif // __ZooLib_Chan_Bin_h__ 35 | -------------------------------------------------------------------------------- /Core/zoolib/Chan_UTF.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Chan_UTF_h__ 4 | #define __ZooLib_Chan_UTF_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Chan.h" 8 | #include "zoolib/UnicodeCU.h" 9 | 10 | namespace ZooLib { 11 | 12 | // ================================================================================================= 13 | #pragma mark - 14 | 15 | using ChanR_UTF = ChanR; 16 | using ChanU_UTF = ChanU; 17 | using ChanW_UTF = ChanW; 18 | 19 | using ChanRU_UTF = ChanRU; 20 | using ChanRPos_UTF = ChanRPos; 21 | using ChanWPos_UTF = ChanWPos; 22 | using ChanRWPos_UTF = ChanRWPos; 23 | using ChanRW_UTF = ChanRW; 24 | using ChanRAbort_UTF = ChanRAbort; 25 | using ChanWAbort_UTF = ChanWAbort; 26 | using ChanRWAbort_UTF = ChanRWAbort; 27 | using ChanRCon_UTF = ChanRCon; 28 | using ChanWCon_UTF = ChanWCon; 29 | using ChanRWCon_UTF = ChanRWCon; 30 | 31 | } // namespace ZooLib 32 | 33 | #endif // __ZooLib_Chan_UTF_h__ 34 | -------------------------------------------------------------------------------- /Core/zoolib/Compat_cmath.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2003 Andrew Green and Learning in Motion, Inc. 2 | // MIT License. http://www.zoolib.org 3 | 4 | #ifndef __ZooLib_Compat_cmath_h__ 5 | #define __ZooLib_Compat_cmath_h__ 1 6 | #include "zconfig.h" 7 | 8 | #define __USE_ISOC99 1 9 | #include 10 | 11 | #if ZCONFIG(Compiler, MSVC) 12 | 13 | #include 14 | 15 | #define isnan _isnan 16 | 17 | static unsigned int __qnan[] = { 0x7fc00001 }; 18 | #define NAN (*(float*)__qnan) 19 | 20 | static unsigned int __infinity[] = { 0x7f800000 }; 21 | #define INFINITY (*(float*)__infinity) 22 | 23 | #else 24 | 25 | #if !defined(INFINITY) 26 | #define INFINITY (1.0/0.0) 27 | #endif 28 | 29 | #if !defined(NAN) 30 | #define NAN (0.0/0.0) 31 | #endif 32 | 33 | #endif 34 | 35 | #endif // __ZooLib_Compat_cmath_h__ 36 | -------------------------------------------------------------------------------- /Core/zoolib/Compat_string.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2008-2020 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Compat_string_h__ 4 | #define __ZooLib_Compat_string_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include 8 | 9 | #endif // __ZooLib_Compat_string_h__ 10 | -------------------------------------------------------------------------------- /Core/zoolib/Compat_unordered_map.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2020 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Compat_unordered_map_h__ 4 | #define __ZooLib_Compat_unordered_map_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include 8 | 9 | namespace ZooLib { 10 | 11 | using std::unordered_map; 12 | using std::unordered_multimap; 13 | 14 | } // namespace ZooLib 15 | 16 | #endif // __ZooLib_Compat_unordered_map_h__ 17 | -------------------------------------------------------------------------------- /Core/zoolib/CountedWithoutFinalize.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/CountedWithoutFinalize.h" 4 | 5 | #include "zoolib/ZDebug.h" 6 | 7 | namespace ZooLib { 8 | 9 | // ================================================================================================= 10 | #pragma mark - CountedWithoutFinalize 11 | 12 | CountedWithoutFinalize::CountedWithoutFinalize() 13 | : fRefCount(0) 14 | {} 15 | 16 | CountedWithoutFinalize::~CountedWithoutFinalize() 17 | { 18 | ZAssertStopf(1, sAtomic_Get(&fRefCount) == 0, 19 | "Non-zero refcount at destruction, it is %d", sAtomic_Get(&fRefCount)); 20 | } 21 | 22 | void CountedWithoutFinalize::Release() 23 | { 24 | if (sAtomic_DecAndTest(&fRefCount)) 25 | delete this; 26 | } 27 | 28 | bool CountedWithoutFinalize::IsShared() const 29 | { return sAtomic_Get(&fRefCount) > 1; } 30 | 31 | bool CountedWithoutFinalize::IsReferenced() const 32 | { return sAtomic_Get(&fRefCount) > 0; } 33 | 34 | } // namespace ZooLib 35 | -------------------------------------------------------------------------------- /Core/zoolib/CountedWithoutFinalize.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_CountedWithoutFinalize_h__ 4 | #define __ZooLib_CountedWithoutFinalize_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Atomic.h" 8 | 9 | namespace ZooLib { 10 | 11 | // ================================================================================================= 12 | #pragma mark - CountedWithoutFinalize 13 | 14 | class CountedWithoutFinalize 15 | { 16 | public: 17 | CountedWithoutFinalize(); 18 | virtual ~CountedWithoutFinalize(); 19 | 20 | void Retain() { sAtomic_Inc(&fRefCount); } 21 | void Release(); 22 | bool IsShared() const; 23 | bool IsReferenced() const; 24 | 25 | private: 26 | ZAtomic_t fRefCount; 27 | }; 28 | 29 | // ================================================================================================= 30 | #pragma mark - sRetain/sRelease for CountedWithoutFinalize derivatives 31 | 32 | inline void sRetain(CountedWithoutFinalize& iObject) 33 | { iObject.Retain(); } 34 | 35 | inline void sRelease(CountedWithoutFinalize& iObject) 36 | { iObject.Release(); } 37 | 38 | inline void sCheck(CountedWithoutFinalize* iP) 39 | {} 40 | 41 | } // namespace ZooLib 42 | 43 | #endif // __ZooLib_CountedWithoutFinalize_h__ 44 | -------------------------------------------------------------------------------- /Core/zoolib/Default.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Default_h__ 4 | #define __ZooLib_Default_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Singleton.h" 8 | 9 | namespace ZooLib { 10 | 11 | // ================================================================================================= 12 | #pragma mark - sDefault() 13 | 14 | template struct DefaultTraits { typedef const Type_p& Return_t; }; 15 | 16 | template <> struct DefaultTraits { typedef void Return_t; }; 17 | 18 | struct Tag_Default; 19 | 20 | template 21 | typename DefaultTraits::Return_t sDefault() 22 | { return sSingleton(); } 23 | 24 | template <> 25 | inline DefaultTraits::Return_t sDefault() 26 | {} 27 | 28 | // ================================================================================================= 29 | #pragma mark - sDefault() 30 | 31 | struct Default_t { template operator const T&() { return sSingleton(); } }; 32 | 33 | inline Default_t sDefault() { return Default_t(); } 34 | 35 | } // namespace ZooLib 36 | 37 | #endif // __ZooLib_Default_h__ 38 | -------------------------------------------------------------------------------- /Core/zoolib/Deleter.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Deleter_h__ 4 | #define __ZooLib_Deleter_h__ 1 5 | #include "zconfig.h" 6 | 7 | namespace ZooLib { 8 | 9 | // ================================================================================================= 10 | #pragma mark - Deleter 11 | 12 | template 13 | class Deleter 14 | { 15 | public: 16 | Deleter(T*& iPtr) : fPtr(iPtr) {} 17 | ~Deleter() { delete fPtr; } 18 | 19 | private: 20 | T*& fPtr; 21 | }; 22 | 23 | // ================================================================================================= 24 | #pragma mark - Deleter specialized for arrays. 25 | 26 | template 27 | class Deleter 28 | { 29 | public: 30 | Deleter(T*& iPtr) : fPtr(iPtr) {} 31 | ~Deleter() { delete[] fPtr; } 32 | 33 | private: 34 | T*& fPtr; 35 | }; 36 | 37 | } // namespace ZooLib 38 | 39 | #endif // __ZooLib_Deleter_h__ 40 | -------------------------------------------------------------------------------- /Core/zoolib/Singleton.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Singleton_h__ 4 | #define __ZooLib_Singleton_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Atomic.h" 8 | #include "zoolib/Deleter.h" 9 | 10 | namespace ZooLib { 11 | 12 | // ================================================================================================= 13 | #pragma mark - sSingleton 14 | 15 | template 16 | Type_p& sSingleton() 17 | { 18 | static std::atomic spType_p; 19 | if (not spType_p) 20 | { 21 | Type_p* newValue = new Type_p(); 22 | if (not sAtomic_CAS(&spType_p, nullptr, newValue)) 23 | { 24 | delete newValue; 25 | } 26 | else 27 | { 28 | static Deleter deleter(*(Type_p**)&spType_p); 29 | } 30 | } 31 | return *spType_p; 32 | } 33 | 34 | template 35 | Type_p& sSingleton() 36 | { return sSingleton(); } 37 | 38 | } // namespace ZooLib 39 | 40 | #endif // __ZooLib_Singleton_h___ 41 | -------------------------------------------------------------------------------- /Core/zoolib/Startable.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Startable_h__ 4 | #define __ZooLib_Startable_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Callable.h" 8 | 9 | namespace ZooLib { 10 | 11 | typedef Callable Startable; 12 | 13 | } // namespace ZooLib 14 | 15 | #endif // __ZooLib_Startable_h__ 16 | -------------------------------------------------------------------------------- /Core/zoolib/Starter.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Starter_h__ 4 | #define __ZooLib_Starter_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Startable.h" 8 | 9 | namespace ZooLib { 10 | 11 | // ================================================================================================= 12 | #pragma mark - Starter 13 | 14 | class Starter 15 | : public Counted 16 | { 17 | public: 18 | // Our protocol 19 | virtual bool QStart(const ZP& iStartable) = 0; 20 | }; 21 | 22 | // ================================================================================================= 23 | #pragma mark - Starter_Trivial 24 | 25 | class Starter_Trivial 26 | : public Starter 27 | { 28 | public: 29 | // From Starter 30 | virtual bool QStart(const ZP& iStartable) 31 | { return sQCall(iStartable); } 32 | }; 33 | 34 | // ================================================================================================= 35 | #pragma mark - sQStart 36 | 37 | inline bool sQStart(ZP iStarter, const ZP& iStartable) 38 | { 39 | if (iStarter && iStartable) 40 | return iStarter->QStart(iStartable); 41 | return false; 42 | } 43 | 44 | } // namespace ZooLib 45 | 46 | #endif // __ZooLib_Starter_h__ 47 | -------------------------------------------------------------------------------- /Core/zoolib/TypeIdName.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_TypeIdName_h__ 4 | #define __ZooLib_TypeIdName_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include 8 | 9 | // ================================================================================================= 10 | 11 | namespace ZooLib { 12 | 13 | template 14 | const char* sTypeIdName(const T& iObj) 15 | { return typeid(iObj).name(); } 16 | 17 | } // namespace ZooLib 18 | 19 | #endif // __ZooLib_TypeIdName_h__ 20 | -------------------------------------------------------------------------------- /Core/zoolib/UnicodeCU.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2020 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_UnicodeCU_h__ 4 | #define __ZooLib_UnicodeCU_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/UnicodeCU8.h" 8 | 9 | namespace ZooLib { 10 | 11 | typedef char32_t UTF32; 12 | typedef char16_t UTF16; 13 | 14 | } // namespace ZooLib 15 | 16 | #endif // __ZooLib_UnicodeCU_h__ 17 | -------------------------------------------------------------------------------- /Core/zoolib/UnicodeCU8.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2020 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_UnicodeCU8_h__ 4 | #define __ZooLib_UnicodeCU8_h__ 1 5 | #include "zconfig.h" 6 | 7 | namespace ZooLib { 8 | 9 | typedef char UTF8; 10 | 11 | } // namespace ZooLib 12 | 13 | #endif // __ZooLib_UnicodeCU8_h__ 14 | -------------------------------------------------------------------------------- /Core/zoolib/UnicodeString.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009-2020 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_UnicodeString_h__ 4 | #define __ZooLib_UnicodeString_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/UnicodeCU.h" 8 | #include "zoolib/UnicodeString8.h" 9 | 10 | namespace ZooLib { 11 | 12 | /// A basic_string specialization that holds a sequence of UTF32 code units. 13 | typedef std::basic_string string32; 14 | 15 | /// A basic_string specialization that holds a sequence of UTF16 code units. 16 | typedef std::basic_string string16; 17 | 18 | } // namespace ZooLib 19 | 20 | #endif // __ZooLib_UnicodeString_h__ 21 | -------------------------------------------------------------------------------- /Core/zoolib/UnicodeString8.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2020 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_UnicodeString8_h__ 4 | #define __ZooLib_UnicodeString8_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/UnicodeCU8.h" 8 | 9 | #include 10 | 11 | namespace ZooLib { 12 | 13 | /** A basic_string specialization that holds a sequence of UTF8 code units. 14 | It is almost certainly same type as std::string. */ 15 | typedef std::basic_string string8; 16 | 17 | } // namespace ZooLib 18 | 19 | #endif // __ZooLib_UnicodeString8_h__ 20 | -------------------------------------------------------------------------------- /Core/zoolib/Util_STL_Base_MapOrSet.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020-2021 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Util_STL_Base_MapOrSet_h__ 4 | #define __ZooLib_Util_STL_Base_MapOrSet_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Util_STL.h" 8 | 9 | #include "zoolib/ZDebug.h" 10 | 11 | namespace ZooLib { 12 | namespace Util_STL { 13 | 14 | // ================================================================================================= 15 | // sEraseMust(key) 16 | 17 | template 18 | auto sEraseMust(const int iDebugLevel, CC& ioContainer, KK iKey) 19 | -> decltype(void(ioContainer.erase(iKey))) 20 | { 21 | bool result = ioContainer.erase(iKey); 22 | ZAssertStop(iDebugLevel, result); 23 | } 24 | 25 | template 26 | auto sEraseMust(CC& ioContainer, KK iKey) 27 | -> decltype(sEraseMust(1, ioContainer, iKey)) 28 | { sEraseMust(1, ioContainer, iKey); } 29 | 30 | } // namespace Util_STL 31 | } // namespace ZooLib 32 | 33 | #endif // __ZooLib_Util_STL_Base_MapOrSet_h__ 34 | -------------------------------------------------------------------------------- /Core/zoolib/Util_STL_map.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-2020 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Util_STL_map_h__ 4 | #define __ZooLib_Util_STL_map_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Util_STL_Base_Map.h" 8 | 9 | #include 10 | 11 | #endif // __ZooLib_Util_STL_map_h__ 12 | -------------------------------------------------------------------------------- /Core/zoolib/Util_STL_set.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2020 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Util_STL_set_h__ 4 | #define __ZooLib_Util_STL_set_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Util_STL_Base_Set.h" 8 | 9 | #include 10 | 11 | #endif // __ZooLib_Util_STL_set_h__ 12 | -------------------------------------------------------------------------------- /Core/zoolib/Util_STL_unordered_map.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2020 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Util_STL_unordered_map_h__ 4 | #define __ZooLib_Util_STL_unordered_map_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Util_STL_Base_Map.h" 8 | 9 | #include "zoolib/Compat_unordered_map.h" 10 | 11 | #endif // __ZooLib_Util_STL_unordered_map_h__ 12 | -------------------------------------------------------------------------------- /Core/zoolib/Util_STL_unordered_set.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2020 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Util_STL_unordered_set_h__ 4 | #define __ZooLib_Util_STL_unordered_set_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Util_STL_Base_Set.h" 8 | 9 | #include 10 | 11 | #endif // __ZooLib_Util_STL_unordered_set_h__ 12 | -------------------------------------------------------------------------------- /Core/zoolib/ZCONFIG_API.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2005 Andrew Green and Learning in Motion, Inc. 2 | // MIT License. http://www.zoolib.org 3 | 4 | #ifndef __ZCONFIG_API_h__ 5 | #define __ZCONFIG_API_h__ 1 6 | #include "zconfig.h" 7 | 8 | #include "zoolib/ZCONFIG_API_Definitions.h" 9 | 10 | #endif // __ZCONFIG_API_h__ 11 | -------------------------------------------------------------------------------- /Core/zoolib/ZCONFIG_API_Definitions.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2005 Andrew Green and Learning in Motion, Inc. 2 | // MIT License. http://www.zoolib.org 3 | 4 | #ifndef __ZCONFIG_API_Definitions_h__ 5 | #define __ZCONFIG_API_Definitions_h__ 1 6 | #include "zconfig.h" 7 | 8 | #define ZCONFIG_API_Avail(facility) (ZCONFIG_API_Avail__##facility) 9 | #define ZCONFIG_API_Desired(facility) (ZCONFIG_API_Desired__##facility) 10 | 11 | #define ZCONFIG_API_Enabled(facility) \ 12 | (ZCONFIG_API_Avail__##facility && ZCONFIG_API_Desired__##facility) 13 | 14 | #endif // __ZCONFIG_API_Definitions_h__ 15 | -------------------------------------------------------------------------------- /Core/zoolib/ZCONFIG_SPI_Definitions.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2005 Andrew Green and Learning in Motion, Inc. 2 | // MIT License. http://www.zoolib.org 3 | 4 | #ifndef __ZCONFIG_SPI_Definitions_h__ 5 | #define __ZCONFIG_SPI_Definitions_h__ 1 6 | #include "zconfig.h" 7 | 8 | #define ZCONFIG_SPI_Desired(facility) (ZCONFIG_SPI_Desired__##facility) 9 | #define ZCONFIG_SPI_Avail(facility) (ZCONFIG_SPI_Avail__##facility) 10 | 11 | #define ZCONFIG_SPI_Enabled(facility) \ 12 | (ZCONFIG_SPI_Avail__##facility && ZCONFIG_SPI_Desired__##facility) 13 | 14 | #endif // __ZCONFIG_SPI_Definitions_h__ 15 | -------------------------------------------------------------------------------- /Core/zoolib/ZMACRO_auto.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZMACRO_auto_h__ 4 | #define __ZMACRO_auto_h__ 1 5 | #include "zconfig.h" 6 | 7 | #define ZMACRO_auto(name,expr) auto name(expr) 8 | #define ZMACRO_auto_(name,expr) auto name=(expr) 9 | 10 | #endif // __ZMACRO_auto_h__ 11 | -------------------------------------------------------------------------------- /Core/zoolib/ZMACRO_decltype.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZMACRO_decltype_h__ 4 | #define __ZMACRO_decltype_h__ 1 5 | #include "zconfig.h" 6 | 7 | #define ZMACRO_decltype(expr) decltype(expr) 8 | 9 | #endif // __ZMACRO_decltype_h__ 10 | -------------------------------------------------------------------------------- /Core/zoolib/ZMACRO_foreach.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZMACRO_foreach_h__ 4 | #define __ZMACRO_foreach_h__ 1 5 | #include "zconfig.h" 6 | 7 | #ifndef foreachv 8 | #define foreachv(vardecl, container) for (vardecl : container) 9 | #endif 10 | 11 | #ifndef foreacha 12 | #define foreacha(varname, container) for (auto&& varname : container) 13 | #endif 14 | 15 | #endif // __ZMACRO_foreach_h__ 16 | -------------------------------------------------------------------------------- /Core/zoolib/size_t.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_size_t_h__ 4 | #define __ZooLib_size_t_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include // For ::size_t 8 | 9 | namespace ZooLib { 10 | 11 | using ::size_t; 12 | 13 | } // namespace ZooLib 14 | 15 | #endif // __ZooLib_size_t_h__ 16 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2000-2020 Andrew Green 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Platform/zoolib/ARM/Compat_arm.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_ARM_Compat_arm_h__ 4 | #define __ZooLib_ARM_Compat_arm_h__ 1 5 | #include "zconfig.h" 6 | 7 | #if __arm__ 8 | #include // picks up arm macros, doesn't choke on android 9 | #endif 10 | 11 | #endif // __ZooLib_ARM_Compat_arm_h__ 12 | -------------------------------------------------------------------------------- /Platform/zoolib/Apple/AutoreleasePool.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Apple_AutoreleasePool_h__ 4 | #define __ZooLib_Apple_AutoreleasePool_h__ 1 5 | #include "zconfig.h" 6 | #include "zoolib/ZCONFIG_SPI.h" 7 | 8 | #if ZCONFIG_SPI_Enabled(Cocoa) 9 | #if __OBJC__ && __cplusplus 10 | 11 | #include "zoolib/Apple/ZP_NS.h" 12 | 13 | #import 14 | 15 | // ================================================================================================= 16 | #pragma mark - AutoreleasePool 17 | 18 | namespace ZooLib { 19 | 20 | struct AutoreleasePool : public ZP 21 | { AutoreleasePool() : ZP(sAdopt& [[NSAutoreleasePool alloc] init]) {}; }; 22 | 23 | } // namespace ZooLib 24 | 25 | #endif // __OBJC__ && __cplusplus 26 | #endif // ZCONFIG_SPI_Enabled(Cocoa) 27 | 28 | #endif // __ZooLib_Apple_AutoreleasePool_h__ 29 | -------------------------------------------------------------------------------- /Platform/zoolib/Apple/CGData_Channer.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2003 Andrew Green and Learning in Motion, Inc. 2 | // MIT License. http://www.zoolib.org 3 | 4 | #ifndef __ZooLib_Apple_CGData_Channer_h__ 5 | #define __ZooLib_Apple_CGData_Channer_h__ 1 6 | #include "zconfig.h" 7 | #include "zoolib/ZCONFIG_SPI.h" 8 | 9 | #if ZCONFIG_SPI_Enabled(CoreGraphics) 10 | 11 | #if ZMACRO_IOS 12 | #include ZMACINCLUDE2(CoreGraphics,CGDataProvider.h) 13 | #include ZMACINCLUDE2(CoreGraphics,CGDataConsumer.h) 14 | #else 15 | #include ZMACINCLUDE3(ApplicationServices,CoreGraphics,CGDataProvider.h) 16 | #include ZMACINCLUDE3(ApplicationServices,CoreGraphics,CGDataConsumer.h) 17 | #endif 18 | 19 | #include "zoolib/Channer_Bin.h" 20 | 21 | namespace ZooLib { 22 | namespace CGData_Channer { 23 | 24 | // ================================================================================================= 25 | #pragma mark - CGData_Channer 26 | 27 | ZP sProvider(ZP iChanner); 28 | 29 | ZP sProvider(ZP iChanner); 30 | 31 | ZP sConsumer(ZP iChanner); 32 | 33 | } // namespace CGData_Channer 34 | } // namespace ZooLib 35 | 36 | #endif // ZCONFIG_SPI_Enabled(CoreGraphics) 37 | 38 | #endif // __ZooLib_Apple_CGData_Channer_h__ 39 | -------------------------------------------------------------------------------- /Platform/zoolib/Apple/Coerce_CF.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 Andrew Green and Mark/Space, Inc 2 | // MIT License. http://www.zoolib.org 3 | 4 | #ifndef __ZooLib_Apple_Coerce_CF_h__ 5 | #define __ZooLib_Apple_Coerce_CF_h__ 1 6 | #include "zconfig.h" 7 | #include "zoolib/ZCONFIG_SPI.h" 8 | 9 | #if ZCONFIG_SPI_Enabled(CFType) 10 | 11 | #include "zoolib/StdInt.h" // For int64 12 | #include "zoolib/ZQ.h" 13 | #include "zoolib/Apple/ZP_CF.h" 14 | 15 | // ================================================================================================= 16 | #pragma mark - Coercion 17 | 18 | namespace ZooLib { 19 | 20 | ZQ sQCoerceBool(CFTypeRef iCF); 21 | bool sQCoerceBool(CFTypeRef iCF, bool& oVal); 22 | bool sCoerceBool(CFTypeRef iCF); 23 | bool sCoerceBool(const ZP& iCF); 24 | 25 | ZQ sQCoerceInt(CFTypeRef iCF); 26 | bool sQCoerceInt(CFTypeRef iCF, int64& oVal); 27 | int64 sCoerceInt(CFTypeRef iCF); 28 | int64 sCoerceInt(const ZP& iCF); 29 | 30 | ZQ sQCoerceRat(CFTypeRef iCF); 31 | bool sQCoerceRat(CFTypeRef iCF, double& oVal); 32 | double sCoerceRat(CFTypeRef iCF); 33 | double sCoerceRat(const ZP& iCF); 34 | 35 | } // namespace ZooLib 36 | 37 | #endif // ZCONFIG_SPI_Enabled(CFType) 38 | 39 | #endif // __ZooLib_Apple_Coerce_CF_h__ 40 | -------------------------------------------------------------------------------- /Platform/zoolib/Apple/Compat_NSObject.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Apple_Compat_NSObject_h__ 4 | #define __ZooLib_Apple_Compat_NSObject_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Apple/ObjC.h" 8 | 9 | ZMACRO_ObjCClass(NSObject); 10 | 11 | #endif // __ZooLib_Apple_Compat_NSObject_h__ 12 | -------------------------------------------------------------------------------- /Platform/zoolib/Apple/ObjC.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2008 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Apple_ObjC_h__ 4 | #define __ZooLib_Apple_ObjC_h__ 1 5 | #include "zconfig.h" 6 | 7 | #ifdef __OBJC__ 8 | #include 9 | #define ZMACRO_ObjCClass(p) @class p 10 | #else 11 | typedef struct objc_class *Class; 12 | typedef struct objc_object { Class isa; } *id; 13 | typedef struct objc_selector *SEL; 14 | typedef id (*IMP)(id, SEL, ...); 15 | #define ZMACRO_ObjCClass(p) typedef struct objc_##p p 16 | #endif 17 | 18 | #endif // __ZooLib_Apple_ObjC_h__ 19 | -------------------------------------------------------------------------------- /Platform/zoolib/Apple/Pixmap_CGImage.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Apple_Pixmap_CGImage_h__ 4 | #define __ZooLib_Apple_Pixmap_CGImage_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/ZCONFIG_SPI.h" 8 | #include "zoolib/Pixels/Pixmap.h" 9 | 10 | #if ZCONFIG_SPI_Enabled(CoreGraphics) 11 | 12 | #if ZMACRO_IOS 13 | #include ZMACINCLUDE2(CoreGraphics,CGImage.h) 14 | #else 15 | #include ZMACINCLUDE3(ApplicationServices,CoreGraphics,CGImage.h) 16 | #endif 17 | 18 | namespace ZooLib { 19 | 20 | // ================================================================================================= 21 | #pragma mark - sPixmap 22 | 23 | Pixels::Pixmap sPixmap(ZP iImageRef); 24 | 25 | } // namespace ZooLib 26 | 27 | #endif // ZCONFIG_SPI_Enabled(CoreGraphics) 28 | 29 | #endif // __ZooLib_Apple_Pixmap_CGImage_h__ 30 | -------------------------------------------------------------------------------- /Platform/zoolib/Apple/PullPush_CF.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Apple_PullPush_CF_h__ 4 | #define __ZooLib_Apple_PullPush_CF_h__ 1 5 | #include "zconfig.h" 6 | #include "zoolib/ZCONFIG_SPI.h" 7 | 8 | #include "zoolib/PullPush.h" 9 | 10 | #include "zoolib/Apple/ZP_CF.h" 11 | 12 | #if ZCONFIG_SPI_Enabled(CFType) 13 | 14 | namespace ZooLib { 15 | 16 | // ================================================================================================= 17 | #pragma mark - 18 | 19 | bool sFromCF_Push_PPT(CFTypeRef iCFTypeRef, const ChanW_PPT& iChanW); 20 | 21 | // ================================================================================================= 22 | #pragma mark - 23 | 24 | bool sPull_PPT_AsCF(const ChanR_PPT& iChanR, ZP& oCFTypeRef); 25 | 26 | ZP sAsCF(const ChanR_PPT& iChanR); 27 | 28 | } // namespace ZooLib 29 | 30 | #endif // ZCONFIG_SPI_Enabled(CFType) 31 | 32 | #endif // __ZooLib_Apple_PullPush_CF_h__ 33 | -------------------------------------------------------------------------------- /Platform/zoolib/Apple/Util_CF_Any.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Apple_Util_CF_Any_h__ 4 | #define __ZooLib_Apple_Util_CF_Any_h__ 1 5 | #include "zconfig.h" 6 | #include "zoolib/ZCONFIG_SPI.h" 7 | 8 | #if ZCONFIG_SPI_Enabled(CFType) 9 | 10 | #include "zoolib/Any.h" 11 | 12 | #include "zoolib/Apple/ZP_CF.h" 13 | 14 | namespace ZooLib { 15 | namespace Util_CF { 16 | 17 | // ================================================================================================= 18 | #pragma mark - Util_CF 19 | 20 | ZQ sQSimpleAsAny(CFTypeID iTypeID, CFTypeRef iVal); 21 | 22 | } // namespace Util_CF 23 | } // namespace ZooLib 24 | 25 | #endif // ZCONFIG_SPI_Enabled(CFType) 26 | 27 | #endif // __ZooLib_Apple_Util_CF_Any_h__ 28 | -------------------------------------------------------------------------------- /Platform/zoolib/Apple/Util_CF_ZZ.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Apple_Util_CF_ZZ_h__ 4 | #define __ZooLib_Apple_Util_CF_ZZ_h__ 1 5 | #include "zconfig.h" 6 | #include "zoolib/ZCONFIG_SPI.h" 7 | 8 | #if ZCONFIG_SPI_Enabled(CFType) 9 | 10 | #include "zoolib/Val_ZZ.h" 11 | 12 | #include "zoolib/Apple/Util_CF_Any.h" 13 | #include "zoolib/Apple/ZP_CF.h" 14 | 15 | namespace ZooLib { 16 | namespace Util_CF { 17 | 18 | // ================================================================================================= 19 | #pragma mark - Util_CF 20 | 21 | ZQ sQAsZZ(CFTypeRef iVal); 22 | Val_ZZ sDAsZZ(const Val_ZZ& iDefault, CFTypeRef iVal); 23 | Val_ZZ sAsZZ(CFTypeRef iVal); 24 | 25 | ZP sDAsCFType(CFTypeRef iDefault, const Val_ZZ& iVal); 26 | ZP sAsCFType(const Val_ZZ& iVal); 27 | 28 | Seq_ZZ sAsSeq_ZZ(const Val_ZZ& iDefault, CFArrayRef iCFArray); 29 | Map_ZZ sAsMap_ZZ(const Val_ZZ& iDefault, CFDictionaryRef iCFDictionary); 30 | 31 | } // namespace Util_CF 32 | } // namespace ZooLib 33 | 34 | #endif // ZCONFIG_SPI_Enabled(CFType) 35 | 36 | #endif // __ZooLib_Apple_Util_CF_ZZ_h__ 37 | -------------------------------------------------------------------------------- /Platform/zoolib/Apple/Util_NS_ZZ.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Apple_Util_NS_ZZ_h__ 4 | #define __ZooLib_Apple_Util_NS_ZZ_h__ 1 5 | #include "zconfig.h" 6 | #include "zoolib/ZCONFIG_SPI.h" 7 | 8 | #if ZCONFIG_SPI_Enabled(CocoaFoundation) 9 | 10 | #include "zoolib/Val_ZZ.h" 11 | 12 | #import 13 | 14 | namespace ZooLib { 15 | namespace Util_NS { 16 | 17 | // ================================================================================================= 18 | #pragma mark - Util_NS 19 | 20 | Val_ZZ sDAsZZ(const Val_ZZ& iDefault, NSObject* iVal); 21 | Val_ZZ sAsZZ(NSObject* iVal); 22 | 23 | NSObject* sDAsNSObject(NSObject* iDefault, const Val_ZZ& iVal); 24 | NSObject* sAsNSObject(const Val_ZZ& iVal); 25 | 26 | } // namespace Util_NS 27 | } // namespace ZooLib 28 | 29 | // ================================================================================================= 30 | #pragma mark - asZZWithDefault 31 | 32 | @interface NSObject (ZooLib_asZZWithDefault) 33 | -(ZooLib::Val_ZZ)asZZWithDefault:(const ZooLib::Val_ZZ&)iDefault; 34 | @end 35 | 36 | #endif // ZCONFIG_SPI_Enabled(CocoaFoundation) 37 | 38 | #endif // __ZooLib_Apple_Util_NS_ZZ_h__ 39 | -------------------------------------------------------------------------------- /Platform/zoolib/Apple/ZP_CF.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Apple_ZP_CF_h__ 4 | #define __ZooLib_Apple_ZP_CF_h__ 1 5 | #include "zconfig.h" 6 | #include "zoolib/ZCONFIG_SPI.h" 7 | 8 | #include "zoolib/ZP.h" 9 | 10 | #if ZCONFIG_SPI_Enabled(CFType) 11 | 12 | typedef unsigned long CFTypeID; 13 | 14 | typedef const void * CFTypeRef; 15 | 16 | typedef const struct __CFNull * CFNullRef; 17 | 18 | typedef const struct __CFArray * CFArrayRef; 19 | typedef struct __CFArray * CFMutableArrayRef; 20 | 21 | typedef const struct __CFData * CFDataRef; 22 | typedef struct __CFData * CFMutableDataRef; 23 | 24 | typedef const struct __CFDictionary * CFDictionaryRef; 25 | typedef struct __CFDictionary * CFMutableDictionaryRef; 26 | 27 | typedef const struct __CFString * CFStringRef; 28 | typedef struct __CFString * CFMutableStringRef; 29 | 30 | #endif // ZCONFIG_SPI_Enabled(CFType) 31 | 32 | #endif // __ZooLib_Apple_ZP_CF_h__ 33 | -------------------------------------------------------------------------------- /Platform/zoolib/Apple/ZP_NS.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Apple_ZP_NS_h__ 4 | #define __ZooLib_Apple_ZP_NS_h__ 1 5 | #include "zconfig.h" 6 | #include "zoolib/ZCONFIG_SPI.h" 7 | 8 | #if ZCONFIG_SPI_Enabled(CocoaFoundation) 9 | 10 | #include "zoolib/Apple/Compat_NSObject.h" 11 | 12 | #include "zoolib/ZP.h" 13 | 14 | // ================================================================================================= 15 | #pragma mark - id and NSObject, sRetain and sRelease 16 | 17 | void sRetain(struct objc_object& iOb); 18 | void sRetain(NSObject& iNSObject); 19 | 20 | void sRelease(struct objc_object& iOb); 21 | void sRelease(NSObject& iNSObject); 22 | 23 | void sCheck(struct objc_object*); 24 | void sCheck(NSObject*); 25 | 26 | int sRetainCount(struct objc_object*); 27 | int sRetainCount(NSObject*); 28 | 29 | #endif // ZCONFIG_SPI_Enabled(CocoaFoundation) 30 | 31 | #endif // __ZooLib_Apple_ZP_NS_h__ 32 | -------------------------------------------------------------------------------- /Platform/zoolib/JNI/JavaStream_Channer_Bin.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2003-2020 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_JNI_JavaStream_Channer_Bin__ 4 | #define __ZooLib_JNI_JavaStream_Channer_Bin__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Channer_Bin.h" 8 | #include "zoolib/JNI/JNI.h" 9 | 10 | namespace ZooLib { 11 | namespace JNI { 12 | 13 | // ================================================================================================= 14 | #pragma mark - JavaInputStream_ChannerR_Bin 15 | 16 | jobject sJavaInputStream(JNIEnv* evnv, ZP iChanner); 17 | jobject sJavaInputStream(ZP iChanner); 18 | 19 | } // namespace JNI 20 | } // namespace ZooLib 21 | 22 | #endif // __ZooLib_JNI_JavaStream_Channer_Bin__ 23 | -------------------------------------------------------------------------------- /Platform/zoolib/JNI/PullPush_JNI.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2003-2020 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_JNI_PullPush_JNI__ 4 | #define __ZooLib_JNI_PullPush_JNI__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/PullPush.h" 8 | #include "zoolib/Val_ZZ.h" // used by sAs_JNI 9 | #include "zoolib/JNI/JNI.h" 10 | 11 | namespace ZooLib { 12 | 13 | typedef TagVal UnhandledJNI; 14 | 15 | // ================================================================================================= 16 | #pragma mark - 17 | 18 | void sFromJNI_Push_PPT(jobject iObject, 19 | const ChanW_PPT& iChanW); 20 | 21 | // ================================================================================================= 22 | #pragma mark - 23 | 24 | jobject sPull_PPT_AsJNI(const ChanR_PPT& iChanR); 25 | 26 | jobject sAsJNI(const Val_ZZ& iVal); 27 | 28 | // ================================================================================================= 29 | #pragma mark - sChannerR_PPT 30 | 31 | ZP sChannerR_PPT(jobject iJObject); 32 | 33 | } // namespace ZooLib 34 | 35 | #endif // __ZooLib_JNI_PullPush_JNI__ 36 | -------------------------------------------------------------------------------- /Platform/zoolib/OSX/TextCoder_Mac.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2003 Andrew Green and Learning in Motion, Inc. 2 | // MIT License. http://www.zoolib.org 3 | 4 | #ifndef __ZooLib_OSX_TextCoder_Mac_h__ 5 | #define __ZooLib_OSX_TextCoder_Mac_h__ 1 6 | #include "zconfig.h" 7 | #include "zoolib/ZCONFIG_API.h" 8 | #include "zoolib/ZCONFIG_SPI.h" 9 | 10 | #ifndef ZCONFIG_API_Avail__TextCoder_Mac 11 | #define ZCONFIG_API_Avail__TextCoder_Mac \ 12 | (ZCONFIG_SPI_Enabled(Carbon64) \ 13 | || ZCONFIG_SPI_Enabled(MacClassic)) 14 | #endif 15 | 16 | #ifndef ZCONFIG_API_Desired__TextCoder_Mac 17 | #define ZCONFIG_API_Desired__TextCoder_Mac 1 18 | #endif 19 | 20 | #include "zoolib/TextCoder.h" 21 | 22 | #if ZCONFIG_API_Enabled(TextCoder_Mac) 23 | 24 | #include ZMACINCLUDE3(CoreServices,CarbonCore,UnicodeConverter.h) 25 | 26 | namespace ZooLib { 27 | 28 | // ================================================================================================= 29 | #pragma mark - 30 | 31 | ZP sMake_TextDecoder_Mac(const std::string& iSourceName); 32 | 33 | ZP sMake_TextEncoder_Mac(const std::string& iDestName); 34 | 35 | } // namespace ZooLib 36 | 37 | #endif // ZCONFIG_API_Enabled(TextCoder_Mac) 38 | 39 | #endif // __ZooLib_OSX_TextCoder_Mac_h__ 40 | -------------------------------------------------------------------------------- /Platform/zoolib/OpenGL/Compat_OpenGL.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_OpenGL_Compat_OpenGL_h__ 4 | #define __ZooLib_OpenGL_Compat_OpenGL_h__ 1 5 | #include "zconfig.h" 6 | 7 | // ================================================================================================= 8 | #pragma mark - defined(ZProjectHeader_OpenGL) 9 | 10 | #if defined(ZProjectHeader_OpenGL) 11 | 12 | #include ZProjectHeader_OpenGL 13 | 14 | #endif // defined(ZProjectHeader_OpenGL) 15 | 16 | // ================================================================================================= 17 | #pragma mark - not defined(ZProjectHeader_OpenGL) 18 | 19 | #if not defined(ZProjectHeader_OpenGL) 20 | 21 | #include "zoolib/ZCONFIG_SPI.h" 22 | 23 | #if ZMACRO_IOS 24 | 25 | #define GLES_SILENCE_DEPRECATION 26 | #include 27 | 28 | #elif defined(__ANDROID__) 29 | 30 | #include 31 | 32 | #else 33 | 34 | #define GL_SILENCE_DEPRECATION 35 | #include 36 | 37 | #endif 38 | 39 | #endif // not defined(ZProjectHeader_OpenGL) 40 | 41 | #endif // __ZooLib_OpenGL_Compat_OpenGL_h__ 42 | -------------------------------------------------------------------------------- /Platform/zoolib/POSIX/Compat_fcntl.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_POSIX_Compat_fcntl_h__ 4 | #define __ZooLib_POSIX_Compat_fcntl_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zconfig.h" 8 | #include "zoolib/ZCONFIG_API.h" 9 | #include "zoolib/ZCONFIG_SPI.h" 10 | 11 | #if ZCONFIG_SPI_Enabled(POSIX) 12 | 13 | #include 14 | 15 | #if defined(__linux__) && not defined(__ANDROID__) 16 | __asm__(".symver fcntl,fcntl@GLIBC_2.4"); 17 | #endif 18 | 19 | #endif // ZCONFIG_SPI_Enabled(POSIX) 20 | 21 | #endif // __ZooLib_POSIX_Compat_fcntl_h__ 22 | -------------------------------------------------------------------------------- /Platform/zoolib/POSIX/Compat_sys_socket.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_POSIX_compat_sys_socket_h__ 4 | #define __ZooLib_POSIX_compat_sys_socket_h__ 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/ZCONFIG_SPI.h" 8 | 9 | #if ZCONFIG_SPI_Enabled(POSIX) 10 | 11 | #include // For getpeername, SOCK_MAXADDRLEN 12 | 13 | #if not defined(SOCK_MAXADDRLEN) 14 | #define SOCK_MAXADDRLEN (255) 15 | #endif 16 | 17 | #endif // ZCONFIG_SPI_Enabled(POSIX) 18 | 19 | #endif // __ZooLib_POSIX_compat_sys_socket_h__ 20 | -------------------------------------------------------------------------------- /Platform/zoolib/POSIX/FILE_Channer.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2003 Andrew Green and Learning in Motion, Inc. 2 | // MIT License. http://www.zoolib.org 3 | 4 | #ifndef __ZooLib_FILE_Channer_h__ 5 | #define __ZooLib_FILE_Channer_h__ 1 6 | #include "zconfig.h" 7 | 8 | #include "zoolib/Channer_Bin.h" 9 | 10 | #include 11 | 12 | namespace ZooLib { 13 | 14 | // ================================================================================================= 15 | #pragma mark - FILE backed by a Channer 16 | 17 | FILE* sFILE_R(ZP iChannerR); 18 | FILE* sFILE_RPos(ZP iChannerRPos); 19 | FILE* sFILE_W(ZP iChannerW); 20 | 21 | } // namespace ZooLib 22 | 23 | #endif // __ZooLib_FILE_Channer_h__ 24 | -------------------------------------------------------------------------------- /Platform/zoolib/POSIX/SocketWatcher.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_SocketWatcher_h__ 4 | #define __ZooLib_SocketWatcher_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Callable.h" 8 | #include "zoolib/Compat_NonCopyable.h" 9 | 10 | #include "zoolib/ZThread.h" 11 | 12 | #include 13 | 14 | namespace ZooLib { 15 | 16 | // ================================================================================================= 17 | #pragma mark - SocketWatcher 18 | 19 | class SocketWatcher 20 | : NonCopyable 21 | { 22 | public: 23 | SocketWatcher(); 24 | 25 | typedef std::pair> Pair_t; 26 | 27 | // ----- 28 | 29 | bool QInsert(const Pair_t& iPair); 30 | bool QErase(const Pair_t& iPair); 31 | 32 | bool QInsert(int iSocket, const ZP& iCallable); 33 | bool QErase(int iSocket, const ZP& iCallable); 34 | 35 | // ----- 36 | 37 | private: 38 | void pRun(); 39 | static void spRun(SocketWatcher* iSocketWatcher); 40 | 41 | ZMtx fMtx; 42 | ZCnd fCnd; 43 | 44 | bool fThreadRunning; 45 | typedef std::set Set_t; 46 | Set_t fSet; 47 | }; 48 | 49 | } // namespace ZooLib 50 | 51 | #endif // __ZooLib_SocketWatcher_h__ 52 | -------------------------------------------------------------------------------- /Platform/zoolib/POSIX/Util_POSIX.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/POSIX/Util_POSIX.h" 4 | 5 | #if ZCONFIG_SPI_Enabled(POSIX) 6 | 7 | #include // For getenv 8 | 9 | namespace ZooLib { 10 | namespace Util_POSIX { 11 | 12 | // ================================================================================================= 13 | #pragma mark - Util_POSIX 14 | 15 | ZQ sQGetEnv(const std::string& iName) 16 | { 17 | if (const char* theEnv = getenv(iName.c_str())) 18 | return theEnv; 19 | return null; 20 | } 21 | 22 | } // namespace Util_POSIX 23 | } // namespace ZooLib 24 | 25 | #endif // ZCONFIG_SPI_Enabled(POSIX) 26 | -------------------------------------------------------------------------------- /Platform/zoolib/POSIX/Util_POSIX.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Util_POSIX_h__ 4 | #define __ZooLib_Util_POSIX_h__ 1 5 | #include "zconfig.h" 6 | #include "zoolib/ZCONFIG_SPI.h" 7 | 8 | #if ZCONFIG_SPI_Enabled(POSIX) 9 | 10 | #include 11 | 12 | #include "zoolib/ZQ.h" 13 | 14 | namespace ZooLib { 15 | namespace Util_POSIX { 16 | 17 | // ================================================================================================= 18 | #pragma mark - Util_POSIX 19 | 20 | ZQ sQGetEnv(const std::string& iName); 21 | 22 | } // namespace Util_POSIX 23 | } // namespace ZooLib 24 | 25 | #endif // ZCONFIG_SPI_Enabled(POSIX) 26 | 27 | #endif // __ZooLib_Util_POSIX_h__ 28 | -------------------------------------------------------------------------------- /Platform/zoolib/Python/Compat_Python.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Python_Compat_Python_h__ 4 | #define __ZooLib_Python_Compat_Python_h__ 1 5 | #include "zconfig.h" 6 | 7 | // ================================================================================================= 8 | #pragma mark - defined(ZProjectHeader_Python) 9 | 10 | #if defined(ZProjectHeader_Python) 11 | 12 | #include ZProjectHeader_Python 13 | 14 | #endif // defined(ZProjectHeader_Python) 15 | 16 | // ================================================================================================= 17 | #pragma mark - not defined(ZProjectHeader_Python) 18 | 19 | #if not defined(ZProjectHeader_Python) 20 | 21 | extern "C" { 22 | #include 23 | } // extern "C" 24 | 25 | #endif // not defined(ZProjectHeader_Python) 26 | 27 | #endif // __ZooLib_Python_Compat_Python_h__ 28 | -------------------------------------------------------------------------------- /Platform/zoolib/Python/ZRef_PyObject.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/Python/ZRef_PyObject.h" 4 | 5 | namespace ZooLib { 6 | 7 | template <> void sRetain_T(PyObject*& ioObject) 8 | { 9 | if (ioObject) 10 | { 11 | PyGILState_STATE gstate = PyGILState_Ensure(); 12 | Py_INCREF(ioObject); 13 | PyGILState_Release(gstate); 14 | } 15 | } 16 | 17 | template <> void sRelease_T(PyObject* iObject) 18 | { 19 | if (iObject) 20 | { 21 | PyGILState_STATE gstate = PyGILState_Ensure(); 22 | Py_DECREF(iObject); 23 | PyGILState_Release(gstate); 24 | } 25 | } 26 | 27 | } // namespace ZooLib 28 | -------------------------------------------------------------------------------- /Platform/zoolib/Python/ZRef_PyObject.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Python_ZRef_PyObject_h__ 4 | #define __ZooLib_Python_ZRef_PyObject_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Python/Compat_Python.h" 8 | #include "zoolib/ZRef.h" 9 | 10 | #endif // __ZooLib_Python_ZRef_PyObject_h__ 11 | -------------------------------------------------------------------------------- /Platform/zoolib/UIKit/TVCell.mm: -------------------------------------------------------------------------------- 1 | #include "zoolib/UIKit/TVCell.h" 2 | #include 3 | 4 | // ================================================================================================= 5 | #pragma mark - 6 | 7 | namespace ZooLib { 8 | namespace UIKit { 9 | 10 | ZP sGetCell_Simple(UITableView* iView, NSString* iText, bool iReusable) 11 | { 12 | ZP theCell = sGetCell_T(iView, iReusable); 13 | [theCell textLabel].text = iText; 14 | return theCell; 15 | } 16 | 17 | } // namespace UIKit 18 | } // namespace ZooLib 19 | -------------------------------------------------------------------------------- /Platform/zoolib/UIKit/UIControl+Callable.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_UIKit_UIControl_Callable_h__ 4 | #define __ZooLib_UIKit_UIControl_Callable_h__ 1 5 | #include "zconfig.h" 6 | 7 | #import 8 | 9 | #include "zoolib/Callable.h" 10 | 11 | // ================================================================================================= 12 | #pragma mark - UIControl (Callable) 13 | 14 | @interface UIControl (Callable) 15 | 16 | - (void)addCallable:(ZooLib::ZP)callable 17 | forControlEvents:(UIControlEvents)controlEvents; 18 | 19 | @end // interface UIControl (Callable) 20 | 21 | // ================================================================================================= 22 | #pragma mark - ZooLib 23 | 24 | namespace ZooLib { 25 | 26 | void sAddCallable(UIControl* iUIControl, 27 | ZP iCallable, UIControlEvents iControlEvents); 28 | 29 | } // namespace ZooLib 30 | 31 | #endif // __ZooLib_UIKit_UIControl_Callable_h__ 32 | -------------------------------------------------------------------------------- /Platform/zoolib/UIKit/UITVController_WithSections+More.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_UITVC_WithSections_More__ 4 | #define __ZooLib_UITVC_WithSections_More__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/UIKit/UITVController_WithSections.h" 8 | 9 | #if ZCONFIG_SPI_Enabled(iPhone) 10 | 11 | // ================================================================================================= 12 | #pragma mark - ZooLib::UIKit 13 | 14 | namespace ZooLib { 15 | namespace UIKit { 16 | 17 | ZP
sMakeSection(ZP iBody, bool iHideWhenEmpty); 18 | ZP
sMakeSection(ZP iBody); 19 | 20 | ZP sMakeSingleRow(ZP iParent, 21 | ZP iCallable_RowSelected = null, 22 | ZP iCallable_ButtonTapped = null); 23 | 24 | ZP sMakeSingleRow(ZP iParent, 25 | id iDelegate, SEL iSEL); 26 | 27 | ZP sMakeUILabel(); 28 | 29 | } // namespace UIKit 30 | } // namespace ZooLib 31 | 32 | #endif // ZCONFIG_SPI_Enabled(iPhone) 33 | 34 | #endif // __ZooLib_UITVC_WithSections_More__ 35 | -------------------------------------------------------------------------------- /Platform/zoolib/UIKit/UIViewController+Subtitle.h: -------------------------------------------------------------------------------- 1 | #ifndef __UIViewController_Subtitle__ 2 | #define __UIViewController_Subtitle__ 1 3 | #include "zconfig.h" 4 | 5 | #import 6 | 7 | // ================================================================================================= 8 | #pragma mark - UIViewController+Subtitle 9 | 10 | @interface UIViewController (Subtitle) 11 | 12 | - (UILabel*)specialTitleUILabel; 13 | - (NSString*)specialTitle; 14 | - (void)setSpecialTitle:(NSString*)iTitle; 15 | 16 | - (UILabel*)subtitleUILabel; 17 | - (NSString*)subtitle; 18 | - (void)setSubtitle:(NSString*)iSubtitle; 19 | 20 | @end // interface UIViewController (Subtitle) 21 | 22 | #endif // __UIViewController_Subtitle__ 23 | -------------------------------------------------------------------------------- /Platform/zoolib/Win/Starter_WinMessageLoop.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Starter_WinMessageLoop_h__ 4 | #define __ZooLib_Starter_WinMessageLoop_h__ 1 5 | #include "zconfig.h" 6 | #include "zoolib/ZCONFIG_SPI.h" 7 | 8 | #include "zoolib/Starter_EventLoopBase.h" 9 | 10 | #if ZCONFIG_SPI_Enabled(Win) 11 | 12 | #include "zoolib/ZCompat_Win.h" 13 | 14 | namespace ZooLib { 15 | 16 | // ================================================================================================= 17 | #pragma mark - Starter_WinMessageLoop 18 | 19 | class Starter_WinMessageLoop 20 | : public Starter_EventLoopBase 21 | { 22 | public: 23 | Starter_WinMessageLoop(); 24 | virtual ~Starter_WinMessageLoop(); 25 | 26 | // From ZCounted via Starter_EventLoopBase 27 | virtual void Initialize(); 28 | virtual void Finalize(); 29 | 30 | // Our protocol 31 | void Disable(); 32 | 33 | protected: 34 | // From Starter_EventLoopBase 35 | virtual bool pTrigger(); 36 | 37 | private: 38 | ZQ pWindowProc(HWND iHWND, UINT iMessage, WPARAM iWPARAM, LPARAM iLPARAM); 39 | 40 | HWND fHWND; 41 | }; 42 | 43 | } // namespace ZooLib 44 | 45 | #endif // ZCONFIG_SPI_Enabled(Win) 46 | 47 | #endif // __ZooLib_Starter_WinMessageLoop_h__ 48 | -------------------------------------------------------------------------------- /Platform/zoolib/Win/ZCompat_GdiPlus.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZCompat_GdiPlus_h__ 4 | #define __ZCompat_GdiPlus_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/ZCompat_Win.h" 8 | 9 | // ================================================================================================= 10 | 11 | #if ZCONFIG_SPI_Enabled(Win) 12 | 13 | #include "zoolib/ZCompat_algorithm.h" 14 | 15 | namespace Gdiplus { 16 | 17 | using std::min; 18 | using std::max; 19 | 20 | } // namespace Gdiplus 21 | 22 | #include 23 | 24 | #endif // ZCONFIG_SPI_Enabled(Win) 25 | 26 | #endif // __ZCompat_GdiPlus_h__ 27 | -------------------------------------------------------------------------------- /Platform/zoolib/Win/ZCompat_WinSock.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZCompat_WinSock_h__ 4 | #define __ZCompat_WinSock_h__ 1 5 | 6 | // ----- 7 | // Maddening crud to be able to reference winsock2 stuff 8 | #ifndef NOMINMAX 9 | # define NOMINMAX 10 | #endif 11 | #include 12 | #include "zoolib/ZCompat_Win.h" 13 | #include 14 | // ----- 15 | 16 | #endif // __ZCompat_WinSock_h__ 17 | -------------------------------------------------------------------------------- /Platform/zoolib/Win/ZRef_WinHANDLE.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZRef_WinHANDLE_h__ 4 | #define __ZRef_WinHANDLE_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/ZRef.h" 8 | 9 | #endif // __ZRef_WinHANDLE_h__ 10 | -------------------------------------------------------------------------------- /Platform/zoolib/Win/ZStrimW_WinDebug.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/ZStrimW_WinDebug.h" 4 | 5 | #if ZCONFIG_SPI_Enabled(Win) 6 | 7 | #include "zoolib/ZCompat_Win.h" 8 | 9 | namespace ZooLib { 10 | 11 | // ================================================================================================= 12 | #pragma mark - ZStrimW_WinDebug 13 | 14 | void ZStrimW_WinDebug::Imp_WriteUTF8(const UTF8* iSource, size_t iCountCU, size_t* oCountCU) 15 | { 16 | std::string theString(iSource, iCountCU); 17 | ::OutputDebugStringA(theString.c_str()); 18 | if (oCountCU) 19 | *oCountCU = iCountCU; 20 | } 21 | 22 | } // namespace ZooLib 23 | 24 | #endif // ZCONFIG_SPI_Enabled(Win) 25 | -------------------------------------------------------------------------------- /Platform/zoolib/Win/ZStrimW_WinDebug.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZStrimW_WinDebug_h__ 4 | #define __ZStrimW_WinDebug_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/ZCONFIG_SPI.h" 8 | #include "zoolib/ZStrim.h" 9 | 10 | #if ZCONFIG_SPI_Enabled(Win) 11 | 12 | namespace ZooLib { 13 | 14 | // ================================================================================================= 15 | #pragma mark - ZStrimW_WinDebug 16 | 17 | class ZStrimW_WinDebug : public ZStrimW_NativeUTF8 18 | { 19 | public: 20 | virtual void Imp_WriteUTF8(const UTF8* iSource, size_t iCountCU, size_t* oCountCU); 21 | }; 22 | 23 | } // namespace ZooLib 24 | 25 | #endif // ZCONFIG_SPI_Enabled(Win) 26 | 27 | #endif // __ZStrimW_WinDebug_h__ 28 | -------------------------------------------------------------------------------- /Platform/zoolib/Win/ZUtil_Win.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2000 Andrew Green and Learning in Motion, Inc. 2 | // MIT License. http://www.zoolib.org 3 | 4 | #ifndef __ZUtil_Win_h__ 5 | #define __ZUtil_Win_h__ 6 | #include "zconfig.h" 7 | 8 | #include "zoolib/ZCONFIG_SPI.h" 9 | #include "zoolib/ZCompat_Win.h" 10 | #include "zoolib/ZQ.h" 11 | 12 | #if ZCONFIG_SPI_Enabled(Win) 13 | 14 | namespace ZooLib { 15 | namespace ZUtil_Win { 16 | 17 | bool sIsWinNT(); 18 | bool sIsWin95OSR2(); 19 | bool sIsVistaOrLater(); 20 | 21 | bool sIsUserAdmin(); 22 | 23 | bool sUseWAPI(); 24 | 25 | void sDisallowWAPI(); 26 | 27 | HINSTANCE sGetModuleHandle(); 28 | 29 | ZQ<__uint64> sQGetVersion_File(const WCHAR* iPath); 30 | 31 | } // namespace ZUtil_Win 32 | } // namespace ZooLib 33 | 34 | #endif // ZCONFIG_SPI_Enabled(Win) 35 | #endif // __ZUtil_Win_h__ 36 | -------------------------------------------------------------------------------- /Platform/zoolib/Win/ZUtil_WinSock.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZUtil_WinSock_h__ 4 | #define __ZUtil_WinSock_h__ 1 5 | #include "zconfig.h" 6 | #include "zoolib/ZCONFIG_SPI.h" 7 | 8 | #if ZCONFIG_SPI_Enabled(Win) 9 | 10 | #include "zoolib/size_t.h" // For size_t 11 | 12 | #include "zoolib/ZCompat_WinSock.h" 13 | 14 | namespace ZooLib { 15 | namespace ZUtil_WinSock { 16 | 17 | // ================================================================================================= 18 | #pragma mark - ZUtil_WinSock 19 | 20 | bool sWaitReadable(SOCKET iSOCKET, double iTimeout); 21 | void sWaitWriteable(SOCKET iSOCKET); 22 | size_t sCountReadable(SOCKET iSOCKET); 23 | 24 | } // namespace ZUtil_WinSock 25 | } // namespace ZooLib 26 | 27 | #endif // ZCONFIG_SPI_Enabled(Win) 28 | 29 | #endif // __ZUtil_WinSock_h__ 30 | -------------------------------------------------------------------------------- /Platform/zoolib/Win/ZWinRegistry_Yad.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/ZWinRegistry_Yad.h" 4 | 5 | #if ZCONFIG_SPI_Enabled(Win) 6 | 7 | #include "zoolib/ZUnicode.h" 8 | #include "zoolib/ZYad_Any.h" 9 | #include "zoolib/ZYad_Val_T.h" 10 | 11 | namespace ZooLib { 12 | namespace ZWinRegistry { 13 | 14 | // ================================================================================================= 15 | #pragma mark - ZWinRegistry 16 | 17 | ZRef sYadR(const Val& iVal) 18 | { 19 | if (const KeyRef* theVal = iVal.PGet()) 20 | return sYadR(*theVal); 21 | 22 | if (const string16* theVal = iVal.PGet()) 23 | return sYadR(ZUnicode::sAsUTF8(*theVal)); 24 | 25 | return sYadR(iVal.AsAny()); 26 | } 27 | 28 | ZRef sYadR(const KeyRef& iKeyRef) 29 | { return new ZYadMapAtRPos_Val_T(iKeyRef); } 30 | 31 | } // namespace ZWinRegistry 32 | } // namespace ZooLib 33 | 34 | #endif // ZCONFIG_SPI_Enabled(Win) 35 | -------------------------------------------------------------------------------- /Platform/zoolib/Win/ZWinRegistry_Yad.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZWinRegistry_Yad_h__ 4 | #define __ZWinRegistry_Yad_h__ 1 5 | #include "zconfig.h" 6 | #include "zoolib/ZCONFIG_SPI.h" 7 | 8 | #if ZCONFIG_SPI_Enabled(Win) 9 | 10 | #include "zoolib/ZCompat_Win.h" 11 | #include "zoolib/ZWinRegistry_Val.h" 12 | #include "zoolib/ZYad.h" 13 | 14 | namespace ZooLib { 15 | namespace ZWinRegistry { 16 | 17 | // ================================================================================================= 18 | #pragma mark - ZWinRegistry 19 | 20 | ZRef sYadR(const Val& iVal); 21 | 22 | ZRef sYadR(const KeyRef& iKeyRef); 23 | 24 | } // namespace ZWinRegistry 25 | } // namespace ZooLib 26 | 27 | #endif // ZCONFIG_SPI_Enabled(Win) 28 | 29 | #endif // __ZWinRegistry_Yad_h__ 30 | -------------------------------------------------------------------------------- /Platform/zoolib/Win/ZWinWND_Dialog.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZWinWND_Dialog_h__ 4 | #define __ZWinWND_Dialog_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/ZWinWND.h" 8 | 9 | #if ZCONFIG_SPI_Enabled(Win) 10 | 11 | namespace ZooLib { 12 | namespace ZWinWND { 13 | 14 | // ================================================================================================= 15 | #pragma mark - ZWinWND, Callable <--> Dialog 16 | 17 | typedef Callable Callable_Dialog; 18 | 19 | HWND sCreateDialog(LPCWSTR lpTemplate, LCID iLCID, HWND hWndParent, ZRef iCallable); 20 | HWND sCreateDialog(LPCWSTR lpTemplate, HWND hWndParent, ZRef iCallable); 21 | 22 | } // namespace ZWinWND 23 | } // namespace ZooLib 24 | 25 | #endif // ZCONFIG_SPI_Enabled(Win) 26 | 27 | #endif // __ZWinWND_h__ 28 | -------------------------------------------------------------------------------- /Platform/zoolib/X11/Compat_Xlib.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2008 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_X11_Compat_XLib_h__ 4 | #define __ZooLib_X11_Compat_XLib_h__ 5 | #include "zconfig.h" 6 | #include "zoolib/ZCONFIG_SPI.h" 7 | 8 | #if ZCONFIG_SPI_Enabled(X11) 9 | // Unfortunately, QuickDraw also defines Cursor. For the moment this lets us compile 10 | // code that sees both QuickDraw and X11 headers. And don't get me started on BOOL ... 11 | #define Cursor ZooLib_X11_Cursor 12 | #include 13 | #undef Cursor 14 | #endif 15 | 16 | #endif // __ZooLib_X11_Compat_XLib_h__ 17 | -------------------------------------------------------------------------------- /Platform/zoolib/Zip/Archive_Zip_More.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021 Andrew Green and Mark/Space. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/Zip/Archive_Zip_More.h" 4 | 5 | #include "zoolib/Util_Channer.h" // For sChannerRPos_XX 6 | 7 | #include "zoolib/POSIX/FILE_Channer.h" // For sFILE_RPos 8 | 9 | namespace ZooLib { 10 | 11 | // ================================================================================================= 12 | #pragma mark - 13 | 14 | ZP sArchive_Zip(ZP iChannerRPos) 15 | { return sArchive_Zip(sFILE_RPos(iChannerRPos), false); } 16 | 17 | ZP sArchive_Zip(ZP iChannerR) 18 | { return sArchive_Zip(sChannerRPos_XX(iChannerR)); } 19 | 20 | } // namespace ZooLib 21 | -------------------------------------------------------------------------------- /Platform/zoolib/Zip/Archive_Zip_More.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021 Andrew Green and Mark/Space, Inc. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Zip_Archive_Zip_More_h__ 4 | #define __ZooLib_Zip_Archive_Zip_More_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Zip/Archive_Zip.h" 8 | 9 | namespace ZooLib { 10 | 11 | // ================================================================================================= 12 | #pragma mark - 13 | 14 | ZP sArchive_Zip(ZP iChannerRPos); 15 | 16 | ZP sArchive_Zip(ZP iChannerR); 17 | 18 | } // namespace ZooLib 19 | 20 | #endif // __ZooLib_Zip_Archive_Zip_More_h__ 21 | -------------------------------------------------------------------------------- /Portable/zoolib/Archive.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-21 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/Archive.h" 4 | 5 | namespace ZooLib { 6 | 7 | // ================================================================================================= 8 | #pragma mark - Archive 9 | 10 | ZQ Archive::QCRC(size_t iIndex) 11 | { return null; } 12 | 13 | ZP Archive::OpenR(size_t iIndex) 14 | { return this->OpenRSize(iIndex); } 15 | 16 | ZP Archive::OpenRSize(size_t iIndex) 17 | { return this->OpenRPos(iIndex); } 18 | 19 | ZP Archive::OpenRPos(size_t iIndex) 20 | { return null; } 21 | 22 | } // namespace ZooLib 23 | -------------------------------------------------------------------------------- /Portable/zoolib/Archive.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-21 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Archive_h__ 4 | #define __ZooLib_Archive_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Channer_Bin.h" 8 | #include "zoolib/UnicodeString8.h" 9 | #include "zoolib/ZQ.h" 10 | 11 | #include 12 | 13 | namespace ZooLib { 14 | 15 | // ================================================================================================= 16 | #pragma mark - Archive 17 | 18 | class Archive 19 | : public Counted 20 | { 21 | public: 22 | // Our protocol 23 | virtual size_t Count() = 0; 24 | virtual bool IsFile(size_t iIndex) = 0; 25 | virtual string8 Name(size_t iIndex) = 0; 26 | virtual uint64 Size(size_t iIndex) = 0; 27 | virtual ZQ QCRC(size_t iIndex); 28 | 29 | virtual ZP OpenR(size_t iIndex); 30 | virtual ZP OpenRSize(size_t iIndex); 31 | virtual ZP OpenRPos(size_t iIndex); 32 | }; 33 | 34 | } // namespace ZooLib 35 | 36 | #endif // __ZooLib_Archive_h__ 37 | -------------------------------------------------------------------------------- /Portable/zoolib/Callable_Bookend.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/Callable_Bookend.h" 4 | #include "zoolib/Callable_Bind.h" 5 | #include "zoolib/Callable_Function.h" 6 | 7 | namespace ZooLib { 8 | 9 | // ================================================================================================= 10 | #pragma mark - 11 | 12 | static void spNester(const ZP& iBookend0, const ZP& iBookend1, 13 | const ZP& iCallable_void) 14 | { sCall(iBookend0, sBindR(iBookend1, iCallable_void)); } 15 | 16 | ZP sNest(ZP iBookend0, ZP iBookend1) 17 | { 18 | if (not iBookend0) 19 | return iBookend1; 20 | 21 | if (not iBookend1) 22 | return iBookend0; 23 | 24 | return sBindL(iBookend0, iBookend1, sCallable(spNester)); 25 | } 26 | 27 | } // namespace ZooLib 28 | -------------------------------------------------------------------------------- /Portable/zoolib/Callable_Bookend.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Callable_Bookend_h__ 4 | #define __ZooLib_Callable_Bookend_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Callable.h" 8 | 9 | namespace ZooLib { 10 | 11 | // ================================================================================================= 12 | #pragma mark - 13 | 14 | typedef Callable&)> Callable_Bookend; 15 | 16 | ZP sNest(ZP iBookend0, ZP iBookend1); 17 | 18 | } // namespace ZooLib 19 | 20 | #endif // __ZooLib_Callable_Bool_h__ 21 | -------------------------------------------------------------------------------- /Portable/zoolib/Callable_Const.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Callable_Const_h__ 4 | #define __ZooLib_Callable_Const_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Callable.h" 8 | 9 | namespace ZooLib { 10 | 11 | // ================================================================================================= 12 | #pragma mark - Callable_Const 13 | 14 | template 15 | class Callable_Const 16 | : public Callable 17 | { 18 | public: 19 | Callable_Const(typename CallableUtil::VT::Param iR) 20 | : fR(iR) 21 | {} 22 | 23 | // From Callable 24 | virtual QRet QCall() 25 | { return fR; } 26 | 27 | private: 28 | typename CallableUtil::VT::Field fR; 29 | }; 30 | 31 | // ================================================================================================= 32 | #pragma mark - sCallable_Const 33 | 34 | template 35 | ZP> sCallable_Const(R iR) 36 | { return new Callable_Const(iR); } 37 | 38 | } // namespace ZooLib 39 | 40 | #endif // __ZooLib_Callable_Const_h__ 41 | -------------------------------------------------------------------------------- /Portable/zoolib/Cancellable.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/Cancellable.h" 4 | 5 | namespace ZooLib { 6 | 7 | // ================================================================================================= 8 | #pragma mark - Cancellable_Callable 9 | 10 | class Cancellable_Callable 11 | : public Cancellable 12 | { 13 | public: 14 | Cancellable_Callable(const ZP& iCallable) 15 | : fCallable(iCallable) 16 | {} 17 | 18 | virtual void Cancel() 19 | { sCall(fCallable); } 20 | 21 | const ZP fCallable; 22 | }; 23 | 24 | // ================================================================================================= 25 | #pragma mark - sCancellable 26 | 27 | ZP sCancellable(const ZP& iCallable) 28 | { 29 | if (iCallable) 30 | return new Cancellable_Callable(iCallable); 31 | return null; 32 | } 33 | 34 | } // namespace ZooLib 35 | -------------------------------------------------------------------------------- /Portable/zoolib/Cancellable.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Cancellable_h__ 4 | #define __ZooLib_Cancellable_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Callable.h" 8 | 9 | namespace ZooLib { 10 | 11 | // ================================================================================================= 12 | #pragma mark - Cancellable 13 | 14 | class Cancellable 15 | : public Counted 16 | { 17 | public: 18 | virtual void Cancel() = 0; 19 | }; 20 | 21 | // ================================================================================================= 22 | #pragma mark - sCancellable 23 | 24 | ZP sCancellable(const ZP& iCallable); 25 | 26 | } // namespace ZooLib 27 | 28 | #endif // __ZooLib_Cancellable_h__ 29 | -------------------------------------------------------------------------------- /Portable/zoolib/ChanRU_UTF_Std.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_ChanRU_UTF_Std_h__ 4 | #define __ZooLib_ChanRU_UTF_Std_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Chan_UTF_CRLF.h" 8 | 9 | #include 10 | 11 | namespace ZooLib { 12 | 13 | // ================================================================================================= 14 | #pragma mark - ChanRU_UTF_Std 15 | 16 | class ChanRU_UTF_Std 17 | : public virtual ChanRU 18 | { 19 | public: 20 | ChanRU_UTF_Std(const ChanR_UTF& iChanR); 21 | 22 | // From ChanR_UTF 23 | virtual size_t Read(UTF32* oDest, size_t iCount); 24 | 25 | // From ChanU_UTF 26 | virtual size_t Unread(const UTF32* iSource, size_t iCount); 27 | 28 | // Our protocol 29 | int GetPos(); 30 | int GetLine(); 31 | int GetColumn(); 32 | 33 | private: 34 | ChanR_UTF_CRLFRemove fChanR_CRLFRemove; 35 | std::vector fStack; 36 | size_t fPos; 37 | size_t fLine; 38 | size_t fColumn; 39 | }; 40 | 41 | } // namespace ZooLib 42 | 43 | #endif // __ZooLib_ChanRU_UTF_Std_h__ 44 | -------------------------------------------------------------------------------- /Portable/zoolib/ChanR_Bin_HexStrim.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_ChanR_Bin_HexStrim_h__ 4 | #define __ZooLib_ChanR_Bin_HexStrim_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Chan_Bin.h" 8 | #include "zoolib/Chan_UTF.h" 9 | 10 | namespace ZooLib { 11 | 12 | // ================================================================================================= 13 | #pragma mark - ChanR_Bin_HexStrim 14 | 15 | /// A read filter stream that reads byte values from a strim, where they're encoded as hex digits. 16 | 17 | class ChanR_Bin_HexStrim 18 | : public virtual ChanR_Bin 19 | { 20 | public: 21 | ChanR_Bin_HexStrim(const ChanRU_UTF& iChanRU); 22 | ChanR_Bin_HexStrim(bool iAllowUnderscore, const ChanRU_UTF& iChanRU); 23 | ~ChanR_Bin_HexStrim(); 24 | 25 | // From ChanAspect_Read 26 | virtual size_t Read(byte* oDest, size_t iCount); 27 | 28 | private: 29 | const ChanRU_UTF& fChanRU; 30 | bool fAllowUnderscore; 31 | }; 32 | 33 | } // namespace ZooLib 34 | 35 | #endif // __ZooLib_ChanR_Bin_HexStrim_h__ 36 | -------------------------------------------------------------------------------- /Portable/zoolib/ChanR_Bin_More.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_ChanR_Bin_More_h__ 4 | #define __ZooLib_ChanR_Bin_More_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/ChanR_Bin.h" 8 | 9 | #include 10 | 11 | namespace ZooLib { 12 | 13 | // ================================================================================================= 14 | #pragma mark - 15 | 16 | ZQ sQReadString(const ChanR_Bin& iChanR, size_t iCount); 17 | 18 | std::string sReadString(const ChanR_Bin& iChanR, size_t iCount); 19 | 20 | std::string sReadAllString(const ChanR_Bin& iChanR); 21 | 22 | bool sRead_String(const ChanR_Bin& iChanR, const std::string& iPattern); 23 | 24 | bool sTryRead_String(const ChanRU_Bin& iChanRU, const std::string& iPattern); 25 | 26 | ZQ sQReadCount(const ChanR_Bin& r); 27 | 28 | uint64 sReadCount(const ChanR_Bin& r); 29 | 30 | std::string sReadCountPrefixedString(const ChanR_Bin& iChanR); 31 | 32 | } // namespace ZooLib 33 | 34 | #endif // __ZooLib_ChanW_Bin_More_h__ 35 | -------------------------------------------------------------------------------- /Portable/zoolib/ChanR_XX_AbortOnSlowRead.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 Andrew Green 2 | // http://www.zoolib.org 3 | 4 | #ifndef __ZooLib_ChanR_XX_AbortOnSlowRead_h__ 5 | #define __ZooLib_ChanR_XX_AbortOnSlowRead_h__ 1 6 | #include "zconfig.h" 7 | 8 | #include "zoolib/Chan.h" 9 | 10 | namespace ZooLib { 11 | 12 | // ================================================================================================= 13 | #pragma mark - ChanR_XX_AbortOnSlowRead 14 | 15 | template 16 | class ChanR_XX_AbortOnSlowRead 17 | : public virtual ChanR 18 | { 19 | public: 20 | using ChanForRead = DeriveFrom< 21 | ChanAspect_Abort, 22 | ChanAspect_Read, 23 | ChanAspect_WaitReadable>; 24 | 25 | ChanR_XX_AbortOnSlowRead(const ChanForRead& iChan, double iTimeout) 26 | : fChan(iChan) 27 | , fTimeout(iTimeout) 28 | {} 29 | 30 | // From ChanAspect_Read 31 | virtual size_t Read(EE* oDest, size_t iCount) 32 | { 33 | if (not sWaitReadable(fChan, fTimeout)) 34 | { 35 | sAbort(fChan); 36 | sThrow_ExhaustedR(); 37 | } 38 | 39 | return sRead(fChan, oDest, iCount); 40 | } 41 | 42 | const ChanForRead& fChan; 43 | const double fTimeout; 44 | }; 45 | 46 | } // namespace ZooLib 47 | 48 | #endif // __ZooLib_ChanR_XX_AbortOnSlowRead_h__ 49 | -------------------------------------------------------------------------------- /Portable/zoolib/ChanR_XX_SkipAllOnDestroy.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2004 Andrew Green and Learning in Motion, Inc. 2 | // MIT License. http://www.zoolib.org 3 | 4 | #ifndef __ZooLib_ChanR_XX_SkipAllOnDestroy_h__ 5 | #define __ZooLib_ChanR_XX_SkipAllOnDestroy_h__ 1 6 | #include "zconfig.h" 7 | 8 | #include "zoolib/ChanFilter.h" 9 | #include "zoolib/ChanR.h" 10 | 11 | namespace ZooLib { 12 | 13 | // ================================================================================================= 14 | #pragma mark - ChanR_XX_SkipAllOnDestroy 15 | 16 | /// A read filter stream that when destroyed invokes SkipAll on its real stream. 17 | 18 | template 19 | class ChanR_XX_SkipAllOnDestroy 20 | : public ChanFilter 21 | { 22 | typedef ChanFilter inherited; 23 | public: 24 | ChanR_XX_SkipAllOnDestroy(const Chan_p& iChan) 25 | : inherited(iChan) 26 | {} 27 | 28 | ~ChanR_XX_SkipAllOnDestroy() 29 | { sSkipAll(inherited::pGetChan()); } 30 | }; 31 | 32 | } // namespace ZooLib 33 | 34 | #endif // __ZooLib_ChanR_XX_SkipAllOnDestroy_h__ 35 | -------------------------------------------------------------------------------- /Portable/zoolib/ChanU_UTF.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_ChanU_UTF_h__ 4 | #define __ZooLib_ChanU_UTF_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Chan_UTF.h" 8 | #include "zoolib/ChanU.h" 9 | #include "zoolib/Unicode.h" 10 | 11 | #include 12 | 13 | namespace ZooLib { 14 | 15 | // ================================================================================================= 16 | #pragma mark - 17 | 18 | template 19 | bool sUnread(const ChanU_UTF& iChanU, const std::basic_string& iString) 20 | { 21 | for (typename std::basic_string::const_iterator iterBegin = iString.cbegin(), 22 | iterEnd = iString.cend(), 23 | iter = iterEnd; 24 | /*no test*/; /*no inc*/) 25 | { 26 | UTF32 theCP; 27 | if (not Unicode::sDecRead(iterBegin, iter, iterEnd, theCP)) 28 | return true; 29 | if (not sUnread(iChanU, theCP)) 30 | return false; 31 | } 32 | } 33 | 34 | } // namespace ZooLib 35 | 36 | #endif // __ZooLib_ChanU_UTF_h__ 37 | -------------------------------------------------------------------------------- /Portable/zoolib/ChanW_UTF_InsertSeparator.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ChanW_UTF_InsertSeparator_h__ 4 | #define __ChanW_UTF_InsertSeparator_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/ChanW_UTF.h" 8 | 9 | #include 10 | 11 | namespace ZooLib { 12 | 13 | // ================================================================================================= 14 | #pragma mark - ChanW_UTF_InsertSeparator 15 | 16 | class ChanW_UTF_InsertSeparator 17 | : public virtual ChanW_UTF_Native32 18 | { 19 | public: 20 | typedef std::map Spacings; 21 | 22 | ChanW_UTF_InsertSeparator(size_t iSpacing, const string8& iSeparator, const ChanW_UTF& iChanW); 23 | 24 | ChanW_UTF_InsertSeparator(const Spacings& iSpacings, const ChanW_UTF& iChanW); 25 | 26 | // From ChanW via ChanW_UTF_Native32 27 | virtual size_t Write(const UTF32* iSource, size_t iCountCU); 28 | 29 | private: 30 | const ChanW_UTF& fChanW; 31 | Spacings fSpacings; 32 | uint64 fCount; 33 | }; 34 | 35 | } // namespace ZooLib 36 | 37 | #endif // __ChanW_UTF_InsertSeparator_h__ 38 | -------------------------------------------------------------------------------- /Portable/zoolib/ChanW_XX_Fragmented.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2007 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_ChanW_XX_Fragmented_h__ 4 | #define __ZooLib_ChanW_XX_Fragmented_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/ChanFilter.h" 8 | #include "zoolib/ChanW.h" 9 | #include "zoolib/Compat_algorithm.h" // For min 10 | 11 | namespace ZooLib { 12 | 13 | // ================================================================================================= 14 | #pragma mark - ChanW_XX_Fragmented 15 | 16 | /// A write filter stream that passes on data in chunks no larger than a limit. 17 | 18 | template 19 | class ChanW_XX_Fragmented 20 | : public ChanFilter 21 | { 22 | typedef ChanFilter inherited; 23 | typedef typename Chan_p::Element_t EE; 24 | public: 25 | ChanW_XX_Fragmented(const Chan_p& iChan, size_t iFragmentCount) 26 | : inherited(iChan) 27 | , fFragmentCount(iFragmentCount) 28 | {} 29 | 30 | virtual size_t Write(const EE* iSource, size_t iCount) 31 | { return sWrite(inherited::pGetChan(), iSource, min(fFragmentCount, iCount)); } 32 | 33 | protected: 34 | const size_t fFragmentCount; 35 | }; 36 | 37 | } // namespace ZooLib 38 | 39 | #endif // __ZooLib_ChanW_XX_Fragmented_h__ 40 | -------------------------------------------------------------------------------- /Portable/zoolib/Chan_XX_RateCapped.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2006 Andrew Green and Learning in Motion, Inc. 2 | // MIT License. http://www.zoolib.org 3 | 4 | #include "zoolib/Chan_XX_RateCapped.h" 5 | 6 | #include "zoolib/Time.h" 7 | #include "zoolib/ZThread.h" 8 | 9 | namespace ZooLib { 10 | 11 | // ================================================================================================= 12 | #pragma mark - RateLimiter 13 | 14 | RateLimiter::RateLimiter(double iRate, size_t iQuantum) 15 | : fRate(iRate), 16 | fQuantum(iQuantum), 17 | fLastTime(0) 18 | {} 19 | 20 | size_t RateLimiter::GetCount(size_t iLastCount, size_t iCount) 21 | { 22 | double now = Time::sSystem(); 23 | if (now <= fLastTime) 24 | return 0; 25 | 26 | const double lastConsumed = fRate * (now - fLastTime); 27 | if (iLastCount > lastConsumed) 28 | { 29 | const double remaining = double(iLastCount) - lastConsumed; 30 | ZThread::sSleep(remaining / fRate); 31 | } 32 | 33 | fLastTime = Time::sSystem(); 34 | return std::min(iCount, fQuantum); 35 | } 36 | 37 | } // namespace ZooLib 38 | -------------------------------------------------------------------------------- /Portable/zoolib/Channer_Bin.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Channer_Bin_h__ 4 | #define __ZooLib_Channer_Bin_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Chan_Bin.h" 8 | #include "zoolib/Channer.h" 9 | 10 | namespace ZooLib { 11 | 12 | // ================================================================================================= 13 | #pragma mark - 14 | 15 | typedef ChannerR ChannerR_Bin; 16 | typedef ChannerU ChannerU_Bin; 17 | typedef ChannerW ChannerW_Bin; 18 | 19 | typedef ChannerRU ChannerRU_Bin; 20 | 21 | typedef ChannerRSize ChannerRSize_Bin; 22 | 23 | typedef ChannerRPos ChannerRPos_Bin; 24 | typedef ChannerWPos ChannerWPos_Bin; 25 | typedef ChannerRWPos ChannerRWPos_Bin; 26 | 27 | typedef ChannerRW ChannerRW_Bin; 28 | 29 | typedef ChannerRAbort ChannerRAbort_Bin; 30 | typedef ChannerWAbort ChannerWAbort_Bin; 31 | typedef ChannerRWAbort ChannerRWAbort_Bin; 32 | 33 | typedef ChannerRCon ChannerRCon_Bin; 34 | typedef ChannerWCon ChannerWCon_Bin; 35 | typedef ChannerRWCon ChannerRWCon_Bin; 36 | 37 | } // namespace ZooLib 38 | 39 | #endif // __ZooLib_Channer_Bin_h__ 40 | -------------------------------------------------------------------------------- /Portable/zoolib/Channer_UTF.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Channer_UTF_h__ 4 | #define __ZooLib_Channer_UTF_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Chan_UTF.h" 8 | #include "zoolib/Channer.h" 9 | 10 | namespace ZooLib { 11 | 12 | // ================================================================================================= 13 | #pragma mark - 14 | 15 | typedef ChannerR ChannerR_UTF; 16 | typedef ChannerU ChannerU_UTF; 17 | typedef ChannerW ChannerW_UTF; 18 | 19 | typedef ChannerRU ChannerRU_UTF; 20 | 21 | } // namespace ZooLib 22 | 23 | #endif // __ZooLib_Channer_UTF_h__ 24 | -------------------------------------------------------------------------------- /Portable/zoolib/Coerce_Any.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Coerce_Any_h__ 4 | #define __ZooLib_Coerce_Any_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/AnyBase.h" 8 | #include "zoolib/StdInt.h" // For int64 9 | 10 | // ================================================================================================= 11 | #pragma mark - Any coercion 12 | 13 | namespace ZooLib { 14 | 15 | ZQ sQCoerceBool(const AnyBase& iAny); 16 | bool sQCoerceBool(const AnyBase& iAny, bool& oVal); 17 | bool sCoerceBool(const AnyBase& iAny); 18 | 19 | ZQ sQCoerceInt(const AnyBase& iAny); 20 | bool sQCoerceInt(const AnyBase& iAny, int64& oVal); 21 | int64 sCoerceInt(const AnyBase& iAny); 22 | 23 | ZQ sQCoerceRat(const AnyBase& iAny); 24 | bool sQCoerceRat(const AnyBase& iAny, double& oVal); 25 | double sCoerceRat(const AnyBase& iAny); 26 | 27 | ZQ sQCoerceNumberAsInt(const AnyBase& iAny); 28 | ZQ sQCoerceNumberAsRat(const AnyBase& iAny); 29 | 30 | } // namespace ZooLib 31 | 32 | #endif // __ZooLib_Coerce_Any_h__ 33 | -------------------------------------------------------------------------------- /Portable/zoolib/Compare_Rational.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Compare_Rational_h__ 4 | #define __ZooLib_Compare_Rational_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Compare_T.h" 8 | 9 | namespace ZooLib { 10 | 11 | template <> 12 | int sCompare_T(const float& iL, const float& iR); 13 | 14 | template <> 15 | int sCompare_T(const double& iL, const double& iR); 16 | 17 | template <> 18 | int sCompare_T(const long double& iL, const long double& iR); 19 | 20 | } // namespace ZooLib 21 | 22 | #endif // __ZooLib_Compare_Rational_h__ 23 | -------------------------------------------------------------------------------- /Portable/zoolib/Compare_string.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/Compare_string.h" 4 | 5 | #include "zoolib/Memory.h" // For sMemCompare 6 | #include "zoolib/size_t.h" // For size_t 7 | 8 | namespace ZooLib { 9 | 10 | bool FastComparator_String::operator()(const std::string& iLeft, const std::string& iRight) const 11 | { 12 | if (const size_t lengthL = iLeft.length()) 13 | { 14 | if (const size_t lengthR = iRight.length()) 15 | { 16 | if (lengthL < lengthR) 17 | return true; 18 | else if (lengthR < lengthL) 19 | return false; 20 | else 21 | return sMemCompare(iLeft.data(), iRight.data(), lengthL) < 0; 22 | } 23 | else 24 | { 25 | return false; 26 | } 27 | } 28 | else 29 | { 30 | return not iRight.empty(); 31 | } 32 | } 33 | 34 | } // namespace ZooLib 35 | -------------------------------------------------------------------------------- /Portable/zoolib/Compare_string.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Compare_string_h__ 4 | #define __ZooLib_Compare_string_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Compare_T.h" 8 | 9 | #include 10 | 11 | namespace ZooLib { 12 | 13 | template <> 14 | inline int sCompare_T(const std::string& iL, const std::string& iR) 15 | { return iL.compare(iR); } 16 | 17 | // ================================================================================================= 18 | #pragma mark - FastComparator_String 19 | 20 | struct FastComparator_String : public std::binary_function 21 | { 22 | bool operator()(const std::string& iLeft, const std::string& iRight) const; 23 | }; 24 | 25 | } // namespace ZooLib 26 | 27 | #endif // __ZooLib_Compare_string_h__ 28 | -------------------------------------------------------------------------------- /Portable/zoolib/Compare_vector.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Compare_vector_h__ 4 | #define __ZooLib_Compare_vector_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Compare_T.h" 8 | 9 | #include 10 | 11 | namespace ZooLib { 12 | 13 | template 14 | inline int sCompare_T(const std::vector& iLeft, const std::vector& iRight) 15 | { return sCompareIterators_T(iLeft.begin(), iLeft.end(), iRight.begin(), iRight.end()); } 16 | 17 | } // namespace ZooLib 18 | 19 | #endif // __ZooLib_Compare_vector_h__ 20 | -------------------------------------------------------------------------------- /Portable/zoolib/Connection.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Connection_h__ 4 | #define __ZooLib_Connection_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Channer_Bin.h" 8 | #include "zoolib/Factory.h" 9 | 10 | namespace ZooLib { 11 | 12 | typedef ChannerRWCon ChannerRWCon_Bin; 13 | typedef Factory> Factory_ChannerRWCon_Bin; 14 | 15 | typedef ChannerRW ChannerRW_Bin; 16 | typedef Factory> Factory_ChannerRW_Bin; 17 | 18 | } // namespace ZooLib 19 | 20 | #endif // __ZooLib_Connection_h__ 21 | -------------------------------------------------------------------------------- /Portable/zoolib/CountedString.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_CountedString_h__ 4 | #define __ZooLib_CountedString_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/CountedVal.h" 8 | #include "zoolib/UnicodeString.h" // For string8 9 | 10 | namespace ZooLib { 11 | 12 | // ================================================================================================= 13 | #pragma mark - 14 | 15 | typedef CountedVal CountedString; 16 | 17 | typedef ZP ZP_CountedString; 18 | 19 | struct Compare_ZP_CountedString 20 | { 21 | bool operator()(const ZP_CountedString& ll, const ZP_CountedString& rr) const 22 | { return ll->Get() < rr->Get(); } 23 | }; 24 | 25 | } // namespace ZooLib 26 | 27 | #endif // __ZooLib_CountedString_h__ 28 | -------------------------------------------------------------------------------- /Portable/zoolib/Factory.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Factory_h__ 4 | #define __ZooLib_Factory_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Callable.h" 8 | 9 | namespace ZooLib { 10 | 11 | template 12 | using Factory = Callable; 13 | 14 | } // namespace ZooLib 15 | 16 | #endif // __ZooLib_Factory_h__ 17 | -------------------------------------------------------------------------------- /Portable/zoolib/Factory_WithFirstProduct.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Factory_WithFirstProduct_h__ 4 | #define __ZooLib_Factory_WithFirstProduct_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Factory.h" 8 | 9 | namespace ZooLib { 10 | 11 | // ================================================================================================= 12 | #pragma mark - Factory_WithFirstProduct 13 | 14 | template 15 | class Factory_WithFirstProduct 16 | : public Factory 17 | { 18 | public: 19 | Factory_WithFirstProduct(const ZP& iFactory, const T& iFirstProduct) 20 | : fFirstProductQ(iFirstProduct) 21 | {} 22 | 23 | // From Callable 24 | virtual ZQ QCall() 25 | { 26 | if (ZQ theQ = sQGetClear(fFirstProductQ)) 27 | return theQ; 28 | return sQCall(fFactory); 29 | } 30 | 31 | private: 32 | const ZP fFactory; 33 | ZQ fFirstProductQ; 34 | }; 35 | 36 | } // namespace ZooLib 37 | 38 | #endif // __ZooLib_Factory_WithFirstProduct_h__ 39 | -------------------------------------------------------------------------------- /Portable/zoolib/File_Archive.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-21 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_File_Archive_h__ 4 | #define __ZooLib_File_Archive_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Archive.h" 8 | #include "zoolib/File.h" 9 | 10 | #include 11 | 12 | namespace ZooLib { 13 | 14 | FileSpec sFileSpec_Archive(const ZP& iArchive); 15 | 16 | } // namespace ZooLib 17 | 18 | #endif // __ZooLib_File_Archive_h__ 19 | -------------------------------------------------------------------------------- /Portable/zoolib/ML.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2004 Andrew Green and Learning in Motion, Inc. 2 | // MIT License. http://www.zoolib.org 3 | 4 | #ifndef __ZooLib_ML_h__ 5 | #define __ZooLib_ML_h__ 1 6 | #include "zconfig.h" 7 | 8 | #include "zoolib/Callable.h" 9 | #include "zoolib/Chan_UTF.h" 10 | #include "zoolib/Name.h" 11 | 12 | #include 13 | 14 | namespace ZooLib { 15 | namespace ML { 16 | 17 | typedef std::pair Attr_t; 18 | typedef std::vector Attrs_t; 19 | 20 | typedef Callable Callable_Entity; 21 | 22 | // ================================================================================================= 23 | #pragma mark - ML 24 | 25 | std::string sReadReference(const ChanRU_UTF& iChanRU, const ZP& iCallable); 26 | 27 | bool sReadIdentifier(const ChanRU_UTF& iChanRU, std::string& oText); 28 | 29 | bool sReadAttributeName(const ChanRU_UTF& iChanRU, std::string& oName); 30 | 31 | bool sReadAttributeValue( 32 | const ChanRU_UTF& iChanRU, 33 | bool iRecognizeEntities, const ZP& iCallable, 34 | std::string& oValue); 35 | 36 | } // namespace ML 37 | } // namespace ZooLib 38 | 39 | #endif // __ZooLib_ML_h__ 40 | -------------------------------------------------------------------------------- /Portable/zoolib/NamePriv.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/Name.h" 4 | 5 | #include "zoolib/CtorDtor.h" 6 | 7 | namespace ZooLib { 8 | 9 | // These are in a separate file so they're part of a separate compilation unit from 10 | // the main Name code. Otherwise when optimizing the compiler would likely inline these, and 11 | // unnecessarily taint their callers with Unwind_SjLj_Register/Unwind_SjLj_Unregister calls, 12 | // which are a noticeable cost on iOS. 13 | 14 | #if ! ZMACRO_NameUsesString 15 | 16 | void Name::spRetain(const CountedString* iCounted) 17 | { 18 | try { const_cast(iCounted)->Retain(); } 19 | catch (...) {} 20 | } 21 | 22 | void Name::spRelease(const CountedString* iCounted) 23 | { 24 | try { const_cast(iCounted)->Release(); } 25 | catch (...) {} 26 | } 27 | 28 | #endif // ZMACRO_NameUsesString 29 | 30 | } // namespace ZooLib 31 | -------------------------------------------------------------------------------- /Portable/zoolib/NameUniquifier.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_NameUniquifier_h__ 4 | #define __ZooLib_NameUniquifier_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/CountedStringUniquifier.h" 8 | #include "zoolib/Name.h" 9 | 10 | namespace ZooLib { 11 | 12 | // ================================================================================================= 13 | #pragma mark - NameUniquifier 14 | 15 | typedef CountedStringUniquifier NameUniquifier; 16 | 17 | typedef ThreadVal_CountedStringUniquifier ThreadVal_NameUniquifier; 18 | 19 | // ================================================================================================= 20 | #pragma mark - sName 21 | 22 | inline Name sName(const Name& iName) 23 | { return iName; } 24 | 25 | inline Name sName(const ZP_CountedString& iCountedString) 26 | { return Name(sCountedString(iCountedString)); } 27 | 28 | inline Name sName(const string8& iString) 29 | { return Name(sCountedString(iString)); } 30 | 31 | inline Name sName(const char* iConstCharStar) 32 | { return Name(iConstCharStar); } 33 | 34 | } // namespace ZooLib 35 | 36 | #endif // __ZooLib_NameUniquifier_h__ 37 | -------------------------------------------------------------------------------- /Portable/zoolib/ParseException.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_ParseException_h__ 4 | #define __ZooLib_ParseException_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include 8 | #include 9 | 10 | namespace ZooLib { 11 | 12 | // ================================================================================================= 13 | #pragma mark - ParseException 14 | 15 | class ParseException : public std::runtime_error 16 | { 17 | public: 18 | ParseException(const std::string& iWhat) 19 | : runtime_error(iWhat) 20 | {} 21 | 22 | ParseException(const char* iWhat) 23 | : runtime_error(iWhat) 24 | {} 25 | }; 26 | 27 | ZMACRO_NoReturn_Pre 28 | inline bool sThrow_ParseException(const std::string& iMessage); 29 | ZMACRO_NoReturn_Post 30 | 31 | inline bool sThrow_ParseException(const std::string& iMessage) 32 | { throw ParseException(iMessage); } 33 | 34 | } // namespace ZooLib 35 | 36 | #endif // __ZooLib_ParseException_h__ 37 | -------------------------------------------------------------------------------- /Portable/zoolib/PullPush_XMLPList.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_PullPush_XMLPList_h__ 4 | #define __ZooLib_PullPush_XMLPList_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/ChanRU_UTF_ML.h" 8 | #include "zoolib/ChanW_UTF_ML.h" 9 | #include "zoolib/PullPush.h" 10 | 11 | namespace ZooLib { 12 | 13 | // ================================================================================================= 14 | #pragma mark - 15 | 16 | void sPull_XMLPList_Push_PPT(ChanRU_UTF_ML& iChanRU, const ChanW_PPT& iChanW); 17 | 18 | void sPull_XMLPList_Push_PPT(const ChanR_PPT& iChanR, const ChanW_PPT& iChanW); 19 | 20 | bool sPull_PPT_Push_XMLPList(const ChanR_PPT& iChanR, const ChanW_UTF_ML& iChanW); 21 | 22 | void sWriteXMLPListPreamble(const ChanW_UTF_ML& s); 23 | void sWriteXMLPListPostamble(const ChanW_UTF_ML& s); 24 | 25 | // ================================================================================================= 26 | #pragma mark - sChannerR_PPT_xx 27 | 28 | ZP sChannerR_PPT_XMLPList(const ZP& iChanner); 29 | 30 | } // namespace ZooLib 31 | 32 | #endif // __ZooLib_PullPush_XMLPList_h__ 33 | -------------------------------------------------------------------------------- /Portable/zoolib/PullTextOptions.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_PullTextOptions_h__ 4 | #define __ZooLib_PullTextOptions_h__ 1 5 | #include "zconfig.h" 6 | 7 | namespace ZooLib { 8 | 9 | // ================================================================================================= 10 | #pragma mark - PullTextOptions 11 | 12 | struct PullTextOptions 13 | { 14 | }; 15 | } // namespace ZooLib 16 | 17 | #endif // __ZooLib_PullTextOptions_h__ 18 | -------------------------------------------------------------------------------- /Portable/zoolib/Pull_Attr.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Pull_Attr_h__ 4 | #define __ZooLib_Pull_Attr_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Pull_Basic.h" 8 | 9 | namespace ZooLib { 10 | 11 | // ================================================================================================= 12 | #pragma mark - 13 | 14 | inline bool sPull_Attr_Push_PPT(const ChanR_UTF& iChanR, 15 | const ChanW_PPT& iChanW) 16 | { return sPull_Basic_Push_PPT(iChanR, Pull_Basic_Options('=', ','), iChanW); } 17 | 18 | } // namespace ZooLib 19 | 20 | #endif // __ZooLib_Pull_Attr_h__ 21 | -------------------------------------------------------------------------------- /Portable/zoolib/Pull_Basic.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Pull_Basic_h__ 4 | #define __ZooLib_Pull_Basic_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/ChanR_UTF.h" 8 | #include "zoolib/PullPush.h" 9 | 10 | namespace ZooLib { 11 | 12 | // ================================================================================================= 13 | #pragma mark - 14 | 15 | struct Pull_Basic_Options 16 | { 17 | Pull_Basic_Options(UTF32 iNameFromValue, UTF32 iEntryFromEntry); 18 | 19 | UTF32 fSeparator_NameFromValue; 20 | UTF32 fSeparator_EntryFromEntry; 21 | 22 | // Perhaps should make sure we differentiate terminator and separator? 23 | }; 24 | 25 | bool sPull_Basic_Push_PPT(const ChanR_UTF& iChanR, const Pull_Basic_Options& iOptions, 26 | const ChanW_PPT& iChanW); 27 | 28 | } // namespace ZooLib 29 | 30 | #endif // __ZooLib_Pull_Basic_h__ 31 | -------------------------------------------------------------------------------- /Portable/zoolib/Pull_Bencode.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Pull_Bencode_h__ 4 | #define __ZooLib_Pull_Bencode_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/ChanR_Bin.h" 8 | #include "zoolib/PullPush.h" 9 | 10 | namespace ZooLib { 11 | 12 | // ================================================================================================= 13 | #pragma mark - 14 | 15 | bool sPull_Bencode_Push_PPT(const ChanRU_Bin& iChanRU, const ChanW_PPT& iChanW); 16 | 17 | } // namespace ZooLib 18 | 19 | #endif // __ZooLib_Pull_Bencode_h__ 20 | -------------------------------------------------------------------------------- /Portable/zoolib/Pull_XMLAttr.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Pull_XMLAttr_h__ 4 | #define __ZooLib_Pull_XMLAttr_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/ChanRU_UTF_ML.h" 8 | #include "zoolib/PullPush.h" 9 | 10 | namespace ZooLib { 11 | 12 | // ================================================================================================= 13 | #pragma mark - 14 | 15 | bool sPull_XMLAttr_Push_PPT(ChanRU_UTF_ML& ioChanRU, const ChanW_PPT& iChanW); 16 | 17 | ZP sChannerR_PPT_XMLAttr(const ZP& iChannerRU); 18 | 19 | } // namespace ZooLib 20 | 21 | #endif // __ZooLib_Pull_XMLAttr_h__ 22 | -------------------------------------------------------------------------------- /Portable/zoolib/Push_bplist.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021 Andrew Green and Mark/Space, Inc. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Push_bplist_h__ 4 | #define __ZooLib_Push_bplist_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/ChanW_Bin.h" 8 | #include "zoolib/Val_ZZ.h" 9 | 10 | namespace ZooLib { 11 | 12 | // ================================================================================================= 13 | #pragma mark - 14 | 15 | void sFromZZ_Push_bplist(const Val_ZZ& iVal, const ChanW_Bin& iChanW); 16 | 17 | } // namespace ZooLib 18 | 19 | #endif // __ZooLib_Push_ZZ_bplist_h__ 20 | -------------------------------------------------------------------------------- /Portable/zoolib/StartOnNewThread.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_StartOnNewThread_h__ 4 | #define __ZooLib_StartOnNewThread_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Startable.h" 8 | 9 | namespace ZooLib { 10 | 11 | // ================================================================================================= 12 | #pragma mark - sStartOnNewThread 13 | 14 | void sStartOnNewThread(const ZP& iStartable); 15 | 16 | void sStartOnNewThread_ProcessIsAboutToExit(); 17 | 18 | } // namespace ZooLib 19 | 20 | #endif // __ZooLib_StartOnNewThread_h__ 21 | -------------------------------------------------------------------------------- /Portable/zoolib/Startable_SetName.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/Startable_SetName.h" 4 | 5 | #include "zoolib/Callable_Bind.h" 6 | #include "zoolib/Callable_Function.h" 7 | 8 | namespace ZooLib { 9 | 10 | class Startable_SetName 11 | : public Startable 12 | { 13 | public: 14 | Startable_SetName(const std::string& iName, const ZP& iStartable) 15 | : fName(iName) 16 | , fStartable(iStartable) 17 | {} 18 | 19 | virtual bool QCall() 20 | { 21 | ZThread::sSetName(fName.c_str()); 22 | fStartable->QCall(); 23 | return true; 24 | } 25 | 26 | const std::string fName; 27 | const ZP fStartable; 28 | }; 29 | 30 | ZP sStartable_SetName(const std::string& iName, const ZP& iStartable) 31 | { 32 | if (iStartable) 33 | return new Startable_SetName(iName, iStartable); 34 | return null; 35 | } 36 | 37 | } // namespace ZooLib 38 | -------------------------------------------------------------------------------- /Portable/zoolib/Startable_SetName.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Startable_SetName_h__ 4 | #define __ZooLib_Startable_SetName_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Startable.h" 8 | 9 | #include 10 | 11 | namespace ZooLib { 12 | 13 | ZP sStartable_SetName(const std::string& iName, const ZP& iStartable); 14 | 15 | } // namespace ZooLib 16 | 17 | #endif // __ZooLib_Startable_SetName_h__ 18 | -------------------------------------------------------------------------------- /Portable/zoolib/Starter_EachOnNewThread.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/Starter_EachOnNewThread.h" 4 | 5 | #include "zoolib/StartOnNewThread.h" 6 | 7 | namespace ZooLib { 8 | 9 | // ================================================================================================= 10 | #pragma mark - Starter_EachOnNewThread 11 | 12 | class Starter_EachOnNewThread 13 | : public Starter 14 | { 15 | public: 16 | // From Starter 17 | virtual bool QStart(const ZP& iStartable) 18 | { 19 | if (iStartable) 20 | { 21 | try 22 | { 23 | sStartOnNewThread(iStartable); 24 | return true; 25 | } 26 | catch (...) 27 | {} 28 | } 29 | return false; 30 | } 31 | }; 32 | 33 | // ================================================================================================= 34 | #pragma mark - sStarter_EachOnNewThread 35 | 36 | ZP sStarter_EachOnNewThread() 37 | { return sSingleton>(); } 38 | 39 | } // namespace ZooLib 40 | -------------------------------------------------------------------------------- /Portable/zoolib/Starter_EachOnNewThread.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Starter_EachOnNewThread_h__ 4 | #define __ZooLib_Starter_EachOnNewThread_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Starter.h" 8 | 9 | namespace ZooLib { 10 | 11 | // ================================================================================================= 12 | #pragma mark - sStarter_EachOnNewThread 13 | 14 | ZP sStarter_EachOnNewThread(); 15 | 16 | } // namespace ZooLib 17 | 18 | #endif // __ZooLib_Starter_EachOnNewThread_h__ 19 | -------------------------------------------------------------------------------- /Portable/zoolib/Starter_EventLoopBase.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Starter_EventLoopBase_h__ 4 | #define __ZooLib_Starter_EventLoopBase_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Starter.h" 8 | 9 | #include "zoolib/ZThread.h" 10 | 11 | #include 12 | 13 | namespace ZooLib { 14 | 15 | // ================================================================================================= 16 | #pragma mark - Starter_EventLoopBase 17 | 18 | class Starter_EventLoopBase 19 | : public Starter 20 | { 21 | public: 22 | Starter_EventLoopBase(); 23 | virtual ~Starter_EventLoopBase(); 24 | 25 | // From Starter 26 | virtual bool QStart(const ZP& iStartable); 27 | 28 | protected: 29 | // Called by concrete subclass 30 | bool pInvokeClearQueue(); 31 | 32 | bool pDiscardPending(); 33 | 34 | // Implemented by concrete subclass 35 | virtual bool pTrigger() = 0; 36 | 37 | private: 38 | ZMtx fMtx; 39 | bool fTriggered; 40 | std::vector> fStartables; 41 | }; 42 | 43 | } // namespace ZooLib 44 | 45 | #endif // __ZooLib_Starter_EventLoopBase_h__ 46 | -------------------------------------------------------------------------------- /Portable/zoolib/Starter_ThreadLoop.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2021 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Starter_ThreadLoop_h__ 4 | #define __ZooLib_Starter_ThreadLoop_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include 8 | 9 | #include "zoolib/Callable_Bookend.h" 10 | #include "zoolib/Starter.h" 11 | 12 | namespace ZooLib { 13 | 14 | // ================================================================================================= 15 | #pragma mark - sStarter_ThreadLoop 16 | 17 | ZP sStarter_ThreadLoop( 18 | const ZP& iBookend_Loop, 19 | const ZP& iBookend_Startable); 20 | 21 | ZP sStarter_ThreadLoop(const std::string& iName); 22 | 23 | ZP sStarter_ThreadLoop(); 24 | 25 | } // namespace ZooLib 26 | 27 | #endif // __ZooLib_Starter_ThreadLoop_h__ 28 | -------------------------------------------------------------------------------- /Portable/zoolib/StdIO.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/StdIO.h" 4 | 5 | #include "zoolib/Chan_Bin_FILE.h" 6 | #include "zoolib/Chan_UTF_Chan_Bin.h" 7 | 8 | namespace ZooLib { 9 | 10 | static ChanR_Bin_FILE spChanR_Bin_In(stdin); 11 | static ChanW_Bin_FILE spChanW_Bin_Out(stdout); 12 | static ChanW_Bin_FILE spChanW_Bin_Err(stderr); 13 | 14 | static ChanR_UTF_Chan_Bin_UTF8 spChanR_UTF_In(spChanR_Bin_In); 15 | static ChanW_UTF_Chan_Bin_UTF8 spChanW_UTF_Out(spChanW_Bin_Out); 16 | static ChanW_UTF_Chan_Bin_UTF8 spChanW_UTF_Err(spChanW_Bin_Err); 17 | 18 | namespace StdIO { 19 | 20 | const ChanR_Bin& sChanR_Bin_In = spChanR_Bin_In; 21 | const ChanW_Bin& sChanW_Bin_Out = spChanW_Bin_Out; 22 | const ChanW_Bin& sChanW_Bin_Err = spChanW_Bin_Err; 23 | 24 | const ChanR_UTF& sChanR_UTF_In = spChanR_UTF_In; 25 | const ChanW_UTF& sChanW_UTF_Out = spChanW_UTF_Out; 26 | const ChanW_UTF& sChanW_UTF_Err = spChanW_UTF_Err; 27 | 28 | } // namespace StdIO 29 | 30 | } // namespace ZooLib 31 | -------------------------------------------------------------------------------- /Portable/zoolib/StdIO.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_StdIO_h__ 4 | #define __ZooLib_StdIO_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/ChanR_Bin.h" 8 | #include "zoolib/ChanW_Bin.h" 9 | #include "zoolib/ChanR_UTF.h" 10 | #include "zoolib/ChanW_UTF.h" 11 | 12 | namespace ZooLib { 13 | namespace StdIO { 14 | 15 | extern const ChanR_Bin& sChanR_Bin_In; 16 | extern const ChanW_Bin& sChanW_Bin_Out; 17 | extern const ChanW_Bin& sChanW_Bin_Err; 18 | 19 | extern const ChanR_UTF& sChanR_UTF_In; 20 | extern const ChanW_UTF& sChanW_UTF_Out; 21 | extern const ChanW_UTF& sChanW_UTF_Err; 22 | 23 | } // namespace ZStdIO 24 | } // namespace ZooLib 25 | 26 | #endif // __ZooLib_StdIO_h__ 27 | -------------------------------------------------------------------------------- /Portable/zoolib/Stringf.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Stringf_h__ 4 | #define __ZooLib_Stringf_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include 8 | #include 9 | 10 | // ================================================================================================= 11 | 12 | namespace ZooLib { 13 | 14 | std::string sStringf(std::string iString, ...); 15 | 16 | std::string sStringf(const char* iString, ...) ZMACRO_Attribute_Format_Printf(1,2); 17 | 18 | std::string sStringv(const char* iString, std::va_list iArgs); 19 | 20 | } // namespace ZooLib 21 | 22 | #endif // __ZooLib_Stringf_h__ 23 | -------------------------------------------------------------------------------- /Portable/zoolib/TextCoderAliases.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_TextCoderAliases_h__ 4 | #define __ZooLib_TextCoderAliases_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include 8 | #include 9 | 10 | namespace ZooLib { 11 | 12 | std::vector sGetTextCoderAliases(const std::string& iName); 13 | 14 | } // namespace ZooLib 15 | 16 | #endif // __ZooLib_TextCoderAliases_h__ 17 | -------------------------------------------------------------------------------- /Portable/zoolib/TextCoder_Std.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2005 Andrew Green and Learning in Motion, Inc. 2 | // MIT License. http://www.zoolib.org 3 | 4 | #ifndef __ZooLib_TextCoder_Std_h__ 5 | #define __ZooLib_TextCoder_Std_h__ 1 6 | #include "zconfig.h" 7 | 8 | #include "zoolib/TextCoder.h" 9 | 10 | namespace ZooLib { 11 | 12 | // ================================================================================================= 13 | #pragma mark - 14 | 15 | ZP sMake_TextDecoder_Std(const std::string& iSourceName); 16 | 17 | ZP sMake_TextEncoder_Std(const std::string& iDestName); 18 | 19 | } // namespace ZooLib 20 | 21 | #endif // __ZooLib_TextCoder_Std_h__ 22 | -------------------------------------------------------------------------------- /Portable/zoolib/UTCDateTime.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_UTCDateTime_h__ 4 | #define __ZooLib_UTCDateTime_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/TagVal.h" 8 | 9 | namespace ZooLib { 10 | 11 | // ================================================================================================= 12 | #pragma mark - UTCDateTime 13 | 14 | typedef TagVal UTCDateTime; 15 | 16 | } // namespace ZooLib 17 | 18 | #endif // __ZooLib_UTCDateTime_h__ 19 | -------------------------------------------------------------------------------- /Portable/zoolib/UUID.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_UUID_h__ 4 | #define __ZooLib_UUID_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/StdInt.h" // For byte 8 | #include "zoolib/TagVal.h" 9 | 10 | #include 11 | 12 | namespace ZooLib { 13 | 14 | // ================================================================================================= 15 | #pragma mark - UUID 16 | 17 | typedef TagVal, struct Tag_UUID> UUID; 18 | 19 | } // namespace ZooLib 20 | 21 | #endif // __ZooLib_UUID_h__ 22 | -------------------------------------------------------------------------------- /Portable/zoolib/Uniquifier.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Uniquifier_h__ 4 | #define __ZooLib_Uniquifier_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include 8 | 9 | namespace ZooLib { 10 | 11 | // ================================================================================================= 12 | #pragma mark - Uniquifier 13 | 14 | template ::key_compare> 15 | class Uniquifier 16 | { 17 | public: 18 | typedef std::set Set_t; 19 | 20 | const Type_p& Get(const Type_p& iValue) { return *fSet.insert(iValue).first; } 21 | Set_t& GetStorage() { return fSet; } 22 | 23 | private: 24 | Set_t fSet; 25 | }; 26 | 27 | } // namespace ZooLib 28 | 29 | #endif // __ZooLib_Uniquifier_h__ 30 | -------------------------------------------------------------------------------- /Portable/zoolib/Util_Chan_Bin_Operators.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/Util_Chan_Bin_Operators.h" 4 | 5 | #include "zoolib/Util_Chan.h" 6 | 7 | #include // For strlen 8 | 9 | // ================================================================================================= 10 | #pragma mark - Util_Chan_Bin_Operators 11 | 12 | namespace ZooLib { 13 | namespace Util_Chan_Bin_Operators { 14 | 15 | const ChanW_Bin& operator<<(const ChanW_Bin& ww, const char* iString) 16 | { 17 | sEWriteMem(ww, iString, strlen(iString)); 18 | return ww; 19 | } 20 | 21 | const ChanW_Bin& operator<<(const ChanW_Bin& ww, char* iString) 22 | { 23 | sEWriteMem(ww, iString, strlen(iString)); 24 | return ww; 25 | } 26 | 27 | const ChanW_Bin& operator<<(const ChanW_Bin& ww, const std::string& iString) 28 | { 29 | sEWriteMem(ww, iString.c_str(), iString.length()); 30 | return ww; 31 | } 32 | 33 | const ChanW_Bin& operator<<(const ChanW_Bin& ww, const ChanR_Bin& r) 34 | { 35 | sCopyAll(r, ww); 36 | return ww; 37 | } 38 | 39 | } // namespace Util_Chan_Bin_Operators 40 | } // namespace ZooLib 41 | -------------------------------------------------------------------------------- /Portable/zoolib/Util_Chan_Bin_Operators.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Util_Chan_Bin_Operators_h__ 4 | #define __ZooLib_Util_Chan_Bin_Operators_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/ChanR_Bin.h" 8 | #include "zoolib/ChanW_Bin.h" 9 | 10 | #include 11 | 12 | // ================================================================================================= 13 | #pragma mark - ZUtil_Stream_Operators 14 | 15 | namespace ZooLib { 16 | namespace Util_Chan_Bin_Operators { 17 | 18 | const ChanW_Bin& operator<<(const ChanW_Bin& ww, const char* iString); 19 | 20 | const ChanW_Bin& operator<<(const ChanW_Bin& ww, char* iString); 21 | 22 | const ChanW_Bin& operator<<(const ChanW_Bin& ww, const std::string& iString); 23 | 24 | const ChanW_Bin& operator<<(const ChanW_Bin& ww, const ChanR_Bin& r); 25 | 26 | } // namespace Util_Chan_Bin_Operators 27 | 28 | #if not defined(ZMACRO_Util_Chan_Bin_Operators_Suppress) || not ZMACRO_Util_Chan_Bin_Operators_Suppress 29 | using Util_Chan_Bin_Operators::operator<<; 30 | #endif 31 | 32 | } // namespace ZooLib 33 | 34 | #endif // __ZooLib_Util_Chan_Bin_Operators_h__ 35 | -------------------------------------------------------------------------------- /Portable/zoolib/Util_Chan_UTF_MatrixArray.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Util_Chan_UTF_MatrixArray_h__ 4 | #define __ZooLib_Util_Chan_UTF_MatrixArray_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/MatrixArray.h" 8 | 9 | namespace ZooLib { 10 | 11 | template 12 | const ChanW_UTF& operator<<(const ChanW_UTF& ww, const MatrixArray& iArray) 13 | { 14 | ww << "Array(" << Length_p << ")["; 15 | for (size_t xx = 0; xx < Length_p; ++xx) 16 | ww << iArray[xx]; 17 | ww << "]"; 18 | 19 | return ww; 20 | } 21 | 22 | } // namespace ZooLib 23 | 24 | #endif // __ZooLib_Util_Chan_UTF_MatrixArray_h__ 25 | -------------------------------------------------------------------------------- /Portable/zoolib/Util_File.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Util_File_h__ 4 | #define __ZooLib_Util_File_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/File.h" 8 | #include "zoolib/ZQ.h" 9 | 10 | namespace ZooLib { 11 | namespace Util_File { 12 | 13 | // ================================================================================================= 14 | #pragma mark - Util_File 15 | 16 | ZQ sQEnsureBranch(const FileSpec& iFS); 17 | 18 | bool sDeleteTree(const FileSpec& iFS); 19 | 20 | FileIter sSorted(FileIter iSource); 21 | 22 | ZP sForceOpenRPos(const FileSpec& iFileSpec); 23 | 24 | } // namespace Util_File 25 | } // namespace ZooLib 26 | 27 | #endif // __ZooLib_Util_File_h__ 28 | -------------------------------------------------------------------------------- /Portable/zoolib/Util_Strim_Cartesian.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Util_Strim_Cartesian_h__ 4 | #define __ZooLib_Util_Strim_Cartesian_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Cartesian.h" 8 | #include "zoolib/Util_Chan_UTF_Operators.h" 9 | 10 | namespace ZooLib { 11 | 12 | template 13 | typename EnableIfC::value,const ChanW_UTF&>::type 14 | operator<<(const ChanW_UTF& ww, const Point_p& iPoint) 15 | { return ww << "(" << X(iPoint) << "," << Y(iPoint) << ")"; } 16 | 17 | template 18 | typename EnableIfC::value,const ChanW_UTF&>::type 19 | operator<<(const ChanW_UTF& ww, const Rect_p& iRect) 20 | { return ww << "(" << L(iRect) << "," << T(iRect) << "," << R(iRect) << "," << B(iRect) << ")"; } 21 | 22 | } // namespace ZooLib 23 | 24 | #endif // __ZooLib_Util_Strim_Cartesian_h__ 25 | -------------------------------------------------------------------------------- /Portable/zoolib/Util_ZZ_JSONB.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/Util_ZZ_JSONB.h" 4 | 5 | #include "zoolib/Chan_Bin_Data.h" 6 | #include "zoolib/PullPush_JSONB.h" 7 | #include "zoolib/PullPush_ZZ.h" 8 | 9 | // ================================================================================================= 10 | #pragma mark - 11 | 12 | namespace ZooLib { 13 | namespace Util_ZZ_JSONB { 14 | 15 | ZQ sQRead(const ChanR_Bin& iChanR) 16 | { 17 | PullPushPair thePair = sMakePullPushPair(); 18 | ZP> theDelivery = sStartAsync_AsZZ(sGetClear(thePair.second)); 19 | sPull_JSONB_Push_PPT(iChanR, null, *thePair.first); 20 | sDisconnectWrite(*thePair.first); 21 | 22 | return theDelivery->QGet(); 23 | } 24 | 25 | // ----- 26 | 27 | void sWrite(const ChanW_Bin& iChanW, const Val_ZZ& iVal) 28 | { sPull_PPT_Push_JSONB(*sChannerR_PPT(iVal), null, iChanW); } 29 | 30 | // ----- 31 | 32 | Data_ZZ sAsJSONB(const Val_ZZ& iVal) 33 | { 34 | Data_ZZ result; 35 | sWrite(ChanW_Bin_Data(&result), iVal); 36 | return result; 37 | } 38 | 39 | } // namespace Util_ZZ_JSONB 40 | } // namespace ZooLib 41 | 42 | -------------------------------------------------------------------------------- /Portable/zoolib/Util_ZZ_JSONB.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Util_JSONB_ZZ_h__ 4 | #define __ZooLib_Util_JSONB_ZZ_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/ChanR_Bin.h" 8 | #include "zoolib/ChanW_Bin.h" 9 | #include "zoolib/Val_ZZ.h" 10 | 11 | // ================================================================================================= 12 | #pragma mark - 13 | 14 | namespace ZooLib { 15 | namespace Util_ZZ_JSONB { 16 | 17 | ZQ sQRead(const ChanR_Bin& iChanR); 18 | 19 | void sWrite(const ChanW_Bin& iChanW, const Val_ZZ& iVal); 20 | 21 | Data_ZZ sAsJSONB(const Val_ZZ& iVal); 22 | 23 | } // namespace Util_ZZ_JSONB 24 | } // namespace ZooLib 25 | 26 | #endif // __ZooLib_Util_JSONB_ZZ_h__ 27 | -------------------------------------------------------------------------------- /Portable/zoolib/Val_DB.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Val_DB_h__ 4 | #define __ZooLib_Val_DB_h__ 1 5 | #include "zconfig.h" 6 | 7 | #if 0 8 | 9 | #include "zoolib/Val_T.h" 10 | #include 11 | #include 12 | 13 | namespace ZooLib { 14 | 15 | typedef Any_T Val_DB; 16 | 17 | bool operator<(const Val_DB& l, const Val_DB& r); 18 | bool operator!=(const Val_DB& l, const Val_DB& r); 19 | 20 | } // namespace ZooLib 21 | 22 | #else 23 | 24 | #include "zoolib/Val_ZZ.h" 25 | 26 | namespace ZooLib { 27 | 28 | 29 | typedef Val_ZZ Val_DB; 30 | 31 | } // namespace ZooLib 32 | 33 | #endif 34 | 35 | #endif // __ZooLib_Val_ZZ_h__ 36 | -------------------------------------------------------------------------------- /Portable/zoolib/Visitor.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/Visitor.h" 4 | 5 | namespace ZooLib { 6 | 7 | // ================================================================================================= 8 | #pragma mark - Visitee 9 | 10 | void Visitee::Accept(const Visitor& iVisitor) 11 | { const_cast(iVisitor).Visit(this); } 12 | 13 | void sAccept(const ZP& iVisitee, const Visitor& iVisitor) 14 | { iVisitee->Accept(iVisitor); } 15 | 16 | // ================================================================================================= 17 | #pragma mark - Visitor 18 | 19 | Visitor::~Visitor() 20 | {} 21 | 22 | void Visitor::Visit(const ZP& iRep) 23 | {} 24 | 25 | } // namespace ZooLib 26 | -------------------------------------------------------------------------------- /Portable/zoolib/Visitor.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Visitor_h__ 4 | #define __ZooLib_Visitor_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Counted.h" 8 | 9 | namespace ZooLib { 10 | 11 | // ================================================================================================= 12 | #pragma mark - Visitee 13 | 14 | class Visitor; 15 | 16 | class Visitee 17 | : public virtual Counted 18 | { 19 | public: 20 | // Our protocol 21 | virtual void Accept(const Visitor& iVisitor) = 0; 22 | }; 23 | 24 | void sAccept(const ZP& iVisitee, const Visitor& iVisitor); 25 | 26 | // ================================================================================================= 27 | #pragma mark - Visitor 28 | 29 | class Visitor 30 | { 31 | public: 32 | virtual ~Visitor(); 33 | virtual void Visit(const ZP& iRep); 34 | }; 35 | 36 | } // namespace ZooLib 37 | 38 | #endif // __ZooLib_Visitor_h__ 39 | -------------------------------------------------------------------------------- /Portable/zoolib/pdesc.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_pdesc_h__ 4 | #define __ZooLib_pdesc_h__ 1 5 | #include "zconfig.h" 6 | 7 | struct ZooLib_MarkAsUsed 8 | { 9 | template 10 | ZooLib_MarkAsUsed(T thing) {} 11 | }; 12 | 13 | #define ZMACRO_UniqueMarkAsUsed(aa) \ 14 | static ZooLib_MarkAsUsed ZMACRO_Concat(UniqueMarkAsUsed, __COUNTER__)(aa) 15 | 16 | #if ZCONFIG_Debug 17 | #define ZMACRO_pdesc(param) \ 18 | void pdesc(param); \ 19 | ZMACRO_UniqueMarkAsUsed(static_cast(pdesc)); \ 20 | void pdesc(param) 21 | #endif 22 | 23 | #endif // __ZooLib_pdesc_h__ 24 | -------------------------------------------------------------------------------- /Project/zoolib/Dataspace/Daton_Val.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Dataspace_Daton_Val_h__ 4 | #define __ZooLib_Dataspace_Daton_Val_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Val_DB.h" 8 | 9 | #include "zoolib/Dataspace/Daton.h" 10 | 11 | // ================================================================================================= 12 | #pragma mark - 13 | 14 | namespace ZooLib { 15 | namespace Dataspace { 16 | 17 | Val_DB sAsVal(const Daton& iDaton); 18 | Daton sAsDaton(const Val_DB& iVal); 19 | 20 | } // namespace Dataspace 21 | } // namespace ZooLib 22 | 23 | #endif // __ZooLib_Dataspace_Daton_Val_h__ 24 | -------------------------------------------------------------------------------- /Project/zoolib/Dataspace/Melange.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Dataspace_Melange_h__ 4 | #define __ZooLib_Dataspace_Melange_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Factory.h" 8 | #include "zoolib/Multi.h" 9 | #include "zoolib/Starter.h" 10 | 11 | #include "zoolib/Dataspace/RelsWatcher.h" 12 | #include "zoolib/Dataspace/Daton.h" 13 | 14 | // ================================================================================================= 15 | #pragma mark - 16 | 17 | namespace ZooLib { 18 | namespace Dataspace { 19 | 20 | using RelsWatcher::Callable_Register; 21 | 22 | typedef Multi3< 23 | ZP, 24 | ZP, 25 | ZP 26 | > Melange_t; 27 | 28 | typedef Factory Factory_Melange; 29 | 30 | } // namespace Dataspace 31 | } // namespace ZooLib 32 | 33 | #endif // __ZooLib_Dataspace_Melange_h__ 34 | -------------------------------------------------------------------------------- /Project/zoolib/Dataspace/RelsWatcher.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Dataspace_RelsWatcher_h__ 4 | #define __ZooLib_Dataspace_RelsWatcher_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/StdInt.h" 8 | 9 | #include "zoolib/Dataspace/Types.h" 10 | 11 | // ================================================================================================= 12 | #pragma mark - 13 | 14 | namespace ZooLib { 15 | namespace Dataspace { 16 | namespace RelsWatcher { 17 | 18 | typedef Callable& iRegistration, 20 | int64 iChangeCount, 21 | const ZP& iResult, 22 | const ZP& iResultDeltas)> 23 | Callable_Changed; 24 | 25 | typedef Callable( 26 | const ZP& iCallable_Changed, 27 | const ZP& iRel)> 28 | Callable_Register; 29 | 30 | } // namespace RelsWatcher 31 | } // namespace Dataspace 32 | } // namespace ZooLib 33 | 34 | #endif // __ZooLib_Dataspace_RelsWatcher_h__ 35 | -------------------------------------------------------------------------------- /Project/zoolib/Dataspace/ResultHandler.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/Dataspace/ResultHandler.h" 4 | 5 | namespace ZooLib { 6 | namespace Dataspace { 7 | 8 | // ================================================================================================= 9 | #pragma mark - ResultHandler 10 | 11 | ResultHandler::ResultHandler(const ZP& iCallable) 12 | : fCallable(iCallable) 13 | {} 14 | 15 | bool ResultHandler::QCall( 16 | const ZP& iRegistration, 17 | int64 iChangeCount, 18 | const ZP& iResult, 19 | const ZP& iResultDeltas) 20 | { 21 | if (iResult) 22 | { 23 | fResult = iResult; 24 | } 25 | else 26 | { 27 | ZAssert(iResultDeltas && fResult); 28 | fResult = sApplyDeltas(fResult, iResultDeltas); 29 | } 30 | sCall(fCallable, iRegistration, fResult); 31 | 32 | return true; 33 | } 34 | 35 | } // namespace Dataspace 36 | } // namespace ZooLib 37 | -------------------------------------------------------------------------------- /Project/zoolib/Dataspace/ResultHandler.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Dataspace_ResultHandler_h__ 4 | #define __ZooLib_Dataspace_ResultHandler_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Dataspace/RelsWatcher.h" 8 | 9 | namespace ZooLib { 10 | namespace Dataspace { 11 | 12 | // ================================================================================================= 13 | #pragma mark - ResultHandler 14 | 15 | class ResultHandler : public RelsWatcher::Callable_Changed 16 | { 17 | public: 18 | typedef Callable& iRegistration, const ZP& iResult)> 19 | Callable_t; 20 | 21 | ResultHandler(const ZP& iCallable); 22 | 23 | virtual bool QCall( 24 | const ZP& iRegistration, 25 | int64 iChangeCount, 26 | const ZP& iResult, 27 | const ZP& iResultDeltas); 28 | 29 | const ZP fCallable; 30 | ZP fResult; 31 | }; 32 | 33 | } // namespace Dataspace 34 | } // namespace ZooLib 35 | 36 | #endif // __ZooLib_Dataspace_ResultHandler_h__ 37 | -------------------------------------------------------------------------------- /Project/zoolib/Dataspace/Tests.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Dataspace_Tests_h__ 4 | #define __ZooLib_Dataspace_Tests_h__ 5 | #include "zconfig.h" 6 | 7 | namespace ZooLib { 8 | namespace Dataspace { 9 | namespace Tests { 10 | 11 | // ================================================================================================= 12 | #pragma mark - 13 | 14 | void RunTests(); 15 | 16 | } // namespace Tests 17 | } // namespace Dataspace 18 | } // namespace ZooLib 19 | 20 | #endif // __ZooLib_Dataspace_Tests_h__ 21 | -------------------------------------------------------------------------------- /Project/zoolib/Dataspace/Types.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/Dataspace/Types.h" 4 | 5 | namespace ZooLib { 6 | 7 | namespace Dataspace { 8 | 9 | } // namespace Dataspace 10 | } // namespace ZooLib 11 | -------------------------------------------------------------------------------- /Project/zoolib/Dataspace/Util_Strim.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/Dataspace/Util_Strim.h" 4 | 5 | #include "zoolib/Util_Chan_UTF_Operators.h" 6 | #include "zoolib/ValueOnce.h" 7 | 8 | #include "zoolib/ZMACRO_foreach.h" 9 | 10 | #include "zoolib/RelationalAlgebra/Util_Strim_RelHead.h" 11 | 12 | namespace ZooLib { 13 | namespace Dataspace { 14 | 15 | // ================================================================================================= 16 | #pragma mark - 17 | 18 | const ChanW_UTF& operator<<(const ChanW_UTF& ww, const std::set& iSet) 19 | { 20 | FalseOnce needsSeparator; 21 | foreacha (entry, iSet) 22 | { 23 | if (needsSeparator()) 24 | ww << ", "; 25 | ww << entry; 26 | } 27 | return ww; 28 | } 29 | 30 | } // namespace Dataspace 31 | } // namespace ZooLib 32 | -------------------------------------------------------------------------------- /Project/zoolib/Dataspace/Util_Strim.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Dataspace_Util_Strim_h__ 4 | #define __ZooLib_Dataspace_Util_Strim_h__ 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/ChanW_UTF.h" 8 | 9 | #include "zoolib/RelationalAlgebra/RelHead.h" 10 | 11 | namespace ZooLib { 12 | namespace Dataspace { 13 | 14 | // ================================================================================================= 15 | #pragma mark - 16 | 17 | const ChanW_UTF& operator<<(const ChanW_UTF& ww, const std::set& iSet); 18 | 19 | } // namespace Dataspace 20 | } // namespace ZooLib 21 | 22 | #endif // __ZooLib_Dataspace_Util_Strim_h__ 23 | -------------------------------------------------------------------------------- /Project/zoolib/Dataspace/Util_Strim_Daton.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/Dataspace/Util_Strim_Daton.h" 4 | 5 | namespace ZooLib { 6 | 7 | // ================================================================================================= 8 | #pragma mark - 9 | 10 | const ChanW_UTF& operator<<(const ChanW_UTF& ww, const Dataspace::Daton& iDaton) 11 | { 12 | sEWrite(ww, "⨴"); 13 | const Data_ZZ& theData = iDaton.GetData(); 14 | sWrite(ww, (const UTF8*)theData.GetPtr(), 15 | theData.GetSize(), nullptr, 16 | theData.GetSize(), nullptr); 17 | sEWrite(ww, "⨵"); 18 | return ww; 19 | } 20 | 21 | } // namespace ZooLib 22 | -------------------------------------------------------------------------------- /Project/zoolib/Dataspace/Util_Strim_Daton.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Dataspace_Util_Strim_Daton_h__ 4 | #define __ZooLib_Dataspace_Util_Strim_Daton_h__ 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/ChanW_UTF.h" 8 | #include "zoolib/Dataspace/Daton.h" 9 | 10 | namespace ZooLib { 11 | 12 | // ================================================================================================= 13 | #pragma mark - 14 | 15 | const ChanW_UTF& operator<<(const ChanW_UTF& ww, const Dataspace::Daton& iDaton); 16 | 17 | } // namespace ZooLib 18 | 19 | #endif // __ZooLib_Dataspace_Util_Strim_Daton_h__ 20 | -------------------------------------------------------------------------------- /Project/zoolib/Dataspace/Util_Strim_Result.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_QueryEngine_Util_Strim_Result_h__ 4 | #define __ZooLib_QueryEngine_Util_Strim_Result_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/ChanW_UTF.h" 8 | #include "zoolib/PullPush_JSON.h" // For Callable_JSON_WriteFilter 9 | 10 | #include "zoolib/QueryEngine/Result.h" 11 | 12 | namespace ZooLib { 13 | namespace QueryEngine { 14 | 15 | // ================================================================================================= 16 | #pragma mark - 17 | 18 | ZP sCallable_JSON_Write_Filter(); 19 | 20 | void sToStrim(const ChanW_UTF& iChanW, const ZP& iResult); 21 | 22 | } // namespace QueryEngine 23 | 24 | const ChanW_UTF& operator<<(const ChanW_UTF& iChanW, const ZP& iResult); 25 | 26 | } // namespace ZooLib 27 | 28 | #endif // __ZooLib_QueryEngine_Util_Strim_Result_h__ 29 | -------------------------------------------------------------------------------- /Project/zoolib/Expr/Expr.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/Expr/Expr.h" 4 | 5 | #include "zoolib/Stringf.h" 6 | #include "zoolib/TypeIdName.h" 7 | 8 | #include // For strcmp 9 | 10 | namespace ZooLib { 11 | 12 | // ================================================================================================= 13 | #pragma mark - Expr 14 | 15 | void Expr::Accept(const Visitor& iVisitor) 16 | { 17 | if (Visitor_Expr* theVisitor = sDynNonConst(&iVisitor)) 18 | this->Accept_Expr(*theVisitor); 19 | else 20 | Visitee::Accept(iVisitor); 21 | } 22 | 23 | void Expr::Accept_Expr(Visitor_Expr& iVisitor) 24 | { iVisitor.Visit_Expr(this); } 25 | 26 | int Expr::Compare(const ZP& iOther) 27 | { 28 | if (int compare = strcmp(sTypeIdName(*this), sTypeIdName(*iOther.Get()))) 29 | return compare; 30 | return 0; 31 | } 32 | 33 | std::string Expr::DebugDescription() 34 | { return sStringf("%p/", this) + sTypeIdName(*this); } 35 | 36 | // ================================================================================================= 37 | #pragma mark - Visitor_Expr 38 | 39 | void Visitor_Expr::Visit_Expr(const ZP& iExpr) 40 | { this->Visit(iExpr); } 41 | 42 | } // namespace ZooLib 43 | -------------------------------------------------------------------------------- /Project/zoolib/Expr/Expr.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Expr_Expr_h__ 4 | #define __ZooLib_Expr_Expr_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Visitor.h" 8 | 9 | #include 10 | 11 | namespace ZooLib { 12 | 13 | class Visitor_Expr; 14 | 15 | // ================================================================================================= 16 | #pragma mark - Expr 17 | 18 | class Expr : public Visitee 19 | { 20 | public: 21 | // From Visitee 22 | virtual void Accept(const Visitor& iVisitor); 23 | 24 | // Our protocol 25 | virtual void Accept_Expr(Visitor_Expr& iVisitor); 26 | 27 | virtual int Compare(const ZP& iOther); 28 | 29 | virtual std::string DebugDescription(); 30 | }; 31 | 32 | // ================================================================================================= 33 | #pragma mark - Visitor_Expr 34 | 35 | class Visitor_Expr 36 | : public virtual Visitor 37 | { 38 | public: 39 | // Our protocol 40 | virtual void Visit_Expr(const ZP& iExpr); 41 | }; 42 | 43 | } // namespace ZooLib 44 | 45 | #endif // __ZooLib_Expr_Expr_h__ 46 | -------------------------------------------------------------------------------- /Project/zoolib/Expr/Util_Expr_Bool_CNF.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Expr_Util_Expr_Bool_CNF_h__ 4 | #define __ZooLib_Expr_Util_Expr_Bool_CNF_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/TagVal.h" 8 | 9 | #include "zoolib/Expr/Expr_Bool.h" 10 | 11 | #include 12 | 13 | namespace ZooLib { 14 | namespace Util_Expr_Bool { 15 | 16 | // ================================================================================================= 17 | #pragma mark - Util_Expr_Bool 18 | 19 | // CNF == Conjunctive Normal Form (an AND of ORs of terms, ie an AND of DClauses). 20 | // DClause is a disjunction of literals (an OR of terms). 21 | // Term is a literal or the negation of a literal. 22 | 23 | typedef TagVal,struct Tag_Clause> Term; 24 | typedef std::set DClause; 25 | typedef std::set CNF; 26 | 27 | ZP sFromCNF(const CNF& iCNF); 28 | CNF sAsCNF(const ZP& iExpr); 29 | 30 | } // namespace Util_Expr_Bool 31 | } // namespace ZooLib 32 | 33 | #endif // __ZooLib_Expr_Util_Expr_Bool_CNF_h__ 34 | -------------------------------------------------------------------------------- /Project/zoolib/Expr/Util_Strim_Expr_Bool.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Expr_Util_Strim_Expr_Bool_h__ 4 | #define __ZooLib_Expr_Util_Strim_Expr_Bool_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Callable.h" 8 | #include "zoolib/Chan_UTF.h" 9 | 10 | #include "zoolib/Expr/Expr_Bool.h" 11 | 12 | namespace ZooLib { 13 | namespace Util_Strim_Expr_Bool { 14 | 15 | // ================================================================================================= 16 | #pragma mark - Util_Strim_Expr_Bool 17 | 18 | typedef Callable(const ChanRU_UTF& iChanRU)> 19 | Callable_Terminal; 20 | 21 | ZP sQFromStrim( 22 | const ZP& iCallable_Terminal, 23 | const ChanRU_UTF& iChanRU); 24 | 25 | } // namespace Util_Strim_Expr_Bool 26 | } // namespace ZooLib 27 | 28 | #endif // __ZooLib_Expr_Util_Strim_Expr_Bool_h__ 29 | -------------------------------------------------------------------------------- /Project/zoolib/Expr/Visitor_Expr_Bool_Do_Eval.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/Expr/Visitor_Expr_Bool_Do_Eval.h" 4 | 5 | namespace ZooLib { 6 | 7 | // ================================================================================================= 8 | #pragma mark - Visitor_Expr_Bool_Do_Eval 9 | 10 | void Visitor_Expr_Bool_Do_Eval::Visit_Expr_Bool_True(const ZP& iRep) 11 | { this->pSetResult(true); } 12 | 13 | void Visitor_Expr_Bool_Do_Eval::Visit_Expr_Bool_False(const ZP& iRep) 14 | { this->pSetResult(false); } 15 | 16 | void Visitor_Expr_Bool_Do_Eval::Visit_Expr_Bool_Not(const ZP& iRep) 17 | { this->pSetResult(not this->Do(iRep)); } 18 | 19 | void Visitor_Expr_Bool_Do_Eval::Visit_Expr_Bool_And(const ZP& iRep) 20 | { this->pSetResult(this->Do(iRep->GetOp0()) && this->Do(iRep->GetOp1())); } 21 | 22 | void Visitor_Expr_Bool_Do_Eval::Visit_Expr_Bool_Or(const ZP& iRep) 23 | { this->pSetResult(this->Do(iRep->GetOp0()) || this->Do(iRep->GetOp1())); } 24 | 25 | } // namespace ZooLib 26 | -------------------------------------------------------------------------------- /Project/zoolib/Expr/Visitor_Expr_Bool_ToStrim.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Expr_Visitor_Expr_Bool_ToStrim_h__ 4 | #define __ZooLib_Expr_Visitor_Expr_Bool_ToStrim_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Visitor_ToStrim.h" 8 | 9 | #include "zoolib/Expr/Expr_Bool.h" 10 | 11 | namespace ZooLib { 12 | 13 | // ================================================================================================= 14 | #pragma mark - Visitor_Expr_Bool_ToStrim 15 | 16 | class Visitor_Expr_Bool_ToStrim 17 | : public virtual Visitor_ToStrim 18 | , public virtual Visitor_Expr_Bool_True 19 | , public virtual Visitor_Expr_Bool_False 20 | , public virtual Visitor_Expr_Bool_Not 21 | , public virtual Visitor_Expr_Bool_And 22 | , public virtual Visitor_Expr_Bool_Or 23 | { 24 | public: 25 | virtual void Visit_Expr_Bool_True(const ZP& iRep); 26 | virtual void Visit_Expr_Bool_False(const ZP& iRep); 27 | virtual void Visit_Expr_Bool_Not(const ZP& iRep); 28 | virtual void Visit_Expr_Bool_And(const ZP& iRep); 29 | virtual void Visit_Expr_Bool_Or(const ZP& iRep); 30 | }; 31 | 32 | } // namespace ZooLib 33 | 34 | #endif // __ZooLib_Expr_Visitor_Expr_Bool_ToStrim_h__ 35 | -------------------------------------------------------------------------------- /Project/zoolib/GameEngine/CoT.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/GameEngine/CoT.h" 4 | 5 | #include "zoolib/GameEngine/Cog_Toon.h" 6 | 7 | namespace ZooLib { 8 | namespace GameEngine { 9 | 10 | // ================================================================================================= 11 | #pragma mark - sCoT 12 | 13 | // CoT == Cog or Toon. 14 | 15 | // Attempts to instantiate a Cog from the Val, and if that fails it attempts to 16 | // instantiate a Toon wrapped in a sCog_Toon. 17 | 18 | Cog sCoT(const ZQ& iVal) 19 | { 20 | if (Cog theCog = sCog(iVal)) 21 | return theCog; 22 | 23 | return sCog_Toon(sToon(iVal)); 24 | } 25 | 26 | } // namespace GameEngine 27 | } // namespace ZooLib 28 | -------------------------------------------------------------------------------- /Project/zoolib/GameEngine/CoT.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_GameEngine_CoT_h__ 4 | #define __ZooLib_GameEngine_CoT_h__ 1 5 | 6 | #include "zoolib/GameEngine/Cog.h" 7 | 8 | namespace ZooLib { 9 | namespace GameEngine { 10 | 11 | Cog sCoT(const ZQ& iVal); 12 | 13 | } // namespace GameEngine 14 | } // namespace ZooLib 15 | 16 | #endif // __ZooLib_GameEngine_CoT_h__ 17 | -------------------------------------------------------------------------------- /Project/zoolib/GameEngine/Cog_Buffer.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_GameEngine_Cog_Buffer_h__ 4 | #define __ZooLib_GameEngine_Cog_Buffer_h__ 1 5 | 6 | #include "zoolib/GameEngine/Cog.h" 7 | #include "zoolib/GameEngine/Tween_BlushGainMat.h" 8 | 9 | namespace ZooLib { 10 | namespace GameEngine { 11 | 12 | Cog sCog_Buffer(int iWidth, int iHeight, const RGBA& iFill, const Cog& iChild); 13 | 14 | Cog sCog_Buffer_Continue(const ZP& iTween, 15 | int iWidth, int iHeight, const RGBA& iFill, const Cog& iChild); 16 | 17 | } // namespace GameEngine 18 | } // namespace ZooLib 19 | 20 | #endif // __ZooLib_GameEngine_Cog_Buffer_h__ 21 | -------------------------------------------------------------------------------- /Project/zoolib/GameEngine/Cog_Button.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/GameEngine/Cog.h" 4 | 5 | namespace ZooLib { 6 | namespace GameEngine { 7 | 8 | Cog sCog_Button( 9 | const ZP& iTouchListener, 10 | const Cog& iCog_UpOut, 11 | const Cog& iCog_DownIn, 12 | const Cog& iCog_DownOut, 13 | const Cog& iCog_Pushed 14 | ); 15 | 16 | } // namespace GameEngine 17 | } // namespace ZooLib 18 | -------------------------------------------------------------------------------- /Project/zoolib/GameEngine/Cog_Delay.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_GameEngine_Cog_Delay_h__ 4 | #define __ZooLib_GameEngine_Cog_Delay_h__ 1 5 | 6 | #include "zoolib/GameEngine/Cog.h" 7 | 8 | namespace ZooLib { 9 | namespace GameEngine { 10 | 11 | // ================================================================================================= 12 | #pragma mark - Delay cogs 13 | 14 | Cog sCog_DelayUntil(double iElapsed); 15 | Cog sCog_DelayFor(double iDelay); 16 | 17 | Cog sCog_StartAt(double iElapsed, const Cog& iCog); 18 | Cog sCog_StopAt(double iElapsed, const Cog& iCog); 19 | Cog sCog_StartAfter(double iDelay, const Cog& iCog); 20 | Cog sCog_StopAfter(double iDelay, const Cog& iCog); 21 | 22 | } // namespace GameEngine 23 | } // namespace ZooLib 24 | 25 | #endif // __ZooLib_GameEngine_Cog_Delay_h__ 26 | -------------------------------------------------------------------------------- /Project/zoolib/GameEngine/Cog_Distribute.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_GameEngine_Cog_Distribute_h__ 4 | #define __ZooLib_GameEngine_Cog_Distribute_h__ 1 5 | 6 | #include "zoolib/GameEngine/Cog.h" 7 | 8 | namespace ZooLib { 9 | namespace GameEngine { 10 | 11 | // ================================================================================================= 12 | #pragma mark - 13 | 14 | Cog sCog_Distribute(CVec3 iSpacing, const std::vector& iCogs); 15 | 16 | } // namespace GameEngine 17 | } // namespace ZooLib 18 | 19 | #endif // __ZooLib_GameEngine_Cog_Distribute_h__ 20 | -------------------------------------------------------------------------------- /Project/zoolib/GameEngine/Cog_Group.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_GameEngine_Cog_Group_h__ 4 | #define __ZooLib_GameEngine_Cog_Group_h__ 1 5 | 6 | #include "zoolib/GameEngine/Cog.h" 7 | #include "zoolib/GameEngine/Tween_BlushGainMat.h" 8 | #include "zoolib/GameEngine/Types.h" 9 | 10 | namespace ZooLib { 11 | namespace GameEngine { 12 | 13 | Cog sCog_Group_WithState(const SharedState& iState, const Cog& iChild); 14 | 15 | Cog sCog_Group_WithBlushGainMat(const BlushGainMat& iBlushGainMat, const Cog& iChild); 16 | 17 | Cog sCog_Group_Loop(const ZP& iTween, const Cog& iChild); 18 | Cog sCog_Group_Terminate(const ZP& iTween, const Cog& iChild); 19 | Cog sCog_Group_Continue(const ZP& iTween, const Cog& iChild); 20 | 21 | ZP sRendered_BlushGainMat(const BlushGainMat& iBGM, ZP iRendered); 22 | 23 | } // namespace GameEngine 24 | } // namespace ZooLib 25 | 26 | #endif // __ZooLib_GameEngine_Cog_Group_h__ 27 | -------------------------------------------------------------------------------- /Project/zoolib/GameEngine/Cog_Indirect.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_GameEngine_Cog_Indirect_h__ 4 | #define __ZooLib_GameEngine_Cog_Indirect_h__ 1 5 | 6 | #include "zoolib/GameEngine/Cog.h" 7 | #include "zoolib/GameEngine/Types.h" 8 | 9 | namespace ZooLib { 10 | namespace GameEngine { 11 | 12 | // ================================================================================================= 13 | #pragma mark - CogIndirect 14 | 15 | void sSetIndirect(const Cog& iLHS, const Cog& iRHS); 16 | 17 | Cog sCog_Indirect(); 18 | Cog sCog_Indirect(Seq& ioSeq); 19 | 20 | Cog sCog_KillIndirects(SharedState_Mutable& ioState, const string8& iName); 21 | 22 | } // namespace GameEngine 23 | } // namespace ZooLib 24 | 25 | #endif // __ZooLib_GameEngine_Cog_Indirect_h__ 26 | -------------------------------------------------------------------------------- /Project/zoolib/GameEngine/Cog_NookScope.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_GameEngine_Cog_NookScope_h__ 4 | #define __ZooLib_GameEngine_Cog_NookScope_h__ 1 5 | 6 | #include "zoolib/GameEngine/Cog.h" 7 | 8 | namespace ZooLib { 9 | namespace GameEngine { 10 | 11 | Cog sCog_NookScope(const ZP& iNookScope, const Cog& iChild); 12 | 13 | Cog sCog_NookScope(const Cog& iChild); 14 | 15 | } // namespace GameEngine 16 | } // namespace ZooLib 17 | 18 | #endif // __ZooLib_GameEngine_Cog_NookScope_h__ 19 | -------------------------------------------------------------------------------- /Project/zoolib/GameEngine/Cog_Random.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/GameEngine/Cog_Random.h" 4 | 5 | namespace ZooLib { 6 | namespace GameEngine { 7 | 8 | // ================================================================================================= 9 | #pragma mark - 10 | 11 | static 12 | Cog spCogFun_Random(const Cog& iSelf, const Param& iParam, 13 | double iRatio, const Cog& iCog0, const Cog& iCog1) 14 | { 15 | if (sRandomInRange(0, 1) <= iRatio) 16 | return sCallCog(iCog0, iParam); 17 | else 18 | return sCallCog(iCog1, iParam); 19 | } 20 | 21 | Cog sCog_Random(double iRatio, const Cog& iCog0, const Cog& iCog1) 22 | { 23 | GEMACRO_Callable(spCallable, spCogFun_Random); 24 | return sBindR(spCallable, iRatio, iCog0, iCog1); 25 | } 26 | 27 | static 28 | Cog spCogCtor_Random(const Map& iMap) 29 | { 30 | double ratio = sQRat(iMap.QGet("Ratio")) | Rat(1.0); 31 | Cog cog0 = sCog(iMap.Get("Cog0")); 32 | Cog cog1 = sCog(iMap.Get("Cog1")); 33 | return sCog_Random(ratio, cog0, cog1); 34 | } 35 | 36 | static 37 | CogRegistration spCogRegistration_Random("CogCtor_Random", spCogCtor_Random); 38 | 39 | } // namespace GameEngine 40 | } // namespace ZooLib 41 | -------------------------------------------------------------------------------- /Project/zoolib/GameEngine/Cog_Random.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_GameEngine_Cog_Random_h__ 4 | #define __ZooLib_GameEngine_Cog_Random_h__ 1 5 | 6 | #include "zoolib/GameEngine/Cog.h" 7 | 8 | namespace ZooLib { 9 | namespace GameEngine { 10 | 11 | // ================================================================================================= 12 | #pragma mark - 13 | 14 | Cog sCog_Random(double iRatio, const Cog& iCog0, const Cog& iCog1); 15 | 16 | } // namespace GameEngine 17 | } // namespace ZooLib 18 | 19 | #endif // __ZooLib_GameEngine_Cog_Random_h__ 20 | -------------------------------------------------------------------------------- /Project/zoolib/GameEngine/Cog_Replicate.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_GameEngine_Cog_Replicate_h__ 4 | #define __ZooLib_GameEngine_Cog_Replicate_h__ 1 5 | 6 | #include "zoolib/GameEngine/Cog.h" 7 | 8 | namespace ZooLib { 9 | namespace GameEngine { 10 | 11 | // ================================================================================================= 12 | #pragma mark - 13 | 14 | Cog sCog_Replicate(CVec3 iSpacing, size_t iCount, Cog iCog); 15 | 16 | } // namespace GameEngine 17 | } // namespace ZooLib 18 | 19 | #endif // __ZooLib_GameEngine_Cog_Replicate_h__ 20 | -------------------------------------------------------------------------------- /Project/zoolib/GameEngine/Cog_Sound.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_GameEngine_Cog_Sound_h__ 4 | #define __ZooLib_GameEngine_Cog_Sound_h__ 1 5 | 6 | #include "zoolib/GameEngine/Cog.h" 7 | 8 | namespace ZooLib { 9 | namespace GameEngine { 10 | 11 | // ================================================================================================= 12 | #pragma mark - Sound cogs 13 | 14 | Cog sCog_Sound(const string8& iName); 15 | Cog sCog_Sound(const string8& iName, const string8& iScope, bool iDetached); 16 | 17 | } // namespace GameEngine 18 | } // namespace ZooLib 19 | 20 | #endif // __ZooLib_GameEngine_Cog_Sound_h__ 21 | -------------------------------------------------------------------------------- /Project/zoolib/GameEngine/Cog_Toon.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_GameEngine_Cog_Toon_h__ 4 | #define __ZooLib_GameEngine_Cog_Toon_h__ 1 5 | 6 | #include "zoolib/GameEngine/Cog.h" 7 | #include "zoolib/GameEngine/Toon.h" 8 | 9 | namespace ZooLib { 10 | namespace GameEngine { 11 | 12 | Cog sCog_Toon_NoEpoch(const ZP& iToon); 13 | 14 | Cog sCog_Toon(const ZP& iToon); 15 | 16 | } // namespace GameEngine 17 | } // namespace ZooLib 18 | 19 | #endif // __ZooLib_GameEngine_Cog_Toon_h__ 20 | -------------------------------------------------------------------------------- /Project/zoolib/GameEngine/DebugFlags.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/GameEngine/DebugFlags.h" 4 | 5 | // ================================================================================================= 6 | #pragma mark - 7 | 8 | namespace ZooLib { 9 | namespace GameEngine { 10 | 11 | bool DebugFlags::sTouches; 12 | bool DebugFlags::sTextureBounds; 13 | bool DebugFlags::sTextureNameFrame; 14 | bool DebugFlags::sInfo; 15 | bool DebugFlags::sInfoText; 16 | 17 | } // namespace GameEngine 18 | } // namespace ZooLib 19 | -------------------------------------------------------------------------------- /Project/zoolib/GameEngine/DebugFlags.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_GameEngine_DebugFlags_h__ 4 | #define __ZooLib_GameEngine_DebugFlags_h__ 1 5 | #include "zconfig.h" 6 | 7 | // ================================================================================================= 8 | #pragma mark - 9 | 10 | namespace ZooLib { 11 | namespace GameEngine { 12 | 13 | struct DebugFlags 14 | { 15 | static bool sTouches; 16 | static bool sTextureBounds; 17 | static bool sTextureNameFrame; 18 | static bool sInfo; 19 | static bool sInfoText; 20 | }; 21 | 22 | } // namespace GameEngine 23 | } // namespace ZooLib 24 | 25 | #endif // __ZooLib_GameEngine_DebugFlags_h__ 26 | -------------------------------------------------------------------------------- /Project/zoolib/GameEngine/DrawPreprocess.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_GameEngine_Util_DrawPreprocess_h__ 4 | #define __ZooLib_GameEngine_Util_DrawPreprocess_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/GameEngine/AssetCatalog.h" 8 | #include "zoolib/GameEngine/FontCatalog.h" 9 | #include "zoolib/GameEngine/Rendered.h" 10 | 11 | namespace ZooLib { 12 | namespace GameEngine { 13 | 14 | ZP sDrawPreprocess(const ZP& iRendered, 15 | const ZP& iAssetCatalog, bool iShowNameFrame, 16 | const ZP& iFontCatalog, 17 | const GPoint& iGameSize); 18 | 19 | } // namespace GameEngine 20 | } // namespace ZooLib 21 | 22 | #endif // __ZooLib_GameEngine_Util_DrawPreprocess_h__ 23 | -------------------------------------------------------------------------------- /Project/zoolib/GameEngine/Draw_GL.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/GameEngine/Draw_GL.h" 4 | #include "zoolib/OpenGL/Util.h" 5 | 6 | #include "zoolib/Unicode.h" 7 | 8 | #include "zoolib/ZMACRO_foreach.h" 9 | 10 | namespace ZooLib { 11 | namespace GameEngine { 12 | 13 | } // namespace GameEngine 14 | } // namespace ZooLib 15 | -------------------------------------------------------------------------------- /Project/zoolib/GameEngine/Draw_GL.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_GameEngine_Draw_GL_h__ 4 | #define __ZooLib_GameEngine_Draw_GL_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/GameEngine/Visitor_Rendered_Std.h" 8 | 9 | namespace ZooLib { 10 | namespace GameEngine { 11 | 12 | } // namespace GameEngine 13 | } // namespace ZooLib 14 | 15 | #endif // __ZooLib_GameEngine_Draw_GL_h__ 16 | -------------------------------------------------------------------------------- /Project/zoolib/GameEngine/RenderGame.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_GameEngine_RenderGame_h__ 4 | #define __ZooLib_GameEngine_RenderGame_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/GameEngine/Rendered.h" 8 | #include "zoolib/GameEngine/Sound.h" 9 | 10 | namespace ZooLib { 11 | namespace GameEngine { 12 | 13 | // ================================================================================================= 14 | #pragma mark - 15 | 16 | GPoint sPixelToGame(const GPoint& iPixelSize, const GPoint& iGameSize, GPoint iPixelPoint); 17 | 18 | void sRenderGame(const ZP& iRendered, 19 | const GPoint& iPixelSize, 20 | const GPoint& iGameSize, 21 | bool iShowBounds, bool iShowOrigin, 22 | const ZP& iSoundMeister, Rat iListenerL, Rat iListenerR, Rat iListenerD); 23 | 24 | } // namespace GameEngine 25 | } // namespace ZooLib { 26 | 27 | #endif // __ZooLib_GameEngine_RenderGame_h__ 28 | -------------------------------------------------------------------------------- /Project/zoolib/GameEngine/Sound.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/GameEngine/Sound.h" 4 | 5 | namespace ZooLib { 6 | namespace GameEngine { 7 | 8 | // ================================================================================================= 9 | #pragma mark - Sound 10 | 11 | Sound::Sound() 12 | : fDetached(false) 13 | {} 14 | 15 | Sound::~Sound() 16 | {} 17 | 18 | // ================================================================================================= 19 | #pragma mark - SoundMeister 20 | 21 | SoundMeister::SoundMeister() 22 | {} 23 | 24 | SoundMeister::~SoundMeister() 25 | {} 26 | 27 | } // namespace GameEngine 28 | } // namespace ZooLib 29 | -------------------------------------------------------------------------------- /Project/zoolib/GameEngine/Texture.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/GameEngine/Texture.h" 4 | 5 | namespace ZooLib { 6 | namespace GameEngine { 7 | 8 | // ================================================================================================= 9 | #pragma mark - Texture 10 | 11 | Texture::Texture() 12 | : fPixelCount(0) 13 | {} 14 | 15 | Texture::~Texture() 16 | {} 17 | 18 | } // namespace GameEngine 19 | } // namespace ZooLib 20 | -------------------------------------------------------------------------------- /Project/zoolib/GameEngine/Texture.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_GameEngine_Texture_h__ 4 | #define __ZooLib_GameEngine_Texture_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Callable.h" 8 | 9 | #include "zoolib/Pixels/Pixmap.h" 10 | 11 | namespace ZooLib { 12 | namespace GameEngine { 13 | 14 | // ================================================================================================= 15 | #pragma mark - Texture 16 | 17 | class Texture 18 | : public Counted 19 | { 20 | protected: 21 | Texture(); 22 | 23 | public: 24 | virtual ~Texture(); 25 | 26 | virtual Pixels::PointPOD GetDrawnSize() = 0; 27 | 28 | virtual void Orphan() = 0; 29 | 30 | size_t fPixelCount; 31 | }; 32 | 33 | typedef Callable(const Pixels::Pixmap&)> Callable_TextureFromPixmap; 34 | 35 | } // namespace GameEngine 36 | } // namespace ZooLib 37 | 38 | #endif // __ZooLib_GameEngine_Texture_h__ 39 | -------------------------------------------------------------------------------- /Project/zoolib/GameEngine/Toon.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_GameEngine_Toon_h__ 4 | #define __ZooLib_GameEngine_Toon_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/CountedVal.h" 8 | 9 | #include "zoolib/GameEngine/Tween.h" 10 | 11 | namespace ZooLib { 12 | namespace GameEngine { 13 | 14 | // ================================================================================================= 15 | #pragma mark - Toon 16 | 17 | typedef ZP > > CelStack; 18 | 19 | typedef Tween Toon; 20 | 21 | // ================================================================================================= 22 | #pragma mark - sToon aka sTween 23 | 24 | ZP sToon(const ZQ& iValQ); 25 | 26 | // ================================================================================================= 27 | #pragma mark - ToonRegistration 28 | 29 | class ToonRegistration 30 | { 31 | public: 32 | typedef ZP(*Fun)(const Map& iMap); 33 | 34 | ToonRegistration(const string8& iCtorName, Fun iFun); 35 | 36 | static ZP sCtor(const string8& iCtorName, const Map& iMap); 37 | }; 38 | 39 | } // namespace GameEngine 40 | } // namespace ZooLib 41 | 42 | #endif // __ZooLib_GameEngine_Toon_h__ 43 | -------------------------------------------------------------------------------- /Project/zoolib/GameEngine/Tween_Rat.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_GameEngine_Tween_Rat_h__ 4 | #define __ZooLib_GameEngine_Tween_Rat_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/GameEngine/Tween.h" 8 | #include "zoolib/GameEngine/Types.h" 9 | 10 | namespace ZooLib { 11 | namespace GameEngine { 12 | 13 | typedef Tween Tween_Rat; 14 | 15 | // ================================================================================================= 16 | #pragma mark - RatRegistration 17 | 18 | class RatRegistration 19 | { 20 | public: 21 | typedef ZP(*Fun)(const Map& iMap); 22 | 23 | RatRegistration(const string8& iCtorName, Fun iFun); 24 | 25 | static ZP sCtor(const string8& iCtorName, const Map& iMap); 26 | }; 27 | 28 | } // namespace GameEngine 29 | } // namespace ZooLib 30 | 31 | #endif // __GameEngine_Tween_Rat_h__ 32 | -------------------------------------------------------------------------------- /Project/zoolib/GameEngine/Util_AssetCatalog.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __GameEngine_Util_AssetCatalog_h__ 4 | #define __GameEngine_Util_AssetCatalog_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/GameEngine/AssetCatalog.h" 8 | 9 | namespace ZooLib { 10 | namespace GameEngine { 11 | 12 | // ================================================================================================= 13 | #pragma mark - 14 | 15 | void sPopulate( 16 | const ZP& iAC, 17 | const FileSpec& iRoot, 18 | const ZP& iTFP, 19 | bool iPreferProcessedArt, bool iPreferSmallArt); 20 | 21 | } // namespace GameEngine 22 | } // namespace ZooLib 23 | 24 | #endif // __GameEngine_Util_AssetCatalog_h__ 25 | -------------------------------------------------------------------------------- /Project/zoolib/GameEngine/Util_Assets.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/GameEngine/Util_Assets.h" 4 | #include "zoolib/GameEngine/Util_TextData.h" // For sQReadMap_ZZ 5 | 6 | #include "zoolib/Util_string.h" 7 | 8 | namespace ZooLib { 9 | namespace GameEngine { 10 | 11 | using std::map; 12 | using namespace Util_string; 13 | 14 | // ================================================================================================= 15 | #pragma mark - 16 | 17 | bool sReadAnim(const FileSpec& iFS, map& oFiles, Map_ZZ& oMap) 18 | { 19 | if (not iFS.IsDir()) 20 | return false; 21 | 22 | for (FileIter iter = iFS; iter; iter.Advance()) 23 | { 24 | const FileSpec current = iter.Current(); 25 | if (ZQ woSuffix = sQWithoutSuffix(current.Name(), ".png")) 26 | oFiles[current.Name()] = current; 27 | } 28 | 29 | if (oFiles.empty()) 30 | return false; 31 | 32 | oMap = sGet(sQReadMap_ZZ(iFS.Child("meta.txt"))); 33 | 34 | return true; 35 | } 36 | 37 | } // namespace GameEngine 38 | } // namespace ZooLib 39 | -------------------------------------------------------------------------------- /Project/zoolib/GameEngine/Util_Assets.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_GameEngine_Util_Assets_h__ 4 | #define __ZooLib_GameEngine_Util_Assets_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/File.h" 8 | #include "zoolib/Val_ZZ.h" 9 | 10 | #include 11 | 12 | namespace ZooLib { 13 | namespace GameEngine { 14 | 15 | // ================================================================================================= 16 | #pragma mark - 17 | 18 | bool sReadAnim(const FileSpec& iFS, std::map& oFiles, Map_ZZ& oMap); 19 | 20 | } // namespace GameEngine 21 | } // namespace ZooLib 22 | 23 | #endif // __ZooLib_GameEngine_Util_Assets_h__ 24 | -------------------------------------------------------------------------------- /Project/zoolib/GameEngine/Util_FinderHider.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_GameEngine_Util_FinderHider_h__ 4 | #define __ZooLib_GameEngine_Util_FinderHider_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/GameEngine/Rendered.h" 8 | 9 | namespace ZooLib { 10 | namespace GameEngine { 11 | namespace Util { 12 | 13 | // ================================================================================================= 14 | #pragma mark - sFinderHider 15 | 16 | ZP sFinderHider( 17 | const ZP& iRendered, 18 | GPoint iBackingSize, 19 | GPoint iGameSize); 20 | 21 | } // namespace Util 22 | } // namespace GameEngine 23 | } // namespace ZooLib 24 | 25 | #endif // __ZooLib_GameEngine_Util_FinderHider_h__ 26 | -------------------------------------------------------------------------------- /Project/zoolib/GameEngine/Util_GrindAssets.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __GameEngine_Util_GrindAssets_h__ 4 | #define __GameEngine_Util_GrindAssets_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/File.h" 8 | 9 | #include "zoolib/GameEngine/Types.h" 10 | 11 | #include 12 | 13 | namespace GameEngine { 14 | namespace Util { 15 | 16 | void sGrindArt( 17 | Rat iScale, int iBaseDim, int iDoublings, 18 | const FileSpec& iFS, const FileSpec& iFS_Sheets, Map_ZZ& ioMap); 19 | 20 | void sGrindAnim( 21 | Rat iScale, int iBaseDim, int iDoublings, 22 | const FileSpec& iFS, const FileSpec& iFS_Sheets, Map_ZZ& ioMap); 23 | 24 | } // namespace Util 25 | } // namespace GameEngine 26 | 27 | #endif // __GameEngine_Util_GrindAssets_h__ 28 | -------------------------------------------------------------------------------- /Project/zoolib/GameEngine/Util_TextData.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_GameEngine_Util_TextData_h__ 4 | #define __ZooLib_GameEngine_Util_TextData_h__ 1 5 | 6 | #include "zoolib/File.h" // For FileSpec 7 | #include "zoolib/Val_ZZ.h" 8 | 9 | namespace ZooLib { 10 | namespace GameEngine { 11 | 12 | // ================================================================================================= 13 | #pragma mark - 14 | 15 | ZQ sQReadMap_ZZ(const ChanR_Bin& iChanR, const string8* iName = nullptr); 16 | ZQ sQReadMap_ZZ(const ChanR_Bin& iChanR, const string8& iName); 17 | ZQ sQReadMap_ZZ(const FileSpec& iFS); 18 | 19 | Map_ZZ sReadTextData(const FileSpec& iFS); 20 | 21 | } // namespace GameEngine 22 | } // namespace ZooLib 23 | 24 | #endif // __ZooLib_GameEngine_Util_TextData_h__ 25 | -------------------------------------------------------------------------------- /Project/zoolib/HTTP/Connect.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/HTTP/Connect.h" 4 | 5 | #include "zoolib/Chan_XX_Buffered.h" 6 | #include "zoolib/Net_Internet.h" 7 | 8 | //###include "zoolib/ZStreamerRWCon_SSL.h" 9 | 10 | namespace ZooLib { 11 | namespace HTTP { 12 | 13 | // ================================================================================================= 14 | #pragma mark - HTTP::sQConnect 15 | 16 | ZP sConnect(const std::string& iHost, uint16 iPort, bool iUseSSL) 17 | { 18 | if (ZP theSR = sCall(sZP(new NetName_Internet(iHost, iPort)))) 19 | { 20 | //## theComboQ->SetW(new ChanW_XX_Buffered(theComboQ->GetW())) 21 | 22 | if (not iUseSSL) 23 | return theSR; 24 | 25 | //## if (ZP wrapped = sStreamerRWCon_SSL(theEP, theSW)) 26 | //## return Connection_t(wrapped, wrapped, new ChannerClose_RWCon(wrapped)); 27 | } 28 | return null; 29 | } 30 | 31 | } // namespace HTTP 32 | } // namespace ZooLib 33 | -------------------------------------------------------------------------------- /Project/zoolib/HTTP/Connect.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_HTTP_Connect_h__ 4 | #define __ZooLib_HTTP_Connect_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Connection.h" 8 | 9 | namespace ZooLib { 10 | namespace HTTP { 11 | 12 | // ================================================================================================= 13 | #pragma mark - HTTP 14 | 15 | typedef Callable(const std::string& iHost, uint16 iPort, bool iUseSSL)> 16 | Callable_Connect; 17 | 18 | ZP sConnect(const std::string& iHost, uint16 iPort, bool iUseSSL); 19 | 20 | } // namespace HTTP 21 | } // namespace ZooLib 22 | 23 | #endif // __ZooLib_HTTP_Connect_h__ 24 | -------------------------------------------------------------------------------- /Project/zoolib/Pixels/PixmapCoder_PNG.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2002 Andrew Green and Learning in Motion, Inc. 2 | // MIT License. http://www.zoolib.org 3 | 4 | #ifndef __ZooLib_Pixels_PixmapCoder_PNG_h__ 5 | #define __ZooLib_Pixels_PixmapCoder_PNG_h__ 1 6 | #include "zconfig.h" 7 | 8 | #include "zoolib/Pixels/Pixmap.h" 9 | #include "zoolib/ChanR_Bin.h" 10 | #include "zoolib/ChanW_Bin.h" 11 | 12 | namespace ZooLib { 13 | namespace Pixels { 14 | 15 | // ================================================================================================= 16 | #pragma mark - 17 | 18 | Pixmap sReadPixmap_PNG(const ChanR_Bin& iChanR); 19 | 20 | void sWritePixmap_PNG(const Pixmap& iPixmap, const ChanW_Bin& iChanW); 21 | 22 | void sWritePixmap_PNG( 23 | const void* iBaseAddress, 24 | const RasterDesc& iRasterDesc, 25 | const PixelDesc& iPixelDesc, 26 | const RectPOD& iFrame, 27 | const ChanW_Bin& iChanW); 28 | 29 | } // namespace Pixels 30 | } // namespace ZooLib 31 | 32 | #endif // __ZooLib_Pixels_PixmapCoder_PNG_h__ 33 | -------------------------------------------------------------------------------- /Project/zoolib/Pixels/Pixval.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Pixels_Pixval_h__ 4 | #define __ZooLib_Pixels_Pixval_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/StdInt.h" // For uint32 8 | 9 | namespace ZooLib { 10 | namespace Pixels { 11 | 12 | typedef uint32 Pixval; 13 | 14 | } // namespace Pixels 15 | } // namespace ZooLib 16 | 17 | #endif // __ZooLib_Pixels_Pixval_h__ 18 | -------------------------------------------------------------------------------- /Project/zoolib/Pixels/PixvalDesc.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_Pixels_PixvalDesc_h__ 4 | #define __ZooLib_Pixels_PixvalDesc_h__ 1 5 | #include "zconfig.h" 6 | 7 | namespace ZooLib { 8 | namespace Pixels { 9 | 10 | // ================================================================================================= 11 | #pragma mark - PixvalDesc 12 | 13 | /** PixvalDesc describes how a single pixval is laid out. */ 14 | 15 | class PixvalDesc 16 | { 17 | public: 18 | PixvalDesc() {} 19 | 20 | PixvalDesc(int iDepth, bool iBigEndian) 21 | : fDepth(iDepth) 22 | , fBigEndian(iBigEndian) 23 | {} 24 | 25 | bool operator==(const PixvalDesc& iOther) const 26 | { return fDepth == iOther.fDepth && fBigEndian == iOther.fBigEndian; } 27 | 28 | int fDepth; 29 | bool fBigEndian; 30 | }; 31 | 32 | } // namespace Pixels 33 | } // namespace ZooLib 34 | 35 | #endif // __ZooLib_Pixels_PixvalDesc_h__ 36 | -------------------------------------------------------------------------------- /Project/zoolib/QueryEngine/ResultFromWalker.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/QueryEngine/ResultFromWalker.h" 4 | 5 | #include "zoolib/Default.h" 6 | 7 | #include "zoolib/ZMACRO_foreach.h" 8 | 9 | namespace ZooLib { 10 | namespace QueryEngine { 11 | 12 | using std::map; 13 | using std::set; 14 | using std::vector; 15 | using RelationalAlgebra::RelHead; 16 | 17 | // ================================================================================================= 18 | #pragma mark - sQuery 19 | 20 | ZP sResultFromWalker(ZP iWalker) 21 | { 22 | map offsets; 23 | size_t baseOffset = 0; 24 | iWalker = iWalker->Prime(sDefault(), offsets, baseOffset); 25 | 26 | vector thePackedRows; 27 | vector theRow(baseOffset); 28 | for (;;) 29 | { 30 | if (not iWalker->QReadInc(&theRow[0])) 31 | break; 32 | 33 | foreacha (entry, offsets) 34 | thePackedRows.push_back(theRow[entry.second]); 35 | } 36 | 37 | RelHead theRelHead; 38 | foreacha (entry, offsets) 39 | theRelHead.insert(entry.first); 40 | 41 | return new Result(&theRelHead, &thePackedRows); 42 | } 43 | 44 | } // namespace QueryEngine 45 | } // namespace ZooLib 46 | -------------------------------------------------------------------------------- /Project/zoolib/QueryEngine/ResultFromWalker.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_QueryEngine_ResultFromWalker_h__ 4 | #define __ZooLib_QueryEngine_ResultFromWalker_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/QueryEngine/Result.h" 8 | #include "zoolib/QueryEngine/Walker.h" 9 | 10 | namespace ZooLib { 11 | namespace QueryEngine { 12 | 13 | // ================================================================================================= 14 | #pragma mark - sQuery 15 | 16 | ZP sResultFromWalker(ZP iWalker); 17 | 18 | } // namespace QueryEngine 19 | } // namespace ZooLib 20 | 21 | #endif // __ZooLib_QueryEngine_ResultFromWalker_h__ 22 | -------------------------------------------------------------------------------- /Project/zoolib/QueryEngine/Transform_Search.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_QueryEngine_Transform_Search_h__ 4 | #define __ZooLib_QueryEngine_Transform_Search_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/RelationalAlgebra/Expr_Rel.h" 8 | 9 | namespace ZooLib { 10 | namespace QueryEngine { 11 | 12 | // ================================================================================================= 13 | #pragma mark - sTransform_Search 14 | 15 | ZP sTransform_Search(const ZP& iExpr); 16 | 17 | } // namespace QueryEngine 18 | } // namespace ZooLib 19 | 20 | #endif // __ZooLib_QueryEngine_Transform_Search_h__ 21 | -------------------------------------------------------------------------------- /Project/zoolib/QueryEngine/Util_Strim_Walker.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_QueryEngine_Util_Strim_Walker_h__ 4 | #define __ZooLib_QueryEngine_Util_Strim_Walker_h__ 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/ChanW_UTF.h" 8 | #include "zoolib/QueryEngine/Walker.h" 9 | 10 | namespace ZooLib { 11 | namespace QueryEngine { 12 | 13 | // ================================================================================================= 14 | #pragma mark - sDumpWalkers 15 | 16 | void sDumpWalkers(const ChanW_UTF& ww, ZP iWalker); 17 | 18 | } // namespace QueryEngine 19 | } // namespace ZooLib 20 | 21 | #endif // __ZooLib_QueryEngine_Util_Strim_Walker_h__ 22 | -------------------------------------------------------------------------------- /Project/zoolib/QueryEngine/Walker_Comment.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_QueryEngine_Walker_Comment_h__ 4 | #define __ZooLib_QueryEngine_Walker_Comment_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Callable.h" 8 | 9 | #include "zoolib/QueryEngine/Walker.h" 10 | 11 | namespace ZooLib { 12 | namespace QueryEngine { 13 | 14 | // ================================================================================================= 15 | #pragma mark - Walker_Comment 16 | 17 | class Walker_Comment : public Walker_Unary 18 | { 19 | public: 20 | Walker_Comment(const ZP& iWalker, 21 | const string8& iComment, 22 | const ZP& iCallable); 23 | 24 | virtual ~Walker_Comment(); 25 | 26 | // From QueryEngine::Walker 27 | virtual ZP Prime( 28 | const std::map& iOffsets, 29 | std::map& oOffsets, 30 | size_t& ioBaseOffset); 31 | 32 | virtual bool QReadInc(Val_DB* ioResults); 33 | 34 | // Our protocol 35 | string8 GetComment(); 36 | 37 | private: 38 | const string8 fComment; 39 | const ZP fCallable; 40 | }; 41 | 42 | } // namespace QueryEngine 43 | } // namespace ZooLib 44 | 45 | #endif // __ZooLib_QueryEngine_Walker_Comment_h__ 46 | -------------------------------------------------------------------------------- /Project/zoolib/QueryEngine/Walker_Const.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/QueryEngine/Walker_Const.h" 4 | 5 | namespace ZooLib { 6 | namespace QueryEngine { 7 | 8 | using std::map; 9 | using std::set; 10 | 11 | // ================================================================================================= 12 | #pragma mark - Walker_Const 13 | 14 | Walker_Const::Walker_Const(const string8& iColName, const Val_DB& iVal) 15 | : fExhausted(false) 16 | , fColName(iColName) 17 | , fVal(iVal) 18 | {} 19 | 20 | Walker_Const::~Walker_Const() 21 | {} 22 | 23 | void Walker_Const::Rewind() 24 | { 25 | this->Called_Rewind(); 26 | fExhausted = false; 27 | } 28 | 29 | ZP Walker_Const::Prime( 30 | const map& iOffsets, 31 | map& oOffsets, 32 | size_t& ioBaseOffset) 33 | { 34 | fOutputOffset = ioBaseOffset++; 35 | oOffsets[fColName] = fOutputOffset; 36 | return this; 37 | } 38 | 39 | bool Walker_Const::QReadInc(Val_DB* ioResults) 40 | { 41 | this->Called_QReadInc(); 42 | 43 | if (sGetSet(fExhausted, true)) 44 | return false; 45 | 46 | ioResults[fOutputOffset] = fVal; 47 | return true; 48 | } 49 | 50 | } // namespace QueryEngine 51 | } // namespace ZooLib 52 | -------------------------------------------------------------------------------- /Project/zoolib/QueryEngine/Walker_Const.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_QueryEngine_Walker_Const_h__ 4 | #define __ZooLib_QueryEngine_Walker_Const_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/QueryEngine/Walker.h" 8 | 9 | namespace ZooLib { 10 | namespace QueryEngine { 11 | 12 | // ================================================================================================= 13 | #pragma mark - Walker_Const 14 | 15 | class Walker_Const : public Walker 16 | { 17 | public: 18 | Walker_Const(const string8& iColName, const Val_DB& iVal); 19 | virtual ~Walker_Const(); 20 | 21 | // From QueryEngine::Walker 22 | virtual void Rewind(); 23 | 24 | virtual ZP Prime( 25 | const std::map& iOffsets, 26 | std::map& oOffsets, 27 | size_t& ioBaseOffset); 28 | 29 | virtual bool QReadInc(Val_DB* ioResults); 30 | 31 | private: 32 | bool fExhausted; 33 | const string8 fColName; 34 | size_t fOutputOffset; 35 | const Val_DB fVal; 36 | }; 37 | 38 | } // namespace QueryEngine 39 | } // namespace ZooLib 40 | 41 | #endif // __ZooLib_QueryEngine_Walker_Const_h__ 42 | -------------------------------------------------------------------------------- /Project/zoolib/QueryEngine/Walker_Dee.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/QueryEngine/Walker_Dee.h" 4 | 5 | namespace ZooLib { 6 | namespace QueryEngine { 7 | 8 | using std::map; 9 | using std::set; 10 | 11 | // ================================================================================================= 12 | #pragma mark - Walker_Dee 13 | 14 | Walker_Dee::Walker_Dee() 15 | : fExhausted(false) 16 | {} 17 | 18 | Walker_Dee::~Walker_Dee() 19 | {} 20 | 21 | void Walker_Dee::Rewind() 22 | { 23 | this->Called_Rewind(); 24 | fExhausted = false; 25 | } 26 | 27 | ZP Walker_Dee::Prime( 28 | const map& iOffsets, 29 | map& oOffsets, 30 | size_t& ioBaseOffset) 31 | { return this; } 32 | 33 | bool Walker_Dee::QReadInc(Val_DB* ioResults) 34 | { 35 | this->Called_QReadInc(); 36 | return not sGetSet(fExhausted, true); 37 | } 38 | 39 | } // namespace QueryEngine 40 | } // namespace ZooLib 41 | -------------------------------------------------------------------------------- /Project/zoolib/QueryEngine/Walker_Dee.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_QueryEngine_Walker_Dee_h__ 4 | #define __ZooLib_QueryEngine_Walker_Dee_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/QueryEngine/Walker.h" 8 | 9 | namespace ZooLib { 10 | namespace QueryEngine { 11 | 12 | // ================================================================================================= 13 | #pragma mark - Walker_Dee 14 | 15 | class Walker_Dee : public Walker 16 | { 17 | public: 18 | Walker_Dee(); 19 | virtual ~Walker_Dee(); 20 | 21 | // From QueryEngine::Walker 22 | virtual void Rewind(); 23 | 24 | virtual ZP Prime( 25 | const std::map& iOffsets, 26 | std::map& oOffsets, 27 | size_t& ioBaseOffset); 28 | 29 | virtual bool QReadInc(Val_DB* ioResults); 30 | 31 | private: 32 | bool fExhausted; 33 | }; 34 | 35 | } // namespace QueryEngine 36 | } // namespace ZooLib 37 | 38 | #endif // __ZooLib_QueryEngine_Walker_Dee_h__ 39 | -------------------------------------------------------------------------------- /Project/zoolib/QueryEngine/Walker_Dum.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/QueryEngine/Walker_Dum.h" 4 | 5 | namespace ZooLib { 6 | namespace QueryEngine { 7 | 8 | using std::map; 9 | using std::set; 10 | 11 | // ================================================================================================= 12 | #pragma mark - Walker_Dum 13 | 14 | Walker_Dum::Walker_Dum() 15 | {} 16 | 17 | Walker_Dum::~Walker_Dum() 18 | {} 19 | 20 | void Walker_Dum::Rewind() 21 | { 22 | this->Called_Rewind(); 23 | } 24 | 25 | ZP Walker_Dum::Prime( 26 | const map& iOffsets, 27 | map& oOffsets, 28 | size_t& ioBaseOffset) 29 | { return this; } 30 | 31 | bool Walker_Dum::QReadInc(Val_DB* ioResults) 32 | { 33 | this->Called_QReadInc(); 34 | return false; 35 | } 36 | 37 | } // namespace QueryEngine 38 | } // namespace ZooLib 39 | -------------------------------------------------------------------------------- /Project/zoolib/QueryEngine/Walker_Dum.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_QueryEngine_Walker_Dum_h__ 4 | #define __ZooLib_QueryEngine_Walker_Dum_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/QueryEngine/Walker.h" 8 | 9 | namespace ZooLib { 10 | namespace QueryEngine { 11 | 12 | // ================================================================================================= 13 | #pragma mark - Walker_Dum 14 | 15 | class Walker_Dum : public Walker 16 | { 17 | public: 18 | Walker_Dum(); 19 | virtual ~Walker_Dum(); 20 | 21 | // From QueryEngine::Walker 22 | virtual void Rewind(); 23 | 24 | virtual ZP Prime( 25 | const std::map& iOffsets, 26 | std::map& oOffsets, 27 | size_t& ioBaseOffset); 28 | 29 | virtual bool QReadInc(Val_DB* ioResults); 30 | }; 31 | 32 | } // namespace QueryEngine 33 | } // namespace ZooLib 34 | 35 | #endif // __ZooLib_QueryEngine_Walker_Dum_h__ 36 | -------------------------------------------------------------------------------- /Project/zoolib/QueryEngine/Walker_Project.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_QueryEngine_Walker_Project_h__ 4 | #define __ZooLib_QueryEngine_Walker_Project_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/QueryEngine/Walker.h" 8 | #include "zoolib/RelationalAlgebra/RelHead.h" 9 | 10 | namespace ZooLib { 11 | namespace QueryEngine { 12 | 13 | // ================================================================================================= 14 | #pragma mark - Walker_Project 15 | 16 | class Walker_Project : public Walker_Unary 17 | { 18 | public: 19 | Walker_Project(const ZP& iWalker, const RelationalAlgebra::RelHead& iRelHead); 20 | virtual ~Walker_Project(); 21 | 22 | // From QueryEngine::Walker 23 | virtual void Rewind(); 24 | 25 | virtual ZP Prime( 26 | const std::map& iOffsets, 27 | std::map& oOffsets, 28 | size_t& ioBaseOffset); 29 | 30 | virtual bool QReadInc(Val_DB* ioResults); 31 | 32 | private: 33 | const RelationalAlgebra::RelHead fRelHead; 34 | std::vector fChildMapping; 35 | std::set> fPriors; 36 | }; 37 | 38 | } // namespace QueryEngine 39 | } // namespace ZooLib 40 | 41 | #endif // __ZooLib_QueryEngine_Walker_Project_h__ 42 | -------------------------------------------------------------------------------- /Project/zoolib/QueryEngine/Walker_Rename.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_QueryEngine_Walker_Rename_h__ 4 | #define __ZooLib_QueryEngine_Walker_Rename_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/QueryEngine/Walker.h" 8 | 9 | namespace ZooLib { 10 | namespace QueryEngine { 11 | 12 | // ================================================================================================= 13 | #pragma mark - Walker_Rename 14 | 15 | class Walker_Rename : public Walker_Unary 16 | { 17 | public: 18 | Walker_Rename(const ZP& iWalker, const string8& iNew, const string8& iOld); 19 | virtual ~Walker_Rename(); 20 | 21 | // From QueryEngine::Walker 22 | virtual ZP Prime( 23 | const std::map& iOffsets, 24 | std::map& oOffsets, 25 | size_t& ioBaseOffset); 26 | 27 | virtual bool QReadInc(Val_DB* ioResults); 28 | 29 | private: 30 | const string8 fNew; 31 | const string8 fOld; 32 | }; 33 | 34 | } // namespace QueryEngine 35 | } // namespace ZooLib 36 | 37 | #endif // __ZooLib_QueryEngine_Walker_Rename_h__ 38 | -------------------------------------------------------------------------------- /Project/zoolib/QueryEngine/Walker_Restrict.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_QueryEngine_Walker_Restrict_h__ 4 | #define __ZooLib_QueryEngine_Walker_Restrict_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Expr/Expr_Bool.h" 8 | #include "zoolib/QueryEngine/Walker.h" 9 | 10 | namespace ZooLib { 11 | namespace QueryEngine { 12 | 13 | // ================================================================================================= 14 | #pragma mark - Walker_Restrict 15 | 16 | class Walker_Restrict : public Walker_Unary 17 | { 18 | public: 19 | Walker_Restrict(ZP iWalker, ZP iExpr_Bool); 20 | virtual ~Walker_Restrict(); 21 | 22 | // From QueryEngine::Walker 23 | virtual ZP Prime( 24 | const std::map& iOffsets, 25 | std::map& oOffsets, 26 | size_t& ioBaseOffset); 27 | 28 | virtual bool QReadInc(Val_DB* ioResults); 29 | 30 | class Exec; 31 | 32 | private: 33 | const ZP fExpr_Bool; 34 | std::map fCombinedOffsets; 35 | 36 | std::vector fConsts; 37 | Exec* fExec; 38 | }; 39 | 40 | } // namespace QueryEngine 41 | } // namespace ZooLib 42 | 43 | #endif // __ZooLib_QueryEngine_Walker_Restrict_h__ 44 | -------------------------------------------------------------------------------- /Project/zoolib/QueryEngine/Walker_Result.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_QueryEngine_Walker_Result_h__ 4 | #define __ZooLib_QueryEngine_Walker_Result_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/QueryEngine/Result.h" 8 | #include "zoolib/QueryEngine/Walker.h" 9 | 10 | namespace ZooLib { 11 | namespace QueryEngine { 12 | 13 | // ================================================================================================= 14 | #pragma mark - Walker_Result 15 | 16 | class Walker_Result : public Walker 17 | { 18 | public: 19 | Walker_Result(ZP iResult); 20 | virtual ~Walker_Result(); 21 | 22 | // From QueryEngine::Walker 23 | virtual void Rewind(); 24 | 25 | virtual ZP Prime( 26 | const std::map& iOffsets, 27 | std::map& oOffsets, 28 | size_t& ioBaseOffset); 29 | 30 | virtual bool QReadInc(Val_DB* oResults); 31 | 32 | ZP fResult; 33 | size_t fIndex; 34 | size_t fBaseOffset; 35 | }; 36 | 37 | } // namespace QueryEngine 38 | } // namespace ZooLib 39 | 40 | #endif // __ZooLib_QueryEngine_Walker_Result_h__ 41 | -------------------------------------------------------------------------------- /Project/zoolib/RelationalAlgebra/AsSQL.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_RelationalAlgebra_AsSQL_h__ 4 | #define __ZooLib_RelationalAlgebra_AsSQL_h__ 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/ChanW_UTF.h" 8 | 9 | #include "zoolib/RelationalAlgebra/Expr_Rel.h" 10 | #include "zoolib/RelationalAlgebra/RelHead.h" 11 | 12 | #include 13 | 14 | namespace ZooLib { 15 | namespace RelationalAlgebra { 16 | 17 | // ================================================================================================= 18 | #pragma mark - 19 | 20 | bool sWriteAsSQL(const std::map& iTables, ZP iRel, const ChanW_UTF& w); 21 | 22 | } // namespace RelationalAlgebra 23 | } // namespace ZooLib 24 | 25 | #endif // __ZooLib_RelationalAlgebra_AsSQL_h__ 26 | -------------------------------------------------------------------------------- /Project/zoolib/RelationalAlgebra/ColName.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_RelationalAlgebra_ColName_h__ 4 | #define __ZooLib_RelationalAlgebra_ColName_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/UnicodeString8.h" 8 | 9 | namespace ZooLib { 10 | namespace RelationalAlgebra { 11 | 12 | // ================================================================================================= 13 | #pragma mark - ColName 14 | 15 | typedef string8 ColName; 16 | 17 | } // namespace RelationalAlgebra 18 | } // namespace ZooLib 19 | 20 | #endif // __ZooLib_RelationalAlgebra_ColName_h__ 21 | -------------------------------------------------------------------------------- /Project/zoolib/RelationalAlgebra/GetRelHead.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_RelationalAlgebra_GetRelHead_h__ 4 | #define __ZooLib_RelationalAlgebra_GetRelHead_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/RelationalAlgebra/Expr_Rel.h" 8 | 9 | namespace ZooLib { 10 | namespace RelationalAlgebra { 11 | 12 | // ================================================================================================= 13 | #pragma mark - sGetRelHead 14 | 15 | RelHead sGetRelHead(const ZP& iRel); 16 | 17 | } // namespace RelationalAlgebra 18 | } // namespace ZooLib 19 | 20 | #endif // __ZooLib_RelationalAlgebra_GetRelHead_h__ 21 | -------------------------------------------------------------------------------- /Project/zoolib/RelationalAlgebra/Transform_ConsolidateRenames.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_RelationalAlgebra_Transform_ConsolidateRenames_h__ 4 | #define __ZooLib_RelationalAlgebra_Transform_ConsolidateRenames_h__ 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/RelationalAlgebra/Expr_Rel.h" 8 | 9 | namespace ZooLib { 10 | namespace RelationalAlgebra { 11 | 12 | // ================================================================================================= 13 | #pragma mark - RelationalAlgebra::sTransform_ConsolidateRenames 14 | ZP sTransform_ConsolidateRenames(const ZP& iRel); 15 | 16 | } // namespace RelationalAlgebra 17 | } // namespace ZooLib 18 | 19 | #endif // __ZooLib_RelationalAlgebra_Transform_ConsolidateRenames_h__ 20 | -------------------------------------------------------------------------------- /Project/zoolib/RelationalAlgebra/Transform_DecomposeRestricts.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/RelationalAlgebra/Transform_DecomposeRestricts.h" 4 | 5 | #include "zoolib/ZMACRO_foreach.h" 6 | 7 | #include "zoolib/Expr/Util_Expr_Bool_CNF.h" 8 | 9 | using std::set; 10 | 11 | namespace ZooLib { 12 | namespace RelationalAlgebra { 13 | 14 | // ================================================================================================= 15 | #pragma mark - Transform_DecomposeRestricts 16 | 17 | void Transform_DecomposeRestricts::Visit_Expr_Rel_Restrict(const ZP& iExpr) 18 | { 19 | ZP theRel = this->Do(iExpr->GetOp0()); 20 | 21 | foreacha (entry, Util_Expr_Bool::sAsCNF(iExpr->GetExpr_Bool())) 22 | { 23 | ZP newBool; 24 | foreacha (entryj, entry) 25 | newBool |= entryj.Get(); 26 | theRel &= newBool; 27 | } 28 | 29 | this->pSetResult(theRel); 30 | } 31 | 32 | } // namespace RelationalAlgebra 33 | } // namespace ZooLib 34 | -------------------------------------------------------------------------------- /Project/zoolib/RelationalAlgebra/Transform_DecomposeRestricts.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_RelationalAlgebra_Transform_DecomposeRestricts_h__ 4 | #define __ZooLib_RelationalAlgebra_Transform_DecomposeRestricts_h__ 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Expr/Visitor_Expr_Op_Do_Transform_T.h" 8 | #include "zoolib/RelationalAlgebra/Expr_Rel_Restrict.h" 9 | 10 | namespace ZooLib { 11 | namespace RelationalAlgebra { 12 | 13 | // ================================================================================================= 14 | #pragma mark - RelationalAlgebra::Transform_DecomposeRestricts 15 | 16 | class Transform_DecomposeRestricts 17 | : public virtual Visitor_Expr_Op_Do_Transform_T 18 | , public virtual Visitor_Expr_Rel_Restrict 19 | { 20 | public: 21 | virtual void Visit_Expr_Rel_Restrict(const ZP& iExpr); 22 | }; 23 | 24 | } // namespace RelationalAlgebra 25 | } // namespace ZooLib 26 | 27 | #endif // __ZooLib_RelationalAlgebra_Transform_DecomposeRestricts_h__ 28 | -------------------------------------------------------------------------------- /Project/zoolib/ValPred/Util_Expr_Bool_ValPred_Rename.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_ValPred_Util_Expr_Bool_ValPred_Rename_h__ 4 | #define __ZooLib_ValPred_Util_Expr_Bool_ValPred_Rename_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Expr/Expr_Bool.h" 8 | 9 | #include 10 | #include 11 | 12 | namespace ZooLib { 13 | namespace Util_Expr_Bool { 14 | 15 | // ================================================================================================= 16 | #pragma mark - Util_Expr_Bool 17 | 18 | ZP sRenamed(const std::map& iRename, 19 | const ZP& iExpr); 20 | 21 | } // namespace Util_Expr_Bool 22 | } // namespace ZooLib 23 | 24 | #endif // __ZooLib_ValPred_Util_Expr_Bool_ValPred_Rename_h__ 25 | -------------------------------------------------------------------------------- /Project/zoolib/ValPred/Util_Strim_Expr_Bool_ValPred.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/ValPred/Util_Strim_Expr_Bool_ValPred.h" 4 | 5 | #include "zoolib/Callable_Function.h" 6 | 7 | #include "zoolib/Expr/Util_Strim_Expr_Bool.h" 8 | 9 | #include "zoolib/ValPred/Expr_Bool_ValPred.h" 10 | #include "zoolib/ValPred/Util_Strim_ValPred_DB.h" 11 | 12 | namespace ZooLib { 13 | namespace Util_Strim_Expr_Bool_ValPred { 14 | 15 | // ================================================================================================= 16 | #pragma mark - Util_Strim_Expr_Bool_ValPred 17 | 18 | static ZP spQReadValPred(const ChanRU_UTF& iChanRU) 19 | { 20 | if (ZQ theQ = Util_Strim_ValPred_DB::sQFromStrim(iChanRU)) 21 | return sExpr_Bool(*theQ); 22 | return null; 23 | } 24 | 25 | ZP sQFromStrim(const ChanRU_UTF& iChanRU) 26 | { 27 | return Util_Strim_Expr_Bool::sQFromStrim(sCallable(spQReadValPred), iChanRU); 28 | } 29 | 30 | } // namespace Util_Strim_Expr_Bool_ValPred 31 | } // namespace ZooLib 32 | -------------------------------------------------------------------------------- /Project/zoolib/ValPred/Util_Strim_Expr_Bool_ValPred.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_ValPred_Util_Strim_Expr_Bool_ValPred_h__ 4 | #define __ZooLib_ValPred_Util_Strim_Expr_Bool_ValPred_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Chan_UTF.h" 8 | 9 | #include "zoolib/Expr/Expr_Bool.h" 10 | 11 | namespace ZooLib { 12 | namespace Util_Strim_Expr_Bool_ValPred { 13 | 14 | // ================================================================================================= 15 | #pragma mark - Util_Strim_Expr_Bool_ValPred 16 | 17 | ZP sQFromStrim(const ChanRU_UTF& iChanRU); 18 | 19 | } // namespace Util_Strim_Expr_Bool_ValPred 20 | } // namespace ZooLib 21 | 22 | #endif // __ZooLib_ValPred_Util_Strim_Expr_Bool_ValPred_h__ 23 | -------------------------------------------------------------------------------- /Project/zoolib/ValPred/Util_Strim_ValPred_DB.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_ValPred_Util_Strim_ValPred_DB_h__ 4 | #define __ZooLib_ValPred_Util_Strim_ValPred_DB_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Chan_UTF.h" 8 | #include "zoolib/ZQ.h" 9 | 10 | #include "zoolib/ValPred/ValPred.h" 11 | 12 | #include 13 | 14 | namespace ZooLib { 15 | namespace Util_Strim_ValPred_DB { 16 | 17 | // ================================================================================================= 18 | #pragma mark - Util_Strim_ValPred_DB 19 | 20 | void sToStrim(const ChanW_UTF& iStrimW, const ValPred& iValPred); 21 | 22 | ZQ sQFromStrim(const ChanRU_UTF& iChanRU); 23 | 24 | } // namespace Util_Strim_ValPred_DB 25 | 26 | const ChanW_UTF& operator<<(const ChanW_UTF& ww, const ValPred& iValPred); 27 | 28 | } // namespace ZooLib 29 | 30 | #endif // __ZooLib_ValPred_Util_Strim_ValPred_DB_h__ 31 | -------------------------------------------------------------------------------- /Project/zoolib/ValPred/ValPred_GetNames.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/ValPred/ValPred_GetNames.h" 4 | 5 | #include "zoolib/Util_STL_set.h" 6 | 7 | namespace ZooLib { 8 | 9 | using std::set; 10 | using std::string; 11 | 12 | using namespace Util_STL; 13 | 14 | // ================================================================================================= 15 | #pragma mark - ValPred, sGetNames 16 | 17 | namespace { // anonymous 18 | 19 | set spGetNames(const ZP& iComparand) 20 | { 21 | if (ZP asName = iComparand.DynamicCast()) 22 | { 23 | const string& theName = asName->GetName(); 24 | return set(&theName, &theName + 1); 25 | } 26 | return set(); 27 | } 28 | 29 | } // anonymous namespace 30 | 31 | set sGetNames(const ValPred& iValPred) 32 | { return spGetNames(iValPred.GetLHS()) | spGetNames(iValPred.GetRHS()); } 33 | 34 | } // namespace ZooLib 35 | -------------------------------------------------------------------------------- /Project/zoolib/ValPred/ValPred_GetNames.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_ValPred_ValPred_GetNames_h__ 4 | #define __ZooLib_ValPred_ValPred_GetNames_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/ValPred/ValPred.h" 8 | 9 | #include 10 | 11 | namespace ZooLib { 12 | 13 | std::set sGetNames(const ValPred& iValPred); 14 | 15 | } // namespace ZooLib 16 | 17 | #endif // __ZooLib_ValPred_ValPred_GetNames_h__ 18 | -------------------------------------------------------------------------------- /Project/zoolib/ValPred/ValPred_Renamed.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/ValPred/ValPred_Renamed.h" 4 | 5 | #include "zoolib/Util_STL_map.h" 6 | #include "zoolib/ZQ.h" 7 | 8 | namespace ZooLib { 9 | 10 | using std::map; 11 | using std::string; 12 | 13 | using namespace Util_STL; 14 | 15 | ZP sRenamed(const map& iRename, 16 | const ZP& iVal) 17 | { 18 | if (ZP asName = iVal.DynamicCast()) 19 | { 20 | if (ZQ theQ = sQGet(iRename, asName->GetName())) 21 | return new ValComparand_Name(*theQ); 22 | } 23 | return iVal; 24 | } 25 | 26 | ValPred sRenamed(const map& iRename, const ValPred& iValPred) 27 | { 28 | return ValPred( 29 | sRenamed(iRename, iValPred.GetLHS()), 30 | iValPred.GetComparator(), 31 | sRenamed(iRename, iValPred.GetRHS())); 32 | } 33 | 34 | } // namespace ZooLib 35 | -------------------------------------------------------------------------------- /Project/zoolib/ValPred/ValPred_Renamed.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_ValPred_ValPred_Renamed_h__ 4 | #define __ZooLib_ValPred_ValPred_Renamed_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/ValPred/ValPred.h" 8 | 9 | #include 10 | 11 | namespace ZooLib { 12 | 13 | ZP sRenamed(const std::map& iRename, 14 | const ZP& iVal); 15 | 16 | ValPred sRenamed(const std::map& iRename, 17 | const ValPred& iValPred); 18 | 19 | } // namespace ZooLib 20 | 21 | #endif // __ZooLib_ValPred_ValPred_Renamed_h__ 22 | -------------------------------------------------------------------------------- /Project/zoolib/ValPred/Visitor_Expr_Bool_ValPred_DB_Do_Eval_Matches.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/ValPred/Visitor_Expr_Bool_ValPred_DB_Do_Eval_Matches.h" 4 | 5 | #include "zoolib/ValPred/ValPred_DB.h" 6 | 7 | namespace ZooLib { 8 | 9 | // ================================================================================================= 10 | #pragma mark - * 11 | 12 | Visitor_Expr_Bool_ValPred_DB_Do_Eval_Matches:: 13 | Visitor_Expr_Bool_ValPred_DB_Do_Eval_Matches(const Val_DB& iVal) 14 | : fVal(iVal) 15 | {} 16 | 17 | void Visitor_Expr_Bool_ValPred_DB_Do_Eval_Matches::Visit_Expr_Bool_ValPred( 18 | const ZP& iExpr) 19 | { this->pSetResult(sMatches(iExpr->GetValPred(), fVal)); } 20 | 21 | bool sMatches(const ZP& iExpr, const Val_DB& iVal) 22 | { return Visitor_Expr_Bool_ValPred_DB_Do_Eval_Matches(iVal).Do(iExpr); } 23 | 24 | } // namespace ZooLib 25 | -------------------------------------------------------------------------------- /Project/zoolib/ValPred/Visitor_Expr_Bool_ValPred_DB_ToStrim.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/ValPred/Visitor_Expr_Bool_ValPred_DB_ToStrim.h" 4 | 5 | #include "zoolib/ValPred/Util_Strim_ValPred_DB.h" 6 | 7 | #include "zoolib/pdesc.h" 8 | #if defined(ZMACRO_pdesc) 9 | #include "zoolib/StdIO.h" 10 | #endif 11 | 12 | namespace ZooLib { 13 | 14 | // ================================================================================================= 15 | #pragma mark - Visitor_Expr_Bool_ValPred_ToStrim 16 | 17 | void Visitor_Expr_Bool_ValPred_DB_ToStrim::Visit_Expr_Bool_ValPred( 18 | const ZP& iRep) 19 | { Util_Strim_ValPred_DB::sToStrim(pStrimW(), iRep->GetValPred()); } 20 | 21 | } // namespace ZooLib 22 | 23 | // ================================================================================================= 24 | #pragma mark - pdesc 25 | 26 | #if defined(ZMACRO_pdesc) 27 | 28 | using namespace ZooLib; 29 | 30 | ZMACRO_pdesc(const ZP& iExpr) 31 | { 32 | Visitor_Expr_Bool_ValPred_DB_ToStrim().ToStrim(StdIO::sChanW_UTF_Err, sDefault(), iExpr); 33 | } 34 | 35 | #endif // defined(ZMACRO_pdesc) 36 | -------------------------------------------------------------------------------- /Project/zoolib/ValPred/Visitor_Expr_Bool_ValPred_DB_ToStrim.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2019 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #ifndef __ZooLib_ValPred_Visitor_Expr_Bool_ValPred_DB_ToStrim_h__ 4 | #define __ZooLib_ValPred_Visitor_Expr_Bool_ValPred_DB_ToStrim_h__ 1 5 | #include "zconfig.h" 6 | 7 | #include "zoolib/Expr/Visitor_Expr_Bool_ToStrim.h" 8 | 9 | #include "zoolib/ValPred/Expr_Bool_ValPred.h" 10 | 11 | namespace ZooLib { 12 | 13 | // ================================================================================================= 14 | #pragma mark - Visitor_Expr_Bool_ValPred_DB_ToStrim 15 | 16 | class Visitor_Expr_Bool_ValPred_DB_ToStrim 17 | : public virtual Visitor_Expr_Bool_ToStrim 18 | , public virtual Visitor_Expr_Bool_ValPred 19 | { 20 | public: 21 | // From Visitor_Expr_Bool_ValPred 22 | virtual void Visit_Expr_Bool_ValPred(const ZP& iRep); 23 | }; 24 | 25 | } // namespace ZooLib 26 | 27 | #endif // __ZooLib_ValPred_Visitor_Expr_Bool_ValPred_DB_ToStrim_h__ 28 | -------------------------------------------------------------------------------- /Project/zoolib/ValPred/Visitor_Expr_Bool_ValPred_Do_GetNames.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 Andrew Green. MIT License. http://www.zoolib.org 2 | 3 | #include "zoolib/ValPred/Visitor_Expr_Bool_ValPred_Do_GetNames.h" 4 | 5 | #include "zoolib/Util_STL_set.h" 6 | 7 | #include "zoolib/ValPred/ValPred_GetNames.h" 8 | 9 | namespace ZooLib { 10 | 11 | using namespace Util_STL; 12 | 13 | // ================================================================================================= 14 | #pragma mark - Visitor_Expr_Bool_ValPred_Do_GetNames 15 | 16 | void Visitor_Expr_Bool_ValPred_Do_GetNames::Visit_Expr_Bool_ValPred( 17 | const ZP& iExpr) 18 | { this->pSetResult(sGetNames(iExpr->GetValPred())); } 19 | 20 | void Visitor_Expr_Bool_ValPred_Do_GetNames::Visit_Expr_Op1( 21 | const ZP>& iExpr) 22 | { this->pSetResult(this->Do(iExpr->GetOp0())); } 23 | 24 | void Visitor_Expr_Bool_ValPred_Do_GetNames::Visit_Expr_Op2( 25 | const ZP>& iExpr) 26 | { this->pSetResult(this->Do(iExpr->GetOp0()) | this->Do(iExpr->GetOp1())); } 27 | 28 | std::set sGetNames(const ZP& iExpr) 29 | { return Visitor_Expr_Bool_ValPred_Do_GetNames().Do(iExpr); } 30 | 31 | } // namespace ZooLib 32 | -------------------------------------------------------------------------------- /README.markdown: -------------------------------------------------------------------------------- 1 | Welcome! 2 | -------- 3 | 4 | ZooLib is a C++ toolkit. I hope you find it useful. 5 | 6 | If you have any questions email me at ag@em.net. 7 | -------------------------------------------------------------------------------- /ZooLibAndroid/.gitignore: -------------------------------------------------------------------------------- 1 | build -------------------------------------------------------------------------------- /ZooLibAndroid/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 29 5 | 6 | defaultConfig { 7 | minSdkVersion 21 8 | targetSdkVersion 29 9 | } 10 | } 11 | 12 | dependencies { 13 | def lifecycle_version = "2.2.0" 14 | implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version" 15 | implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version" 16 | implementation "androidx.appcompat:appcompat:1.3.0-alpha02" 17 | } 18 | -------------------------------------------------------------------------------- /ZooLibAndroid/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /default_config/zconfig.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2002 Andrew Green and Learning in Motion, Inc. 2 | // MIT License. http://www.zoolib.org 3 | 4 | #ifndef __zconfig__ 5 | #define __zconfig__ 1 6 | 7 | #include "zoolib/zconfigd.h" 8 | 9 | // For projects that need special settings, copy this file to a location that will be found 10 | // first by your compiler and put any settings here -- after zconfigd.h, and before zconfigl.h. 11 | 12 | #include "zoolib/zconfigl.h" 13 | 14 | #endif // __zconfig__ 15 | --------------------------------------------------------------------------------