From 2d4078f3920e6dec8f8a33ded4c43374d803fd57 Mon Sep 17 00:00:00 2001 From: Guenter Obiltschnig Date: Tue, 29 Aug 2006 07:10:35 +0000 Subject: [PATCH] submitted 1.2.0 --- CHANGELOG | 103 +- CONTRIBUTORS | 9 + CppUnit/Makefile | 2 +- .../include/WinTestRunner/WinTestRunner.h | 11 +- CppUnit/WinTestRunner/src/ActiveTest.cpp | 6 +- CppUnit/WinTestRunner/src/ActiveTest.h | 10 +- CppUnit/WinTestRunner/src/DLLMain.cpp | 2 +- CppUnit/WinTestRunner/src/GUITestResult.cpp | 6 +- CppUnit/WinTestRunner/src/GUITestResult.h | 10 +- CppUnit/WinTestRunner/src/ProgressBar.cpp | 6 +- CppUnit/WinTestRunner/src/ProgressBar.h | 8 +- CppUnit/WinTestRunner/src/TestRunnerDlg.cpp | 6 +- CppUnit/WinTestRunner/src/TestRunnerDlg.h | 17 +- CppUnit/WinTestRunner/src/WinTestRunner.cpp | 6 +- CppUnit/include/CppUnit/CppUnit.h | 11 +- CppUnit/include/CppUnit/CppUnitException.h | 63 +- CppUnit/include/CppUnit/Guards.h | 2 +- CppUnit/include/CppUnit/Orthodox.h | 10 +- CppUnit/include/CppUnit/RepeatedTest.h | 16 +- CppUnit/include/CppUnit/Test.h | 11 +- CppUnit/include/CppUnit/TestCaller.h | 20 +- CppUnit/include/CppUnit/TestCase.h | 45 +- CppUnit/include/CppUnit/TestDecorator.h | 12 +- CppUnit/include/CppUnit/TestFailure.h | 12 +- CppUnit/include/CppUnit/TestResult.h | 15 +- CppUnit/include/CppUnit/TestRunner.h | 14 +- CppUnit/include/CppUnit/TestSetup.h | 12 +- CppUnit/include/CppUnit/TestSuite.h | 18 +- CppUnit/include/CppUnit/TextTestResult.h | 13 +- CppUnit/include/CppUnit/estring.h | 14 +- CppUnit/src/CppUnitException.cpp | 6 +- CppUnit/src/TestCase.cpp | 20 +- CppUnit/src/TestDecorator.cpp | 6 +- CppUnit/src/TestFailure.cpp | 6 +- CppUnit/src/TestResult.cpp | 6 +- CppUnit/src/TestRunner.cpp | 6 +- CppUnit/src/TestSuite.cpp | 6 +- CppUnit/src/TextTestResult.cpp | 53 +- Foundation/Foundation_vs71.vcproj | 596 +++++++----- Foundation/Foundation_vs80.vcproj | 652 ++++++++----- Foundation/Makefile | 13 +- Foundation/foundation.vmsbuild | 1 + .../{Foundation => Poco}/ASCIIEncoding.h | 14 +- .../{Foundation => Poco}/AbstractCache.h | 25 +- .../{Foundation => Poco}/AbstractDelegate.h | 8 +- .../{Foundation => Poco}/AbstractEvent.h | 43 +- .../AbstractPriorityDelegate.h | 8 +- .../{Foundation => Poco}/AbstractStrategy.h | 12 +- Foundation/include/Poco/ActiveDispatcher.h | 137 +++ .../{Foundation => Poco}/ActiveMethod.h | 86 +- .../{Foundation => Poco}/ActiveResult.h | 79 +- Foundation/include/Poco/ActiveRunnable.h | 103 ++ Foundation/include/Poco/ActiveStarter.h | 71 ++ .../include/{Foundation => Poco}/Activity.h | 26 +- Foundation/include/{Foundation => Poco}/Any.h | 82 +- .../{Foundation => Poco}/ArchiveStrategy.h | 26 +- .../{Foundation => Poco}/AsyncChannel.h | 30 +- .../include/{Foundation => Poco}/AutoPtr.h | 36 +- .../{Foundation => Poco}/AutoReleasePool.h | 13 +- .../{Foundation => Poco}/Base64Decoder.h | 17 +- .../{Foundation => Poco}/Base64Encoder.h | 17 +- .../include/{Foundation => Poco}/BasicEvent.h | 14 +- .../{Foundation => Poco}/BinaryReader.h | 13 +- .../{Foundation => Poco}/BinaryWriter.h | 13 +- .../include/{Foundation => Poco}/Buffer.h | 10 +- .../{Foundation => Poco}/BufferAllocator.h | 13 +- .../BufferedBidirectionalStreamBuf.h | 27 +- .../{Foundation => Poco}/BufferedStreamBuf.h | 27 +- .../include/{Foundation => Poco}/Bugcheck.h | 27 +- .../include/{Foundation => Poco}/ByteOrder.h | 14 +- .../include/{Foundation => Poco}/Channel.h | 22 +- .../{Foundation => Poco}/ClassLibrary.h | 25 +- .../{Foundation => Poco}/ClassLoader.h | 33 +- .../{Foundation => Poco}/CompareFunctions.h | 8 +- Foundation/include/Poco/Config.h | 55 ++ .../{Foundation => Poco}/Configurable.h | 10 +- .../{Foundation => Poco}/ConsoleChannel.h | 21 +- .../{Foundation => Poco}/CountingStream.h | 20 +- .../include/{Foundation => Poco}/DateTime.h | 65 +- .../{Foundation => Poco}/DateTimeFormat.h | 10 +- .../{Foundation => Poco}/DateTimeFormatter.h | 10 +- .../{Foundation => Poco}/DateTimeParser.h | 14 +- .../include/{Foundation => Poco}/Debugger.h | 10 +- .../{Foundation => Poco}/DefaultStrategy.h | 8 +- .../{Foundation => Poco}/DeflatingStream.h | 24 +- .../include/{Foundation => Poco}/Delegate.h | 12 +- .../{Foundation => Poco}/DigestEngine.h | 13 +- .../{Foundation => Poco}/DigestStream.h | 24 +- .../{Foundation => Poco}/DirectoryIterator.h | 18 +- .../DirectoryIterator_UNIX.h | 13 +- .../DirectoryIterator_VMS.h | 13 +- .../DirectoryIterator_WIN32.h | 13 +- .../DirectoryIterator_WIN32U.h | 13 +- .../{Foundation => Poco}/DynamicFactory.h | 28 +- .../{Foundation => Poco}/Environment.h | 10 +- .../{Foundation => Poco}/Environment_UNIX.h | 17 +- .../{Foundation => Poco}/Environment_VMS.h | 14 +- .../{Foundation => Poco}/Environment_WIN32.h | 10 +- .../{Foundation => Poco}/Environment_WIN32U.h | 10 +- .../{Foundation => Poco}/ErrorHandler.h | 22 +- .../include/{Foundation => Poco}/Event.h | 18 +- .../include/{Foundation => Poco}/EventArgs.h | 8 +- .../{Foundation => Poco}/EventLogChannel.h | 21 +- .../{Foundation => Poco}/Event_POSIX.h | 20 +- .../{Foundation => Poco}/Event_WIN32.h | 17 +- .../include/{Foundation => Poco}/Exception.h | 52 +- .../include/{Foundation => Poco}/Expire.h | 22 +- .../{Foundation => Poco}/ExpireCache.h | 10 +- .../{Foundation => Poco}/ExpireLRUCache.h | 16 +- .../{Foundation => Poco}/ExpireStrategy.h | 28 +- .../include/{Foundation => Poco}/FIFOEvent.h | 14 +- .../{Foundation => Poco}/FIFOStrategy.h | 13 +- .../{Foundation => Poco}/FPEnvironment.h | 26 +- .../{Foundation => Poco}/FPEnvironment_C99.h | 16 +- .../{Foundation => Poco}/FPEnvironment_DEC.h | 10 +- .../FPEnvironment_DUMMY.h | 15 +- .../{Foundation => Poco}/FPEnvironment_SUN.h | 13 +- .../FPEnvironment_WIN32.h | 16 +- .../include/{Foundation => Poco}/File.h | 28 +- .../{Foundation => Poco}/FileChannel.h | 22 +- .../{Foundation => Poco}/FileStreamFactory.h | 14 +- .../include/{Foundation => Poco}/File_UNIX.h | 11 +- .../include/{Foundation => Poco}/File_VMS.h | 11 +- .../include/{Foundation => Poco}/File_WIN32.h | 15 +- .../{Foundation => Poco}/File_WIN32U.h | 15 +- Foundation/include/Poco/Format.h | 154 +++ .../include/{Foundation => Poco}/Formatter.h | 18 +- .../{Foundation => Poco}/FormattingChannel.h | 14 +- .../include/{Foundation => Poco}/Foundation.h | 44 +- .../include/{Foundation => Poco}/Glob.h | 13 +- .../include/{Foundation => Poco}/HMACEngine.h | 17 +- Foundation/include/Poco/HashFunction.h | 82 ++ Foundation/include/Poco/HashStatistic.h | 147 +++ Foundation/include/Poco/HashTable.h | 362 +++++++ .../{Foundation => Poco}/HexBinaryDecoder.h | 17 +- .../{Foundation => Poco}/HexBinaryEncoder.h | 17 +- .../{Foundation => Poco}/InflatingStream.h | 24 +- .../{Foundation => Poco}/Instantiator.h | 10 +- .../{Foundation => Poco}/KeyValueArgs.h | 8 +- .../include/{Foundation => Poco}/LRUCache.h | 10 +- .../{Foundation => Poco}/LRUStrategy.h | 23 +- .../{Foundation => Poco}/Latin1Encoding.h | 14 +- .../{Foundation => Poco}/Latin9Encoding.h | 14 +- .../LineEndingConverter.h | 20 +- .../{Foundation => Poco}/LocalDateTime.h | 14 +- .../include/{Foundation => Poco}/LogFile.h | 20 +- .../{Foundation => Poco}/LogFile_STD.h | 17 +- .../{Foundation => Poco}/LogFile_VMS.h | 17 +- .../{Foundation => Poco}/LogFile_WIN32.h | 17 +- Foundation/include/Poco/LogFile_WIN32U.h | 74 ++ Foundation/include/Poco/LogStream.h | 166 ++++ .../include/{Foundation => Poco}/Logger.h | 26 +- .../{Foundation => Poco}/LoggingFactory.h | 22 +- .../{Foundation => Poco}/LoggingRegistry.h | 29 +- .../include/{Foundation => Poco}/MD2Engine.h | 14 +- .../include/{Foundation => Poco}/MD4Engine.h | 14 +- .../include/{Foundation => Poco}/MD5Engine.h | 14 +- .../include/{Foundation => Poco}/Manifest.h | 20 +- .../include/{Foundation => Poco}/MemoryPool.h | 17 +- .../include/{Foundation => Poco}/Message.h | 17 +- .../include/{Foundation => Poco}/MetaObject.h | 23 +- .../include/{Foundation => Poco}/Mutex.h | 22 +- .../{Foundation => Poco}/Mutex_POSIX.h | 20 +- .../{Foundation => Poco}/Mutex_WIN32.h | 17 +- .../include/{Foundation => Poco}/NamedEvent.h | 19 +- .../{Foundation => Poco}/NamedEvent_UNIX.h | 10 +- .../{Foundation => Poco}/NamedEvent_VMS.h | 10 +- .../{Foundation => Poco}/NamedEvent_WIN32.h | 13 +- .../{Foundation => Poco}/NamedEvent_WIN32U.h | 13 +- .../include/{Foundation => Poco}/NamedMutex.h | 26 +- .../{Foundation => Poco}/NamedMutex_UNIX.h | 12 +- .../{Foundation => Poco}/NamedMutex_VMS.h | 16 +- .../{Foundation => Poco}/NamedMutex_WIN32.h | 13 +- .../{Foundation => Poco}/NamedMutex_WIN32U.h | 13 +- .../NestedDiagnosticContext.h | 18 +- .../{Foundation => Poco}/Notification.h | 18 +- .../{Foundation => Poco}/NotificationCenter.h | 17 +- .../{Foundation => Poco}/NotificationQueue.h | 21 +- .../NotificationStrategy.h | 8 +- .../{Foundation => Poco}/NullChannel.h | 14 +- .../include/{Foundation => Poco}/NullStream.h | 20 +- .../{Foundation => Poco}/NumberFormatter.h | 10 +- .../{Foundation => Poco}/NumberParser.h | 10 +- .../include/{Foundation => Poco}/Observer.h | 23 +- .../{Foundation => Poco}/OpcomChannel.h | 14 +- .../include/{Foundation => Poco}/Path.h | 13 +- .../include/{Foundation => Poco}/Path_UNIX.h | 13 +- .../include/{Foundation => Poco}/Path_VMS.h | 13 +- .../include/{Foundation => Poco}/Path_WIN32.h | 13 +- .../{Foundation => Poco}/Path_WIN32U.h | 13 +- .../{Foundation => Poco}/PatternFormatter.h | 18 +- Foundation/include/Poco/Pipe.h | 164 ++++ Foundation/include/Poco/PipeImpl.h | 55 ++ Foundation/include/Poco/PipeImpl_DUMMY.h | 71 ++ Foundation/include/Poco/PipeImpl_POSIX.h | 75 ++ Foundation/include/Poco/PipeImpl_WIN32.h | 76 ++ Foundation/include/Poco/PipeStream.h | 142 +++ .../include/{Foundation => Poco}/Platform.h | 8 +- .../{Foundation => Poco}/Platform_POSIX.h | 2 +- .../{Foundation => Poco}/Platform_VMS.h | 2 +- .../{Foundation => Poco}/Platform_WIN32.h | 11 +- Foundation/include/Poco/Poco.h | 46 + .../{Foundation => Poco}/PriorityDelegate.h | 12 +- .../{Foundation => Poco}/PriorityEvent.h | 14 +- .../{Foundation => Poco}/PriorityExpire.h | 20 +- .../include/{Foundation => Poco}/Process.h | 48 +- .../{Foundation => Poco}/Process_UNIX.h | 27 +- .../{Foundation => Poco}/Process_VMS.h | 27 +- .../{Foundation => Poco}/Process_WIN32.h | 25 +- .../{Foundation => Poco}/Process_WIN32U.h | 25 +- .../{Foundation => Poco}/PurgeStrategy.h | 21 +- .../include/{Foundation => Poco}/RWLock.h | 18 +- .../{Foundation => Poco}/RWLock_POSIX.h | 20 +- .../{Foundation => Poco}/RWLock_WIN32.h | 17 +- .../include/{Foundation => Poco}/Random.h | 10 +- .../{Foundation => Poco}/RandomStream.h | 17 +- .../{Foundation => Poco}/RefCountedObject.h | 14 +- .../{Foundation => Poco}/RegularExpression.h | 13 +- .../{Foundation => Poco}/RotateStrategy.h | 38 +- .../include/{Foundation => Poco}/Runnable.h | 10 +- .../{Foundation => Poco}/RunnableAdapter.h | 14 +- .../include/{Foundation => Poco}/SHA1Engine.h | 14 +- .../include/{Foundation => Poco}/ScopedLock.h | 10 +- .../include/{Foundation => Poco}/Semaphore.h | 18 +- .../{Foundation => Poco}/Semaphore_POSIX.h | 20 +- .../{Foundation => Poco}/Semaphore_WIN32.h | 17 +- .../{Foundation => Poco}/SharedLibrary.h | 20 +- .../{Foundation => Poco}/SharedLibrary_HPUX.h | 17 +- .../{Foundation => Poco}/SharedLibrary_UNIX.h | 14 +- .../{Foundation => Poco}/SharedLibrary_VMS.h | 14 +- .../SharedLibrary_WIN32.h | 14 +- .../include/{Foundation => Poco}/SharedPtr.h | 173 ++-- .../{Foundation => Poco}/SignalHandler.h | 20 +- .../{Foundation => Poco}/SimpleFileChannel.h | 22 +- Foundation/include/Poco/SimpleHashTable.h | 407 ++++++++ .../{Foundation => Poco}/SingletonHolder.h | 14 +- .../{Foundation => Poco}/SplitterChannel.h | 21 +- .../include/{Foundation => Poco}/Stopwatch.h | 14 +- .../{Foundation => Poco}/StrategyCollection.h | 26 +- .../{Foundation => Poco}/StreamChannel.h | 21 +- .../{Foundation => Poco}/StreamConverter.h | 24 +- .../{Foundation => Poco}/StreamCopier.h | 16 +- .../{Foundation => Poco}/StreamTokenizer.h | 20 +- .../include/{Foundation => Poco}/StreamUtil.h | 6 +- .../include/{Foundation => Poco}/String.h | 13 +- .../{Foundation => Poco}/StringTokenizer.h | 17 +- .../{Foundation => Poco}/SynchronizedObject.h | 20 +- .../{Foundation => Poco}/SyslogChannel.h | 14 +- .../include/{Foundation => Poco}/Task.h | 26 +- .../{Foundation => Poco}/TaskManager.h | 33 +- .../{Foundation => Poco}/TaskNotification.h | 18 +- .../include/{Foundation => Poco}/TeeStream.h | 23 +- .../{Foundation => Poco}/TemporaryFile.h | 14 +- .../{Foundation => Poco}/TextConverter.h | 10 +- .../{Foundation => Poco}/TextEncoding.h | 10 +- .../{Foundation => Poco}/TextIterator.h | 10 +- .../include/{Foundation => Poco}/Thread.h | 17 +- .../{Foundation => Poco}/ThreadLocal.h | 13 +- .../include/{Foundation => Poco}/ThreadPool.h | 29 +- .../{Foundation => Poco}/Thread_POSIX.h | 27 +- .../{Foundation => Poco}/Thread_WIN32.h | 17 +- .../include/{Foundation => Poco}/Timer.h | 33 +- .../include/{Foundation => Poco}/Timespan.h | 14 +- .../include/{Foundation => Poco}/Timestamp.h | 13 +- .../include/{Foundation => Poco}/Timezone.h | 14 +- .../include/{Foundation => Poco}/Token.h | 13 +- .../include/{Foundation => Poco}/Types.h | 10 +- Foundation/include/{Foundation => Poco}/URI.h | 13 +- .../{Foundation => Poco}/URIStreamFactory.h | 13 +- .../{Foundation => Poco}/URIStreamOpener.h | 20 +- .../{Foundation => Poco}/UTF16Encoding.h | 14 +- .../{Foundation => Poco}/UTF8Encoding.h | 14 +- .../include/{Foundation => Poco}/UUID.h | 18 +- .../{Foundation => Poco}/UUIDGenerator.h | 26 +- .../UnbufferedStreamBuf.h | 23 +- .../{Foundation => Poco}/UnicodeConverter.h | 10 +- .../include/{Foundation => Poco}/ValidArgs.h | 8 +- Foundation/include/Poco/Void.h | 90 ++ .../Windows1252Encoding.h | 14 +- .../include/{Foundation => Poco}/zconf.h | 2 +- .../include/{Foundation => Poco}/zlib.h | 0 .../ActiveMethod/ActiveMethod.vmsbuild | 2 +- Foundation/samples/ActiveMethod/Makefile | 2 +- .../samples/ActiveMethod/src/ActiveMethod.cpp | 10 +- Foundation/samples/Activity/Activity.vmsbuild | 2 +- Foundation/samples/Activity/src/Activity.cpp | 10 +- .../BinaryReaderWriter.vmsbuild | 2 +- .../samples/BinaryReaderWriter/Makefile | 2 +- .../src/BinaryReaderWriter.cpp | 10 +- Foundation/samples/DateTime/DateTime.vmsbuild | 2 +- Foundation/samples/DateTime/Makefile | 2 +- Foundation/samples/DateTime/src/DateTime.cpp | 10 +- Foundation/samples/Logger/Logger.vmsbuild | 2 +- Foundation/samples/Logger/Makefile | 2 +- Foundation/samples/Logger/src/Logger.cpp | 26 +- Foundation/samples/Makefile | 6 +- Foundation/samples/NotificationQueue/Makefile | 2 +- .../NotificationQueue.vmsbuild | 2 +- .../src/NotificationQueue.cpp | 34 +- Foundation/samples/StringTokenizer/Makefile | 2 +- .../StringTokenizer/StringTokenizer.vmsbuild | 2 +- .../StringTokenizer/src/StringTokenizer.cpp | 6 +- Foundation/samples/Timer/Makefile | 2 +- Foundation/samples/Timer/Timer.vmsbuild | 2 +- Foundation/samples/Timer/src/Timer.cpp | 16 +- Foundation/samples/URI/Makefile | 2 +- Foundation/samples/URI/URI.vmsbuild | 2 +- Foundation/samples/URI/src/URI.cpp | 6 +- Foundation/samples/base64decode/Makefile | 2 +- .../base64decode/base64decode.vmsbuild | 2 +- .../samples/base64decode/src/base64decode.cpp | 10 +- Foundation/samples/base64encode/Makefile | 2 +- .../base64encode/base64encode.vmsbuild | 2 +- .../samples/base64encode/src/base64encode.cpp | 10 +- Foundation/samples/deflate/Makefile | 2 +- Foundation/samples/deflate/deflate.vmsbuild | 2 +- Foundation/samples/deflate/src/deflate.cpp | 10 +- Foundation/samples/dir/Makefile | 2 +- Foundation/samples/dir/dir.vmsbuild | 2 +- Foundation/samples/dir/src/dir.cpp | 57 +- Foundation/samples/grep/Makefile | 2 +- Foundation/samples/grep/grep.vmsbuild | 2 +- Foundation/samples/grep/src/grep.cpp | 6 +- Foundation/samples/hmacmd5/Makefile | 2 +- Foundation/samples/hmacmd5/hmacmd5.vmsbuild | 2 +- Foundation/samples/hmacmd5/src/hmacmd5.cpp | 20 +- Foundation/samples/inflate/Makefile | 2 +- Foundation/samples/inflate/inflate.vmsbuild | 2 +- Foundation/samples/inflate/src/inflate.cpp | 10 +- Foundation/samples/md5/Makefile | 2 +- Foundation/samples/md5/md5.vmsbuild | 2 +- Foundation/samples/md5/src/md5.cpp | 16 +- Foundation/samples/uuidgen/Makefile | 2 +- Foundation/samples/uuidgen/src/uuidgen.cpp | 14 +- Foundation/samples/uuidgen/uuidgen.vmsbuild | 2 +- Foundation/src/ASCIIEncoding.cpp | 8 +- Foundation/src/ActiveDispatcher.cpp | 133 +++ Foundation/src/ArchiveStrategy.cpp | 87 +- Foundation/src/AsyncChannel.cpp | 18 +- Foundation/src/Base64Decoder.cpp | 18 +- Foundation/src/Base64Encoder.cpp | 8 +- Foundation/src/BinaryReader.cpp | 16 +- Foundation/src/BinaryWriter.cpp | 16 +- Foundation/src/Bugcheck.cpp | 12 +- Foundation/src/ByteOrder.cpp | 4 +- Foundation/src/Channel.cpp | 8 +- Foundation/src/Configurable.cpp | 8 +- Foundation/src/ConsoleChannel.cpp | 10 +- Foundation/src/CountingStream.cpp | 8 +- Foundation/src/DateTime.cpp | 97 +- Foundation/src/DateTimeFormat.cpp | 8 +- Foundation/src/DateTimeFormatter.cpp | 18 +- Foundation/src/DateTimeParser.cpp | 16 +- Foundation/src/Debugger.cpp | 18 +- Foundation/src/DeflatingStream.cpp | 21 +- Foundation/src/DigestEngine.cpp | 8 +- Foundation/src/DigestStream.cpp | 12 +- Foundation/src/DirectoryIterator.cpp | 8 +- Foundation/src/DirectoryIterator_UNIX.cpp | 12 +- Foundation/src/DirectoryIterator_VMS.cpp | 12 +- Foundation/src/DirectoryIterator_WIN32.cpp | 12 +- Foundation/src/DirectoryIterator_WIN32U.cpp | 14 +- Foundation/src/Environment.cpp | 8 +- Foundation/src/Environment_UNIX.cpp | 10 +- Foundation/src/Environment_VMS.cpp | 10 +- Foundation/src/Environment_WIN32.cpp | 10 +- Foundation/src/Environment_WIN32U.cpp | 18 +- Foundation/src/ErrorHandler.cpp | 10 +- Foundation/src/Event.cpp | 8 +- Foundation/src/EventArgs.cpp | 8 +- Foundation/src/EventLogChannel.cpp | 85 +- Foundation/src/Event_POSIX.cpp | 8 +- Foundation/src/Event_WIN32.cpp | 8 +- Foundation/src/Exception.cpp | 29 +- Foundation/src/FPEnvironment.cpp | 16 +- Foundation/src/FPEnvironment_C99.cpp | 8 +- Foundation/src/FPEnvironment_DEC.cpp | 8 +- Foundation/src/FPEnvironment_DUMMY.cpp | 8 +- Foundation/src/FPEnvironment_SUN.cpp | 8 +- Foundation/src/FPEnvironment_WIN32.cpp | 8 +- Foundation/src/File.cpp | 20 +- Foundation/src/FileChannel.cpp | 34 +- Foundation/src/FileStreamFactory.cpp | 16 +- Foundation/src/File_UNIX.cpp | 27 +- Foundation/src/File_VMS.cpp | 18 +- Foundation/src/File_WIN32.cpp | 16 +- Foundation/src/File_WIN32U.cpp | 18 +- Foundation/src/Format.cpp | 334 +++++++ Foundation/src/Formatter.cpp | 10 +- Foundation/src/FormattingChannel.cpp | 14 +- Foundation/src/Glob.cpp | 16 +- Foundation/src/HashStatistic.cpp | 86 ++ Foundation/src/HexBinaryDecoder.cpp | 10 +- Foundation/src/HexBinaryEncoder.cpp | 8 +- Foundation/src/InflatingStream.cpp | 21 +- Foundation/src/Latin1Encoding.cpp | 8 +- Foundation/src/Latin9Encoding.cpp | 8 +- Foundation/src/LineEndingConverter.cpp | 8 +- Foundation/src/LocalDateTime.cpp | 14 +- Foundation/src/LogFile.cpp | 12 +- Foundation/src/LogFile_STD.cpp | 14 +- Foundation/src/LogFile_VMS.cpp | 12 +- Foundation/src/LogFile_WIN32.cpp | 12 +- Foundation/src/LogFile_WIN32U.cpp | 112 +++ Foundation/src/LogStream.cpp | 181 ++++ Foundation/src/Logger.cpp | 31 +- Foundation/src/LoggingFactory.cpp | 30 +- Foundation/src/LoggingRegistry.cpp | 10 +- Foundation/src/MD2Engine.cpp | 8 +- Foundation/src/MD4Engine.cpp | 8 +- Foundation/src/MD5Engine.cpp | 8 +- Foundation/src/MSG00001.bin | Bin 232 -> 241 bytes Foundation/src/Manifest.cpp | 8 +- Foundation/src/MemoryPool.cpp | 10 +- Foundation/src/Message.cpp | 22 +- Foundation/src/Mutex.cpp | 8 +- Foundation/src/Mutex_POSIX.cpp | 8 +- Foundation/src/Mutex_WIN32.cpp | 8 +- Foundation/src/NamedEvent.cpp | 8 +- Foundation/src/NamedEvent_UNIX.cpp | 10 +- Foundation/src/NamedEvent_VMS.cpp | 8 +- Foundation/src/NamedEvent_WIN32.cpp | 10 +- Foundation/src/NamedEvent_WIN32U.cpp | 12 +- Foundation/src/NamedMutex.cpp | 8 +- Foundation/src/NamedMutex_UNIX.cpp | 10 +- Foundation/src/NamedMutex_VMS.cpp | 8 +- Foundation/src/NamedMutex_WIN32.cpp | 10 +- Foundation/src/NamedMutex_WIN32U.cpp | 12 +- Foundation/src/NestedDiagnosticContext.cpp | 12 +- Foundation/src/Notification.cpp | 8 +- Foundation/src/NotificationCenter.cpp | 16 +- Foundation/src/NotificationQueue.cpp | 14 +- Foundation/src/NullChannel.cpp | 8 +- Foundation/src/NullStream.cpp | 8 +- Foundation/src/NumberFormatter.cpp | 8 +- Foundation/src/NumberParser.cpp | 10 +- Foundation/src/Observer.cpp | 8 +- Foundation/src/OpcomChannel.cpp | 10 +- Foundation/src/Path.cpp | 14 +- Foundation/src/Path_UNIX.cpp | 12 +- Foundation/src/Path_VMS.cpp | 10 +- Foundation/src/Path_WIN32.cpp | 10 +- Foundation/src/Path_WIN32U.cpp | 28 +- Foundation/src/PatternFormatter.cpp | 24 +- Foundation/src/Pipe.cpp | 92 ++ Foundation/src/PipeImpl.cpp | 46 + Foundation/src/PipeImpl_DUMMY.cpp | 87 ++ Foundation/src/PipeImpl_POSIX.cpp | 122 +++ Foundation/src/PipeImpl_WIN32.cpp | 119 +++ Foundation/src/PipeStream.cpp | 149 +++ Foundation/src/Process.cpp | 18 +- Foundation/src/Process_UNIX.cpp | 49 +- Foundation/src/Process_VMS.cpp | 14 +- Foundation/src/Process_WIN32.cpp | 41 +- Foundation/src/Process_WIN32U.cpp | 43 +- Foundation/src/PurgeStrategy.cpp | 14 +- Foundation/src/RWLock.cpp | 8 +- Foundation/src/RWLock_POSIX.cpp | 8 +- Foundation/src/RWLock_WIN32.cpp | 8 +- Foundation/src/Random.cpp | 10 +- Foundation/src/RandomStream.cpp | 12 +- Foundation/src/RefCountedObject.cpp | 8 +- Foundation/src/RegularExpression.cpp | 10 +- Foundation/src/RotateStrategy.cpp | 8 +- Foundation/src/Runnable.cpp | 8 +- Foundation/src/SHA1Engine.cpp | 8 +- Foundation/src/Semaphore.cpp | 8 +- Foundation/src/Semaphore_POSIX.cpp | 8 +- Foundation/src/Semaphore_WIN32.cpp | 8 +- Foundation/src/SharedLibrary.cpp | 12 +- Foundation/src/SharedLibrary_HPUX.cpp | 8 +- Foundation/src/SharedLibrary_UNIX.cpp | 16 +- Foundation/src/SharedLibrary_VMS.cpp | 10 +- Foundation/src/SharedLibrary_WIN32.cpp | 8 +- Foundation/src/SharedLibrary_WIN32U.cpp | 119 +++ Foundation/src/SignalHandler.cpp | 14 +- Foundation/src/SimpleFileChannel.cpp | 16 +- Foundation/src/SplitterChannel.cpp | 10 +- Foundation/src/Stopwatch.cpp | 8 +- Foundation/src/StreamChannel.cpp | 10 +- Foundation/src/StreamConverter.cpp | 10 +- Foundation/src/StreamCopier.cpp | 10 +- Foundation/src/StreamTokenizer.cpp | 8 +- Foundation/src/String.cpp | 8 +- Foundation/src/StringTokenizer.cpp | 8 +- Foundation/src/SynchronizedObject.cpp | 8 +- Foundation/src/SyslogChannel.cpp | 12 +- Foundation/src/Task.cpp | 12 +- Foundation/src/TaskManager.cpp | 12 +- Foundation/src/TaskNotification.cpp | 8 +- Foundation/src/TeeStream.cpp | 8 +- Foundation/src/TemporaryFile.cpp | 16 +- Foundation/src/TextConverter.cpp | 12 +- Foundation/src/TextEncoding.cpp | 8 +- Foundation/src/TextIterator.cpp | 34 +- Foundation/src/Thread.cpp | 14 +- Foundation/src/ThreadLocal.cpp | 12 +- Foundation/src/ThreadPool.cpp | 59 +- Foundation/src/Thread_POSIX.cpp | 12 +- Foundation/src/Thread_WIN32.cpp | 12 +- Foundation/src/Timer.cpp | 22 +- Foundation/src/Timespan.cpp | 8 +- Foundation/src/Timestamp.cpp | 10 +- Foundation/src/Timezone.cpp | 8 +- Foundation/src/Timezone_UNIX.cpp | 14 +- Foundation/src/Timezone_WIN32.cpp | 8 +- Foundation/src/Token.cpp | 10 +- Foundation/src/URI.cpp | 16 +- Foundation/src/URIStreamFactory.cpp | 8 +- Foundation/src/URIStreamOpener.cpp | 20 +- Foundation/src/UTF16Encoding.cpp | 12 +- Foundation/src/UTF8Encoding.cpp | 8 +- Foundation/src/UUID.cpp | 12 +- Foundation/src/UUIDGenerator.cpp | 119 ++- Foundation/src/UnicodeConverter.cpp | 28 +- Foundation/src/Void.cpp | 79 ++ Foundation/src/Windows1252Encoding.cpp | 8 +- Foundation/src/compress.c | 2 +- Foundation/src/crc32.c | 2 +- Foundation/src/deflate.c | 2 +- Foundation/src/deflate.h | 2 +- Foundation/src/gzio.c | 2 +- Foundation/src/pocomsg.h | 2 +- Foundation/src/pocomsg.mc | 2 +- Foundation/src/trees.c | 2 +- Foundation/src/zconf.h | 2 +- Foundation/src/zutil.c | 2 +- Foundation/src/zutil.h | 2 +- Foundation/testsuite/Makefile | 6 +- Foundation/testsuite/Makefile-Driver | 11 +- Foundation/testsuite/Makefile-TestApp | 2 +- Foundation/testsuite/Makefile-TestLibrary | 2 +- Foundation/testsuite/TestSuite_vs71.vcproj | 24 + Foundation/testsuite/TestSuite_vs80.vcproj | 32 + .../testsuite/src/ActiveDispatcherTest.cpp | 190 ++++ .../testsuite/src/ActiveDispatcherTest.h | 76 ++ Foundation/testsuite/src/ActiveMethodTest.cpp | 87 +- Foundation/testsuite/src/ActiveMethodTest.h | 8 +- Foundation/testsuite/src/ActivityTest.cpp | 73 +- Foundation/testsuite/src/ActivityTest.h | 8 +- Foundation/testsuite/src/AnyTest.cpp | 27 +- Foundation/testsuite/src/AnyTest.h | 9 +- Foundation/testsuite/src/AutoPtrTest.cpp | 10 +- Foundation/testsuite/src/AutoPtrTest.h | 8 +- .../testsuite/src/AutoReleasePoolTest.cpp | 6 +- .../testsuite/src/AutoReleasePoolTest.h | 8 +- Foundation/testsuite/src/Base64Test.cpp | 14 +- Foundation/testsuite/src/Base64Test.h | 8 +- Foundation/testsuite/src/BasicEventTest.cpp | 60 +- Foundation/testsuite/src/BasicEventTest.h | 33 +- .../testsuite/src/BinaryReaderWriterTest.cpp | 18 +- .../testsuite/src/BinaryReaderWriterTest.h | 20 +- Foundation/testsuite/src/ByteOrderTest.cpp | 18 +- Foundation/testsuite/src/ByteOrderTest.h | 8 +- Foundation/testsuite/src/CacheTestSuite.cpp | 2 +- Foundation/testsuite/src/CacheTestSuite.h | 4 +- Foundation/testsuite/src/ChannelTest.cpp | 34 +- Foundation/testsuite/src/ChannelTest.h | 8 +- Foundation/testsuite/src/ClassLoaderTest.cpp | 20 +- Foundation/testsuite/src/ClassLoaderTest.h | 8 +- Foundation/testsuite/src/CoreTest.cpp | 38 +- Foundation/testsuite/src/CoreTest.h | 8 +- Foundation/testsuite/src/CoreTestSuite.cpp | 6 +- Foundation/testsuite/src/CoreTestSuite.h | 4 +- .../testsuite/src/CountingStreamTest.cpp | 8 +- Foundation/testsuite/src/CountingStreamTest.h | 8 +- Foundation/testsuite/src/CryptTestSuite.cpp | 2 +- Foundation/testsuite/src/CryptTestSuite.h | 4 +- .../testsuite/src/DateTimeFormatterTest.cpp | 18 +- .../testsuite/src/DateTimeFormatterTest.h | 8 +- .../testsuite/src/DateTimeParserTest.cpp | 22 +- Foundation/testsuite/src/DateTimeParserTest.h | 8 +- Foundation/testsuite/src/DateTimeTest.cpp | 525 +++++++++- Foundation/testsuite/src/DateTimeTest.h | 13 +- .../testsuite/src/DateTimeTestSuite.cpp | 2 +- Foundation/testsuite/src/DateTimeTestSuite.h | 4 +- Foundation/testsuite/src/DigestStreamTest.cpp | 14 +- Foundation/testsuite/src/DigestStreamTest.h | 8 +- Foundation/testsuite/src/Driver.cpp | 2 +- Foundation/testsuite/src/DummyDelegate.cpp | 8 +- Foundation/testsuite/src/DummyDelegate.h | 40 +- .../testsuite/src/DynamicFactoryTest.cpp | 14 +- Foundation/testsuite/src/DynamicFactoryTest.h | 8 +- Foundation/testsuite/src/EventTestSuite.cpp | 2 +- Foundation/testsuite/src/EventTestSuite.h | 4 +- Foundation/testsuite/src/ExpireCacheTest.cpp | 34 +- Foundation/testsuite/src/ExpireCacheTest.h | 10 +- .../testsuite/src/ExpireLRUCacheTest.cpp | 39 +- Foundation/testsuite/src/ExpireLRUCacheTest.h | 10 +- Foundation/testsuite/src/FIFOEventTest.cpp | 64 +- Foundation/testsuite/src/FIFOEventTest.h | 33 +- Foundation/testsuite/src/FPETest.cpp | 6 +- Foundation/testsuite/src/FPETest.h | 8 +- Foundation/testsuite/src/FileChannelTest.cpp | 59 +- Foundation/testsuite/src/FileChannelTest.h | 8 +- Foundation/testsuite/src/FileTest.cpp | 24 +- Foundation/testsuite/src/FileTest.h | 8 +- .../testsuite/src/FilesystemTestSuite.cpp | 2 +- .../testsuite/src/FilesystemTestSuite.h | 4 +- Foundation/testsuite/src/FormatTest.cpp | 310 ++++++ Foundation/testsuite/src/FormatTest.h | 78 ++ .../testsuite/src/FoundationTestSuite.cpp | 2 +- .../testsuite/src/FoundationTestSuite.h | 4 +- Foundation/testsuite/src/GlobTest.cpp | 14 +- Foundation/testsuite/src/GlobTest.h | 11 +- Foundation/testsuite/src/HMACEngineTest.cpp | 12 +- Foundation/testsuite/src/HMACEngineTest.h | 8 +- Foundation/testsuite/src/HashTest.cpp | 226 +++++ Foundation/testsuite/src/HashTest.h | 65 ++ Foundation/testsuite/src/HexBinaryTest.cpp | 14 +- Foundation/testsuite/src/HexBinaryTest.h | 8 +- Foundation/testsuite/src/LRUCacheTest.cpp | 31 +- Foundation/testsuite/src/LRUCacheTest.h | 11 +- .../testsuite/src/LineEndingConverterTest.cpp | 14 +- .../testsuite/src/LineEndingConverterTest.h | 8 +- .../testsuite/src/LocalDateTimeTest.cpp | 22 +- Foundation/testsuite/src/LocalDateTimeTest.h | 8 +- Foundation/testsuite/src/LogStreamTest.cpp | 109 +++ Foundation/testsuite/src/LogStreamTest.h | 73 ++ Foundation/testsuite/src/LoggerTest.cpp | 25 +- Foundation/testsuite/src/LoggerTest.h | 8 +- .../testsuite/src/LoggingFactoryTest.cpp | 48 +- Foundation/testsuite/src/LoggingFactoryTest.h | 8 +- .../testsuite/src/LoggingRegistryTest.cpp | 28 +- .../testsuite/src/LoggingRegistryTest.h | 8 +- Foundation/testsuite/src/LoggingTestSuite.cpp | 4 +- Foundation/testsuite/src/LoggingTestSuite.h | 4 +- Foundation/testsuite/src/MD2EngineTest.cpp | 8 +- Foundation/testsuite/src/MD2EngineTest.h | 8 +- Foundation/testsuite/src/MD4EngineTest.cpp | 8 +- Foundation/testsuite/src/MD4EngineTest.h | 8 +- Foundation/testsuite/src/MD5EngineTest.cpp | 8 +- Foundation/testsuite/src/MD5EngineTest.h | 8 +- Foundation/testsuite/src/ManifestTest.cpp | 10 +- Foundation/testsuite/src/ManifestTest.h | 8 +- Foundation/testsuite/src/MemoryPoolTest.cpp | 8 +- Foundation/testsuite/src/MemoryPoolTest.h | 8 +- Foundation/testsuite/src/NDCTest.cpp | 6 +- Foundation/testsuite/src/NDCTest.h | 8 +- Foundation/testsuite/src/NamedEventTest.cpp | 18 +- Foundation/testsuite/src/NamedEventTest.h | 8 +- Foundation/testsuite/src/NamedMutexTest.cpp | 18 +- Foundation/testsuite/src/NamedMutexTest.h | 8 +- .../testsuite/src/NotificationCenterTest.cpp | 22 +- .../testsuite/src/NotificationCenterTest.h | 21 +- .../testsuite/src/NotificationQueueTest.cpp | 20 +- .../testsuite/src/NotificationQueueTest.h | 23 +- .../testsuite/src/NotificationsTestSuite.cpp | 2 +- .../testsuite/src/NotificationsTestSuite.h | 4 +- Foundation/testsuite/src/NullStreamTest.cpp | 8 +- Foundation/testsuite/src/NullStreamTest.h | 8 +- .../testsuite/src/NumberFormatterTest.cpp | 10 +- .../testsuite/src/NumberFormatterTest.h | 8 +- Foundation/testsuite/src/NumberParserTest.cpp | 10 +- Foundation/testsuite/src/NumberParserTest.h | 8 +- Foundation/testsuite/src/PathTest.cpp | 18 +- Foundation/testsuite/src/PathTest.h | 8 +- .../testsuite/src/PatternFormatterTest.cpp | 14 +- .../testsuite/src/PatternFormatterTest.h | 8 +- .../testsuite/src/PriorityEventTest.cpp | 71 +- Foundation/testsuite/src/PriorityEventTest.h | 33 +- Foundation/testsuite/src/ProcessTest.cpp | 71 +- Foundation/testsuite/src/ProcessTest.h | 10 +- .../testsuite/src/ProcessesTestSuite.cpp | 2 +- Foundation/testsuite/src/ProcessesTestSuite.h | 4 +- Foundation/testsuite/src/RWLockTest.cpp | 14 +- Foundation/testsuite/src/RWLockTest.h | 8 +- Foundation/testsuite/src/RandomStreamTest.cpp | 6 +- Foundation/testsuite/src/RandomStreamTest.h | 8 +- Foundation/testsuite/src/RandomTest.cpp | 8 +- Foundation/testsuite/src/RandomTest.h | 8 +- .../testsuite/src/RegularExpressionTest.cpp | 10 +- .../testsuite/src/RegularExpressionTest.h | 8 +- Foundation/testsuite/src/SHA1EngineTest.cpp | 8 +- Foundation/testsuite/src/SHA1EngineTest.h | 8 +- Foundation/testsuite/src/SemaphoreTest.cpp | 18 +- Foundation/testsuite/src/SemaphoreTest.h | 8 +- .../testsuite/src/SharedLibraryTest.cpp | 14 +- Foundation/testsuite/src/SharedLibraryTest.h | 8 +- .../testsuite/src/SharedLibraryTestSuite.cpp | 2 +- .../testsuite/src/SharedLibraryTestSuite.h | 4 +- Foundation/testsuite/src/SharedPtrTest.cpp | 64 +- Foundation/testsuite/src/SharedPtrTest.h | 11 +- .../testsuite/src/SimpleFileChannelTest.cpp | 34 +- .../testsuite/src/SimpleFileChannelTest.h | 8 +- Foundation/testsuite/src/StopwatchTest.cpp | 14 +- Foundation/testsuite/src/StopwatchTest.h | 8 +- .../testsuite/src/StreamConverterTest.cpp | 24 +- .../testsuite/src/StreamConverterTest.h | 8 +- Foundation/testsuite/src/StreamCopierTest.cpp | 6 +- Foundation/testsuite/src/StreamCopierTest.h | 8 +- .../testsuite/src/StreamTokenizerTest.cpp | 16 +- .../testsuite/src/StreamTokenizerTest.h | 8 +- Foundation/testsuite/src/StreamsTestSuite.cpp | 2 +- Foundation/testsuite/src/StreamsTestSuite.h | 4 +- Foundation/testsuite/src/StringTest.cpp | 32 +- Foundation/testsuite/src/StringTest.h | 8 +- .../testsuite/src/StringTokenizerTest.cpp | 6 +- .../testsuite/src/StringTokenizerTest.h | 8 +- Foundation/testsuite/src/TaskManagerTest.cpp | 52 +- Foundation/testsuite/src/TaskManagerTest.h | 8 +- Foundation/testsuite/src/TaskTest.cpp | 18 +- Foundation/testsuite/src/TaskTest.h | 8 +- Foundation/testsuite/src/TaskTestSuite.cpp | 2 +- Foundation/testsuite/src/TaskTestSuite.h | 4 +- Foundation/testsuite/src/TeeStreamTest.cpp | 8 +- Foundation/testsuite/src/TeeStreamTest.h | 8 +- Foundation/testsuite/src/TestApp.cpp | 21 +- Foundation/testsuite/src/TestChannel.cpp | 4 +- Foundation/testsuite/src/TestChannel.h | 19 +- Foundation/testsuite/src/TestLibrary.cpp | 4 +- Foundation/testsuite/src/TestPlugin.cpp | 2 +- Foundation/testsuite/src/TestPlugin.h | 6 +- .../testsuite/src/TextConverterTest.cpp | 18 +- Foundation/testsuite/src/TextConverterTest.h | 8 +- Foundation/testsuite/src/TextIteratorTest.cpp | 16 +- Foundation/testsuite/src/TextIteratorTest.h | 8 +- Foundation/testsuite/src/TextTestSuite.cpp | 2 +- Foundation/testsuite/src/TextTestSuite.h | 4 +- Foundation/testsuite/src/ThreadLocalTest.cpp | 14 +- Foundation/testsuite/src/ThreadLocalTest.h | 8 +- Foundation/testsuite/src/ThreadPoolTest.cpp | 18 +- Foundation/testsuite/src/ThreadPoolTest.h | 20 +- Foundation/testsuite/src/ThreadTest.cpp | 14 +- Foundation/testsuite/src/ThreadTest.h | 8 +- .../testsuite/src/ThreadingTestSuite.cpp | 4 +- Foundation/testsuite/src/ThreadingTestSuite.h | 4 +- Foundation/testsuite/src/TimerTest.cpp | 14 +- Foundation/testsuite/src/TimerTest.h | 20 +- Foundation/testsuite/src/TimespanTest.cpp | 6 +- Foundation/testsuite/src/TimespanTest.h | 8 +- Foundation/testsuite/src/TimestampTest.cpp | 14 +- Foundation/testsuite/src/TimestampTest.h | 8 +- Foundation/testsuite/src/TimezoneTest.cpp | 6 +- Foundation/testsuite/src/TimezoneTest.h | 8 +- .../testsuite/src/URIStreamOpenerTest.cpp | 22 +- .../testsuite/src/URIStreamOpenerTest.h | 8 +- Foundation/testsuite/src/URITest.cpp | 6 +- Foundation/testsuite/src/URITest.h | 8 +- Foundation/testsuite/src/URITestSuite.cpp | 2 +- Foundation/testsuite/src/URITestSuite.h | 4 +- .../testsuite/src/UUIDGeneratorTest.cpp | 10 +- Foundation/testsuite/src/UUIDGeneratorTest.h | 8 +- Foundation/testsuite/src/UUIDTest.cpp | 6 +- Foundation/testsuite/src/UUIDTest.h | 8 +- Foundation/testsuite/src/UUIDTestSuite.cpp | 2 +- Foundation/testsuite/src/UUIDTestSuite.h | 4 +- Foundation/testsuite/src/WinDriver.cpp | 2 +- Foundation/testsuite/src/ZLibTest.cpp | 22 +- Foundation/testsuite/src/ZLibTest.h | 8 +- Foundation/testsuite/testapp.vmsbuild | 2 +- Foundation/testsuite/testlibrary.vmsbuild | 2 +- Foundation/testsuite/testsuite.vmsbuild | 3 +- MANIFEST | 904 ++++++++++-------- Makefile | 58 +- NEWS | 22 +- Net/Makefile | 12 +- Net/Net.vmsbuild | 2 +- Net/Net_vs71.vcproj | 224 +++-- Net/Net_vs80.vcproj | 248 +++-- Net/include/{ => Poco}/Net/DNS.h | 32 +- Net/include/{ => Poco}/Net/DatagramSocket.h | 15 +- .../{ => Poco}/Net/DatagramSocketImpl.h | 15 +- Net/include/{ => Poco}/Net/DialogSocket.h | 15 +- Net/include/{ => Poco}/Net/FTPClientSession.h | 47 +- Net/include/{ => Poco}/Net/FTPStreamFactory.h | 27 +- Net/include/{ => Poco}/Net/FilePartSource.h | 18 +- Net/include/{ => Poco}/Net/HTMLForm.h | 36 +- .../{ => Poco}/Net/HTTPBasicCredentials.h | 11 +- .../{ => Poco}/Net/HTTPBasicStreamBuf.h | 19 +- .../{ => Poco}/Net/HTTPBufferAllocator.h | 18 +- .../{ => Poco}/Net/HTTPChunkedStream.h | 29 +- .../{ => Poco}/Net/HTTPClientSession.h | 62 +- Net/include/{ => Poco}/Net/HTTPCookie.h | 11 +- .../{ => Poco}/Net/HTTPFixedLengthStream.h | 25 +- Net/include/{ => Poco}/Net/HTTPHeaderStream.h | 29 +- Net/include/{ => Poco}/Net/HTTPIOStream.h | 13 +- Net/include/{ => Poco}/Net/HTTPMessage.h | 15 +- Net/include/{ => Poco}/Net/HTTPRequest.h | 17 +- .../{ => Poco}/Net/HTTPRequestHandler.h | 11 +- .../Net/HTTPRequestHandlerFactory.h | 11 +- Net/include/{ => Poco}/Net/HTTPResponse.h | 30 +- Net/include/{ => Poco}/Net/HTTPServer.h | 17 +- .../{ => Poco}/Net/HTTPServerConnection.h | 15 +- .../Net/HTTPServerConnectionFactory.h | 15 +- Net/include/{ => Poco}/Net/HTTPServerParams.h | 39 +- .../{ => Poco}/Net/HTTPServerRequest.h | 22 +- .../{ => Poco}/Net/HTTPServerResponse.h | 18 +- .../{ => Poco}/Net/HTTPServerSession.h | 29 +- Net/include/{ => Poco}/Net/HTTPSession.h | 58 +- Net/include/Poco/Net/HTTPSessionFactory.h | 154 +++ .../Poco/Net/HTTPSessionInstantiator.h | 116 +++ Net/include/{ => Poco}/Net/HTTPStream.h | 29 +- .../{ => Poco}/Net/HTTPStreamFactory.h | 38 +- Net/include/{ => Poco}/Net/HostEntry.h | 22 +- Net/include/Poco/Net/ICMPClient.h | 107 +++ Net/include/Poco/Net/ICMPEventArgs.h | 188 ++++ Net/include/Poco/Net/ICMPPacket.h | 111 +++ Net/include/Poco/Net/ICMPPacketImpl.h | 163 ++++ Net/include/Poco/Net/ICMPSocket.h | 139 +++ Net/include/Poco/Net/ICMPSocketImpl.h | 84 ++ Net/include/Poco/Net/ICMPv4PacketImpl.h | 186 ++++ Net/include/{ => Poco}/Net/IPAddress.h | 15 +- Net/include/{ => Poco}/Net/MailMessage.h | 30 +- Net/include/{ => Poco}/Net/MailRecipient.h | 11 +- Net/include/{ => Poco}/Net/MailStream.h | 23 +- Net/include/{ => Poco}/Net/MediaType.h | 15 +- Net/include/{ => Poco}/Net/MessageHeader.h | 24 +- Net/include/{ => Poco}/Net/MulticastSocket.h | 19 +- Net/include/{ => Poco}/Net/MultipartReader.h | 22 +- Net/include/{ => Poco}/Net/MultipartWriter.h | 14 +- .../{ => Poco}/Net/NameValueCollection.h | 24 +- Net/include/{ => Poco}/Net/Net.h | 15 +- Net/include/{ => Poco}/Net/NetException.h | 19 +- Net/include/{ => Poco}/Net/NetworkInterface.h | 24 +- Net/include/{ => Poco}/Net/NullPartHandler.h | 15 +- .../{ => Poco}/Net/POP3ClientSession.h | 30 +- Net/include/{ => Poco}/Net/PartHandler.h | 14 +- Net/include/{ => Poco}/Net/PartSource.h | 14 +- .../{ => Poco}/Net/QuotedPrintableDecoder.h | 20 +- .../{ => Poco}/Net/QuotedPrintableEncoder.h | 20 +- Net/include/Poco/Net/RawSocket.h | 169 ++++ Net/include/Poco/Net/RawSocketImpl.h | 78 ++ .../{ => Poco}/Net/SMTPClientSession.h | 25 +- Net/include/{ => Poco}/Net/ServerSocket.h | 23 +- Net/include/{ => Poco}/Net/ServerSocketImpl.h | 15 +- Net/include/{ => Poco}/Net/Socket.h | 48 +- Net/include/{ => Poco}/Net/SocketAcceptor.h | 31 +- Net/include/{ => Poco}/Net/SocketAddress.h | 42 +- Net/include/{ => Poco}/Net/SocketConnector.h | 39 +- Net/include/{ => Poco}/Net/SocketDefs.h | 2 +- Net/include/{ => Poco}/Net/SocketImpl.h | 47 +- .../{ => Poco}/Net/SocketNotification.h | 21 +- Net/include/{ => Poco}/Net/SocketNotifier.h | 45 +- Net/include/{ => Poco}/Net/SocketReactor.h | 72 +- Net/include/{ => Poco}/Net/SocketStream.h | 27 +- Net/include/{ => Poco}/Net/StreamSocket.h | 27 +- Net/include/{ => Poco}/Net/StreamSocketImpl.h | 15 +- Net/include/{ => Poco}/Net/StringPartSource.h | 18 +- Net/include/{ => Poco}/Net/TCPServer.h | 33 +- .../{ => Poco}/Net/TCPServerConnection.h | 21 +- .../Net/TCPServerConnectionFactory.h | 15 +- .../{ => Poco}/Net/TCPServerDispatcher.h | 53 +- Net/include/{ => Poco}/Net/TCPServerParams.h | 29 +- Net/samples/EchoServer/EchoServer.vmsbuild | 2 +- Net/samples/EchoServer/Makefile | 4 +- Net/samples/EchoServer/src/EchoServer.cpp | 54 +- .../HTTPFormServer/HTTPFormServer.properties | 10 + .../HTTPFormServer/HTTPFormServer.vmsbuild | 8 + .../HTTPFormServer/HTTPFormServer_vs71.vcproj | 152 +++ .../HTTPFormServer/HTTPFormServer_vs80.vcproj | 217 +++++ Net/samples/HTTPFormServer/Makefile | 17 + .../HTTPFormServer/src/HTTPFormServer.cpp | 326 +++++++ .../HTTPLoadTest/HTTPLoadTest.vmsbuild | 7 + .../HTTPLoadTest/HTTPLoadTest_vs71.vcproj | 145 +++ .../HTTPLoadTest/HTTPLoadTest_vs80.vcproj | 209 ++++ Net/samples/HTTPLoadTest/Makefile | 17 + Net/samples/HTTPLoadTest/src/HTTPLoadTest.cpp | 388 ++++++++ .../HTTPTimeServer/HTTPTimeServer.properties | 6 +- .../HTTPTimeServer/HTTPTimeServer.vmsbuild | 2 +- Net/samples/HTTPTimeServer/Makefile | 4 +- .../HTTPTimeServer/src/HTTPTimeServer.cpp | 79 +- Net/samples/Mail/Mail.vmsbuild | 2 +- Net/samples/Mail/Makefile | 4 +- Net/samples/Mail/src/Mail.cpp | 26 +- Net/samples/Makefile | 6 +- Net/samples/Ping/Makefile | 17 + Net/samples/Ping/Ping.vmsbuild | 7 + Net/samples/Ping/Ping_vs71.vcproj | 152 +++ Net/samples/Ping/Ping_vs80.vcproj | 217 +++++ Net/samples/Ping/ping.properties | 8 + Net/samples/Ping/src/Ping.cpp | 219 +++++ Net/samples/TimeServer/Makefile | 4 +- Net/samples/TimeServer/TimeServer.vmsbuild | 2 +- Net/samples/TimeServer/src/TimeServer.cpp | 60 +- Net/samples/dict/Makefile | 4 +- Net/samples/dict/dict.vmsbuild | 2 +- Net/samples/dict/src/dict.cpp | 26 +- Net/samples/download/Makefile | 2 +- Net/samples/download/src/download.cpp | 30 +- Net/samples/httpget/Makefile | 4 +- Net/samples/httpget/httpget.vmsbuild | 2 +- Net/samples/httpget/src/httpget.cpp | 32 +- Net/samples/samples_vs71.sln | 24 + Net/samples/samples_vs80.sln | 18 + Net/src/DNS.cpp | 27 +- Net/src/DatagramSocket.cpp | 15 +- Net/src/DatagramSocketImpl.cpp | 13 +- Net/src/DialogSocket.cpp | 9 +- Net/src/FTPClientSession.cpp | 35 +- Net/src/FTPStreamFactory.cpp | 33 +- Net/src/FilePartSource.cpp | 17 +- Net/src/HTMLForm.cpp | 85 +- Net/src/HTTPBasicCredentials.cpp | 25 +- Net/src/HTTPBufferAllocator.cpp | 9 +- Net/src/HTTPChunkedStream.cpp | 23 +- Net/src/HTTPClientSession.cpp | 70 +- Net/src/HTTPCookie.cpp | 43 +- Net/src/HTTPFixedLengthStream.cpp | 17 +- Net/src/HTTPHeaderStream.cpp | 15 +- Net/src/HTTPIOStream.cpp | 11 +- Net/src/HTTPMessage.cpp | 23 +- Net/src/HTTPRequest.cpp | 22 +- Net/src/HTTPRequestHandler.cpp | 9 +- Net/src/HTTPRequestHandlerFactory.cpp | 9 +- Net/src/HTTPResponse.cpp | 72 +- Net/src/HTTPServer.cpp | 15 +- Net/src/HTTPServerConnection.cpp | 25 +- Net/src/HTTPServerConnectionFactory.cpp | 15 +- Net/src/HTTPServerParams.cpp | 13 +- Net/src/HTTPServerRequest.cpp | 25 +- Net/src/HTTPServerResponse.cpp | 41 +- Net/src/HTTPServerSession.cpp | 11 +- Net/src/HTTPSession.cpp | 60 +- Net/src/HTTPSessionFactory.cpp | 153 +++ Net/src/HTTPSessionInstantiator.cpp | 88 ++ Net/src/HTTPStream.cpp | 15 +- Net/src/HTTPStreamFactory.cpp | 36 +- Net/src/HostEntry.cpp | 11 +- Net/src/ICMPClient.cpp | 166 ++++ Net/src/ICMPEventArgs.cpp | 195 ++++ Net/src/ICMPPacket.cpp | 134 +++ Net/src/ICMPPacketImpl.cpp | 127 +++ Net/src/ICMPSocket.cpp | 101 ++ Net/src/ICMPSocketImpl.cpp | 111 +++ Net/src/ICMPv4PacketImpl.cpp | 275 ++++++ Net/src/IPAddress.cpp | 33 +- Net/src/MailMessage.cpp | 57 +- Net/src/MailRecipient.cpp | 21 +- Net/src/MailStream.cpp | 9 +- Net/src/MediaType.cpp | 15 +- Net/src/MessageHeader.cpp | 23 +- Net/src/MulticastSocket.cpp | 13 +- Net/src/MultipartReader.cpp | 15 +- Net/src/MultipartWriter.cpp | 19 +- Net/src/NameValueCollection.cpp | 23 +- Net/src/NetException.cpp | 13 +- Net/src/NetworkInterface.cpp | 51 +- Net/src/NullPartHandler.cpp | 19 +- Net/src/POP3ClientSession.cpp | 35 +- Net/src/PartHandler.cpp | 9 +- Net/src/PartSource.cpp | 9 +- Net/src/QuotedPrintableDecoder.cpp | 21 +- Net/src/QuotedPrintableEncoder.cpp | 15 +- Net/src/RawSocket.cpp | 133 +++ Net/src/RawSocketImpl.cpp | 91 ++ Net/src/SMTPClientSession.cpp | 31 +- Net/src/ServerSocket.cpp | 19 +- Net/src/ServerSocketImpl.cpp | 9 +- Net/src/Socket.cpp | 13 +- Net/src/SocketAddress.cpp | 82 +- Net/src/SocketImpl.cpp | 46 +- Net/src/SocketNotification.cpp | 9 +- Net/src/SocketNotifier.cpp | 17 +- Net/src/SocketReactor.cpp | 33 +- Net/src/SocketStream.cpp | 17 +- Net/src/StreamSocket.cpp | 17 +- Net/src/StreamSocketImpl.cpp | 9 +- Net/src/StringPartSource.cpp | 9 +- Net/src/TCPServer.cpp | 33 +- Net/src/TCPServerConnection.cpp | 17 +- Net/src/TCPServerConnectionFactory.cpp | 9 +- Net/src/TCPServerDispatcher.cpp | 27 +- Net/src/TCPServerParams.cpp | 11 +- Net/testsuite/Makefile | 5 +- Net/testsuite/TestSuite.vmsbuild | 2 +- Net/testsuite/TestSuite_vs71.vcproj | 36 + Net/testsuite/TestSuite_vs80.vcproj | 44 + Net/testsuite/src/DNSTest.cpp | 22 +- Net/testsuite/src/DNSTest.h | 8 +- Net/testsuite/src/DatagramSocketTest.cpp | 30 +- Net/testsuite/src/DatagramSocketTest.h | 8 +- Net/testsuite/src/DialogServer.cpp | 24 +- Net/testsuite/src/DialogServer.h | 51 +- Net/testsuite/src/DialogSocketTest.cpp | 10 +- Net/testsuite/src/DialogSocketTest.h | 8 +- Net/testsuite/src/Driver.cpp | 2 +- Net/testsuite/src/EchoServer.cpp | 20 +- Net/testsuite/src/EchoServer.h | 30 +- Net/testsuite/src/FTPClientSessionTest.cpp | 36 +- Net/testsuite/src/FTPClientSessionTest.h | 8 +- Net/testsuite/src/FTPClientTestSuite.cpp | 2 +- Net/testsuite/src/FTPClientTestSuite.h | 4 +- Net/testsuite/src/FTPStreamFactoryTest.cpp | 28 +- Net/testsuite/src/FTPStreamFactoryTest.h | 8 +- Net/testsuite/src/HTMLFormTest.cpp | 26 +- Net/testsuite/src/HTMLFormTest.h | 8 +- Net/testsuite/src/HTMLTestSuite.cpp | 2 +- Net/testsuite/src/HTMLTestSuite.h | 4 +- Net/testsuite/src/HTTPClientSessionTest.cpp | 20 +- Net/testsuite/src/HTTPClientSessionTest.h | 8 +- Net/testsuite/src/HTTPClientTestSuite.cpp | 2 +- Net/testsuite/src/HTTPClientTestSuite.h | 4 +- Net/testsuite/src/HTTPCookieTest.cpp | 6 +- Net/testsuite/src/HTTPCookieTest.h | 8 +- Net/testsuite/src/HTTPCredentialsTest.cpp | 14 +- Net/testsuite/src/HTTPCredentialsTest.h | 8 +- Net/testsuite/src/HTTPRequestTest.cpp | 14 +- Net/testsuite/src/HTTPRequestTest.h | 8 +- Net/testsuite/src/HTTPResponseTest.cpp | 33 +- Net/testsuite/src/HTTPResponseTest.h | 9 +- Net/testsuite/src/HTTPServerTest.cpp | 72 +- Net/testsuite/src/HTTPServerTest.h | 9 +- Net/testsuite/src/HTTPServerTestSuite.cpp | 2 +- Net/testsuite/src/HTTPServerTestSuite.h | 4 +- Net/testsuite/src/HTTPStreamFactoryTest.cpp | 20 +- Net/testsuite/src/HTTPStreamFactoryTest.h | 8 +- Net/testsuite/src/HTTPTestServer.cpp | 26 +- Net/testsuite/src/HTTPTestServer.h | 32 +- Net/testsuite/src/HTTPTestSuite.cpp | 2 +- Net/testsuite/src/HTTPTestSuite.h | 4 +- Net/testsuite/src/ICMPClientTest.cpp | 152 +++ Net/testsuite/src/ICMPClientTest.h | 68 ++ Net/testsuite/src/ICMPClientTestSuite.cpp | 44 + Net/testsuite/src/ICMPClientTestSuite.h | 49 + Net/testsuite/src/ICMPSocketTest.cpp | 115 +++ Net/testsuite/src/ICMPSocketTest.h | 61 ++ Net/testsuite/src/IPAddressTest.cpp | 10 +- Net/testsuite/src/IPAddressTest.h | 8 +- Net/testsuite/src/MailMessageTest.cpp | 28 +- Net/testsuite/src/MailMessageTest.h | 8 +- Net/testsuite/src/MailStreamTest.cpp | 12 +- Net/testsuite/src/MailStreamTest.h | 8 +- Net/testsuite/src/MailTestSuite.cpp | 2 +- Net/testsuite/src/MailTestSuite.h | 4 +- Net/testsuite/src/MediaTypeTest.cpp | 6 +- Net/testsuite/src/MediaTypeTest.h | 8 +- Net/testsuite/src/MessageHeaderTest.cpp | 12 +- Net/testsuite/src/MessageHeaderTest.h | 8 +- Net/testsuite/src/MessagesTestSuite.cpp | 2 +- Net/testsuite/src/MessagesTestSuite.h | 4 +- Net/testsuite/src/MulticastEchoServer.cpp | 22 +- Net/testsuite/src/MulticastEchoServer.h | 48 +- Net/testsuite/src/MulticastSocketTest.cpp | 30 +- Net/testsuite/src/MulticastSocketTest.h | 8 +- Net/testsuite/src/MultipartReaderTest.cpp | 14 +- Net/testsuite/src/MultipartReaderTest.h | 8 +- Net/testsuite/src/MultipartWriterTest.cpp | 10 +- Net/testsuite/src/MultipartWriterTest.h | 8 +- Net/testsuite/src/NameValueCollectionTest.cpp | 13 +- Net/testsuite/src/NameValueCollectionTest.h | 8 +- Net/testsuite/src/NetCoreTestSuite.cpp | 2 +- Net/testsuite/src/NetCoreTestSuite.h | 4 +- Net/testsuite/src/NetTestSuite.cpp | 4 +- Net/testsuite/src/NetTestSuite.h | 4 +- Net/testsuite/src/NetworkInterfaceTest.cpp | 6 +- Net/testsuite/src/NetworkInterfaceTest.h | 8 +- Net/testsuite/src/POP3ClientSessionTest.cpp | 16 +- Net/testsuite/src/POP3ClientSessionTest.h | 8 +- Net/testsuite/src/QuotedPrintableTest.cpp | 10 +- Net/testsuite/src/QuotedPrintableTest.h | 8 +- Net/testsuite/src/RawSocketTest.cpp | 127 +++ Net/testsuite/src/RawSocketTest.h | 61 ++ Net/testsuite/src/ReactorTestSuite.cpp | 2 +- Net/testsuite/src/ReactorTestSuite.h | 4 +- Net/testsuite/src/SMTPClientSessionTest.cpp | 18 +- Net/testsuite/src/SMTPClientSessionTest.h | 8 +- Net/testsuite/src/SocketAddressTest.cpp | 45 +- Net/testsuite/src/SocketAddressTest.h | 8 +- Net/testsuite/src/SocketReactorTest.cpp | 42 +- Net/testsuite/src/SocketReactorTest.h | 8 +- Net/testsuite/src/SocketStreamTest.cpp | 36 +- Net/testsuite/src/SocketStreamTest.h | 8 +- Net/testsuite/src/SocketTest.cpp | 36 +- Net/testsuite/src/SocketTest.h | 8 +- Net/testsuite/src/SocketsTestSuite.cpp | 4 +- Net/testsuite/src/SocketsTestSuite.h | 4 +- Net/testsuite/src/TCPServerTest.cpp | 36 +- Net/testsuite/src/TCPServerTest.h | 8 +- Net/testsuite/src/TCPServerTestSuite.cpp | 2 +- Net/testsuite/src/TCPServerTestSuite.h | 4 +- Net/testsuite/src/UDPEchoServer.cpp | 20 +- Net/testsuite/src/UDPEchoServer.h | 38 +- Net/testsuite/src/WinDriver.cpp | 2 +- README | 53 +- Util/Makefile | 7 +- Util/Util.vmsbuild | 2 +- Util/Util_vs71.vcproj | 76 +- Util/Util_vs80.vcproj | 86 +- .../{ => Poco}/Util/AbstractConfiguration.h | 26 +- Util/include/{ => Poco}/Util/Application.h | 172 ++-- .../{ => Poco}/Util/ConfigurationMapper.h | 15 +- .../{ => Poco}/Util/ConfigurationView.h | 15 +- .../{ => Poco}/Util/FilesystemConfiguration.h | 23 +- Util/include/{ => Poco}/Util/HelpFormatter.h | 14 +- .../{ => Poco}/Util/IniFileConfiguration.h | 21 +- Util/include/Poco/Util/IntValidator.h | 78 ++ .../{ => Poco}/Util/LayeredConfiguration.h | 29 +- .../{ => Poco}/Util/LoggingConfigurator.h | 23 +- .../{ => Poco}/Util/LoggingSubsystem.h | 15 +- .../{ => Poco}/Util/MapConfiguration.h | 18 +- Util/include/{ => Poco}/Util/Option.h | 82 +- Util/include/Poco/Util/OptionCallback.h | 131 +++ .../include/{ => Poco}/Util/OptionException.h | 19 +- .../include/{ => Poco}/Util/OptionProcessor.h | 20 +- Util/include/{ => Poco}/Util/OptionSet.h | 18 +- .../Util/PropertyFileConfiguration.h | 21 +- Util/include/Poco/Util/RegExpValidator.h | 76 ++ .../{ => Poco}/Util/ServerApplication.h | 56 +- Util/include/{ => Poco}/Util/Subsystem.h | 17 +- .../{ => Poco}/Util/SystemConfiguration.h | 15 +- Util/include/{ => Poco}/Util/Util.h | 15 +- Util/include/Poco/Util/Validator.h | 79 ++ .../Poco/Util/WinRegistryConfiguration.h | 97 ++ Util/include/{ => Poco}/Util/WinRegistryKey.h | 35 +- Util/include/{ => Poco}/Util/WinService.h | 14 +- .../{ => Poco}/Util/XMLConfiguration.h | 56 +- Util/samples/Makefile | 6 +- Util/samples/SampleApp/Makefile | 4 +- Util/samples/SampleApp/SampleApp.vmsbuild | 2 +- Util/samples/SampleApp/src/SampleApp.cpp | 96 +- Util/samples/SampleServer/Makefile | 4 +- .../SampleServer/SampleServer.vmsbuild | 2 +- .../samples/SampleServer/src/SampleServer.cpp | 57 +- Util/src/AbstractConfiguration.cpp | 33 +- Util/src/Application.cpp | 183 +++- Util/src/ConfigurationMapper.cpp | 9 +- Util/src/ConfigurationView.cpp | 9 +- Util/src/FilesystemConfiguration.cpp | 27 +- Util/src/HelpFormatter.cpp | 13 +- Util/src/IniFileConfiguration.cpp | 21 +- Util/src/IntValidator.cpp | 76 ++ Util/src/LayeredConfiguration.cpp | 15 +- Util/src/LoggingConfigurator.cpp | 43 +- Util/src/LoggingSubsystem.cpp | 17 +- Util/src/MapConfiguration.cpp | 9 +- Util/src/Option.cpp | 97 +- Util/src/OptionCallback.cpp | 59 ++ Util/src/OptionException.cpp | 13 +- Util/src/OptionProcessor.cpp | 25 +- Util/src/OptionSet.cpp | 13 +- Util/src/PropertyFileConfiguration.cpp | 21 +- Util/src/RegExpValidator.cpp | 69 ++ Util/src/ServerApplication.cpp | 103 +- Util/src/Subsystem.cpp | 9 +- Util/src/SystemConfiguration.cpp | 21 +- Util/src/Validator.cpp | 54 ++ Util/src/WinRegistryConfiguration.cpp | 134 +++ Util/src/WinRegistryKey.cpp | 239 ++++- Util/src/WinService.cpp | 61 +- Util/src/XMLConfiguration.cpp | 91 +- Util/testsuite/Makefile | 6 +- Util/testsuite/TestSuite.vmsbuild | 2 +- Util/testsuite/TestSuite_vs71.vcproj | 12 + Util/testsuite/TestSuite_vs80.vcproj | 16 + .../src/AbstractConfigurationTest.cpp | 24 +- .../testsuite/src/AbstractConfigurationTest.h | 12 +- .../testsuite/src/ConfigurationMapperTest.cpp | 18 +- Util/testsuite/src/ConfigurationMapperTest.h | 12 +- Util/testsuite/src/ConfigurationTestSuite.cpp | 2 +- Util/testsuite/src/ConfigurationTestSuite.h | 4 +- Util/testsuite/src/ConfigurationViewTest.cpp | 14 +- Util/testsuite/src/ConfigurationViewTest.h | 12 +- Util/testsuite/src/Driver.cpp | 2 +- .../src/FilesystemConfigurationTest.cpp | 12 +- .../src/FilesystemConfigurationTest.h | 8 +- Util/testsuite/src/HelpFormatterTest.cpp | 14 +- Util/testsuite/src/HelpFormatterTest.h | 8 +- .../src/IniFileConfigurationTest.cpp | 18 +- Util/testsuite/src/IniFileConfigurationTest.h | 8 +- .../src/LayeredConfigurationTest.cpp | 22 +- Util/testsuite/src/LayeredConfigurationTest.h | 8 +- .../testsuite/src/LoggingConfiguratorTest.cpp | 56 +- Util/testsuite/src/LoggingConfiguratorTest.h | 8 +- Util/testsuite/src/MapConfigurationTest.cpp | 10 +- Util/testsuite/src/MapConfigurationTest.h | 8 +- Util/testsuite/src/OptionProcessorTest.cpp | 59 +- Util/testsuite/src/OptionProcessorTest.h | 9 +- Util/testsuite/src/OptionSetTest.cpp | 16 +- Util/testsuite/src/OptionSetTest.h | 8 +- Util/testsuite/src/OptionTest.cpp | 30 +- Util/testsuite/src/OptionTest.h | 8 +- Util/testsuite/src/OptionsTestSuite.cpp | 4 +- Util/testsuite/src/OptionsTestSuite.h | 4 +- .../src/PropertyFileConfigurationTest.cpp | 16 +- .../src/PropertyFileConfigurationTest.h | 8 +- .../testsuite/src/SystemConfigurationTest.cpp | 26 +- Util/testsuite/src/SystemConfigurationTest.h | 8 +- Util/testsuite/src/UtilTestSuite.cpp | 2 +- Util/testsuite/src/UtilTestSuite.h | 4 +- Util/testsuite/src/ValidatorTest.cpp | 177 ++++ Util/testsuite/src/ValidatorTest.h | 61 ++ Util/testsuite/src/WinConfigurationTest.cpp | 87 ++ Util/testsuite/src/WinConfigurationTest.h | 60 ++ Util/testsuite/src/WinDriver.cpp | 2 +- Util/testsuite/src/WinRegistryTest.cpp | 20 +- Util/testsuite/src/WinRegistryTest.h | 8 +- Util/testsuite/src/WindowsTestSuite.cpp | 4 +- Util/testsuite/src/WindowsTestSuite.h | 4 +- Util/testsuite/src/XMLConfigurationTest.cpp | 18 +- Util/testsuite/src/XMLConfigurationTest.h | 8 +- VERSION | 2 +- XML/Makefile | 6 +- XML/XML.vmsbuild | 2 +- XML/XML_vs71.vcproj | 142 +-- XML/XML_vs80.vcproj | 142 +-- .../{ => Poco}/DOM/AbstractContainerNode.h | 15 +- XML/include/{ => Poco}/DOM/AbstractNode.h | 23 +- XML/include/{ => Poco}/DOM/Attr.h | 26 +- XML/include/{ => Poco}/DOM/AttrMap.h | 15 +- XML/include/{ => Poco}/DOM/AutoPtr.h | 19 +- XML/include/{ => Poco}/DOM/CDATASection.h | 15 +- XML/include/{ => Poco}/DOM/CharacterData.h | 19 +- XML/include/{ => Poco}/DOM/ChildNodesList.h | 15 +- XML/include/{ => Poco}/DOM/Comment.h | 19 +- XML/include/{ => Poco}/DOM/DOMBuilder.h | 27 +- XML/include/{ => Poco}/DOM/DOMException.h | 22 +- .../{ => Poco}/DOM/DOMImplementation.h | 15 +- XML/include/{ => Poco}/DOM/DOMObject.h | 11 +- XML/include/{ => Poco}/DOM/DOMParser.h | 17 +- XML/include/{ => Poco}/DOM/DOMSerializer.h | 15 +- XML/include/{ => Poco}/DOM/DOMWriter.h | 33 +- XML/include/{ => Poco}/DOM/DTDMap.h | 15 +- XML/include/{ => Poco}/DOM/Document.h | 33 +- XML/include/{ => Poco}/DOM/DocumentEvent.h | 15 +- XML/include/{ => Poco}/DOM/DocumentFragment.h | 19 +- XML/include/{ => Poco}/DOM/DocumentType.h | 15 +- XML/include/{ => Poco}/DOM/Element.h | 21 +- .../{ => Poco}/DOM/ElementsByTagNameList.h | 19 +- XML/include/{ => Poco}/DOM/Entity.h | 19 +- XML/include/{ => Poco}/DOM/EntityReference.h | 19 +- XML/include/{ => Poco}/DOM/Event.h | 23 +- XML/include/{ => Poco}/DOM/EventDispatcher.h | 18 +- XML/include/{ => Poco}/DOM/EventException.h | 17 +- XML/include/{ => Poco}/DOM/EventListener.h | 15 +- XML/include/{ => Poco}/DOM/EventTarget.h | 19 +- XML/include/{ => Poco}/DOM/MutationEvent.h | 15 +- XML/include/{ => Poco}/DOM/NamedNodeMap.h | 19 +- XML/include/{ => Poco}/DOM/Node.h | 19 +- XML/include/{ => Poco}/DOM/NodeFilter.h | 15 +- XML/include/{ => Poco}/DOM/NodeIterator.h | 11 +- XML/include/{ => Poco}/DOM/NodeList.h | 15 +- XML/include/{ => Poco}/DOM/Notation.h | 19 +- .../{ => Poco}/DOM/ProcessingInstruction.h | 19 +- XML/include/{ => Poco}/DOM/Text.h | 22 +- XML/include/{ => Poco}/DOM/TreeWalker.h | 15 +- XML/include/{ => Poco}/SAX/Attributes.h | 15 +- XML/include/{ => Poco}/SAX/AttributesImpl.h | 18 +- XML/include/{ => Poco}/SAX/ContentHandler.h | 15 +- XML/include/{ => Poco}/SAX/DTDHandler.h | 15 +- XML/include/{ => Poco}/SAX/DeclHandler.h | 15 +- XML/include/{ => Poco}/SAX/DefaultHandler.h | 27 +- XML/include/{ => Poco}/SAX/EntityResolver.h | 15 +- .../{ => Poco}/SAX/EntityResolverImpl.h | 27 +- XML/include/{ => Poco}/SAX/ErrorHandler.h | 11 +- XML/include/{ => Poco}/SAX/InputSource.h | 19 +- XML/include/{ => Poco}/SAX/LexicalHandler.h | 15 +- XML/include/{ => Poco}/SAX/Locator.h | 15 +- XML/include/{ => Poco}/SAX/LocatorImpl.h | 19 +- XML/include/{ => Poco}/SAX/NamespaceSupport.h | 24 +- XML/include/{ => Poco}/SAX/SAXException.h | 32 +- XML/include/{ => Poco}/SAX/SAXParser.h | 21 +- XML/include/{ => Poco}/SAX/WhitespaceFilter.h | 19 +- XML/include/{ => Poco}/SAX/XMLFilter.h | 15 +- XML/include/{ => Poco}/SAX/XMLFilterImpl.h | 31 +- XML/include/{ => Poco}/SAX/XMLReader.h | 15 +- XML/include/{ => Poco}/XML/Name.h | 15 +- XML/include/{ => Poco}/XML/NamePool.h | 19 +- .../{ => Poco}/XML/NamespaceStrategy.h | 19 +- XML/include/{ => Poco}/XML/ParserEngine.h | 41 +- XML/include/{ => Poco}/XML/XML.h | 15 +- XML/include/{ => Poco}/XML/XMLException.h | 17 +- XML/include/{ => Poco}/XML/XMLStream.h | 17 +- XML/include/{ => Poco}/XML/XMLString.h | 11 +- XML/include/{ => Poco}/XML/XMLWriter.h | 63 +- XML/include/{ => Poco}/XML/expat.h | 0 XML/include/{ => Poco}/XML/expat_external.h | 0 XML/samples/DOMParser/DOMParser.vmsbuild | 2 +- XML/samples/DOMParser/Makefile | 4 +- XML/samples/DOMParser/src/DOMParser.cpp | 32 +- XML/samples/DOMWriter/DOMWriter.vmsbuild | 2 +- XML/samples/DOMWriter/Makefile | 4 +- XML/samples/DOMWriter/src/DOMWriter.cpp | 26 +- XML/samples/Makefile | 6 +- XML/samples/PrettyPrint/Makefile | 4 +- XML/samples/PrettyPrint/PrettyPrint.vmsbuild | 2 +- XML/samples/PrettyPrint/src/PrettyPrint.cpp | 26 +- XML/samples/SAXParser/Makefile | 4 +- XML/samples/SAXParser/SAXParser.vmsbuild | 2 +- XML/samples/SAXParser/src/SAXParser.cpp | 32 +- XML/src/AbstractContainerNode.cpp | 13 +- XML/src/AbstractNode.cpp | 36 +- XML/src/Attr.cpp | 19 +- XML/src/AttrMap.cpp | 17 +- XML/src/Attributes.cpp | 9 +- XML/src/AttributesImpl.cpp | 15 +- XML/src/CDATASection.cpp | 13 +- XML/src/CharacterData.cpp | 15 +- XML/src/ChildNodesList.cpp | 13 +- XML/src/Comment.cpp | 9 +- XML/src/ContentHandler.cpp | 9 +- XML/src/DOMBuilder.cpp | 39 +- XML/src/DOMException.cpp | 17 +- XML/src/DOMImplementation.cpp | 23 +- XML/src/DOMObject.cpp | 9 +- XML/src/DOMParser.cpp | 19 +- XML/src/DOMSerializer.cpp | 49 +- XML/src/DOMWriter.cpp | 29 +- XML/src/DTDHandler.cpp | 9 +- XML/src/DTDMap.cpp | 15 +- XML/src/DeclHandler.cpp | 9 +- XML/src/DefaultHandler.cpp | 9 +- XML/src/Document.cpp | 41 +- XML/src/DocumentEvent.cpp | 9 +- XML/src/DocumentFragment.cpp | 9 +- XML/src/DocumentType.cpp | 15 +- XML/src/Element.cpp | 34 +- XML/src/ElementsByTagNameList.cpp | 13 +- XML/src/Entity.cpp | 9 +- XML/src/EntityReference.cpp | 9 +- XML/src/EntityResolver.cpp | 9 +- XML/src/EntityResolverImpl.cpp | 31 +- XML/src/ErrorHandler.cpp | 9 +- XML/src/Event.cpp | 11 +- XML/src/EventDispatcher.cpp | 13 +- XML/src/EventException.cpp | 11 +- XML/src/EventListener.cpp | 9 +- XML/src/EventTarget.cpp | 9 +- XML/src/InputSource.cpp | 9 +- XML/src/LexicalHandler.cpp | 9 +- XML/src/Locator.cpp | 9 +- XML/src/LocatorImpl.cpp | 9 +- XML/src/MutationEvent.cpp | 9 +- XML/src/Name.cpp | 9 +- XML/src/NamePool.cpp | 13 +- XML/src/NamedNodeMap.cpp | 9 +- XML/src/NamespaceStrategy.cpp | 17 +- XML/src/NamespaceSupport.cpp | 11 +- XML/src/Node.cpp | 9 +- XML/src/NodeFilter.cpp | 9 +- XML/src/NodeIterator.cpp | 15 +- XML/src/NodeList.cpp | 9 +- XML/src/Notation.cpp | 9 +- XML/src/ParserEngine.cpp | 43 +- XML/src/ProcessingInstruction.cpp | 9 +- XML/src/SAXException.cpp | 23 +- XML/src/SAXParser.cpp | 19 +- XML/src/Text.cpp | 19 +- XML/src/TreeWalker.cpp | 13 +- XML/src/WhitespaceFilter.cpp | 11 +- XML/src/XMLException.cpp | 11 +- XML/src/XMLFilter.cpp | 9 +- XML/src/XMLFilterImpl.cpp | 11 +- XML/src/XMLReader.cpp | 9 +- XML/src/XMLString.cpp | 9 +- XML/src/XMLWriter.cpp | 48 +- XML/src/expat_config.h | 6 +- XML/src/xmlparse.cpp | 2 +- XML/src/xmlrole.c | 2 +- XML/src/xmltok.c | 2 +- XML/testsuite/Makefile | 2 +- XML/testsuite/TestSuite.vmsbuild | 2 +- XML/testsuite/src/AttributesImplTest.cpp | 6 +- XML/testsuite/src/AttributesImplTest.h | 8 +- XML/testsuite/src/ChildNodesTest.cpp | 20 +- XML/testsuite/src/ChildNodesTest.h | 8 +- XML/testsuite/src/DOMTestSuite.cpp | 2 +- XML/testsuite/src/DOMTestSuite.h | 4 +- XML/testsuite/src/DocumentTest.cpp | 30 +- XML/testsuite/src/DocumentTest.h | 8 +- XML/testsuite/src/DocumentTypeTest.cpp | 30 +- XML/testsuite/src/DocumentTypeTest.h | 8 +- XML/testsuite/src/Driver.cpp | 2 +- XML/testsuite/src/ElementTest.cpp | 34 +- XML/testsuite/src/ElementTest.h | 8 +- XML/testsuite/src/EventTest.cpp | 38 +- XML/testsuite/src/EventTest.h | 8 +- XML/testsuite/src/NamePoolTest.cpp | 14 +- XML/testsuite/src/NamePoolTest.h | 8 +- XML/testsuite/src/NameTest.cpp | 6 +- XML/testsuite/src/NameTest.h | 8 +- XML/testsuite/src/NamespaceSupportTest.cpp | 6 +- XML/testsuite/src/NamespaceSupportTest.h | 8 +- XML/testsuite/src/NodeIteratorTest.cpp | 30 +- XML/testsuite/src/NodeIteratorTest.h | 8 +- XML/testsuite/src/NodeTest.cpp | 20 +- XML/testsuite/src/NodeTest.h | 8 +- XML/testsuite/src/ParserWriterTest.cpp | 26 +- XML/testsuite/src/ParserWriterTest.h | 8 +- XML/testsuite/src/SAXParserTest.cpp | 40 +- XML/testsuite/src/SAXParserTest.h | 14 +- XML/testsuite/src/SAXTestSuite.cpp | 2 +- XML/testsuite/src/SAXTestSuite.h | 4 +- XML/testsuite/src/TextTest.cpp | 24 +- XML/testsuite/src/TextTest.h | 8 +- XML/testsuite/src/TreeWalkerTest.cpp | 30 +- XML/testsuite/src/TreeWalkerTest.h | 8 +- XML/testsuite/src/WinDriver.cpp | 2 +- XML/testsuite/src/XMLTestSuite.cpp | 2 +- XML/testsuite/src/XMLTestSuite.h | 4 +- XML/testsuite/src/XMLWriterTest.cpp | 35 +- XML/testsuite/src/XMLWriterTest.h | 9 +- build/config/ARM-Linux | 8 +- build/config/CYGWIN | 17 +- build/config/Darwin | 24 +- build/config/{Darwin8 => Darwin7} | 22 +- build/config/FreeBSD | 6 +- build/config/HP-UX | 6 +- build/config/Linux | 8 +- build/config/MinGW | 71 ++ build/config/OSF1 | 6 +- build/config/QNX | 4 +- build/config/SunOS | 8 +- build/rules/compile | 10 +- build/rules/dylib | 19 +- build/rules/exec | 15 +- build/rules/global | 52 +- build/rules/lib | 28 +- build/script/makedepend.SunCC | 2 +- build/script/makedepend.aCC | 2 +- build/script/makedepend.cxx | 2 +- build/script/makedepend.gcc | 2 +- build/script/makedepend.qcc | 2 +- build/script/makeldpath | 2 +- build/script/projname | 2 +- build/script/shlibln | 19 +- build/vms/build.com | 2 +- build/vms/pococc.com | 2 +- build/vms/pococxx.com | 2 +- build/vms/pocolib.com | 2 +- build/vms/pocolnk.com | 2 +- build_vs71.cmd | 10 +- build_vs80.cmd | 10 +- buildvms.com | 2 +- components | 1 - configure | 91 ++ contrib/poco-doc.pl | 47 + libversion | 1 + 1428 files changed, 25715 insertions(+), 12456 deletions(-) create mode 100644 CONTRIBUTORS rename Foundation/include/{Foundation => Poco}/ASCIIEncoding.h (85%) rename Foundation/include/{Foundation => Poco}/AbstractCache.h (90%) rename Foundation/include/{Foundation => Poco}/AbstractDelegate.h (91%) rename Foundation/include/{Foundation => Poco}/AbstractEvent.h (87%) rename Foundation/include/{Foundation => Poco}/AbstractPriorityDelegate.h (91%) rename Foundation/include/{Foundation => Poco}/AbstractStrategy.h (90%) create mode 100644 Foundation/include/Poco/ActiveDispatcher.h rename Foundation/include/{Foundation => Poco}/ActiveMethod.h (67%) rename Foundation/include/{Foundation => Poco}/ActiveResult.h (81%) create mode 100644 Foundation/include/Poco/ActiveRunnable.h create mode 100644 Foundation/include/Poco/ActiveStarter.h rename Foundation/include/{Foundation => Poco}/Activity.h (87%) rename Foundation/include/{Foundation => Poco}/Any.h (68%) rename Foundation/include/{Foundation => Poco}/ArchiveStrategy.h (85%) rename Foundation/include/{Foundation => Poco}/AsyncChannel.h (82%) rename Foundation/include/{Foundation => Poco}/AutoPtr.h (85%) rename Foundation/include/{Foundation => Poco}/AutoReleasePool.h (89%) rename Foundation/include/{Foundation => Poco}/Base64Decoder.h (85%) rename Foundation/include/{Foundation => Poco}/Base64Encoder.h (86%) rename Foundation/include/{Foundation => Poco}/BasicEvent.h (88%) rename Foundation/include/{Foundation => Poco}/BinaryReader.h (92%) rename Foundation/include/{Foundation => Poco}/BinaryWriter.h (93%) rename Foundation/include/{Foundation => Poco}/Buffer.h (90%) rename Foundation/include/{Foundation => Poco}/BufferAllocator.h (86%) rename Foundation/include/{Foundation => Poco}/BufferedBidirectionalStreamBuf.h (87%) rename Foundation/include/{Foundation => Poco}/BufferedStreamBuf.h (86%) rename Foundation/include/{Foundation => Poco}/Bugcheck.h (79%) rename Foundation/include/{Foundation => Poco}/ByteOrder.h (93%) rename Foundation/include/{Foundation => Poco}/Channel.h (84%) rename Foundation/include/{Foundation => Poco}/ClassLibrary.h (76%) rename Foundation/include/{Foundation => Poco}/ClassLoader.h (90%) rename Foundation/include/{Foundation => Poco}/CompareFunctions.h (90%) create mode 100644 Foundation/include/Poco/Config.h rename Foundation/include/{Foundation => Poco}/Configurable.h (91%) rename Foundation/include/{Foundation => Poco}/ConsoleChannel.h (83%) rename Foundation/include/{Foundation => Poco}/CountingStream.h (89%) rename Foundation/include/{Foundation => Poco}/DateTime.h (83%) rename Foundation/include/{Foundation => Poco}/DateTimeFormat.h (92%) rename Foundation/include/{Foundation => Poco}/DateTimeFormatter.h (94%) rename Foundation/include/{Foundation => Poco}/DateTimeParser.h (93%) rename Foundation/include/{Foundation => Poco}/Debugger.h (92%) rename Foundation/include/{Foundation => Poco}/DefaultStrategy.h (92%) rename Foundation/include/{Foundation => Poco}/DeflatingStream.h (88%) rename Foundation/include/{Foundation => Poco}/Delegate.h (90%) rename Foundation/include/{Foundation => Poco}/DigestEngine.h (90%) rename Foundation/include/{Foundation => Poco}/DigestStream.h (84%) rename Foundation/include/{Foundation => Poco}/DirectoryIterator.h (88%) rename Foundation/include/{Foundation => Poco}/DirectoryIterator_UNIX.h (86%) rename Foundation/include/{Foundation => Poco}/DirectoryIterator_VMS.h (87%) rename Foundation/include/{Foundation => Poco}/DirectoryIterator_WIN32.h (86%) rename Foundation/include/{Foundation => Poco}/DirectoryIterator_WIN32U.h (86%) rename Foundation/include/{Foundation => Poco}/DynamicFactory.h (86%) rename Foundation/include/{Foundation => Poco}/Environment.h (90%) rename Foundation/include/{Foundation => Poco}/Environment_UNIX.h (85%) rename Foundation/include/{Foundation => Poco}/Environment_VMS.h (87%) rename Foundation/include/{Foundation => Poco}/Environment_WIN32.h (89%) rename Foundation/include/{Foundation => Poco}/Environment_WIN32U.h (89%) rename Foundation/include/{Foundation => Poco}/ErrorHandler.h (87%) rename Foundation/include/{Foundation => Poco}/Event.h (87%) rename Foundation/include/{Foundation => Poco}/EventArgs.h (90%) rename Foundation/include/{Foundation => Poco}/EventLogChannel.h (89%) rename Foundation/include/{Foundation => Poco}/Event_POSIX.h (83%) rename Foundation/include/{Foundation => Poco}/Event_WIN32.h (83%) rename Foundation/include/{Foundation => Poco}/Exception.h (86%) rename Foundation/include/{Foundation => Poco}/Expire.h (82%) rename Foundation/include/{Foundation => Poco}/ExpireCache.h (90%) rename Foundation/include/{Foundation => Poco}/ExpireLRUCache.h (85%) rename Foundation/include/{Foundation => Poco}/ExpireStrategy.h (85%) rename Foundation/include/{Foundation => Poco}/FIFOEvent.h (88%) rename Foundation/include/{Foundation => Poco}/FIFOStrategy.h (90%) rename Foundation/include/{Foundation => Poco}/FPEnvironment.h (87%) rename Foundation/include/{Foundation => Poco}/FPEnvironment_C99.h (89%) rename Foundation/include/{Foundation => Poco}/FPEnvironment_DEC.h (91%) rename Foundation/include/{Foundation => Poco}/FPEnvironment_DUMMY.h (89%) rename Foundation/include/{Foundation => Poco}/FPEnvironment_SUN.h (89%) rename Foundation/include/{Foundation => Poco}/FPEnvironment_WIN32.h (89%) rename Foundation/include/{Foundation => Poco}/File.h (89%) rename Foundation/include/{Foundation => Poco}/FileChannel.h (93%) rename Foundation/include/{Foundation => Poco}/FileStreamFactory.h (87%) rename Foundation/include/{Foundation => Poco}/File_UNIX.h (90%) rename Foundation/include/{Foundation => Poco}/File_VMS.h (90%) rename Foundation/include/{Foundation => Poco}/File_WIN32.h (88%) rename Foundation/include/{Foundation => Poco}/File_WIN32U.h (88%) create mode 100644 Foundation/include/Poco/Format.h rename Foundation/include/{Foundation => Poco}/Formatter.h (86%) rename Foundation/include/{Foundation => Poco}/FormattingChannel.h (90%) rename Foundation/include/{Foundation => Poco}/Foundation.h (77%) rename Foundation/include/{Foundation => Poco}/Glob.h (93%) rename Foundation/include/{Foundation => Poco}/HMACEngine.h (88%) create mode 100644 Foundation/include/Poco/HashFunction.h create mode 100644 Foundation/include/Poco/HashStatistic.h create mode 100644 Foundation/include/Poco/HashTable.h rename Foundation/include/{Foundation => Poco}/HexBinaryDecoder.h (87%) rename Foundation/include/{Foundation => Poco}/HexBinaryEncoder.h (88%) rename Foundation/include/{Foundation => Poco}/InflatingStream.h (87%) rename Foundation/include/{Foundation => Poco}/Instantiator.h (90%) rename Foundation/include/{Foundation => Poco}/KeyValueArgs.h (91%) rename Foundation/include/{Foundation => Poco}/LRUCache.h (89%) rename Foundation/include/{Foundation => Poco}/LRUStrategy.h (87%) rename Foundation/include/{Foundation => Poco}/Latin1Encoding.h (85%) rename Foundation/include/{Foundation => Poco}/Latin9Encoding.h (86%) rename Foundation/include/{Foundation => Poco}/LineEndingConverter.h (91%) rename Foundation/include/{Foundation => Poco}/LocalDateTime.h (94%) rename Foundation/include/{Foundation => Poco}/LogFile.h (84%) rename Foundation/include/{Foundation => Poco}/LogFile_STD.h (84%) rename Foundation/include/{Foundation => Poco}/LogFile_VMS.h (85%) rename Foundation/include/{Foundation => Poco}/LogFile_WIN32.h (84%) create mode 100644 Foundation/include/Poco/LogFile_WIN32U.h create mode 100644 Foundation/include/Poco/LogStream.h rename Foundation/include/{Foundation => Poco}/Logger.h (94%) rename Foundation/include/{Foundation => Poco}/LoggingFactory.h (86%) rename Foundation/include/{Foundation => Poco}/LoggingRegistry.h (84%) rename Foundation/include/{Foundation => Poco}/MD2Engine.h (89%) rename Foundation/include/{Foundation => Poco}/MD4Engine.h (90%) rename Foundation/include/{Foundation => Poco}/MD5Engine.h (90%) rename Foundation/include/{Foundation => Poco}/Manifest.h (88%) rename Foundation/include/{Foundation => Poco}/MemoryPool.h (88%) rename Foundation/include/{Foundation => Poco}/Message.h (91%) rename Foundation/include/{Foundation => Poco}/MetaObject.h (88%) rename Foundation/include/{Foundation => Poco}/Mutex.h (86%) rename Foundation/include/{Foundation => Poco}/Mutex_POSIX.h (83%) rename Foundation/include/{Foundation => Poco}/Mutex_WIN32.h (84%) rename Foundation/include/{Foundation => Poco}/NamedEvent.h (87%) rename Foundation/include/{Foundation => Poco}/NamedEvent_UNIX.h (89%) rename Foundation/include/{Foundation => Poco}/NamedEvent_VMS.h (88%) rename Foundation/include/{Foundation => Poco}/NamedEvent_WIN32.h (85%) rename Foundation/include/{Foundation => Poco}/NamedEvent_WIN32U.h (86%) rename Foundation/include/{Foundation => Poco}/NamedMutex.h (83%) rename Foundation/include/{Foundation => Poco}/NamedMutex_UNIX.h (89%) rename Foundation/include/{Foundation => Poco}/NamedMutex_VMS.h (84%) rename Foundation/include/{Foundation => Poco}/NamedMutex_WIN32.h (86%) rename Foundation/include/{Foundation => Poco}/NamedMutex_WIN32U.h (86%) rename Foundation/include/{Foundation => Poco}/NestedDiagnosticContext.h (90%) rename Foundation/include/{Foundation => Poco}/Notification.h (83%) rename Foundation/include/{Foundation => Poco}/NotificationCenter.h (92%) rename Foundation/include/{Foundation => Poco}/NotificationQueue.h (90%) rename Foundation/include/{Foundation => Poco}/NotificationStrategy.h (91%) rename Foundation/include/{Foundation => Poco}/NullChannel.h (87%) rename Foundation/include/{Foundation => Poco}/NullStream.h (84%) rename Foundation/include/{Foundation => Poco}/NumberFormatter.h (95%) rename Foundation/include/{Foundation => Poco}/NumberParser.h (94%) rename Foundation/include/{Foundation => Poco}/Observer.h (86%) rename Foundation/include/{Foundation => Poco}/OpcomChannel.h (89%) rename Foundation/include/{Foundation => Poco}/Path.h (94%) rename Foundation/include/{Foundation => Poco}/Path_UNIX.h (86%) rename Foundation/include/{Foundation => Poco}/Path_VMS.h (86%) rename Foundation/include/{Foundation => Poco}/Path_WIN32.h (86%) rename Foundation/include/{Foundation => Poco}/Path_WIN32U.h (86%) rename Foundation/include/{Foundation => Poco}/PatternFormatter.h (91%) create mode 100644 Foundation/include/Poco/Pipe.h create mode 100644 Foundation/include/Poco/PipeImpl.h create mode 100644 Foundation/include/Poco/PipeImpl_DUMMY.h create mode 100644 Foundation/include/Poco/PipeImpl_POSIX.h create mode 100644 Foundation/include/Poco/PipeImpl_WIN32.h create mode 100644 Foundation/include/Poco/PipeStream.h rename Foundation/include/{Foundation => Poco}/Platform.h (96%) rename Foundation/include/{Foundation => Poco}/Platform_POSIX.h (94%) rename Foundation/include/{Foundation => Poco}/Platform_VMS.h (94%) rename Foundation/include/{Foundation => Poco}/Platform_WIN32.h (89%) create mode 100644 Foundation/include/Poco/Poco.h rename Foundation/include/{Foundation => Poco}/PriorityDelegate.h (90%) rename Foundation/include/{Foundation => Poco}/PriorityEvent.h (88%) rename Foundation/include/{Foundation => Poco}/PriorityExpire.h (83%) rename Foundation/include/{Foundation => Poco}/Process.h (72%) rename Foundation/include/{Foundation => Poco}/Process_UNIX.h (80%) rename Foundation/include/{Foundation => Poco}/Process_VMS.h (79%) rename Foundation/include/{Foundation => Poco}/Process_WIN32.h (81%) rename Foundation/include/{Foundation => Poco}/Process_WIN32U.h (81%) rename Foundation/include/{Foundation => Poco}/PurgeStrategy.h (86%) rename Foundation/include/{Foundation => Poco}/RWLock.h (88%) rename Foundation/include/{Foundation => Poco}/RWLock_POSIX.h (84%) rename Foundation/include/{Foundation => Poco}/RWLock_WIN32.h (83%) rename Foundation/include/{Foundation => Poco}/Random.h (93%) rename Foundation/include/{Foundation => Poco}/RandomStream.h (85%) rename Foundation/include/{Foundation => Poco}/RefCountedObject.h (88%) rename Foundation/include/{Foundation => Poco}/RegularExpression.h (95%) rename Foundation/include/{Foundation => Poco}/RotateStrategy.h (82%) rename Foundation/include/{Foundation => Poco}/Runnable.h (89%) rename Foundation/include/{Foundation => Poco}/RunnableAdapter.h (87%) rename Foundation/include/{Foundation => Poco}/SHA1Engine.h (88%) rename Foundation/include/{Foundation => Poco}/ScopedLock.h (89%) rename Foundation/include/{Foundation => Poco}/Semaphore.h (89%) rename Foundation/include/{Foundation => Poco}/Semaphore_POSIX.h (83%) rename Foundation/include/{Foundation => Poco}/Semaphore_WIN32.h (83%) rename Foundation/include/{Foundation => Poco}/SharedLibrary.h (87%) rename Foundation/include/{Foundation => Poco}/SharedLibrary_HPUX.h (84%) rename Foundation/include/{Foundation => Poco}/SharedLibrary_UNIX.h (86%) rename Foundation/include/{Foundation => Poco}/SharedLibrary_VMS.h (86%) rename Foundation/include/{Foundation => Poco}/SharedLibrary_WIN32.h (86%) rename Foundation/include/{Foundation => Poco}/SharedPtr.h (61%) rename Foundation/include/{Foundation => Poco}/SignalHandler.h (88%) rename Foundation/include/{Foundation => Poco}/SimpleFileChannel.h (89%) create mode 100644 Foundation/include/Poco/SimpleHashTable.h rename Foundation/include/{Foundation => Poco}/SingletonHolder.h (87%) rename Foundation/include/{Foundation => Poco}/SplitterChannel.h (85%) rename Foundation/include/{Foundation => Poco}/Stopwatch.h (88%) rename Foundation/include/{Foundation => Poco}/StrategyCollection.h (86%) rename Foundation/include/{Foundation => Poco}/StreamChannel.h (82%) rename Foundation/include/{Foundation => Poco}/StreamConverter.h (88%) rename Foundation/include/{Foundation => Poco}/StreamCopier.h (86%) rename Foundation/include/{Foundation => Poco}/StreamTokenizer.h (87%) rename Foundation/include/{Foundation => Poco}/StreamUtil.h (92%) rename Foundation/include/{Foundation => Poco}/String.h (94%) rename Foundation/include/{Foundation => Poco}/StringTokenizer.h (88%) rename Foundation/include/{Foundation => Poco}/SynchronizedObject.h (87%) rename Foundation/include/{Foundation => Poco}/SyslogChannel.h (92%) rename Foundation/include/{Foundation => Poco}/Task.h (87%) rename Foundation/include/{Foundation => Poco}/TaskManager.h (84%) rename Foundation/include/{Foundation => Poco}/TaskNotification.h (89%) rename Foundation/include/{Foundation => Poco}/TeeStream.h (86%) rename Foundation/include/{Foundation => Poco}/TemporaryFile.h (89%) rename Foundation/include/{Foundation => Poco}/TextConverter.h (91%) rename Foundation/include/{Foundation => Poco}/TextEncoding.h (93%) rename Foundation/include/{Foundation => Poco}/TextIterator.h (92%) rename Foundation/include/{Foundation => Poco}/Thread.h (90%) rename Foundation/include/{Foundation => Poco}/ThreadLocal.h (91%) rename Foundation/include/{Foundation => Poco}/ThreadPool.h (84%) rename Foundation/include/{Foundation => Poco}/Thread_POSIX.h (82%) rename Foundation/include/{Foundation => Poco}/Thread_WIN32.h (86%) rename Foundation/include/{Foundation => Poco}/Timer.h (88%) rename Foundation/include/{Foundation => Poco}/Timespan.h (92%) rename Foundation/include/{Foundation => Poco}/Timestamp.h (92%) rename Foundation/include/{Foundation => Poco}/Timezone.h (89%) rename Foundation/include/{Foundation => Poco}/Token.h (91%) rename Foundation/include/{Foundation => Poco}/Types.h (94%) rename Foundation/include/{Foundation => Poco}/URI.h (95%) rename Foundation/include/{Foundation => Poco}/URIStreamFactory.h (88%) rename Foundation/include/{Foundation => Poco}/URIStreamOpener.h (90%) rename Foundation/include/{Foundation => Poco}/UTF16Encoding.h (89%) rename Foundation/include/{Foundation => Poco}/UTF8Encoding.h (85%) rename Foundation/include/{Foundation => Poco}/UUID.h (90%) rename Foundation/include/{Foundation => Poco}/UUIDGenerator.h (85%) rename Foundation/include/{Foundation => Poco}/UnbufferedStreamBuf.h (86%) rename Foundation/include/{Foundation => Poco}/UnicodeConverter.h (92%) rename Foundation/include/{Foundation => Poco}/ValidArgs.h (90%) create mode 100644 Foundation/include/Poco/Void.h rename Foundation/include/{Foundation => Poco}/Windows1252Encoding.h (85%) rename Foundation/include/{Foundation => Poco}/zconf.h (95%) rename Foundation/include/{Foundation => Poco}/zlib.h (100%) create mode 100644 Foundation/src/ActiveDispatcher.cpp create mode 100644 Foundation/src/Format.cpp create mode 100644 Foundation/src/HashStatistic.cpp create mode 100644 Foundation/src/LogFile_WIN32U.cpp create mode 100644 Foundation/src/LogStream.cpp create mode 100644 Foundation/src/Pipe.cpp create mode 100644 Foundation/src/PipeImpl.cpp create mode 100644 Foundation/src/PipeImpl_DUMMY.cpp create mode 100644 Foundation/src/PipeImpl_POSIX.cpp create mode 100644 Foundation/src/PipeImpl_WIN32.cpp create mode 100644 Foundation/src/PipeStream.cpp create mode 100644 Foundation/src/SharedLibrary_WIN32U.cpp create mode 100644 Foundation/src/Void.cpp create mode 100644 Foundation/testsuite/src/ActiveDispatcherTest.cpp create mode 100644 Foundation/testsuite/src/ActiveDispatcherTest.h create mode 100644 Foundation/testsuite/src/FormatTest.cpp create mode 100644 Foundation/testsuite/src/FormatTest.h create mode 100644 Foundation/testsuite/src/HashTest.cpp create mode 100644 Foundation/testsuite/src/HashTest.h create mode 100644 Foundation/testsuite/src/LogStreamTest.cpp create mode 100644 Foundation/testsuite/src/LogStreamTest.h rename Net/include/{ => Poco}/Net/DNS.h (86%) rename Net/include/{ => Poco}/Net/DatagramSocket.h (93%) rename Net/include/{ => Poco}/Net/DatagramSocketImpl.h (89%) rename Net/include/{ => Poco}/Net/DialogSocket.h (94%) rename Net/include/{ => Poco}/Net/FTPClientSession.h (90%) rename Net/include/{ => Poco}/Net/FTPStreamFactory.h (85%) rename Net/include/{ => Poco}/Net/FilePartSource.h (87%) rename Net/include/{ => Poco}/Net/HTMLForm.h (87%) rename Net/include/{ => Poco}/Net/HTTPBasicCredentials.h (92%) rename Net/include/{ => Poco}/Net/HTTPBasicStreamBuf.h (80%) rename Net/include/{ => Poco}/Net/HTTPBufferAllocator.h (86%) rename Net/include/{ => Poco}/Net/HTTPChunkedStream.h (83%) rename Net/include/{ => Poco}/Net/HTTPClientSession.h (81%) rename Net/include/{ => Poco}/Net/HTTPCookie.h (93%) rename Net/include/{ => Poco}/Net/HTTPFixedLengthStream.h (86%) rename Net/include/{ => Poco}/Net/HTTPHeaderStream.h (83%) rename Net/include/{ => Poco}/Net/HTTPIOStream.h (88%) rename Net/include/{ => Poco}/Net/HTTPMessage.h (93%) rename Net/include/{ => Poco}/Net/HTTPRequest.h (91%) rename Net/include/{ => Poco}/Net/HTTPRequestHandler.h (92%) rename Net/include/{ => Poco}/Net/HTTPRequestHandlerFactory.h (91%) rename Net/include/{ => Poco}/Net/HTTPResponse.h (91%) rename Net/include/{ => Poco}/Net/HTTPServer.h (88%) rename Net/include/{ => Poco}/Net/HTTPServerConnection.h (88%) rename Net/include/{ => Poco}/Net/HTTPServerConnectionFactory.h (88%) rename Net/include/{ => Poco}/Net/HTTPServerParams.h (82%) rename Net/include/{ => Poco}/Net/HTTPServerRequest.h (87%) rename Net/include/{ => Poco}/Net/HTTPServerResponse.h (90%) rename Net/include/{ => Poco}/Net/HTTPServerSession.h (80%) rename Net/include/{ => Poco}/Net/HTTPSession.h (79%) create mode 100644 Net/include/Poco/Net/HTTPSessionFactory.h create mode 100644 Net/include/Poco/Net/HTTPSessionInstantiator.h rename Net/include/{ => Poco}/Net/HTTPStream.h (82%) rename Net/include/{ => Poco}/Net/HTTPStreamFactory.h (70%) rename Net/include/{ => Poco}/Net/HostEntry.h (87%) create mode 100644 Net/include/Poco/Net/ICMPClient.h create mode 100644 Net/include/Poco/Net/ICMPEventArgs.h create mode 100644 Net/include/Poco/Net/ICMPPacket.h create mode 100644 Net/include/Poco/Net/ICMPPacketImpl.h create mode 100644 Net/include/Poco/Net/ICMPSocket.h create mode 100644 Net/include/Poco/Net/ICMPSocketImpl.h create mode 100644 Net/include/Poco/Net/ICMPv4PacketImpl.h rename Net/include/{ => Poco}/Net/IPAddress.h (95%) rename Net/include/{ => Poco}/Net/MailMessage.h (91%) rename Net/include/{ => Poco}/Net/MailRecipient.h (92%) rename Net/include/{ => Poco}/Net/MailStream.h (88%) rename Net/include/{ => Poco}/Net/MediaType.h (92%) rename Net/include/{ => Poco}/Net/MessageHeader.h (89%) rename Net/include/{ => Poco}/Net/MulticastSocket.h (91%) rename Net/include/{ => Poco}/Net/MultipartReader.h (89%) rename Net/include/{ => Poco}/Net/MultipartWriter.h (91%) rename Net/include/{ => Poco}/Net/NameValueCollection.h (87%) rename Net/include/{ => Poco}/Net/Net.h (86%) rename Net/include/{ => Poco}/Net/NetException.h (86%) rename Net/include/{ => Poco}/Net/NetworkInterface.h (90%) rename Net/include/{ => Poco}/Net/NullPartHandler.h (88%) rename Net/include/{ => Poco}/Net/POP3ClientSession.h (89%) rename Net/include/{ => Poco}/Net/PartHandler.h (90%) rename Net/include/{ => Poco}/Net/PartSource.h (90%) rename Net/include/{ => Poco}/Net/QuotedPrintableDecoder.h (85%) rename Net/include/{ => Poco}/Net/QuotedPrintableEncoder.h (86%) create mode 100644 Net/include/Poco/Net/RawSocket.h create mode 100644 Net/include/Poco/Net/RawSocketImpl.h rename Net/include/{ => Poco}/Net/SMTPClientSession.h (88%) rename Net/include/{ => Poco}/Net/ServerSocket.h (89%) rename Net/include/{ => Poco}/Net/ServerSocketImpl.h (88%) rename Net/include/{ => Poco}/Net/Socket.h (87%) rename Net/include/{ => Poco}/Net/SocketAcceptor.h (85%) rename Net/include/{ => Poco}/Net/SocketAddress.h (78%) rename Net/include/{ => Poco}/Net/SocketConnector.h (80%) rename Net/include/{ => Poco}/Net/SocketDefs.h (96%) rename Net/include/{ => Poco}/Net/SocketImpl.h (89%) rename Net/include/{ => Poco}/Net/SocketNotification.h (89%) rename Net/include/{ => Poco}/Net/SocketNotifier.h (71%) rename Net/include/{ => Poco}/Net/SocketReactor.h (78%) rename Net/include/{ => Poco}/Net/SocketStream.h (87%) rename Net/include/{ => Poco}/Net/StreamSocket.h (86%) rename Net/include/{ => Poco}/Net/StreamSocketImpl.h (88%) rename Net/include/{ => Poco}/Net/StringPartSource.h (88%) rename Net/include/{ => Poco}/Net/TCPServer.h (88%) rename Net/include/{ => Poco}/Net/TCPServerConnection.h (86%) rename Net/include/{ => Poco}/Net/TCPServerConnectionFactory.h (90%) rename Net/include/{ => Poco}/Net/TCPServerDispatcher.h (75%) rename Net/include/{ => Poco}/Net/TCPServerParams.h (82%) create mode 100644 Net/samples/HTTPFormServer/HTTPFormServer.properties create mode 100644 Net/samples/HTTPFormServer/HTTPFormServer.vmsbuild create mode 100644 Net/samples/HTTPFormServer/HTTPFormServer_vs71.vcproj create mode 100644 Net/samples/HTTPFormServer/HTTPFormServer_vs80.vcproj create mode 100644 Net/samples/HTTPFormServer/Makefile create mode 100644 Net/samples/HTTPFormServer/src/HTTPFormServer.cpp create mode 100644 Net/samples/HTTPLoadTest/HTTPLoadTest.vmsbuild create mode 100644 Net/samples/HTTPLoadTest/HTTPLoadTest_vs71.vcproj create mode 100644 Net/samples/HTTPLoadTest/HTTPLoadTest_vs80.vcproj create mode 100644 Net/samples/HTTPLoadTest/Makefile create mode 100644 Net/samples/HTTPLoadTest/src/HTTPLoadTest.cpp create mode 100644 Net/samples/Ping/Makefile create mode 100644 Net/samples/Ping/Ping.vmsbuild create mode 100644 Net/samples/Ping/Ping_vs71.vcproj create mode 100644 Net/samples/Ping/Ping_vs80.vcproj create mode 100644 Net/samples/Ping/ping.properties create mode 100644 Net/samples/Ping/src/Ping.cpp create mode 100644 Net/src/HTTPSessionFactory.cpp create mode 100644 Net/src/HTTPSessionInstantiator.cpp create mode 100644 Net/src/ICMPClient.cpp create mode 100644 Net/src/ICMPEventArgs.cpp create mode 100644 Net/src/ICMPPacket.cpp create mode 100644 Net/src/ICMPPacketImpl.cpp create mode 100644 Net/src/ICMPSocket.cpp create mode 100644 Net/src/ICMPSocketImpl.cpp create mode 100644 Net/src/ICMPv4PacketImpl.cpp create mode 100644 Net/src/RawSocket.cpp create mode 100644 Net/src/RawSocketImpl.cpp create mode 100644 Net/testsuite/src/ICMPClientTest.cpp create mode 100644 Net/testsuite/src/ICMPClientTest.h create mode 100644 Net/testsuite/src/ICMPClientTestSuite.cpp create mode 100644 Net/testsuite/src/ICMPClientTestSuite.h create mode 100644 Net/testsuite/src/ICMPSocketTest.cpp create mode 100644 Net/testsuite/src/ICMPSocketTest.h create mode 100644 Net/testsuite/src/RawSocketTest.cpp create mode 100644 Net/testsuite/src/RawSocketTest.h rename Util/include/{ => Poco}/Util/AbstractConfiguration.h (92%) rename Util/include/{ => Poco}/Util/Application.h (74%) rename Util/include/{ => Poco}/Util/ConfigurationMapper.h (91%) rename Util/include/{ => Poco}/Util/ConfigurationView.h (90%) rename Util/include/{ => Poco}/Util/FilesystemConfiguration.h (88%) rename Util/include/{ => Poco}/Util/HelpFormatter.h (93%) rename Util/include/{ => Poco}/Util/IniFileConfiguration.h (89%) create mode 100644 Util/include/Poco/Util/IntValidator.h rename Util/include/{ => Poco}/Util/LayeredConfiguration.h (85%) rename Util/include/{ => Poco}/Util/LoggingConfigurator.h (92%) rename Util/include/{ => Poco}/Util/LoggingSubsystem.h (88%) rename Util/include/{ => Poco}/Util/MapConfiguration.h (86%) rename Util/include/{ => Poco}/Util/Option.h (74%) create mode 100644 Util/include/Poco/Util/OptionCallback.h rename Util/include/{ => Poco}/Util/OptionException.h (82%) rename Util/include/{ => Poco}/Util/OptionProcessor.h (91%) rename Util/include/{ => Poco}/Util/OptionSet.h (90%) rename Util/include/{ => Poco}/Util/PropertyFileConfiguration.h (89%) create mode 100644 Util/include/Poco/Util/RegExpValidator.h rename Util/include/{ => Poco}/Util/ServerApplication.h (82%) rename Util/include/{ => Poco}/Util/Subsystem.h (88%) rename Util/include/{ => Poco}/Util/SystemConfiguration.h (90%) rename Util/include/{ => Poco}/Util/Util.h (86%) create mode 100644 Util/include/Poco/Util/Validator.h create mode 100644 Util/include/Poco/Util/WinRegistryConfiguration.h rename Util/include/{ => Poco}/Util/WinRegistryKey.h (85%) rename Util/include/{ => Poco}/Util/WinService.h (92%) rename Util/include/{ => Poco}/Util/XMLConfiguration.h (75%) create mode 100644 Util/src/IntValidator.cpp create mode 100644 Util/src/OptionCallback.cpp create mode 100644 Util/src/RegExpValidator.cpp create mode 100644 Util/src/Validator.cpp create mode 100644 Util/src/WinRegistryConfiguration.cpp create mode 100644 Util/testsuite/src/ValidatorTest.cpp create mode 100644 Util/testsuite/src/ValidatorTest.h create mode 100644 Util/testsuite/src/WinConfigurationTest.cpp create mode 100644 Util/testsuite/src/WinConfigurationTest.h rename XML/include/{ => Poco}/DOM/AbstractContainerNode.h (89%) rename XML/include/{ => Poco}/DOM/AbstractNode.h (90%) rename XML/include/{ => Poco}/DOM/Attr.h (93%) rename XML/include/{ => Poco}/DOM/AttrMap.h (89%) rename XML/include/{ => Poco}/DOM/AutoPtr.h (82%) rename XML/include/{ => Poco}/DOM/CDATASection.h (93%) rename XML/include/{ => Poco}/DOM/CharacterData.h (91%) rename XML/include/{ => Poco}/DOM/ChildNodesList.h (88%) rename XML/include/{ => Poco}/DOM/Comment.h (87%) rename XML/include/{ => Poco}/DOM/DOMBuilder.h (88%) rename XML/include/{ => Poco}/DOM/DOMException.h (91%) rename XML/include/{ => Poco}/DOM/DOMImplementation.h (91%) rename XML/include/{ => Poco}/DOM/DOMObject.h (92%) rename XML/include/{ => Poco}/DOM/DOMParser.h (90%) rename XML/include/{ => Poco}/DOM/DOMSerializer.h (92%) rename XML/include/{ => Poco}/DOM/DOMWriter.h (81%) rename XML/include/{ => Poco}/DOM/DTDMap.h (89%) rename XML/include/{ => Poco}/DOM/Document.h (92%) rename XML/include/{ => Poco}/DOM/DocumentEvent.h (92%) rename XML/include/{ => Poco}/DOM/DocumentFragment.h (91%) rename XML/include/{ => Poco}/DOM/DocumentType.h (92%) rename XML/include/{ => Poco}/DOM/Element.h (94%) rename XML/include/{ => Poco}/DOM/ElementsByTagNameList.h (88%) rename XML/include/{ => Poco}/DOM/Entity.h (91%) rename XML/include/{ => Poco}/DOM/EntityReference.h (90%) rename XML/include/{ => Poco}/DOM/Event.h (92%) rename XML/include/{ => Poco}/DOM/EventDispatcher.h (90%) rename XML/include/{ => Poco}/DOM/EventException.h (89%) rename XML/include/{ => Poco}/DOM/EventListener.h (90%) rename XML/include/{ => Poco}/DOM/EventTarget.h (91%) rename XML/include/{ => Poco}/DOM/MutationEvent.h (93%) rename XML/include/{ => Poco}/DOM/NamedNodeMap.h (91%) rename XML/include/{ => Poco}/DOM/Node.h (95%) rename XML/include/{ => Poco}/DOM/NodeFilter.h (94%) rename XML/include/{ => Poco}/DOM/NodeIterator.h (94%) rename XML/include/{ => Poco}/DOM/NodeList.h (90%) rename XML/include/{ => Poco}/DOM/Notation.h (89%) rename XML/include/{ => Poco}/DOM/ProcessingInstruction.h (89%) rename XML/include/{ => Poco}/DOM/Text.h (90%) rename XML/include/{ => Poco}/DOM/TreeWalker.h (95%) rename XML/include/{ => Poco}/SAX/Attributes.h (94%) rename XML/include/{ => Poco}/SAX/AttributesImpl.h (93%) rename XML/include/{ => Poco}/SAX/ContentHandler.h (96%) rename XML/include/{ => Poco}/SAX/DTDHandler.h (93%) rename XML/include/{ => Poco}/SAX/DeclHandler.h (93%) rename XML/include/{ => Poco}/SAX/DefaultHandler.h (87%) rename XML/include/{ => Poco}/SAX/EntityResolver.h (93%) rename XML/include/{ => Poco}/SAX/EntityResolverImpl.h (83%) rename XML/include/{ => Poco}/SAX/ErrorHandler.h (94%) rename XML/include/{ => Poco}/SAX/InputSource.h (93%) rename XML/include/{ => Poco}/SAX/LexicalHandler.h (94%) rename XML/include/{ => Poco}/SAX/Locator.h (94%) rename XML/include/{ => Poco}/SAX/LocatorImpl.h (89%) rename XML/include/{ => Poco}/SAX/NamespaceSupport.h (93%) rename XML/include/{ => Poco}/SAX/SAXException.h (91%) rename XML/include/{ => Poco}/SAX/SAXParser.h (88%) rename XML/include/{ => Poco}/SAX/WhitespaceFilter.h (89%) rename XML/include/{ => Poco}/SAX/XMLFilter.h (91%) rename XML/include/{ => Poco}/SAX/XMLFilterImpl.h (89%) rename XML/include/{ => Poco}/SAX/XMLReader.h (95%) rename XML/include/{ => Poco}/XML/Name.h (92%) rename XML/include/{ => Poco}/XML/NamePool.h (89%) rename XML/include/{ => Poco}/XML/NamespaceStrategy.h (90%) rename XML/include/{ => Poco}/XML/ParserEngine.h (91%) rename XML/include/{ => Poco}/XML/XML.h (86%) rename XML/include/{ => Poco}/XML/XMLException.h (83%) rename XML/include/{ => Poco}/XML/XMLStream.h (89%) rename XML/include/{ => Poco}/XML/XMLString.h (92%) rename XML/include/{ => Poco}/XML/XMLWriter.h (88%) rename XML/include/{ => Poco}/XML/expat.h (100%) rename XML/include/{ => Poco}/XML/expat_external.h (100%) rename build/config/{Darwin8 => Darwin7} (59%) create mode 100644 build/config/MinGW create mode 100644 configure create mode 100644 contrib/poco-doc.pl create mode 100644 libversion diff --git a/CHANGELOG b/CHANGELOG index 298e731a3..a1a0931c7 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,9 +1,108 @@ -This is the changelog file for the C++ Portable Components. +This is the changelog file for POCO - the C++ Portable Components. + +Release 1.2.0 (2006-08-29) +========================== + +- DateTime fixes: Julian Day is no longer stored internally. + Times (hours, minutes, seconds, ...) are now always taken from an utcValue (if available) and not from the Julian day. + The Julian day is only used for calculating year, month and day (except when the Julian day is the only thing we have) + This helps us get rid of rounding errors that the Julian Day arithmetic introduced.- on Windows, UUIDGenerator no longer uses Netbios, but GetAdaptersInfo instead +- The main Makefile now has correct dependencies +- updated poco-doc.pl with latest version by Caleb Epstein +- fixed SF #1542722: InflatingInputStream: buffer error +- improved Windows UTF-8 support +- added Logger::names() +- added configure script and make install target +- XMLWriter bugfix: pretty-print bug with characters() and rawCharacters() +- improvements to build system: support builds outside of source tree +- added header doc conversion tool contributed by Caleb Epstein +- fixed SF #1542618 (build/config/Linux patch) +- bugfix: BinaryReader/BinaryWriter BOM is now 16 bits, as documented +- fixed SF #1542247 (Compiler warning from OptionCallback) +- fixed SF #1542253 (ServerApplication::handleOption doesn't call Application::handleOption) +- added Application::stopOptionsProcessing() +- updated samples +- Util::Application command line handling now supports: + * argument validation (Option::validator(); see Validator, IntValidator, RegExpValidator) + * binding of argument values to config properties (Option::binding()) + * callbacks for arguments (Option::callback()) + * checking of required parameters +- changed header file locations: + Foundation headers are now in Poco (#include "Poco/Foundation.h") + XML headers are now in Poco/XML, Poco/SAX and Poco/DOM (#include "Poco/XML/XML.h") + Util headers are now in Poco/Util (#include "Poco/Util/Util.h") + etc. + Unfortunately, this change will break existing code. However, fixing the code is + a matter of a few global search/replace operations and can be done quickly. + On the plus side, POCO is now a much better citizen when used with other + libraries. +- changed namespaces: + Foundation is now Poco + XML is now Poco::XML + Util is now Poco::Util + Net is now Poco::Net +- removed namespace macros +- fixed some warnings reported by gcc -Wall -Wextra +- fixed AutoPtr and LayeredConfiguration documentation +- improved StreamSocket::receiveBytes() doc +- added Pipe and PipeStream classes +- added support for I/O redirection (pipes) to Process::launch() +- added LogStream class (ostream interface to Logger) +- improved Makefiles (no more double-building if clean all is specified) +- added CppUnit and DateTime testsuite contributions by Andrew Marlow +- improved Cygwin and minimal MinGW support +- FileChannel: gzip compression if archived files now runs in a background thread (SF #1537481) +- POCO now compiles with large (64-bit) file support on Linux (SF #1536634) +- added format() function, which provides typesafe sprintf-like functionality (SF #1327621) +- added File::isLink() +- bugfix: dangling symbolic links in a directory no longer cause recursive remove to fail with file not found error +- added Void class (useful as argument to ActiveMethod) +- ActiveResult now supports exceptions +- bugfix: Timezone::utcOffset() and Timezone::dst() returned wrong values on Unix platforms (SF #1535428) +- added ActiveDispatcher class +- added ActiveStarter class, which is a policy used by ActiveMethod for starting methods +- ActiveRunnable moved to its own header file +- ThreadPool: added startWithPriority(), which allows for running threads with a different priority +- added error handling to dir sample +- added additional test case to HTTPServer test suite- HTMLForm: should now work with request methods other than POST and GET (all non-POST requests are treated the same as GET) +- clarified HTMLForm documentation +- HTMLForm bugfix: uploaded files no longer end up in value; PartHandler is called instead +- NameValueCollection: added get(name, defaultValue) +- added HTTPFormServer sample +- added Foundation::HashTable and SimpleHashTable +- added Net::HTTPSessionFactory +- improvements to AutoPtr and SharedPtr +- improvements to namespaces handling in XMLWriter +- Foundation Cache: fixed add implementation to match the docu: a 2nd add will now simply overwrite existing entries +- added DateTime::isValid() +- added Exception::rethrow() (virtual, must be overridden by all subclasses) +- Timer can now use a user-supplied ThreadPool +- added rethrow() to exception classes +- Net: made some constructors explicit +- Net: added SocketAddress constructor to HTTPClientSession +- Net: added HTTPSession::networkException() to check for exceptions swallowed by stream classes +- Net: added single string argument constructor to SocketAddress. +- Net: improved HTTPClientSession error handling (no more "Invalid HTTP version string" exceptions when the server prematurely closes the connection due to too much load) +- Net: improved HTTPSession error handling. Exceptions while sending and receiving data are stored for later retrieval and no longer get lost since streambufs swallow them. +- Net: added HTTPLoadTest sample +- fixed a bug when opening logfiles on Unix platforms causing an existing logfile to be truncated +- bugfix: log file purge intervals given in months did not work, due to a stupid typo +- added RawSocket and ICMP classes +- UUID: fixed a doc formatting bug +- NetworkInterface::list() now includes loopback interface on Windows (SF #1460309) +- made Exception::message() and Exception::nested() inline +- added Net::UnsupportedRedirectException +- HTTPStreamFactory throws an UnsupportedRedirectException if it encounters a redirect to https +- HTTP: fixed bad 100 Continue handling in client and server code +- added CONTRIBUTORS file + Release 1.1.2 (2006-07-07) ========================== - Changed license to Boost license +- DBlite and NetSSL have been removed from the Boost-licensed release. + Please contact Applied Informatics (info@appinf.com) if you're interested in them. Release 1.1.1 (2006-04-03) @@ -367,4 +466,4 @@ building the libraries. -- -$Id: //poco/1.1.0/dist/CHANGELOG#3 $ +$Id: //poco/1.2/dist/CHANGELOG#1 $ diff --git a/CONTRIBUTORS b/CONTRIBUTORS new file mode 100644 index 000000000..1821e8624 --- /dev/null +++ b/CONTRIBUTORS @@ -0,0 +1,9 @@ +Guenter Obiltschnig +Alex Fabijanic +Peter Schojer +Claus Dabringer +Andrew Marlow (public@marlowa.plus.com) +Caleb Epstein (caleb.epstein@gmail.com) + +-- +$Id: //poco/1.2/dist/CONTRIBUTORS#1 $ diff --git a/CppUnit/Makefile b/CppUnit/Makefile index c997ad8ad..18c331ca9 100644 --- a/CppUnit/Makefile +++ b/CppUnit/Makefile @@ -1,7 +1,7 @@ # # Makefile # -# $Id: //poco/1.1.0/CppUnit/Makefile#1 $ +# $Id: //poco/1.2/CppUnit/Makefile#1 $ # # Makefile for Poco CppUnit # diff --git a/CppUnit/WinTestRunner/include/WinTestRunner/WinTestRunner.h b/CppUnit/WinTestRunner/include/WinTestRunner/WinTestRunner.h index cda856266..933918478 100644 --- a/CppUnit/WinTestRunner/include/WinTestRunner/WinTestRunner.h +++ b/CppUnit/WinTestRunner/include/WinTestRunner/WinTestRunner.h @@ -1,7 +1,7 @@ // // WinTestRunner.h // -// $Id: //poco/1.1.0/CppUnit/WinTestRunner/include/WinTestRunner/WinTestRunner.h#1 $ +// $Id: //poco/1.2/CppUnit/WinTestRunner/include/WinTestRunner/WinTestRunner.h#1 $ // // Application shell for CppUnit's TestRunner dialog. // @@ -18,17 +18,12 @@ #endif -#ifndef CppUnit_CppUnit_INCLUDED #include "CppUnit/CppUnit.h" -#endif -#ifndef STD_VECTOR_INCLUDED #include -#define STD_VECTOR_INCLUDED -#endif #include -CppUnit_BEGIN +namespace CppUnit { class Test; @@ -61,7 +56,7 @@ public: }; -CppUnit_END +} // namespace CppUnit #endif // WinTestRunner_H_INCLUDED diff --git a/CppUnit/WinTestRunner/src/ActiveTest.cpp b/CppUnit/WinTestRunner/src/ActiveTest.cpp index 4baf58671..3718ed01d 100644 --- a/CppUnit/WinTestRunner/src/ActiveTest.cpp +++ b/CppUnit/WinTestRunner/src/ActiveTest.cpp @@ -1,7 +1,7 @@ // // ActiveTest.cpp // -// $Id: //poco/1.1.0/CppUnit/WinTestRunner/src/ActiveTest.cpp#1 $ +// $Id: //poco/1.2/CppUnit/WinTestRunner/src/ActiveTest.cpp#1 $ // @@ -9,7 +9,7 @@ #include "ActiveTest.h" -CppUnit_BEGIN +namespace CppUnit { // Spawn a thread to a test @@ -40,5 +40,5 @@ UINT ActiveTest::threadFunction(LPVOID thisInstance) } -CppUnit_END +} // namespace CppUnit diff --git a/CppUnit/WinTestRunner/src/ActiveTest.h b/CppUnit/WinTestRunner/src/ActiveTest.h index 2ccd888d3..2343aecd8 100644 --- a/CppUnit/WinTestRunner/src/ActiveTest.h +++ b/CppUnit/WinTestRunner/src/ActiveTest.h @@ -1,7 +1,7 @@ // // ActiveTest.h // -// $Id: //poco/1.1.0/CppUnit/WinTestRunner/src/ActiveTest.h#1 $ +// $Id: //poco/1.2/CppUnit/WinTestRunner/src/ActiveTest.h#1 $ // @@ -9,16 +9,12 @@ #define ActiveTest_INCLUDED -#ifndef CppUnit_CppUnit_INCLUDED #include "CppUnit/CppUnit.h" -#endif -#ifndef CppUnit_TestDecorator_INCLUDED #include "CppUnit/TestDecorator.h" -#endif #include -CppUnit_BEGIN +namespace CppUnit { /* A Microsoft-specific active test @@ -85,7 +81,7 @@ inline void ActiveTest::run() } -CppUnit_END +} // namespace CppUnit #endif // ActiveTest_INCLUDED diff --git a/CppUnit/WinTestRunner/src/DLLMain.cpp b/CppUnit/WinTestRunner/src/DLLMain.cpp index e7e92204b..15ba83ab8 100644 --- a/CppUnit/WinTestRunner/src/DLLMain.cpp +++ b/CppUnit/WinTestRunner/src/DLLMain.cpp @@ -1,7 +1,7 @@ // // DLLMain.cpp // -// $Id: //poco/1.1.0/CppUnit/WinTestRunner/src/DLLMain.cpp#1 $ +// $Id: //poco/1.2/CppUnit/WinTestRunner/src/DLLMain.cpp#1 $ // diff --git a/CppUnit/WinTestRunner/src/GUITestResult.cpp b/CppUnit/WinTestRunner/src/GUITestResult.cpp index 9bfc65c4f..aabf09795 100644 --- a/CppUnit/WinTestRunner/src/GUITestResult.cpp +++ b/CppUnit/WinTestRunner/src/GUITestResult.cpp @@ -1,7 +1,7 @@ // // GUITestResult.cpp // -// $Id: //poco/1.1.0/CppUnit/WinTestRunner/src/GUITestResult.cpp#1 $ +// $Id: //poco/1.2/CppUnit/WinTestRunner/src/GUITestResult.cpp#1 $ // @@ -9,7 +9,7 @@ #include "GUITestResult.h" -CppUnit_BEGIN +namespace CppUnit { void GUITestResult::addError(Test *test, CppUnitException *e) @@ -39,5 +39,5 @@ void GUITestResult::endTest(Test *test) } -CppUnit_END +} // namespace CppUnit diff --git a/CppUnit/WinTestRunner/src/GUITestResult.h b/CppUnit/WinTestRunner/src/GUITestResult.h index 87d0987f3..752c93e3e 100644 --- a/CppUnit/WinTestRunner/src/GUITestResult.h +++ b/CppUnit/WinTestRunner/src/GUITestResult.h @@ -1,7 +1,7 @@ // // GUITestResult.h // -// $Id: //poco/1.1.0/CppUnit/WinTestRunner/src/GUITestResult.h#1 $ +// $Id: //poco/1.2/CppUnit/WinTestRunner/src/GUITestResult.h#1 $ // @@ -9,16 +9,12 @@ #define GuiTestResult_INCLUDED -#ifndef CppUnit_CppUnit_INCLUDED #include "CppUnit/CppUnit.h" -#endif -#ifndef CppUnit_TestResult_INCLUDED #include "CppUnit/TestResult.h" -#endif #include -CppUnit_BEGIN +namespace CppUnit { class TestRunnerDlg; @@ -80,7 +76,7 @@ inline void GUITestResult::stop() } -CppUnit_END +} // namespace CppUnit #endif // GuiTestResult_INCLUDED diff --git a/CppUnit/WinTestRunner/src/ProgressBar.cpp b/CppUnit/WinTestRunner/src/ProgressBar.cpp index dcb6b86bb..4ddd4c211 100644 --- a/CppUnit/WinTestRunner/src/ProgressBar.cpp +++ b/CppUnit/WinTestRunner/src/ProgressBar.cpp @@ -1,14 +1,14 @@ // // ProgressBar.cpp // -// $Id: //poco/1.1.0/CppUnit/WinTestRunner/src/ProgressBar.cpp#1 $ +// $Id: //poco/1.2/CppUnit/WinTestRunner/src/ProgressBar.cpp#1 $ // #include "ProgressBar.h" -CppUnit_BEGIN +namespace CppUnit { // Paint the progress bar in response to a paint message @@ -137,4 +137,4 @@ void ProgressBar::reset () } -CppUnit_END +} // namespace CppUnit diff --git a/CppUnit/WinTestRunner/src/ProgressBar.h b/CppUnit/WinTestRunner/src/ProgressBar.h index df485cf26..44bb7cd85 100644 --- a/CppUnit/WinTestRunner/src/ProgressBar.h +++ b/CppUnit/WinTestRunner/src/ProgressBar.h @@ -1,7 +1,7 @@ // // ProgressBar.h // -// $Id: //poco/1.1.0/CppUnit/WinTestRunner/src/ProgressBar.h#1 $ +// $Id: //poco/1.2/CppUnit/WinTestRunner/src/ProgressBar.h#1 $ // @@ -9,13 +9,11 @@ #define ProgressBar_INCLUDED -#ifndef CppUnit_CppUnit_INCLUDED #include "CppUnit/CppUnit.h" -#endif #include -CppUnit_BEGIN +namespace CppUnit { /* A Simple ProgressBar for test execution display @@ -70,7 +68,7 @@ inline COLORREF ProgressBar::getStatusColor() } -CppUnit_END +} // namespace CppUnit #endif // ProgressBar_INCLUDED diff --git a/CppUnit/WinTestRunner/src/TestRunnerDlg.cpp b/CppUnit/WinTestRunner/src/TestRunnerDlg.cpp index f8e777353..2c93fcd33 100644 --- a/CppUnit/WinTestRunner/src/TestRunnerDlg.cpp +++ b/CppUnit/WinTestRunner/src/TestRunnerDlg.cpp @@ -1,7 +1,7 @@ // // TestRunnerDlg.cpp // -// $Id: //poco/1.1.0/CppUnit/WinTestRunner/src/TestRunnerDlg.cpp#1 $ +// $Id: //poco/1.2/CppUnit/WinTestRunner/src/TestRunnerDlg.cpp#1 $ // @@ -17,7 +17,7 @@ #include "TestRunnerDlg.h" -CppUnit_BEGIN +namespace CppUnit { TestRunnerDlg::TestRunnerDlg(CWnd* pParent): CDialog(TestRunnerDlg::IDD, pParent) @@ -421,4 +421,4 @@ void TestRunnerDlg::addTest(Test* pTest, int level) } -CppUnit_END +} // namespace CppUnit diff --git a/CppUnit/WinTestRunner/src/TestRunnerDlg.h b/CppUnit/WinTestRunner/src/TestRunnerDlg.h index 63800ecda..fea02a926 100644 --- a/CppUnit/WinTestRunner/src/TestRunnerDlg.h +++ b/CppUnit/WinTestRunner/src/TestRunnerDlg.h @@ -1,7 +1,7 @@ // // TestRunnerDlg.h // -// $Id: //poco/1.1.0/CppUnit/WinTestRunner/src/TestRunnerDlg.h#1 $ +// $Id: //poco/1.2/CppUnit/WinTestRunner/src/TestRunnerDlg.h#1 $ // @@ -9,27 +9,16 @@ #define TestRunnerDlg_INCLUDED -#ifndef CppUnit_CppUnit_INCLUDED #include "CppUnit/CppUnit.h" -#endif -#ifndef CppUnit_CppUnitException_INCLUDED #include "CppUnit/CppUnitException.h" -#endif -#ifndef ActiveTest_INCLUDED #include "ActiveTest.h" -#endif -#ifndef STD_VECTOR_INCLUDED #include -#define STD_VECTOR_INCLUDED -#endif -#ifndef IDD_DIALOG_TESTRUNNER #include "../res/Resource.h" -#endif #include #include "afxwin.h" -CppUnit_BEGIN +namespace CppUnit { class ProgressBar; @@ -96,7 +85,7 @@ protected: }; -CppUnit_END +} // namespace CppUnit #endif // TestRunnerDlg_INCLUDED diff --git a/CppUnit/WinTestRunner/src/WinTestRunner.cpp b/CppUnit/WinTestRunner/src/WinTestRunner.cpp index d0bcfa7c6..122b7d9c0 100644 --- a/CppUnit/WinTestRunner/src/WinTestRunner.cpp +++ b/CppUnit/WinTestRunner/src/WinTestRunner.cpp @@ -1,7 +1,7 @@ // // WinTestRunner.cpp // -// $Id: //poco/1.1.0/CppUnit/WinTestRunner/src/WinTestRunner.cpp#1 $ +// $Id: //poco/1.2/CppUnit/WinTestRunner/src/WinTestRunner.cpp#1 $ // @@ -9,7 +9,7 @@ #include "TestRunnerDlg.h" -CppUnit_BEGIN +namespace CppUnit { WinTestRunner::WinTestRunner() @@ -61,4 +61,4 @@ void WinTestRunnerApp::TestMain() } -CppUnit_END +} // namespace CppUnit diff --git a/CppUnit/include/CppUnit/CppUnit.h b/CppUnit/include/CppUnit/CppUnit.h index d51c54ac1..eef1337b4 100644 --- a/CppUnit/include/CppUnit/CppUnit.h +++ b/CppUnit/include/CppUnit/CppUnit.h @@ -1,7 +1,7 @@ // // CppUnit.h // -// $Id: //poco/1.1.0/CppUnit/include/CppUnit/CppUnit.h#1 $ +// $Id: //poco/1.2/CppUnit/include/CppUnit/CppUnit.h#1 $ // @@ -27,7 +27,7 @@ // CppUnit_API functions as being imported from a DLL, wheras this DLL sees symbols // defined with this macro as being exported. // -#if (defined(_WIN32) || defined(__CYGWIN__)) && defined(POCO_DLL) +#if defined(_WIN32) && defined(POCO_DLL) #if defined(CppUnit_EXPORTS) #define CppUnit_API __declspec(dllexport) #else @@ -41,13 +41,6 @@ #endif -// -// Macros to declare the namespace -// -#define CppUnit_BEGIN namespace CppUnit { -#define CppUnit_END } - - // Turn off some annoying warnings #ifdef _MSC_VER #pragma warning(disable:4786) // identifier truncation warning diff --git a/CppUnit/include/CppUnit/CppUnitException.h b/CppUnit/include/CppUnit/CppUnitException.h index 5f4dedaf4..b4a61f3c6 100644 --- a/CppUnit/include/CppUnit/CppUnitException.h +++ b/CppUnit/include/CppUnit/CppUnitException.h @@ -1,7 +1,7 @@ // // CppUnitException.h // -// $Id: //poco/1.1.0/CppUnit/include/CppUnit/CppUnitException.h#1 $ +// $Id: //poco/1.2/CppUnit/include/CppUnit/CppUnitException.h#1 $ // @@ -9,20 +9,12 @@ #define CppUnit_CppUnitException_INCLUDED -#ifndef CppUnit_CppUnit_INCLUDED #include "CppUnit/CppUnit.h" -#endif -#ifndef STD_EXCEPTION_INCLUDED #include -#define STD_EXCEPTION_INCLUDED -#endif -#ifndef STD_STRING_INCLUDED #include -#define STD_STRING_INCLUDED -#endif -CppUnit_BEGIN +namespace CppUnit { class CppUnit_API CppUnitException: public std::exception @@ -33,6 +25,15 @@ public: CppUnitException(const std::string& message = "", long lineNumber = CPPUNIT_UNKNOWNLINENUMBER, const std::string& fileName = CPPUNIT_UNKNOWNFILENAME); + CppUnitException(const std::string& message, + long lineNumber, + long data1lineNumber, + const std::string& fileName); + CppUnitException(const std::string& message, + long lineNumber, + long data1lineNumber, + long data2lineNumber, + const std::string& fileName); CppUnitException(const CppUnitException& other); virtual ~CppUnitException() throw(); @@ -41,6 +42,8 @@ public: const char* what() const throw (); long lineNumber() const; + long data1LineNumber() const; + long data2LineNumber() const; const std::string& fileName() const; static const std::string CPPUNIT_UNKNOWNFILENAME; @@ -49,18 +52,33 @@ public: private: std::string _message; long _lineNumber; + long _data1lineNumber; + long _data2lineNumber; std::string _fileName; }; inline CppUnitException::CppUnitException(const CppUnitException& other): exception (other) { - _message = other._message; - _lineNumber = other._lineNumber; - _fileName = other._fileName; + _message = other._message; + _lineNumber = other._lineNumber; + _data1lineNumber = other._data1lineNumber; + _data2lineNumber = other._data2lineNumber; + _fileName = other._fileName; } -inline CppUnitException::CppUnitException (const std::string& message, long lineNumber, const std::string& fileName): _message(message), _lineNumber(lineNumber), _fileName(fileName) + +inline CppUnitException::CppUnitException (const std::string& message, long lineNumber, const std::string& fileName): _message(message), _lineNumber(lineNumber), _data1lineNumber(CPPUNIT_UNKNOWNLINENUMBER), _data2lineNumber(CPPUNIT_UNKNOWNLINENUMBER), _fileName(fileName) +{ +} + + +inline CppUnitException::CppUnitException (const std::string& message, long lineNumber, long data1lineNumber, const std::string& fileName): _message(message), _lineNumber(lineNumber), _data1lineNumber(data1lineNumber), _data2lineNumber(CPPUNIT_UNKNOWNLINENUMBER), _fileName(fileName) +{ +} + + +inline CppUnitException::CppUnitException (const std::string& message, long lineNumber, long data1lineNumber, long data2lineNumber, const std::string& fileName): _message(message), _lineNumber(lineNumber), _data1lineNumber(data1lineNumber), _data2lineNumber(data2lineNumber), _fileName(fileName) { } @@ -78,6 +96,8 @@ inline CppUnitException& CppUnitException::operator = (const CppUnitException& o { _message = other._message; _lineNumber = other._lineNumber; + _data1lineNumber = other._data1lineNumber; + _data2lineNumber = other._data2lineNumber; _fileName = other._fileName; } return *this; @@ -96,6 +116,18 @@ inline long CppUnitException::lineNumber() const } +inline long CppUnitException::data1LineNumber() const +{ + return _data1lineNumber; +} + + +inline long CppUnitException::data2LineNumber() const +{ + return _data2lineNumber; +} + + // The file in which the error occurred inline const std::string& CppUnitException::fileName() const { @@ -103,8 +135,7 @@ inline const std::string& CppUnitException::fileName() const } -CppUnit_END +} // namespace CppUnit #endif // CppUnit_CppUnitException_INCLUDED - diff --git a/CppUnit/include/CppUnit/Guards.h b/CppUnit/include/CppUnit/Guards.h index 8f7ef7e6e..444879256 100644 --- a/CppUnit/include/CppUnit/Guards.h +++ b/CppUnit/include/CppUnit/Guards.h @@ -1,7 +1,7 @@ // // Guards.h // -// $Id: //poco/1.1.0/CppUnit/include/CppUnit/Guards.h#1 $ +// $Id: //poco/1.2/CppUnit/include/CppUnit/Guards.h#1 $ // diff --git a/CppUnit/include/CppUnit/Orthodox.h b/CppUnit/include/CppUnit/Orthodox.h index 8aacc7e74..ad32bc155 100644 --- a/CppUnit/include/CppUnit/Orthodox.h +++ b/CppUnit/include/CppUnit/Orthodox.h @@ -1,7 +1,7 @@ // // Orthodox.h // -// $Id: //poco/1.1.0/CppUnit/include/CppUnit/Orthodox.h#1 $ +// $Id: //poco/1.2/CppUnit/include/CppUnit/Orthodox.h#1 $ // @@ -9,15 +9,11 @@ #define CppUnit_Orthodox_INCLUDED -#ifndef CppUnit_CppUnit_INCLUDED #include "CppUnit/CppUnit.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED #include "CppUnit/TestCase.h" -#endif -CppUnit_BEGIN +namespace CppUnit { /* @@ -103,7 +99,7 @@ ClassUnderTest Orthodox::call(ClassUnderTest object) } -CppUnit_END +} // namespace CppUnit #endif // CppUnit_Orthodox_INCLUDED diff --git a/CppUnit/include/CppUnit/RepeatedTest.h b/CppUnit/include/CppUnit/RepeatedTest.h index 2dcb2ea11..da1a86bce 100644 --- a/CppUnit/include/CppUnit/RepeatedTest.h +++ b/CppUnit/include/CppUnit/RepeatedTest.h @@ -1,7 +1,7 @@ // // RepeatedTest.h // -// $Id: //poco/1.1.0/CppUnit/include/CppUnit/RepeatedTest.h#1 $ +// $Id: //poco/1.2/CppUnit/include/CppUnit/RepeatedTest.h#1 $ // @@ -9,18 +9,12 @@ #define CppUnit_RepeatedTest_INCLUDED -#ifndef CppUnit_CppUnit_INCLUDED #include "CppUnit/CppUnit.h" -#endif -#ifndef CppUnit_Guards_INCLUDED #include "CppUnit/Guards.h" -#endif -#ifndef CppUnit_TestDecorator_INCLUDED #include "CppUnit/TestDecorator.h" -#endif -CppUnit_BEGIN +namespace CppUnit { class Test; @@ -53,14 +47,14 @@ private: // Counts the number of test cases that will be run by this test. inline RepeatedTest::countTestCases () { - return TestDecorator::countTestCases () * _timesRepeat; + return TestDecorator::countTestCases() * _timesRepeat; } // Returns the name of the test instance. inline std::string RepeatedTest::toString() { - return TestDecorator::toString () + " (repeated)"; + return TestDecorator::toString() + " (repeated)"; } @@ -77,7 +71,7 @@ inline void RepeatedTest::run(TestResult *result) } -CppUnit_END +} // namespace CppUnit #endif // CppUnit_RepeatedTest_INCLUDED diff --git a/CppUnit/include/CppUnit/Test.h b/CppUnit/include/CppUnit/Test.h index d85b01c4d..e5de999e1 100644 --- a/CppUnit/include/CppUnit/Test.h +++ b/CppUnit/include/CppUnit/Test.h @@ -1,7 +1,7 @@ // // Test.h // -// $Id: //poco/1.1.0/CppUnit/include/CppUnit/Test.h#1 $ +// $Id: //poco/1.2/CppUnit/include/CppUnit/Test.h#1 $ // @@ -9,16 +9,11 @@ #define CppUnit_Test_INCLUDED -#ifndef CppUnit_CppUnit_INCLUDED #include "CppUnit/CppUnit.h" -#endif -#ifndef STD_STRING_INCLUDED #include -#define STD_STRING_INCLUDED -#endif -CppUnit_BEGIN +namespace CppUnit { class TestResult; @@ -64,7 +59,7 @@ inline std::string Test::toString() } -CppUnit_END +} // namespace CppUnit #endif // CppUnit_Test_INCLUDED diff --git a/CppUnit/include/CppUnit/TestCaller.h b/CppUnit/include/CppUnit/TestCaller.h index 70a2d2d53..70a95f1f1 100644 --- a/CppUnit/include/CppUnit/TestCaller.h +++ b/CppUnit/include/CppUnit/TestCaller.h @@ -1,7 +1,7 @@ // // TestCaller.h // -// $Id: //poco/1.1.0/CppUnit/include/CppUnit/TestCaller.h#1 $ +// $Id: //poco/1.2/CppUnit/include/CppUnit/TestCaller.h#1 $ // @@ -9,22 +9,13 @@ #define CppUnit_TestCaller_INCLUDED -#ifndef CppUnit_CppUnit_INCLUDED #include "CppUnit/CppUnit.h" -#endif -#ifndef CppUnit_Guards_INCLUDED #include "Guards.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED #include "TestCase.h" -#endif -#ifndef STD_MEMORY_INCLUDED #include -#define STD_MEMORY_INCLUDED -#endif -CppUnit_BEGIN +namespace CppUnit { /* @@ -65,7 +56,10 @@ class TestCaller: public TestCase typedef void (Fixture::*TestMethod)(); public: - TestCaller(const std::string& name, TestMethod test): TestCase(name), _fixture(new Fixture(name)), _test(test) + TestCaller(const std::string& name, TestMethod test): + TestCase(name), + _test(test), + _fixture(new Fixture(name)) { } @@ -91,7 +85,7 @@ private: }; -CppUnit_END +} // namespace CppUnit #define CppUnit_addTest(suite, cls, mth) \ diff --git a/CppUnit/include/CppUnit/TestCase.h b/CppUnit/include/CppUnit/TestCase.h index e2a185e09..4a8129018 100644 --- a/CppUnit/include/CppUnit/TestCase.h +++ b/CppUnit/include/CppUnit/TestCase.h @@ -1,7 +1,7 @@ // // TestCase.h // -// $Id: //poco/1.1.0/CppUnit/include/CppUnit/TestCase.h#1 $ +// $Id: //poco/1.2/CppUnit/include/CppUnit/TestCase.h#1 $ // @@ -9,29 +9,15 @@ #define CppUnit_TestCase_INCLUDED -#ifndef CppUnit_CppUnit_INCLUDED #include "CppUnit/CppUnit.h" -#endif -#ifndef CppUnit_Guards_INCLUDED #include "CppUnit/Guards.h" -#endif -#ifndef CppUnit_Test_INCLUDED #include "CppUnit/Test.h" -#endif -#ifndef CppUnit_CppUnitException_INCLUDED #include "CppUnit/CppUnitException.h" -#endif -#ifndef STD_STRING_INCLUDED #include -#define STD_STRING_INCLUDED -#endif -#ifndef STD_TYPEINFO_INCLUDED #include -#define STD_TYPEINFO_INCLUDED -#endif -CppUnit_BEGIN +namespace CppUnit { class TestResult; @@ -123,6 +109,19 @@ protected: long lineNumber = CppUnitException::CPPUNIT_UNKNOWNLINENUMBER, const std::string& fileName = CppUnitException::CPPUNIT_UNKNOWNFILENAME); + void loop1assertImplementation(bool condition, + const std::string& conditionExpression = "", + long lineNumber = CppUnitException::CPPUNIT_UNKNOWNLINENUMBER, + long dataLineNumber = CppUnitException::CPPUNIT_UNKNOWNLINENUMBER, + const std::string& fileName = CppUnitException::CPPUNIT_UNKNOWNFILENAME); + + void loop2assertImplementation(bool condition, + const std::string& conditionExpression = "", + long lineNumber = CppUnitException::CPPUNIT_UNKNOWNLINENUMBER, + long data1LineNumber = CppUnitException::CPPUNIT_UNKNOWNLINENUMBER, + long data2LineNumber = CppUnitException::CPPUNIT_UNKNOWNLINENUMBER, + const std::string& fileName = CppUnitException::CPPUNIT_UNKNOWNFILENAME); + void assertEquals(long expected, long actual, long lineNumber = CppUnitException::CPPUNIT_UNKNOWNLINENUMBER, @@ -150,9 +149,9 @@ protected: std::string notEqualsMessage(const std::string& expected, const std::string& actual); void assertNotNull(const void* pointer, - const std::string& pointerExpression = "", - long lineNumber = CppUnitException::CPPUNIT_UNKNOWNLINENUMBER, - const std::string& fileName = CppUnitException::CPPUNIT_UNKNOWNFILENAME); + const std::string& pointerExpression = "", + long lineNumber = CppUnitException::CPPUNIT_UNKNOWNLINENUMBER, + const std::string& fileName = CppUnitException::CPPUNIT_UNKNOWNFILENAME); void assertNull(const void* pointer, const std::string& pointerExpression = "", @@ -222,6 +221,12 @@ inline std::string TestCase::toString() #define assert(condition) \ (this->assertImplementation((condition), (#condition), __LINE__, __FILE__)) +#define loop_1_assert(data1line, condition) \ + (this->loop1assertImplementation((condition), (#condition), __LINE__, data1line, __FILE__)) + +#define loop_2_assert(data1line, data2line, condition) \ + (this->loop2assertImplementation((condition), (#condition), __LINE__, data1line, data2line, __FILE__)) + #define assertEqualDelta(expected, actual, delta) \ (this->assertEquals((expected), (actual), (delta), __LINE__, __FILE__)) @@ -238,7 +243,7 @@ inline std::string TestCase::toString() (this->fail(msg, __LINE__, __FILE__)) -CppUnit_END +} // namespace CppUnit #endif // CppUnit_TestCase_INCLUDED diff --git a/CppUnit/include/CppUnit/TestDecorator.h b/CppUnit/include/CppUnit/TestDecorator.h index c19a29c71..5ec09f14b 100644 --- a/CppUnit/include/CppUnit/TestDecorator.h +++ b/CppUnit/include/CppUnit/TestDecorator.h @@ -1,7 +1,7 @@ // // TestDecorator.h // -// $Id: //poco/1.1.0/CppUnit/include/CppUnit/TestDecorator.h#1 $ +// $Id: //poco/1.2/CppUnit/include/CppUnit/TestDecorator.h#1 $ // @@ -9,18 +9,12 @@ #define CppUnit_TestDecorator_INCLUDED -#ifndef CppUnit_CppUnit_INCLUDED #include "CppUnit/CppUnit.h" -#endif -#ifndef CppUnit_Guards_INCLUDED #include "CppUnit/Guards.h" -#endif -#ifndef CppUnit_Test_INCLUDED #include "CppUnit/Test.h" -#endif -CppUnit_BEGIN +namespace CppUnit { class TestResult; @@ -52,7 +46,7 @@ protected: }; -CppUnit_END +} // namespace CppUnit #endif // CppUnit_TestDecorator_INCLUDED diff --git a/CppUnit/include/CppUnit/TestFailure.h b/CppUnit/include/CppUnit/TestFailure.h index 6038ef184..6e2cb58df 100644 --- a/CppUnit/include/CppUnit/TestFailure.h +++ b/CppUnit/include/CppUnit/TestFailure.h @@ -1,7 +1,7 @@ // // TestFailure.h // -// $Id: //poco/1.1.0/CppUnit/include/CppUnit/TestFailure.h#1 $ +// $Id: //poco/1.2/CppUnit/include/CppUnit/TestFailure.h#1 $ // @@ -9,18 +9,12 @@ #define CppUnit_TestFailure_INCLUDED -#ifndef CppUnit_CppUnit_INCLUDED #include "CppUnit/CppUnit.h" -#endif -#ifndef CppUnit_CppUnitException_INCLUDED #include "CppUnit/CppUnitException.h" -#endif -#ifndef CppUnit_Guards_INCLUDED #include "CppUnit/Guards.h" -#endif -CppUnit_BEGIN +namespace CppUnit { class Test; @@ -84,7 +78,7 @@ inline CppUnitException* TestFailure::thrownException() } -CppUnit_END +} // namespace CppUnit #endif // CppUnit_TestFailure_INCLUDED diff --git a/CppUnit/include/CppUnit/TestResult.h b/CppUnit/include/CppUnit/TestResult.h index b895e8c39..5a591b108 100644 --- a/CppUnit/include/CppUnit/TestResult.h +++ b/CppUnit/include/CppUnit/TestResult.h @@ -1,7 +1,7 @@ // // TestResult.h // -// $Id: //poco/1.1.0/CppUnit/include/CppUnit/TestResult.h#1 $ +// $Id: //poco/1.2/CppUnit/include/CppUnit/TestResult.h#1 $ // @@ -9,22 +9,13 @@ #define CppUnit_TestResult_INCLUDED -#ifndef CppUnit_CppUnit_INCLUDED #include "CppUnit/CppUnit.h" -#endif -#ifndef CppUnit_Guards_INCLUDED #include "CppUnit/Guards.h" -#endif -#ifndef CppUnit_TestFailure_INCLUDED #include "CppUnit/TestFailure.h" -#endif -#ifndef STD_VECTOR_INCLUDED #include -#define STD_VECTOR_INCLUDED -#endif -CppUnit_BEGIN +namespace CppUnit { class CppUnitException; @@ -234,7 +225,7 @@ inline void TestResult::setSynchronizationObject(SynchronizationObject* syncObje } -CppUnit_END +} // namespace CppUnit #endif // CppUnit_TestResult_INCLUDED diff --git a/CppUnit/include/CppUnit/TestRunner.h b/CppUnit/include/CppUnit/TestRunner.h index f0edb016a..b59846194 100644 --- a/CppUnit/include/CppUnit/TestRunner.h +++ b/CppUnit/include/CppUnit/TestRunner.h @@ -1,7 +1,7 @@ // // TestRunner.h // -// $Id: //poco/1.1.0/CppUnit/include/CppUnit/TestRunner.h#1 $ +// $Id: //poco/1.2/CppUnit/include/CppUnit/TestRunner.h#1 $ // @@ -9,20 +9,12 @@ #define CppUnit_TestRunner_INCLUDED -#ifndef CppUnit_CppUnit_INCLUDED #include "CppUnit/CppUnit.h" -#endif -#ifndef STD_VECTOR_INCLUDED #include -#define STD_VECTOR_INCLUDED -#endif -#ifndef STD_STRING_INCLUDED #include -#define STD_STRING_INCLUDED -#endif -CppUnit_BEGIN +namespace CppUnit { class Test; @@ -65,7 +57,7 @@ private: }; -CppUnit_END +} // namespace CppUnit #define CppUnitMain(testCase) \ diff --git a/CppUnit/include/CppUnit/TestSetup.h b/CppUnit/include/CppUnit/TestSetup.h index 0a13294b2..bef487765 100644 --- a/CppUnit/include/CppUnit/TestSetup.h +++ b/CppUnit/include/CppUnit/TestSetup.h @@ -1,7 +1,7 @@ // // TestSetup.h // -// $Id: //poco/1.1.0/CppUnit/include/CppUnit/TestSetup.h#1 $ +// $Id: //poco/1.2/CppUnit/include/CppUnit/TestSetup.h#1 $ // @@ -9,18 +9,12 @@ #define CppUnit_TestSetup_INCLUDED -#ifndef CppUnit_CppUnit_INCLUDED #include "CppUnit/CppUnit.h" -#endif -#ifndef CppUnit_Guards_INCLUDED #include "CppUnit/Guards.h" -#endif -#ifndef CppUnit_TestDecorator_INCLUDED #include "CppUnit/TestDecorator.h" -#endif -CppUnit_BEGIN +namespace CppUnit { class Test; @@ -57,7 +51,7 @@ inline void TestSetup::run(TestResult* result) } -CppUnit_END +} // namespace CppUnit #endif // CppUnit_TestSetup_INCLUDED diff --git a/CppUnit/include/CppUnit/TestSuite.h b/CppUnit/include/CppUnit/TestSuite.h index f9aef4746..e8be58f7b 100644 --- a/CppUnit/include/CppUnit/TestSuite.h +++ b/CppUnit/include/CppUnit/TestSuite.h @@ -1,7 +1,7 @@ // // TestSuite.h // -// $Id: //poco/1.1.0/CppUnit/include/CppUnit/TestSuite.h#1 $ +// $Id: //poco/1.2/CppUnit/include/CppUnit/TestSuite.h#1 $ // @@ -9,26 +9,14 @@ #define CppUnit_TestSuite_INCLUDED -#ifndef CppUnit_CppUnit_INCLUDED #include "CppUnit/CppUnit.h" -#endif -#ifndef CppUnit_Guards_INCLUDED #include "CppUnit/Guards.h" -#endif -#ifndef CppUnit_Test_INCLUDED #include "CppUnit/Test.h" -#endif -#ifndef STD_VECTOR_INCLUDED #include -#define STD_VECTOR_INCLUDED -#endif -#ifndef STD_STRING_INCLUDED #include -#define STD_STRING_INCLUDED -#endif -CppUnit_BEGIN +namespace CppUnit { class TestResult; @@ -104,7 +92,7 @@ inline const std::vector TestSuite::tests() const } -CppUnit_END +} // namespace CppUnit #endif // CppUnit_TestSuite_INCLUDED diff --git a/CppUnit/include/CppUnit/TextTestResult.h b/CppUnit/include/CppUnit/TextTestResult.h index 1a093e66e..c45f62232 100644 --- a/CppUnit/include/CppUnit/TextTestResult.h +++ b/CppUnit/include/CppUnit/TextTestResult.h @@ -1,7 +1,7 @@ // // TextTestResult.h // -// $Id: //poco/1.1.0/CppUnit/include/CppUnit/TextTestResult.h#1 $ +// $Id: //poco/1.2/CppUnit/include/CppUnit/TextTestResult.h#1 $ // @@ -9,19 +9,12 @@ #define CppUnit_TextTestResult_INCLUDED -#ifndef CppUnit_CppUnit_INCLUDED #include "CppUnit/CppUnit.h" -#endif -#ifndef CppUnit_TestResult_INCLUDED #include "CppUnit/TestResult.h" -#endif -#ifndef STD_OSTREAM_INCLUDED #include -#define STD_OSTREAM_INCLUDED -#endif -CppUnit_BEGIN +namespace CppUnit { class CppUnit_API TextTestResult: public TestResult @@ -48,7 +41,7 @@ inline std::ostream& operator<< (std::ostream& stream, TextTestResult& result) } -CppUnit_END +} // namespace CppUnit #endif // CppUnit_TextTestResult_INCLUDED diff --git a/CppUnit/include/CppUnit/estring.h b/CppUnit/include/CppUnit/estring.h index 4d2c2d88c..6e7a18f8e 100644 --- a/CppUnit/include/CppUnit/estring.h +++ b/CppUnit/include/CppUnit/estring.h @@ -1,7 +1,7 @@ // // estring.h // -// $Id: //poco/1.1.0/CppUnit/include/CppUnit/estring.h#1 $ +// $Id: //poco/1.2/CppUnit/include/CppUnit/estring.h#1 $ // @@ -9,20 +9,12 @@ #define CppUnit_estring_INCLUDED -#ifndef CppUnit_CppUnit_INCLUDED #include "CppUnit/CppUnit.h" -#endif -#ifndef STD_STRING_INCLUDED #include -#define STD_STRING_INCLUDED -#endif -#ifndef STD_STDIO_INCLUDED #include -#define STD_STDIO_INCLUDED -#endif -CppUnit_BEGIN +namespace CppUnit { // Create a std::string from a const char pointer @@ -75,7 +67,7 @@ inline std::string estring(const void* ptr) } -CppUnit_END +} // namespace CppUnit #endif // CppUnit_estring_INCLUDED diff --git a/CppUnit/src/CppUnitException.cpp b/CppUnit/src/CppUnitException.cpp index 7510cf9ee..ad4083265 100644 --- a/CppUnit/src/CppUnitException.cpp +++ b/CppUnit/src/CppUnitException.cpp @@ -1,18 +1,18 @@ // // CppUnitException.cpp // -// $Id: //poco/1.1.0/CppUnit/src/CppUnitException.cpp#1 $ +// $Id: //poco/1.2/CppUnit/src/CppUnitException.cpp#1 $ // #include "CppUnit/CppUnitException.h" -CppUnit_BEGIN +namespace CppUnit { const std::string CppUnitException::CPPUNIT_UNKNOWNFILENAME = ""; const int CppUnitException::CPPUNIT_UNKNOWNLINENUMBER = -1; -CppUnit_END +} // namespace CppUnit diff --git a/CppUnit/src/TestCase.cpp b/CppUnit/src/TestCase.cpp index 2c6ae841c..2bde12d0d 100644 --- a/CppUnit/src/TestCase.cpp +++ b/CppUnit/src/TestCase.cpp @@ -1,7 +1,7 @@ // // TestCase.cpp // -// $Id: //poco/1.1.0/CppUnit/src/TestCase.cpp#1 $ +// $Id: //poco/1.2/CppUnit/src/TestCase.cpp#1 $ // @@ -16,7 +16,7 @@ using namespace std; -CppUnit_BEGIN +namespace CppUnit { // Create a default TestResult @@ -34,6 +34,20 @@ void TestCase::assertImplementation(bool condition, const std::string& condition } +void TestCase::loop1assertImplementation(bool condition, const std::string& conditionExpression, long lineNumber, long data1lineNumber, const std::string& fileName) +{ + if (!condition) + throw CppUnitException(conditionExpression, lineNumber, data1lineNumber, fileName); +} + + +void TestCase::loop2assertImplementation(bool condition, const std::string& conditionExpression, long lineNumber, long data1lineNumber, long data2lineNumber, const std::string& fileName) +{ + if (!condition) + throw CppUnitException(conditionExpression, lineNumber, data1lineNumber, data2lineNumber, fileName); +} + + // Check for a failed equality assertion void TestCase::assertEquals(long expected, long actual, long lineNumber, const std::string& fileName) { @@ -165,4 +179,4 @@ std::string TestCase::notEqualsMessage(const std::string& expected, const std::s } -CppUnit_END +} // namespace CppUnit diff --git a/CppUnit/src/TestDecorator.cpp b/CppUnit/src/TestDecorator.cpp index a80136043..033709b41 100644 --- a/CppUnit/src/TestDecorator.cpp +++ b/CppUnit/src/TestDecorator.cpp @@ -1,14 +1,14 @@ // // TestDecorator.cpp // -// $Id: //poco/1.1.0/CppUnit/src/TestDecorator.cpp#1 $ +// $Id: //poco/1.2/CppUnit/src/TestDecorator.cpp#1 $ // #include "CppUnit/TestDecorator.h" -CppUnit_BEGIN +namespace CppUnit { TestDecorator::TestDecorator(Test* test) @@ -40,4 +40,4 @@ std::string TestDecorator::toString() } -CppUnit_END +} // namespace CppUnit diff --git a/CppUnit/src/TestFailure.cpp b/CppUnit/src/TestFailure.cpp index 1a7a6a125..0e16f2e9b 100644 --- a/CppUnit/src/TestFailure.cpp +++ b/CppUnit/src/TestFailure.cpp @@ -1,7 +1,7 @@ // // TestFailure.cpp // -// $Id: //poco/1.1.0/CppUnit/src/TestFailure.cpp#1 $ +// $Id: //poco/1.2/CppUnit/src/TestFailure.cpp#1 $ // @@ -9,7 +9,7 @@ #include "CppUnit/Test.h" -CppUnit_BEGIN +namespace CppUnit { // Returns a short description of the failure. @@ -19,4 +19,4 @@ std::string TestFailure::toString() } -CppUnit_END +} // namespace CppUnit diff --git a/CppUnit/src/TestResult.cpp b/CppUnit/src/TestResult.cpp index 9a3db286a..604d87eee 100644 --- a/CppUnit/src/TestResult.cpp +++ b/CppUnit/src/TestResult.cpp @@ -1,14 +1,14 @@ // // TestResult.cpp // -// $Id: //poco/1.1.0/CppUnit/src/TestResult.cpp#1 $ +// $Id: //poco/1.2/CppUnit/src/TestResult.cpp#1 $ // #include "CppUnit/TestResult.h" -CppUnit_BEGIN +namespace CppUnit { // Destroys a test result @@ -26,4 +26,4 @@ TestResult::~TestResult() } -CppUnit_END +} // namespace CppUnit diff --git a/CppUnit/src/TestRunner.cpp b/CppUnit/src/TestRunner.cpp index 4248a7ae6..149cda5ed 100644 --- a/CppUnit/src/TestRunner.cpp +++ b/CppUnit/src/TestRunner.cpp @@ -1,7 +1,7 @@ // // TestRunner.cpp // -// $Id: //poco/1.1.0/CppUnit/src/TestRunner.cpp#1 $ +// $Id: //poco/1.2/CppUnit/src/TestRunner.cpp#1 $ // @@ -12,7 +12,7 @@ #include -CppUnit_BEGIN +namespace CppUnit { TestRunner::TestRunner() @@ -178,4 +178,4 @@ Test* TestRunner::find(const std::string& name, Test* pTest, const std::string& } -CppUnit_END +} // namespace CppUnit diff --git a/CppUnit/src/TestSuite.cpp b/CppUnit/src/TestSuite.cpp index d11c720df..52edeaef0 100644 --- a/CppUnit/src/TestSuite.cpp +++ b/CppUnit/src/TestSuite.cpp @@ -1,7 +1,7 @@ // // TestSuite.cpp // -// $Id: //poco/1.1.0/CppUnit/src/TestSuite.cpp#1 $ +// $Id: //poco/1.2/CppUnit/src/TestSuite.cpp#1 $ // @@ -9,7 +9,7 @@ #include "CppUnit/TestResult.h" -CppUnit_BEGIN +namespace CppUnit { // Deletes all tests in the suite. @@ -46,4 +46,4 @@ int TestSuite::countTestCases() } -CppUnit_END +} // namespace CppUnit diff --git a/CppUnit/src/TextTestResult.cpp b/CppUnit/src/TextTestResult.cpp index 495231950..dd9bb0ef7 100644 --- a/CppUnit/src/TextTestResult.cpp +++ b/CppUnit/src/TextTestResult.cpp @@ -1,7 +1,7 @@ // // TextTestResult.cpp // -// $Id: //poco/1.1.0/CppUnit/src/TextTestResult.cpp#1 $ +// $Id: //poco/1.2/CppUnit/src/TextTestResult.cpp#1 $ // @@ -13,7 +13,7 @@ #include -CppUnit_BEGIN +namespace CppUnit { void TextTestResult::addError(Test* test, CppUnitException* e) @@ -42,6 +42,7 @@ void TextTestResult::printErrors(std::ostream& stream) if (testErrors() != 0) { stream << "\n"; + if (testErrors() == 1) stream << "There was " << testErrors() << " error: " << std::endl; else @@ -57,7 +58,27 @@ void TextTestResult::printErrors(std::ostream& stream) << ": " << failure->failedTest()->toString() << "\n" << " \"" << (e ? e->what() : "") << "\"\n" - << " in \"" << (e ? e->fileName() : std::string()) << "\", line " << (e ? e->lineNumber() : 0) << "\n"; + << " in \"" + << (e ? e->fileName() : std::string()) + << "\", line "; + if (e == 0) + { + stream << "0"; + } + else + { + stream << e->lineNumber(); + if (e->data2LineNumber() != CppUnitException::CPPUNIT_UNKNOWNLINENUMBER) + { + stream << " data lines " << e->data1LineNumber() + << ", " << e->data2LineNumber(); + } + else if (e->data1LineNumber() != CppUnitException::CPPUNIT_UNKNOWNLINENUMBER) + { + stream << " data line " << e->data1LineNumber(); + } + } + stream << "\n"; i++; } } @@ -85,11 +106,31 @@ void TextTestResult::printFailures(std::ostream& stream) << ": " << failure->failedTest()->toString() << "\n" << " \"" << (e ? e->what() : "") << "\"\n" - << " in \"" << (e ? e->fileName() : std::string()) << "\", line " << (e ? e->lineNumber() : 0) << "\n"; + << " in \"" + << (e ? e->fileName() : std::string()) + << "\", line "; + if (e == 0) + { + stream << "0"; + } + else + { + stream << e->lineNumber(); + if (e->data2LineNumber() != CppUnitException::CPPUNIT_UNKNOWNLINENUMBER) + { + stream << " data lines " + << e->data1LineNumber() + << ", " << e->data2LineNumber(); + } + else if (e->data1LineNumber() != CppUnitException::CPPUNIT_UNKNOWNLINENUMBER) + { + stream << " data line " << e->data1LineNumber(); + } + } + stream << "\n"; i++; } } - } @@ -130,4 +171,4 @@ std::string TextTestResult::shortName(const std::string& testName) } -CppUnit_END +} // namespace CppUnit diff --git a/Foundation/Foundation_vs71.vcproj b/Foundation/Foundation_vs71.vcproj index 5a320f51e..2cc004fd6 100644 --- a/Foundation/Foundation_vs71.vcproj +++ b/Foundation/Foundation_vs71.vcproj @@ -39,7 +39,7 @@ Name="VCCustomBuildTool"/> + + @@ -299,6 +302,9 @@ Name="VCCLCompilerTool"/> + + @@ -320,117 +326,141 @@ + + + RelativePath=".\include\Poco\Any.h"> + RelativePath=".\include\Poco\AutoPtr.h"> + RelativePath=".\include\Poco\AutoReleasePool.h"> + RelativePath=".\include\Poco\Buffer.h"> + RelativePath=".\include\Poco\Bugcheck.h"> + RelativePath=".\include\Poco\ByteOrder.h"> + RelativePath=".\include\Poco\Config.h"> + RelativePath=".\include\Poco\Debugger.h"> + RelativePath=".\include\Poco\DynamicFactory.h"> + RelativePath=".\include\Poco\Environment.h"> + RelativePath=".\include\Poco\Environment_UNIX.h"> + RelativePath=".\include\Poco\Environment_VMS.h"> + RelativePath=".\include\Poco\Environment_WIN32.h"> + RelativePath=".\include\Poco\Environment_WIN32U.h"> + RelativePath=".\include\Poco\Exception.h"> + RelativePath=".\include\Poco\Format.h"> + RelativePath=".\include\Poco\Foundation.h"> + RelativePath=".\include\Poco\FPEnvironment.h"> + RelativePath=".\include\Poco\FPEnvironment_C99.h"> + RelativePath=".\include\Poco\FPEnvironment_DEC.h"> + RelativePath=".\include\Poco\FPEnvironment_DUMMY.h"> + RelativePath=".\include\Poco\FPEnvironment_SUN.h"> + RelativePath=".\include\Poco\FPEnvironment_WIN32.h"> + RelativePath=".\include\Poco\HashFunction.h"> + RelativePath=".\include\Poco\HashTable.h"> + RelativePath=".\include\Poco\Instantiator.h"> + RelativePath=".\include\Poco\MemoryPool.h"> + RelativePath=".\include\Poco\NestedDiagnosticContext.h"> + RelativePath=".\include\Poco\NumberFormatter.h"> + RelativePath=".\include\Poco\NumberParser.h"> + RelativePath=".\include\Poco\Platform.h"> + RelativePath=".\include\Poco\Platform_POSIX.h"> + RelativePath=".\include\Poco\Platform_VMS.h"> + RelativePath=".\include\Poco\Platform_WIN32.h"> + RelativePath=".\include\Poco\Poco.h"> + RelativePath=".\include\Poco\RefCountedObject.h"> + + + + + + + + + + + + + + @@ -490,64 +520,64 @@ Name="Header Files" Filter=""> + RelativePath=".\include\Poco\Base64Decoder.h"> + RelativePath=".\include\Poco\Base64Encoder.h"> + RelativePath=".\include\Poco\BinaryReader.h"> + RelativePath=".\include\Poco\BinaryWriter.h"> + RelativePath=".\include\Poco\BufferAllocator.h"> + RelativePath=".\include\Poco\BufferedBidirectionalStreamBuf.h"> + RelativePath=".\include\Poco\BufferedStreamBuf.h"> + RelativePath=".\include\Poco\CountingStream.h"> + RelativePath=".\include\Poco\DeflatingStream.h"> + RelativePath=".\include\Poco\HexBinaryDecoder.h"> + RelativePath=".\include\Poco\HexBinaryEncoder.h"> + RelativePath=".\include\Poco\InflatingStream.h"> + RelativePath=".\include\Poco\LineEndingConverter.h"> + RelativePath=".\include\Poco\NullStream.h"> + RelativePath=".\include\Poco\StreamCopier.h"> + RelativePath=".\include\Poco\StreamTokenizer.h"> + RelativePath=".\include\Poco\StreamUtil.h"> + RelativePath=".\include\Poco\TeeStream.h"> + RelativePath=".\include\Poco\Token.h"> + RelativePath=".\include\Poco\UnbufferedStreamBuf.h"> + + @@ -812,85 +845,94 @@ Name="Header Files" Filter=""> + RelativePath=".\include\Poco\ActiveDispatcher.h"> + RelativePath=".\include\Poco\ActiveMethod.h"> + RelativePath=".\include\Poco\ActiveResult.h"> + RelativePath=".\include\Poco\ActiveRunnable.h"> + RelativePath=".\include\Poco\ActiveStarter.h"> + RelativePath=".\include\Poco\Activity.h"> + RelativePath=".\include\Poco\ErrorHandler.h"> + RelativePath=".\include\Poco\Event.h"> + RelativePath=".\include\Poco\Event_POSIX.h"> + RelativePath=".\include\Poco\Event_WIN32.h"> + RelativePath=".\include\Poco\Mutex.h"> + RelativePath=".\include\Poco\Mutex_POSIX.h"> + RelativePath=".\include\Poco\Mutex_WIN32.h"> + RelativePath=".\include\Poco\Runnable.h"> + RelativePath=".\include\Poco\RunnableAdapter.h"> + RelativePath=".\include\Poco\RWLock.h"> + RelativePath=".\include\Poco\RWLock_POSIX.h"> + RelativePath=".\include\Poco\RWLock_WIN32.h"> + RelativePath=".\include\Poco\ScopedLock.h"> + RelativePath=".\include\Poco\Semaphore.h"> + RelativePath=".\include\Poco\Semaphore_POSIX.h"> + RelativePath=".\include\Poco\Semaphore_WIN32.h"> + RelativePath=".\include\Poco\SignalHandler.h"> + RelativePath=".\include\Poco\SynchronizedObject.h"> + RelativePath=".\include\Poco\Thread.h"> + RelativePath=".\include\Poco\Thread_POSIX.h"> + RelativePath=".\include\Poco\Thread_WIN32.h"> + + + + + + @@ -929,31 +971,31 @@ Name="Header Files" Filter=""> + RelativePath=".\include\Poco\DigestEngine.h"> + RelativePath=".\include\Poco\DigestStream.h"> + RelativePath=".\include\Poco\HMACEngine.h"> + RelativePath=".\include\Poco\MD2Engine.h"> + RelativePath=".\include\Poco\MD4Engine.h"> + RelativePath=".\include\Poco\MD5Engine.h"> + RelativePath=".\include\Poco\Random.h"> + RelativePath=".\include\Poco\RandomStream.h"> + RelativePath=".\include\Poco\SHA1Engine.h"> @@ -1029,36 +1071,54 @@ Name="VCCLCompilerTool"/> + + + + + + + + + RelativePath=".\include\Poco\ClassLibrary.h"> + RelativePath=".\include\Poco\ClassLoader.h"> + RelativePath=".\include\Poco\Manifest.h"> + RelativePath=".\include\Poco\MetaObject.h"> + RelativePath=".\include\Poco\SharedLibrary.h"> + RelativePath=".\include\Poco\SharedLibrary_HPUX.h"> + RelativePath=".\include\Poco\SharedLibrary_UNIX.h"> + RelativePath=".\include\Poco\SharedLibrary_VMS.h"> + RelativePath=".\include\Poco\SharedLibrary_WIN32.h"> + + @@ -1098,7 +1158,7 @@ Name="Header Files" Filter=""> + RelativePath=".\include\Poco\RegularExpression.h"> @@ -1183,6 +1243,21 @@ Name="VCCLCompilerTool"/> + + + + + + + + @@ -1192,6 +1267,9 @@ + + @@ -1251,85 +1329,91 @@ Name="Header Files" Filter=""> + RelativePath=".\include\Poco\ArchiveStrategy.h"> + RelativePath=".\include\Poco\AsyncChannel.h"> + RelativePath=".\include\Poco\Channel.h"> + RelativePath=".\include\Poco\Configurable.h"> + RelativePath=".\include\Poco\ConsoleChannel.h"> + RelativePath=".\include\Poco\EventLogChannel.h"> + RelativePath=".\include\Poco\FileChannel.h"> + RelativePath=".\include\Poco\Formatter.h"> + RelativePath=".\include\Poco\FormattingChannel.h"> + RelativePath=".\include\Poco\LogFile.h"> + RelativePath=".\include\Poco\LogFile_STD.h"> + RelativePath=".\include\Poco\LogFile_VMS.h"> + RelativePath=".\include\Poco\LogFile_WIN32.h"> + RelativePath=".\include\Poco\LogFile_WIN32U.h"> + RelativePath=".\include\Poco\Logger.h"> + RelativePath=".\include\Poco\LoggingFactory.h"> + RelativePath=".\include\Poco\LoggingRegistry.h"> + RelativePath=".\include\Poco\LogStream.h"> + RelativePath=".\include\Poco\Message.h"> + RelativePath=".\include\Poco\NullChannel.h"> + + + + + RelativePath=".\include\Poco\PurgeStrategy.h"> + RelativePath=".\include\Poco\RotateStrategy.h"> + RelativePath=".\include\Poco\SimpleFileChannel.h"> + RelativePath=".\include\Poco\SplitterChannel.h"> + RelativePath=".\include\Poco\StreamChannel.h"> + RelativePath=".\include\Poco\SyslogChannel.h"> + RelativePath=".\include\Poco\Notification.h"> + RelativePath=".\include\Poco\NotificationCenter.h"> + RelativePath=".\include\Poco\NotificationQueue.h"> + RelativePath=".\include\Poco\Observer.h"> @@ -1605,55 +1689,55 @@ Name="Header Files" Filter=""> + RelativePath=".\include\Poco\DirectoryIterator.h"> + RelativePath=".\include\Poco\DirectoryIterator_UNIX.h"> + RelativePath=".\include\Poco\DirectoryIterator_VMS.h"> + RelativePath=".\include\Poco\DirectoryIterator_WIN32.h"> + RelativePath=".\include\Poco\DirectoryIterator_WIN32U.h"> + RelativePath=".\include\Poco\File.h"> + RelativePath=".\include\Poco\File_UNIX.h"> + RelativePath=".\include\Poco\File_VMS.h"> + RelativePath=".\include\Poco\File_WIN32.h"> + RelativePath=".\include\Poco\File_WIN32U.h"> + RelativePath=".\include\Poco\Glob.h"> + RelativePath=".\include\Poco\Path.h"> + RelativePath=".\include\Poco\Path_UNIX.h"> + RelativePath=".\include\Poco\Path_VMS.h"> + RelativePath=".\include\Poco\Path_WIN32.h"> + RelativePath=".\include\Poco\Path_WIN32U.h"> + RelativePath=".\include\Poco\TemporaryFile.h"> @@ -1789,6 +1873,60 @@ Name="VCCLCompilerTool"/> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1857,49 +1995,67 @@ Name="Header Files" Filter=""> + RelativePath=".\include\Poco\NamedEvent.h"> + RelativePath=".\include\Poco\NamedEvent_UNIX.h"> + RelativePath=".\include\Poco\NamedEvent_VMS.h"> + RelativePath=".\include\Poco\NamedEvent_WIN32.h"> + RelativePath=".\include\Poco\NamedEvent_WIN32U.h"> + RelativePath=".\include\Poco\NamedMutex.h"> + RelativePath=".\include\Poco\NamedMutex_UNIX.h"> + RelativePath=".\include\Poco\NamedMutex_VMS.h"> + RelativePath=".\include\Poco\NamedMutex_WIN32.h"> + RelativePath=".\include\Poco\NamedMutex_WIN32U.h"> + RelativePath=".\include\Poco\Pipe.h"> + RelativePath=".\include\Poco\PipeImpl.h"> + RelativePath=".\include\Poco\PipeImpl_DUMMY.h"> + RelativePath=".\include\Poco\PipeImpl_POSIX.h"> + RelativePath=".\include\Poco\PipeImpl_WIN32.h"> + + + + + + + + + + + + @@ -1920,10 +2076,10 @@ Name="Header Files" Filter=""> + RelativePath=".\include\Poco\UUID.h"> + RelativePath=".\include\Poco\UUIDGenerator.h"> @@ -1995,31 +2151,31 @@ Name="Header Files" Filter=""> + RelativePath=".\include\Poco\DateTime.h"> + RelativePath=".\include\Poco\DateTimeFormat.h"> + RelativePath=".\include\Poco\DateTimeFormatter.h"> + RelativePath=".\include\Poco\DateTimeParser.h"> + RelativePath=".\include\Poco\LocalDateTime.h"> + RelativePath=".\include\Poco\Stopwatch.h"> + RelativePath=".\include\Poco\Timespan.h"> + RelativePath=".\include\Poco\Timestamp.h"> + RelativePath=".\include\Poco\Timezone.h"> @@ -2067,37 +2223,37 @@ Name="Header Files" Filter=""> + RelativePath=".\include\Poco\ASCIIEncoding.h"> + RelativePath=".\include\Poco\Latin1Encoding.h"> + RelativePath=".\include\Poco\Latin9Encoding.h"> + RelativePath=".\include\Poco\StreamConverter.h"> + RelativePath=".\include\Poco\TextConverter.h"> + RelativePath=".\include\Poco\TextEncoding.h"> + RelativePath=".\include\Poco\TextIterator.h"> + RelativePath=".\include\Poco\UnicodeConverter.h"> + RelativePath=".\include\Poco\UTF16Encoding.h"> + RelativePath=".\include\Poco\UTF8Encoding.h"> + RelativePath=".\include\Poco\Windows1252Encoding.h"> @@ -2124,16 +2280,16 @@ Name="Header Files" Filter=""> + RelativePath=".\include\Poco\FileStreamFactory.h"> + RelativePath=".\include\Poco\URI.h"> + RelativePath=".\include\Poco\URIStreamFactory.h"> + RelativePath=".\include\Poco\URIStreamOpener.h"> @@ -2157,13 +2313,13 @@ Name="Header Files" Filter=""> + RelativePath=".\include\Poco\Task.h"> + RelativePath=".\include\Poco\TaskManager.h"> + RelativePath=".\include\Poco\TaskNotification.h"> @@ -2174,49 +2330,49 @@ Name="Header Files" Filter=""> + RelativePath=".\include\Poco\AbstractDelegate.h"> + RelativePath=".\include\Poco\AbstractEvent.h"> + RelativePath=".\include\Poco\AbstractPriorityDelegate.h"> + RelativePath=".\include\Poco\BasicEvent.h"> + RelativePath=".\include\Poco\CompareFunctions.h"> + RelativePath=".\include\Poco\DefaultStrategy.h"> + RelativePath=".\include\Poco\Delegate.h"> + RelativePath=".\include\Poco\EventArgs.h"> + RelativePath=".\include\Poco\Expire.h"> + RelativePath=".\include\Poco\FIFOEvent.h"> + RelativePath=".\include\Poco\FIFOStrategy.h"> + RelativePath=".\include\Poco\NotificationStrategy.h"> + RelativePath=".\include\Poco\PriorityDelegate.h"> + RelativePath=".\include\Poco\PriorityEvent.h"> + RelativePath=".\include\Poco\PriorityExpire.h"> + RelativePath=".\include\Poco\AbstractCache.h"> + RelativePath=".\include\Poco\AbstractStrategy.h"> + RelativePath=".\include\Poco\ExpireCache.h"> + RelativePath=".\include\Poco\ExpireLRUCache.h"> + RelativePath=".\include\Poco\ExpireStrategy.h"> + RelativePath=".\include\Poco\KeyValueArgs.h"> + RelativePath=".\include\Poco\LRUCache.h"> + RelativePath=".\include\Poco\LRUStrategy.h"> + RelativePath=".\include\Poco\StrategyCollection.h"> + RelativePath=".\include\Poco\ValidArgs.h"> diff --git a/Foundation/Foundation_vs80.vcproj b/Foundation/Foundation_vs80.vcproj index 6f9c7cd18..9c5a00648 100644 --- a/Foundation/Foundation_vs80.vcproj +++ b/Foundation/Foundation_vs80.vcproj @@ -68,7 +68,7 @@ /> + + @@ -413,6 +417,10 @@ /> + + @@ -441,152 +449,188 @@ RelativePath=".\src\StringTokenizer.cpp" > + + + + + + + + + + + + + + + + + + @@ -662,83 +706,83 @@ Name="Header Files" > @@ -833,6 +877,10 @@ + + @@ -1086,111 +1134,123 @@ Name="Header Files" > + + + + + + @@ -1238,39 +1298,39 @@ Name="Header Files" > @@ -1369,44 +1429,68 @@ /> + + + + + + + + + + @@ -1454,7 +1538,7 @@ Name="Header Files" > @@ -1565,6 +1649,26 @@ /> + + + + + + + + @@ -1577,6 +1681,10 @@ RelativePath=".\src\LoggingRegistry.cpp" > + + @@ -1654,83 +1762,91 @@ Name="Header Files" > + + + + @@ -1824,19 +1940,19 @@ Name="Header Files" > @@ -2112,71 +2228,71 @@ Name="Header Files" > @@ -2355,6 +2471,78 @@ /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2444,63 +2632,87 @@ Name="Header Files" > + + + + + + + + + + + + @@ -2524,11 +2736,11 @@ Name="Header Files" > @@ -2620,39 +2832,39 @@ Name="Header Files" > @@ -2712,47 +2924,47 @@ Name="Header Files" > @@ -2784,19 +2996,19 @@ Name="Header Files" > @@ -2824,15 +3036,15 @@ Name="Header Files" > @@ -2844,63 +3056,63 @@ Name="Header Files" > @@ -2920,43 +3132,43 @@ Name="Header Files" > diff --git a/Foundation/Makefile b/Foundation/Makefile index 7f8823da4..ebb282fed 100644 --- a/Foundation/Makefile +++ b/Foundation/Makefile @@ -1,7 +1,7 @@ # # Makefile # -# $Id: //poco/1.1.0/Foundation/Makefile#1 $ +# $Id: //poco/1.2/Foundation/Makefile#1 $ # # Makefile for Poco Foundation # @@ -15,7 +15,7 @@ objects = ArchiveStrategy ASCIIEncoding AsyncChannel Base64Decoder Base64Encoder Environment Event EventArgs ErrorHandler Exception FPEnvironment File Glob \ FileChannel Formatter FormattingChannel HexBinaryDecoder LineEndingConverter \ HexBinaryEncoder InflatingStream Latin1Encoding Latin9Encoding LogFile Logger \ - LoggingFactory LoggingRegistry NamedEvent NamedMutex NullChannel \ + LoggingFactory LoggingRegistry LogStream NamedEvent NamedMutex NullChannel \ MemoryPool MD2Engine MD4Engine MD5Engine Manifest Message Mutex \ NestedDiagnosticContext Notification NotificationCenter \ NotificationQueue NullStream NumberFormatter NumberParser Observer \ @@ -24,17 +24,18 @@ objects = ArchiveStrategy ASCIIEncoding AsyncChannel Base64Decoder Base64Encoder SHA1Engine Semaphore SharedLibrary SimpleFileChannel \ SignalHandler SplitterChannel Stopwatch StreamChannel StreamConverter StreamCopier \ StreamTokenizer String StringTokenizer SynchronizedObject SyslogChannel \ - Task TaskManager TaskNotification TeeStream \ + Task TaskManager TaskNotification TeeStream HashStatistic\ TemporaryFile TextConverter TextEncoding TextIterator Thread ThreadLocal \ - ThreadPool Timer Timespan Timestamp Timezone Token URI \ + ThreadPool ActiveDispatcher Timer Timespan Timestamp Timezone Token URI \ FileStreamFactory URIStreamFactory URIStreamOpener UTF16Encoding Windows1252Encoding \ - UTF8Encoding UnicodeConverter UUID UUIDGenerator \ + UTF8Encoding UnicodeConverter UUID UUIDGenerator Void Format \ + Pipe PipeImpl PipeStream \ adler32 chartables compress crc32 \ deflate get gzio infback inffast inflate inftrees maketables pcre study \ trees zutil target = PocoFoundation -target_version = 1 +target_version = $(LIBVERSION) target_libs = include $(POCO_BASE)/build/rules/lib diff --git a/Foundation/foundation.vmsbuild b/Foundation/foundation.vmsbuild index 248b8bcce..8be41b0d9 100644 --- a/Foundation/foundation.vmsbuild +++ b/Foundation/foundation.vmsbuild @@ -36,6 +36,7 @@ Glob FileChannel Formatter FormattingChannel +HashStatistic HexBinaryDecoder HexBinaryEncoder InflatingStream diff --git a/Foundation/include/Foundation/ASCIIEncoding.h b/Foundation/include/Poco/ASCIIEncoding.h similarity index 85% rename from Foundation/include/Foundation/ASCIIEncoding.h rename to Foundation/include/Poco/ASCIIEncoding.h index b6f79a137..b1151504e 100644 --- a/Foundation/include/Foundation/ASCIIEncoding.h +++ b/Foundation/include/Poco/ASCIIEncoding.h @@ -1,7 +1,7 @@ // // ASCIIEncoding.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/ASCIIEncoding.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/ASCIIEncoding.h#1 $ // // Library: Foundation // Package: Text @@ -40,15 +40,11 @@ #define Foundation_ASCIIEncoding_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_TextEncoding_INCLUDED -#include "Foundation/TextEncoding.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/TextEncoding.h" -Foundation_BEGIN +namespace Poco { class Foundation_API ASCIIEncoding: public TextEncoding @@ -66,7 +62,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_ASCIIEncoding_INCLUDED diff --git a/Foundation/include/Foundation/AbstractCache.h b/Foundation/include/Poco/AbstractCache.h similarity index 90% rename from Foundation/include/Foundation/AbstractCache.h rename to Foundation/include/Poco/AbstractCache.h index 064976a47..81cf57ed1 100644 --- a/Foundation/include/Foundation/AbstractCache.h +++ b/Foundation/include/Poco/AbstractCache.h @@ -1,7 +1,7 @@ // // AbstractCache.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/AbstractCache.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/AbstractCache.h#1 $ // // Library: Foundation // Package: Cache @@ -40,20 +40,19 @@ #define Foundation_AbstractCache_INCLUDED -#include "Foundation/KeyValueArgs.h" -#include "Foundation/ValidArgs.h" -#include "Foundation/ScopedLock.h" -#include "Foundation/Mutex.h" -#include "Foundation/Exception.h" -#include "Foundation/BasicEvent.h" -#include "Foundation/EventArgs.h" -#include "Foundation/Delegate.h" -#include "Foundation/SharedPtr.h" +#include "Poco/KeyValueArgs.h" +#include "Poco/ValidArgs.h" +#include "Poco/Mutex.h" +#include "Poco/Exception.h" +#include "Poco/BasicEvent.h" +#include "Poco/EventArgs.h" +#include "Poco/Delegate.h" +#include "Poco/SharedPtr.h" #include #include -Foundation_BEGIN +namespace Poco { template @@ -235,7 +234,7 @@ protected: typename std::set::const_iterator it = delMe.begin(); typename std::set::const_iterator endIt = delMe.end(); - for (it; it != endIt; ++it) + for (; it != endIt; ++it) { doRemove(*it); } @@ -252,7 +251,7 @@ private: }; -Foundation_END +} // namespace Poco #endif diff --git a/Foundation/include/Foundation/AbstractDelegate.h b/Foundation/include/Poco/AbstractDelegate.h similarity index 91% rename from Foundation/include/Foundation/AbstractDelegate.h rename to Foundation/include/Poco/AbstractDelegate.h index c0b98e29c..5020eeb47 100644 --- a/Foundation/include/Foundation/AbstractDelegate.h +++ b/Foundation/include/Poco/AbstractDelegate.h @@ -1,7 +1,7 @@ // // AbstractDelegate.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/AbstractDelegate.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/AbstractDelegate.h#1 $ // // Library: Foundation // Package: Events @@ -40,10 +40,10 @@ #define Foundation_AbstractDelegate_INCLUDED -#include "Foundation/Foundation.h" +#include "Poco/Foundation.h" -Foundation_BEGIN +namespace Poco { template @@ -73,7 +73,7 @@ public: }; -Foundation_END +} // namespace Poco #endif diff --git a/Foundation/include/Foundation/AbstractEvent.h b/Foundation/include/Poco/AbstractEvent.h similarity index 87% rename from Foundation/include/Foundation/AbstractEvent.h rename to Foundation/include/Poco/AbstractEvent.h index a798862c1..b5c1fa722 100644 --- a/Foundation/include/Foundation/AbstractEvent.h +++ b/Foundation/include/Poco/AbstractEvent.h @@ -1,7 +1,7 @@ // // AbstractEvent.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/AbstractEvent.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/AbstractEvent.h#1 $ // // Library: Foundation // Package: Events @@ -40,16 +40,15 @@ #define Foundation_AbstractFoundation_INCLUDED -#include "Foundation/Foundation.h" -#include "Foundation/SingletonHolder.h" -#include "Foundation/SharedPtr.h" -#include "Foundation/ActiveResult.h" -#include "Foundation/ActiveMethod.h" -#include "Foundation/ScopedLock.h" -#include "Foundation/Mutex.h" +#include "Poco/Foundation.h" +#include "Poco/SingletonHolder.h" +#include "Poco/SharedPtr.h" +#include "Poco/ActiveResult.h" +#include "Poco/ActiveMethod.h" +#include "Poco/Mutex.h" -Foundation_BEGIN +namespace Poco { template @@ -71,7 +70,7 @@ class AbstractEvent /// class MyData /// { /// public: - /// Foundation::BasicEvent AgeChanged; + /// Poco::BasicEvent AgeChanged; /// /// MyData(); /// ... @@ -136,15 +135,15 @@ class AbstractEvent { public: AbstractEvent(): - _enabled(true), - _executeAsync(this, &AbstractEvent::executeAsyncImpl) + _executeAsync(this, &AbstractEvent::executeAsyncImpl), + _enabled(true) { } AbstractEvent(const TStrategy& strat): - _enabled(true), + _executeAsync(this, &AbstractEvent::executeAsyncImpl), _strategy(strat), - _executeAsync(this, &AbstractEvent::executeAsyncImpl) + _enabled(true) { } @@ -181,7 +180,7 @@ public: /// the next notify. If one of the delegates throws an exception, the notify /// method is immediately aborted and the exception is reported to the caller. { - Foundation::SharedPtr ptrStrat; + SharedPtr ptrStrat; bool enabled = false; { @@ -202,7 +201,7 @@ public: } } - Foundation::ActiveResult notifyAsync(const void* pSender, const TArgs& args) + ActiveResult notifyAsync(const void* pSender, const TArgs& args) /// Sends a notification to all registered delegates. The order is /// determined by the TStrategy. This method is not blocking and will /// immediately return. The delegates are invoked in a seperate thread. @@ -223,13 +222,13 @@ public: // make a copy of the strategy here to guarantee that // between notifyAsync and the execution of the method no changes can occur - params.ptrStrat = Foundation::SharedPtr(new TStrategy(_strategy)); + params.ptrStrat = SharedPtr(new TStrategy(_strategy)); params.pSender = pSender; params.args = args; params.enabled = _enabled; } - Foundation::ActiveResult result = _executeAsync(params); + ActiveResult result = _executeAsync(params); return result; } @@ -264,12 +263,12 @@ public: protected: struct NotifyAsyncParams { - Foundation::SharedPtr ptrStrat; + SharedPtr ptrStrat; const void* pSender; TArgs args; bool enabled; }; - Foundation::ActiveMethod _executeAsync; + ActiveMethod _executeAsync; TArgs executeAsyncImpl(const NotifyAsyncParams& par) { @@ -287,7 +286,7 @@ protected: TStrategy _strategy; /// The strategy used to notify observers. bool _enabled; /// Stores if an event is enabled. Notfies on disabled events have no effect /// but it is possible to change the observers. - mutable Foundation::FastMutex _mutex; + mutable FastMutex _mutex; private: AbstractEvent(const AbstractEvent& other); @@ -295,7 +294,7 @@ private: }; -Foundation_END +} // namespace Poco #endif diff --git a/Foundation/include/Foundation/AbstractPriorityDelegate.h b/Foundation/include/Poco/AbstractPriorityDelegate.h similarity index 91% rename from Foundation/include/Foundation/AbstractPriorityDelegate.h rename to Foundation/include/Poco/AbstractPriorityDelegate.h index 13fcd91b4..c6d790838 100644 --- a/Foundation/include/Foundation/AbstractPriorityDelegate.h +++ b/Foundation/include/Poco/AbstractPriorityDelegate.h @@ -1,7 +1,7 @@ // // AbstractPriorityDelegate.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/AbstractPriorityDelegate.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/AbstractPriorityDelegate.h#1 $ // // Library: Foundation // Package: Events @@ -40,10 +40,10 @@ #define Foundation_AbstractPriorityDelegate_INCLUDED -#include "Foundation/Foundation.h" +#include "Poco/Foundation.h" -Foundation_BEGIN +namespace Poco { template @@ -73,7 +73,7 @@ public: }; -Foundation_END +} // namespace Poco #endif diff --git a/Foundation/include/Foundation/AbstractStrategy.h b/Foundation/include/Poco/AbstractStrategy.h similarity index 90% rename from Foundation/include/Foundation/AbstractStrategy.h rename to Foundation/include/Poco/AbstractStrategy.h index dc565bc6d..a49e18367 100644 --- a/Foundation/include/Foundation/AbstractStrategy.h +++ b/Foundation/include/Poco/AbstractStrategy.h @@ -1,7 +1,7 @@ // // AbstractStrategy.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/AbstractStrategy.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/AbstractStrategy.h#1 $ // // Library: Foundation // Package: Cache @@ -40,12 +40,12 @@ #define Foundation_AbstractStrategy_INCLUDED -#include "Foundation/KeyValueArgs.h" -#include "Foundation/ValidArgs.h" -#include "Foundation/EventArgs.h" +#include "Poco/KeyValueArgs.h" +#include "Poco/ValidArgs.h" +#include "Poco/EventArgs.h" -Foundation_BEGIN +namespace Poco { template @@ -85,7 +85,7 @@ public: }; -Foundation_END +} // namespace Poco #endif diff --git a/Foundation/include/Poco/ActiveDispatcher.h b/Foundation/include/Poco/ActiveDispatcher.h new file mode 100644 index 000000000..ae3d7fdb3 --- /dev/null +++ b/Foundation/include/Poco/ActiveDispatcher.h @@ -0,0 +1,137 @@ +// +// ActiveDispatcher.h +// +// $Id: //poco/1.2/Foundation/include/Poco/ActiveDispatcher.h#1 $ +// +// Library: Foundation +// Package: Threading +// Module: ActiveObjects +// +// Definition of the ActiveDispatcher class. +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef Foundation_ActiveDispatcher_INCLUDED +#define Foundation_ActiveDispatcher_INCLUDED + + +#include "Poco/Foundation.h" +#include "Poco/Runnable.h" +#include "Poco/Thread.h" +#include "Poco/ActiveStarter.h" +#include "Poco/NotificationQueue.h" + + +namespace Poco { + + +class Foundation_API ActiveDispatcher: protected Runnable + /// This class is used to implement an active object + /// with strictly serialized method execution. + /// + /// An active object, with is an ordinary object + /// containing ActiveMethod members, executes all + /// active methods in their own thread. + /// This behavior does not fit the "classic" + /// definition of an active object, which serializes + /// the execution of active methods (in other words, + /// only one active method can be running at any given + /// time). + /// + /// Using this class as a base class, the serializing + /// behavior for active objects can be implemented. + /// + /// The following example shows how this is done: + /// + /// class ActiveObject: public ActiveDispatcher + /// { + /// public: + /// ActiveObject(): + /// exampleActiveMethod(this, &ActiveObject::exampleActiveMethodImpl) + /// { + /// } + /// + /// ActiveMethod > exampleActiveMethod; + /// + /// protected: + /// std::string exampleActiveMethodImpl(const std::string& arg) + /// { + /// ... + /// } + /// }; + /// + /// The only things different from the example in + /// ActiveMethod is that the ActiveObject in this case + /// inherits from ActiveDispatcher, and that the ActiveMethod + /// template for exampleActiveMethod has an additional parameter, + /// specifying the specialized ActiveStarter for ActiveDispatcher. +{ +public: + ActiveDispatcher(); + /// Creates the ActiveDispatcher. + + ActiveDispatcher(Thread::Priority prio); + /// Creates the ActiveDispatcher and sets + /// the priority of its thread. + + virtual ~ActiveDispatcher(); + /// Destroys the ActiveDispatcher. + + void start(Runnable* pRunnable); + /// Adds the Runnable to the dispatch queue. + + void cancel(); + /// Cancels all queued methods. + +protected: + void run(); + void stop(); + +private: + Thread _thread; + NotificationQueue _queue; +}; + + +template <> +class ActiveStarter + /// A specialization of ActiveStarter + /// for ActiveDispatcher. +{ +public: + static void start(ActiveDispatcher* pOwner, Runnable* pRunnable) + { + pOwner->start(pRunnable); + } +}; + + +} // namespace Poco + + +#endif // Foundation_ActiveDispatcher_INCLUDED diff --git a/Foundation/include/Foundation/ActiveMethod.h b/Foundation/include/Poco/ActiveMethod.h similarity index 67% rename from Foundation/include/Foundation/ActiveMethod.h rename to Foundation/include/Poco/ActiveMethod.h index 7863b3cd1..2ac11e0a7 100644 --- a/Foundation/include/Foundation/ActiveMethod.h +++ b/Foundation/include/Poco/ActiveMethod.h @@ -1,7 +1,7 @@ // // ActiveMethod.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/ActiveMethod.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/ActiveMethod.h#1 $ // // Library: Foundation // Package: Threading @@ -40,75 +40,16 @@ #define Foundation_ActiveMethod_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_ActiveResult_INCLUDED -#include "Foundation/ActiveResult.h" -#endif -#ifndef Foundation_Runnable_INCLUDED -#include "Foundation/Runnable.h" -#endif -#ifndef Foundation_ThreadPool_INCLUDED -#include "Foundation/ThreadPool.h" -#endif -#ifndef Foundation_Exception_INCLUDED -#include "Foundation/Exception.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/ActiveResult.h" +#include "Poco/ActiveRunnable.h" +#include "Poco/ActiveStarter.h" -Foundation_BEGIN +namespace Poco { -template -class ActiveRunnable: public Runnable - /// This class is used by ActiveMethod. - /// See the ActiveMethod class for more information. -{ -public: - typedef ResultType (OwnerType::*Callback)(const ArgType&); - typedef ActiveResult ActiveResultType; - - ActiveRunnable(OwnerType* pOwner, Callback method, const ArgType& arg, const ActiveResultType& result): - _pOwner(pOwner), - _method(method), - _arg(arg), - _result(result) - { - poco_check_ptr (pOwner); - } - - void run() - { - try - { - _result.data() = (_pOwner->*_method)(_arg); - } - catch (Exception& e) - { - _result.error(e.message()); - } - catch (std::exception& e) - { - _result.error(e.what()); - } - catch (...) - { - _result.error("unknown exception"); - } - _result.notify(); - delete this; - } - -private: - OwnerType* _pOwner; - Callback _method; - ArgType _arg; - ActiveResultType _result; -}; - - -template +template > class ActiveMethod /// An active method is a method that, when called, executes /// in its own thread. ActiveMethod's take exactly one @@ -141,6 +82,15 @@ class ActiveMethod /// ... /// result.wait(); /// std::cout << result.data() << std::endl; + /// + /// The way an ActiveMethod is started can be changed by passing a StarterType + /// template argument with a corresponding class. The default ActiveStarter + /// starts the method in its own thread, obtained from a thread pool. + /// + /// For an alternative implementation of StarterType, see ActiveDispatcher. + /// + /// For methods that do not require an argument or a return value, the Void + /// class can be used. { public: typedef ResultType (OwnerType::*Callback)(const ArgType&); @@ -160,7 +110,7 @@ public: { ActiveResultType result(new ActiveResultHolder()); ActiveRunnableType* pRunnable = new ActiveRunnableType(_pOwner, _method, arg, result); - ThreadPool::defaultPool().start(*pRunnable); + StarterType::start(_pOwner, pRunnable); return result; } @@ -174,7 +124,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_ActiveMethod_INCLUDED diff --git a/Foundation/include/Foundation/ActiveResult.h b/Foundation/include/Poco/ActiveResult.h similarity index 81% rename from Foundation/include/Foundation/ActiveResult.h rename to Foundation/include/Poco/ActiveResult.h index 9a3c520b9..905dd967c 100644 --- a/Foundation/include/Foundation/ActiveResult.h +++ b/Foundation/include/Poco/ActiveResult.h @@ -1,7 +1,7 @@ // // ActiveResult.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/ActiveResult.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/ActiveResult.h#1 $ // // Library: Foundation // Package: Threading @@ -40,21 +40,14 @@ #define Foundation_ActiveResult_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Mutex_INCLUDED -#include "Foundation/Mutex.h" -#endif -#ifndef Foundation_Event_INCLUDED -#include "Foundation/Event.h" -#endif -#ifndef Foundation_RefCountedObject_INCLUDED -#include "Foundation/RefCountedObject.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/Mutex.h" +#include "Poco/Event.h" +#include "Poco/RefCountedObject.h" +#include "Poco/Exception.h" -Foundation_BEGIN +namespace Poco { template @@ -67,7 +60,7 @@ class ActiveResultHolder: public RefCountedObject { public: ActiveResultHolder(): - _failed(false), + _pExc(0), _event(false) /// Creates an ActiveResultHolder. { @@ -111,34 +104,51 @@ public: /// Returns true if the active method failed (and threw an exception). /// Information about the exception can be obtained by calling error(). { - return _failed; + return _pExc != 0; } - const std::string& error() const + std::string error() const /// If the active method threw an exception, a textual representation /// of the exception is returned. An empty string is returned if the /// active method completed successfully. { - return _error; + if (_pExc) + return _pExc->message(); + else + return std::string(); + } + + Exception* exception() const + /// If the active method threw an exception, a clone of the exception + /// object is returned, otherwise null. + { + return _pExc; + } + + void error(const Exception& exc) + /// Sets the exception. + { + delete _pExc; + _pExc = exc.clone(); } void error(const std::string& msg) - /// Sets the failed flag and the exception message. + /// Sets the exception. { - _error = msg; - _failed = true; + delete _pExc; + _pExc = new UnhandledException(msg); } protected: ~ActiveResultHolder() { + delete _pExc; } private: - ResultType _data; - std::string _error; - bool _failed; - Event _event; + ResultType _data; + Exception* _pExc; + Event _event; }; @@ -225,14 +235,21 @@ public: return _pHolder->failed(); } - const std::string& error() const + std::string error() const /// If the active method threw an exception, a textual representation /// of the exception is returned. An empty string is returned if the /// active method completed successfully. { return _pHolder->error(); } - + + Exception* exception() const + /// If the active method threw an exception, a clone of the exception + /// object is returned, otherwise null. + { + return _pHolder->exception(); + } + void notify() /// Notifies the invoking thread that the result became available. /// For internal use only. @@ -252,6 +269,12 @@ public: { _pHolder->error(msg); } + + void error(const Exception& exc) + /// Sets the failed flag and the exception message. + { + _pHolder->error(exc); + } private: ActiveResult(); @@ -260,7 +283,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_ActiveResult_INCLUDED diff --git a/Foundation/include/Poco/ActiveRunnable.h b/Foundation/include/Poco/ActiveRunnable.h new file mode 100644 index 000000000..a743e7aca --- /dev/null +++ b/Foundation/include/Poco/ActiveRunnable.h @@ -0,0 +1,103 @@ +// +// ActiveRunnable.h +// +// $Id: //poco/1.2/Foundation/include/Poco/ActiveRunnable.h#1 $ +// +// Library: Foundation +// Package: Threading +// Module: ActiveObjects +// +// Definition of the ActiveRunnable class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef Foundation_ActiveRunnable_INCLUDED +#define Foundation_ActiveRunnable_INCLUDED + + +#include "Poco/Foundation.h" +#include "Poco/ActiveResult.h" +#include "Poco/Runnable.h" +#include "Poco/Exception.h" + + +namespace Poco { + + +template +class ActiveRunnable: public Runnable + /// This class is used by ActiveMethod. + /// See the ActiveMethod class for more information. +{ +public: + typedef ResultType (OwnerType::*Callback)(const ArgType&); + typedef ActiveResult ActiveResultType; + + ActiveRunnable(OwnerType* pOwner, Callback method, const ArgType& arg, const ActiveResultType& result): + _pOwner(pOwner), + _method(method), + _arg(arg), + _result(result) + { + poco_check_ptr (pOwner); + } + + void run() + { + try + { + _result.data() = (_pOwner->*_method)(_arg); + } + catch (Exception& e) + { + _result.error(e); + } + catch (std::exception& e) + { + _result.error(e.what()); + } + catch (...) + { + _result.error("unknown exception"); + } + _result.notify(); + delete this; + } + +private: + OwnerType* _pOwner; + Callback _method; + ArgType _arg; + ActiveResultType _result; +}; + + +} // namespace Poco + + +#endif // Foundation_ActiveRunnable_INCLUDED diff --git a/Foundation/include/Poco/ActiveStarter.h b/Foundation/include/Poco/ActiveStarter.h new file mode 100644 index 000000000..19305f594 --- /dev/null +++ b/Foundation/include/Poco/ActiveStarter.h @@ -0,0 +1,71 @@ +// +// ActiveStarter.h +// +// $Id: //poco/1.2/Foundation/include/Poco/ActiveStarter.h#1 $ +// +// Library: Foundation +// Package: Threading +// Module: ActiveObjects +// +// Definition of the ActiveStarter class. +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef Foundation_ActiveStarter_INCLUDED +#define Foundation_ActiveStarter_INCLUDED + + +#include "Poco/Foundation.h" +#include "Poco/ThreadPool.h" + + +namespace Poco { + + +class Runnable; + + +template +class ActiveStarter + /// The default implementation of the StarterType + /// policy for ActiveMethod. It starts the method + /// in its own thread, obtained from the default + /// thread pool. +{ +public: + static void start(OwnerType* pOwner, Runnable* pRunnable) + { + ThreadPool::defaultPool().start(*pRunnable); + } +}; + + +} // namespace Poco + + +#endif // Foundation_ActiveStarter_INCLUDED diff --git a/Foundation/include/Foundation/Activity.h b/Foundation/include/Poco/Activity.h similarity index 87% rename from Foundation/include/Foundation/Activity.h rename to Foundation/include/Poco/Activity.h index 0ec6cb3e1..2a6439033 100644 --- a/Foundation/include/Foundation/Activity.h +++ b/Foundation/include/Poco/Activity.h @@ -1,7 +1,7 @@ // // Activity.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Activity.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Activity.h#1 $ // // Library: Foundation // Package: Threading @@ -40,24 +40,14 @@ #define Foundation_Activity_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_RunnableAdapter_INCLUDED -#include "Foundation/RunnableAdapter.h" -#endif -#ifndef Foundation_ThreadPool_INCLUDED -#include "Foundation/ThreadPool.h" -#endif -#ifndef Foundation_Event_INCLUDED -#include "Foundation/Event.h" -#endif -#ifndef Foundation_Mutex_INCLUDED -#include "Foundation/Mutex.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/RunnableAdapter.h" +#include "Poco/ThreadPool.h" +#include "Poco/Event.h" +#include "Poco/Mutex.h" -Foundation_BEGIN +namespace Poco { template @@ -222,7 +212,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_Activity_INCLUDED diff --git a/Foundation/include/Foundation/Any.h b/Foundation/include/Poco/Any.h similarity index 68% rename from Foundation/include/Foundation/Any.h rename to Foundation/include/Poco/Any.h index 052500d59..8cadf656c 100644 --- a/Foundation/include/Foundation/Any.h +++ b/Foundation/include/Poco/Any.h @@ -1,24 +1,36 @@ // // Any.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Any.h#1 $ +// $Id: //poco/1.2/Foundation/include/Poco/Any.h#1 $ // // Library: Foundation // Package: Core // Module: Any // // Copyright Kevlin Henney, 2000, 2001, 2002. All rights reserved. +// Extracted from Boost 1.33.1 lib and adapted for poco: Peter Schojer/AppliedInformatics 2006-02-02 // -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// what: variant type boost::any -// who: contributed by Kevlin Henney, -// with features contributed and bugs found by -// Ed Brey, Mark Rodgers, Peter Dimov, and James Curran -// when: July 2001 -// where: tested with BCC 5.5, MSVC 6.0, and g++ 2.95 -// modified: extracted from Boost 1.33.1 lib and adapted for poco: Peter Schojer/AppliedInformatics 2006-02-02 +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. // @@ -26,12 +38,12 @@ #define Foundation_Any_INCLUDED -#include "Foundation/Exception.h" +#include "Poco/Exception.h" #include #include -Foundation_BEGIN +namespace Poco { class Any @@ -39,7 +51,7 @@ class Any /// of the internally stored data. /// /// Code taken from the Boost 1.33.1 library. Original copyright by Kevlin Henney. Modified for Poco - /// by Applied Informatics. This file is under the BOOST license, see http://www.boost.org/LICENSE_1_0.txt + /// by Applied Informatics. { public: Any(): @@ -77,7 +89,7 @@ public: return *this; } - template + template Any& operator = (const ValueType& rhs) /// Assignment operator for all types != Any. /// @@ -123,7 +135,7 @@ private: virtual Placeholder* clone() const = 0; }; - template + template class Holder: public Placeholder { public: @@ -146,17 +158,17 @@ private: }; private: - template + template friend ValueType* AnyCast(Any*); - template + template friend ValueType* UnsafeAnyCast(Any*); Placeholder* _content; }; -template +template ValueType* AnyCast(Any* operand) /// AnyCast operator used to extract the ValueType from an Any*. Will return a pointer /// to the stored value. @@ -171,7 +183,7 @@ ValueType* AnyCast(Any* operand) } -template +template const ValueType* AnyCast(const Any* operand) /// AnyCast operator used to extract a const ValueType pointer from an const Any*. Will return a const pointer /// to the stored value. @@ -184,43 +196,41 @@ const ValueType* AnyCast(const Any* operand) } -template +template ValueType AnyCast(const Any& operand) /// AnyCast operator used to extract a copy of the ValueType from an const Any&. /// /// Example Usage: /// MyType tmp = AnyCast(anAny). - /// Will throw a Foundation::BadCastException if the cast fails. + /// Will throw a BadCastException if the cast fails. /// Dont use an AnyCast in combination with references, i.e. MyType& tmp = ... or const MyType& = ... /// Some compilers will accept this code although a copy is returned. Use the RefAnyCast in /// these cases. { ValueType* result = AnyCast(const_cast(&operand)); - if(!result) - throw BadCastException("Failed to convert between const Any types"); + if (!result) throw BadCastException("Failed to convert between const Any types"); return *result; } -template +template ValueType AnyCast(Any& operand) /// AnyCast operator used to extract a copy of the ValueType from an Any&. /// /// Example Usage: /// MyType tmp = AnyCast(anAny). - /// Will throw a Foundation::BadCastException if the cast fails. + /// Will throw a BadCastException if the cast fails. /// Dont use an AnyCast in combination with references, i.e. MyType& tmp = ... or const MyType& tmp = ... /// Some compilers will accept this code although a copy is returned. Use the RefAnyCast in /// these cases. { ValueType* result = AnyCast(&operand); - if(!result) - throw BadCastException("Failed to convert between Any types"); + if (!result) throw BadCastException("Failed to convert between Any types"); return *result; } -template +template const ValueType& RefAnyCast(const Any & operand) /// AnyCast operator used to return a const reference to the internal data. /// @@ -228,13 +238,12 @@ const ValueType& RefAnyCast(const Any & operand) /// const MyType& tmp = RefAnyCast(anAny); { ValueType* result = AnyCast(const_cast(&operand)); - if(!result) - throw BadCastException("RefAnyCast: Failed to convert between const Any types"); + if (!result) throw BadCastException("RefAnyCast: Failed to convert between const Any types"); return *result; } -template +template ValueType& RefAnyCast(Any& operand) /// AnyCast operator used to return a reference to the internal data. /// @@ -242,13 +251,12 @@ ValueType& RefAnyCast(Any& operand) /// MyType& tmp = RefAnyCast(anAny); { ValueType* result = AnyCast(&operand); - if(!result) - throw BadCastException("RefAnyCast: Failed to convert between Any types"); + if (!result) throw BadCastException("RefAnyCast: Failed to convert between Any types"); return *result; } -template +template ValueType* UnsafeAnyCast(Any* operand) /// The "unsafe" versions of AnyCast are not part of the /// public interface and may be removed at any time. They are @@ -260,7 +268,7 @@ ValueType* UnsafeAnyCast(Any* operand) } -template +template const ValueType* UnsafeAnyCast(const Any* operand) /// The "unsafe" versions of AnyCast are not part of the /// public interface and may be removed at any time. They are @@ -272,7 +280,7 @@ const ValueType* UnsafeAnyCast(const Any* operand) } -Foundation_END +} // namespace Poco #endif diff --git a/Foundation/include/Foundation/ArchiveStrategy.h b/Foundation/include/Poco/ArchiveStrategy.h similarity index 85% rename from Foundation/include/Foundation/ArchiveStrategy.h rename to Foundation/include/Poco/ArchiveStrategy.h index c32c8ae07..9c9702221 100644 --- a/Foundation/include/Foundation/ArchiveStrategy.h +++ b/Foundation/include/Poco/ArchiveStrategy.h @@ -1,7 +1,7 @@ // // ArchiveStrategy.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/ArchiveStrategy.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/ArchiveStrategy.h#1 $ // // Library: Foundation // Package: Logging @@ -40,21 +40,16 @@ #define Foundation_ArchiveStrategy_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_LogFile_INCLUDED -#include "Foundation/LogFile.h" -#endif -#ifndef Foundation_File_INCLUDED -#include "Foundation/File.h" -#endif -#ifndef Foundation_DateTimeFormatter_INCLUDED -#include "Foundation/DateTimeFormatter.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/LogFile.h" +#include "Poco/File.h" +#include "Poco/DateTimeFormatter.h" -Foundation_BEGIN +namespace Poco { + + +class ArchiveCompressor; class Foundation_API ArchiveStrategy @@ -85,6 +80,7 @@ private: ArchiveStrategy& operator = (const ArchiveStrategy&); bool _compress; + ArchiveCompressor* _pCompressor; }; @@ -127,7 +123,7 @@ public: }; -Foundation_END +} // namespace Poco #endif // Foundation_ArchiveStrategy_INCLUDED diff --git a/Foundation/include/Foundation/AsyncChannel.h b/Foundation/include/Poco/AsyncChannel.h similarity index 82% rename from Foundation/include/Foundation/AsyncChannel.h rename to Foundation/include/Poco/AsyncChannel.h index 43a84e212..240e092f2 100644 --- a/Foundation/include/Foundation/AsyncChannel.h +++ b/Foundation/include/Poco/AsyncChannel.h @@ -1,7 +1,7 @@ // // AsyncChannel.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/AsyncChannel.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/AsyncChannel.h#1 $ // // Library: Foundation // Package: Logging @@ -40,27 +40,15 @@ #define Foundation_AsyncChannel_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Channel_INCLUDED -#include "Foundation/Channel.h" -#endif -#ifndef Foundation_Thread_INCLUDED -#include "Foundation/Thread.h" -#endif -#ifndef Foundation_Mutex_INCLUDED -#include "Foundation/Mutex.h" -#endif -#ifndef Foundation_Runnable_INCLUDED -#include "Foundation/Runnable.h" -#endif -#ifndef Foundation_NotificationQueue_INCLUDED -#include "Foundation/NotificationQueue.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/Channel.h" +#include "Poco/Thread.h" +#include "Poco/Mutex.h" +#include "Poco/Runnable.h" +#include "Poco/NotificationQueue.h" -Foundation_BEGIN +namespace Poco { class Foundation_API AsyncChannel: public Channel, public Runnable @@ -116,7 +104,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_AsyncChannel_INCLUDED diff --git a/Foundation/include/Foundation/AutoPtr.h b/Foundation/include/Poco/AutoPtr.h similarity index 85% rename from Foundation/include/Foundation/AutoPtr.h rename to Foundation/include/Poco/AutoPtr.h index 3adebe35e..c5154be27 100644 --- a/Foundation/include/Foundation/AutoPtr.h +++ b/Foundation/include/Poco/AutoPtr.h @@ -1,7 +1,7 @@ // // AutoPtr.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/AutoPtr.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/AutoPtr.h#1 $ // // Library: Foundation // Package: Core @@ -40,19 +40,12 @@ #define Foundation_AutoPtr_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Exception_INCLUDED -#include "Foundation/Exception.h" -#endif -#ifndef STD_ALGORITHM_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/Exception.h" #include -#define STD_ALGORITHM_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { template @@ -71,7 +64,8 @@ class AutoPtr /// void release() /// that decrements the reference count by one, and, /// if the reference count reaches zero, deletes the - /// class. + /// object. + /// /// AutoPtr works in the following way: /// If an AutoPtr is assigned an ordinary pointer to /// an object (via the constructor or the assignment operator), @@ -86,6 +80,7 @@ class AutoPtr /// and the * operator. An attempt to dereference a null /// AutoPtr results in a NullPointerException being thrown. /// AutoPtr also implements all relational operators. + /// Note that AutoPtr allows casting of its encapsulated data types. { public: AutoPtr(): _ptr(0) @@ -155,6 +150,21 @@ public: return *this; } + template + AutoPtr < Other > cast() + /// Casts the AutoPtr via a dynamic cast to the given type. + /// Returns an AutoPtr containing NULL if the cast fails. + /// Example: (assume class Sub: public Super) + /// AutoPtr < Super > super(new Sub()); + /// AutoPtr < Sub > sub = super.cast(); + /// poco_assert (sub.get()); + { + Other* pOther = dynamic_cast (_ptr); + if (pOther) + pOther->duplicate(); + return AutoPtr < Other > (pOther); + } + C* operator -> () { if (_ptr) @@ -315,7 +325,7 @@ inline void swap(AutoPtr& p1, AutoPtr& p2) } -Foundation_END +} // namespace Poco #endif // Foundation_AutoPtr_INCLUDED diff --git a/Foundation/include/Foundation/AutoReleasePool.h b/Foundation/include/Poco/AutoReleasePool.h similarity index 89% rename from Foundation/include/Foundation/AutoReleasePool.h rename to Foundation/include/Poco/AutoReleasePool.h index d1bb97977..11670b75c 100644 --- a/Foundation/include/Foundation/AutoReleasePool.h +++ b/Foundation/include/Poco/AutoReleasePool.h @@ -1,7 +1,7 @@ // // AutoReleasePool.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/AutoReleasePool.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/AutoReleasePool.h#1 $ // // Library: Foundation // Package: Core @@ -40,16 +40,11 @@ #define Foundation_AutoReleasePool_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef STD_LIST_INCLUDED +#include "Poco/Foundation.h" #include -#define STD_LIST_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { template @@ -107,7 +102,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_AutoReleasePool_INCLUDED diff --git a/Foundation/include/Foundation/Base64Decoder.h b/Foundation/include/Poco/Base64Decoder.h similarity index 85% rename from Foundation/include/Foundation/Base64Decoder.h rename to Foundation/include/Poco/Base64Decoder.h index d050fac0d..dc4051d59 100644 --- a/Foundation/include/Foundation/Base64Decoder.h +++ b/Foundation/include/Poco/Base64Decoder.h @@ -1,7 +1,7 @@ // // Base64Decoder.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Base64Decoder.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Base64Decoder.h#1 $ // // Library: Foundation // Package: Streams @@ -40,19 +40,12 @@ #define Foundation_Base64Decoder_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_UnbufferedStreamBuf_INCLUDED -#include "Foundation/UnbufferedStreamBuf.h" -#endif -#ifndef STD_ISTREAM_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/UnbufferedStreamBuf.h" #include -#define STD_ISTREAM_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API Base64DecoderBuf: public UnbufferedStreamBuf @@ -103,7 +96,7 @@ public: }; -Foundation_END +} // namespace Poco #endif // Foundation_Base64Decoder_INCLUDED diff --git a/Foundation/include/Foundation/Base64Encoder.h b/Foundation/include/Poco/Base64Encoder.h similarity index 86% rename from Foundation/include/Foundation/Base64Encoder.h rename to Foundation/include/Poco/Base64Encoder.h index 724ef6e2a..69f5c0113 100644 --- a/Foundation/include/Foundation/Base64Encoder.h +++ b/Foundation/include/Poco/Base64Encoder.h @@ -1,7 +1,7 @@ // // Base64Encoder.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Base64Encoder.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Base64Encoder.h#1 $ // // Library: Foundation // Package: Streams @@ -40,19 +40,12 @@ #define Foundation_Base64Encoder_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_UnbufferedStreamBuf_INCLUDED -#include "Foundation/UnbufferedStreamBuf.h" -#endif -#ifndef STD_OSTREAM_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/UnbufferedStreamBuf.h" #include -#define STD_OSTREAM_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API Base64EncoderBuf: public UnbufferedStreamBuf @@ -113,7 +106,7 @@ public: }; -Foundation_END +} // namespace Poco #endif // Foundation_Base64Encoder_INCLUDED diff --git a/Foundation/include/Foundation/BasicEvent.h b/Foundation/include/Poco/BasicEvent.h similarity index 88% rename from Foundation/include/Foundation/BasicEvent.h rename to Foundation/include/Poco/BasicEvent.h index 3cb9f31f9..2773d559c 100644 --- a/Foundation/include/Foundation/BasicEvent.h +++ b/Foundation/include/Poco/BasicEvent.h @@ -1,7 +1,7 @@ // // BasicEvent.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/BasicEvent.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/BasicEvent.h#1 $ // // Library: Foundation // Package: Events @@ -40,13 +40,13 @@ #define Foundation_BasicEvent_INCLUDED -#include "Foundation/AbstractEvent.h" -#include "Foundation/DefaultStrategy.h" -#include "Foundation/AbstractDelegate.h" -#include "Foundation/CompareFunctions.h" +#include "Poco/AbstractEvent.h" +#include "Poco/DefaultStrategy.h" +#include "Poco/AbstractDelegate.h" +#include "Poco/CompareFunctions.h" -Foundation_BEGIN +namespace Poco { template @@ -82,7 +82,7 @@ private: }; -Foundation_END +} // namespace Poco #endif diff --git a/Foundation/include/Foundation/BinaryReader.h b/Foundation/include/Poco/BinaryReader.h similarity index 92% rename from Foundation/include/Foundation/BinaryReader.h rename to Foundation/include/Poco/BinaryReader.h index 3b67495b6..cff5aac82 100644 --- a/Foundation/include/Foundation/BinaryReader.h +++ b/Foundation/include/Poco/BinaryReader.h @@ -1,7 +1,7 @@ // // BinaryReader.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/BinaryReader.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/BinaryReader.h#1 $ // // Library: Foundation // Package: Streams @@ -40,16 +40,11 @@ #define Foundation_BinaryReader_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef STD_ISTREAM_INCLUDED +#include "Poco/Foundation.h" #include -#define STD_ISTREAM_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API BinaryReader @@ -186,7 +181,7 @@ inline BinaryReader::StreamByteOrder BinaryReader::byteOrder() const } -Foundation_END +} // namespace Poco #endif // Foundation_BinaryReader_INCLUDED diff --git a/Foundation/include/Foundation/BinaryWriter.h b/Foundation/include/Poco/BinaryWriter.h similarity index 93% rename from Foundation/include/Foundation/BinaryWriter.h rename to Foundation/include/Poco/BinaryWriter.h index f0b7422f7..da519e953 100644 --- a/Foundation/include/Foundation/BinaryWriter.h +++ b/Foundation/include/Poco/BinaryWriter.h @@ -1,7 +1,7 @@ // // BinaryWriter.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/BinaryWriter.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/BinaryWriter.h#1 $ // // Library: Foundation // Package: Streams @@ -40,16 +40,11 @@ #define Foundation_BinaryWriter_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef STD_OSTREAM_INCLUDED +#include "Poco/Foundation.h" #include -#define STD_OSTREAM_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API BinaryWriter @@ -198,7 +193,7 @@ inline BinaryWriter::StreamByteOrder BinaryWriter::byteOrder() const } -Foundation_END +} // namespace Poco #endif // Foundation_BinaryWriter_INCLUDED diff --git a/Foundation/include/Foundation/Buffer.h b/Foundation/include/Poco/Buffer.h similarity index 90% rename from Foundation/include/Foundation/Buffer.h rename to Foundation/include/Poco/Buffer.h index 7ce87fd8d..2d3857d46 100644 --- a/Foundation/include/Foundation/Buffer.h +++ b/Foundation/include/Poco/Buffer.h @@ -1,7 +1,7 @@ // // Buffer.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Buffer.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Buffer.h#1 $ // // Library: Foundation // Package: Core @@ -40,12 +40,10 @@ #define Foundation_Buffer_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif +#include "Poco/Foundation.h" -Foundation_BEGIN +namespace Poco { template @@ -125,7 +123,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_Buffer_INCLUDED diff --git a/Foundation/include/Foundation/BufferAllocator.h b/Foundation/include/Poco/BufferAllocator.h similarity index 86% rename from Foundation/include/Foundation/BufferAllocator.h rename to Foundation/include/Poco/BufferAllocator.h index 201e2b08c..fa6814516 100644 --- a/Foundation/include/Foundation/BufferAllocator.h +++ b/Foundation/include/Poco/BufferAllocator.h @@ -1,7 +1,7 @@ // // BufferAllocator.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/BufferAllocator.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/BufferAllocator.h#1 $ // // Library: Foundation // Package: Streams @@ -40,16 +40,11 @@ #define Foundation_BufferAllocator_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef STD_IOS_INCLUDED +#include "Poco/Foundation.h" #include -#define STD_IOS_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { template @@ -72,7 +67,7 @@ public: }; -Foundation_END +} // namespace Poco #endif // Foundation_BufferAllocator_INCLUDED diff --git a/Foundation/include/Foundation/BufferedBidirectionalStreamBuf.h b/Foundation/include/Poco/BufferedBidirectionalStreamBuf.h similarity index 87% rename from Foundation/include/Foundation/BufferedBidirectionalStreamBuf.h rename to Foundation/include/Poco/BufferedBidirectionalStreamBuf.h index fb47e11af..73208bdc7 100644 --- a/Foundation/include/Foundation/BufferedBidirectionalStreamBuf.h +++ b/Foundation/include/Poco/BufferedBidirectionalStreamBuf.h @@ -1,7 +1,7 @@ // // BufferedBidirectionalStreamBuf.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/BufferedBidirectionalStreamBuf.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/BufferedBidirectionalStreamBuf.h#1 $ // // Library: Foundation // Package: Streams @@ -40,30 +40,15 @@ #define Foundation_BufferedBidirectionalStreamBuf_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_BufferAllocator_INCLUDED -#include "Foundation/BufferAllocator.h" -#endif -#ifndef Foundation_StreamUtil_INCLUDED -#include "Foundation/StreamUtil.h" -#endif -#ifndef STD_STREAMBUF_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/BufferAllocator.h" +#include "Poco/StreamUtil.h" #include -#define STD_STREAMBUF_INCLUDED -#endif -#ifndef STD_IOSFWD_INCLUDED #include -#define STD_IOSFWD_INCLUDED -#endif -#ifndef STD_IOS_INCLUDED #include -#define STD_IOS_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { template > @@ -186,7 +171,7 @@ private: typedef BasicBufferedBidirectionalStreamBuf > BufferedBidirectionalStreamBuf; -Foundation_END +} // namespace Poco #endif // Foundation_BufferedBidirectionalStreamBuf_INCLUDED diff --git a/Foundation/include/Foundation/BufferedStreamBuf.h b/Foundation/include/Poco/BufferedStreamBuf.h similarity index 86% rename from Foundation/include/Foundation/BufferedStreamBuf.h rename to Foundation/include/Poco/BufferedStreamBuf.h index e4281b02b..f88210fcf 100644 --- a/Foundation/include/Foundation/BufferedStreamBuf.h +++ b/Foundation/include/Poco/BufferedStreamBuf.h @@ -1,7 +1,7 @@ // // BufferedStreamBuf.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/BufferedStreamBuf.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/BufferedStreamBuf.h#1 $ // // Library: Foundation // Package: Streams @@ -40,30 +40,15 @@ #define Foundation_BufferedStreamBuf_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_BufferAllocator_INCLUDED -#include "Foundation/BufferAllocator.h" -#endif -#ifndef Foundation_StreamUtil_INCLUDED -#include "Foundation/StreamUtil.h" -#endif -#ifndef STD_STREAMBUF_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/BufferAllocator.h" +#include "Poco/StreamUtil.h" #include -#define STD_STREAMBUF_INCLUDED -#endif -#ifndef STD_IOSFWD_INCLUDED #include -#define STD_IOSFWD_INCLUDED -#endif -#ifndef STD_IOS_INCLUDED #include -#define STD_IOS_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { template > @@ -183,7 +168,7 @@ private: typedef BasicBufferedStreamBuf > BufferedStreamBuf; -Foundation_END +} // namespace Poco #endif // Foundation_BufferedStreamBuf_INCLUDED diff --git a/Foundation/include/Foundation/Bugcheck.h b/Foundation/include/Poco/Bugcheck.h similarity index 79% rename from Foundation/include/Foundation/Bugcheck.h rename to Foundation/include/Poco/Bugcheck.h index 3cd85fd29..193c08eeb 100644 --- a/Foundation/include/Foundation/Bugcheck.h +++ b/Foundation/include/Poco/Bugcheck.h @@ -1,7 +1,7 @@ // // Bugcheck.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Bugcheck.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Bugcheck.h#1 $ // // Library: Foundation // Package: Core @@ -40,16 +40,11 @@ #define Foundation_Bugcheck_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef STD_STRING_INCLUDED +#include "Poco/Foundation.h" #include -#define STD_STRING_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API Bugcheck @@ -95,37 +90,37 @@ protected: // useful macros (these automatically supply line number and file name) // #if defined(_DEBUG) - #define poco_assert_dbg(cond) if (!(cond)) Foundation::Bugcheck::assertion(#cond, __FILE__, __LINE__); else (void) 0 + #define poco_assert_dbg(cond) if (!(cond)) Poco::Bugcheck::assertion(#cond, __FILE__, __LINE__); else (void) 0 #else #define poco_assert_dbg(cond) #endif #define poco_assert(cond) \ - if (!(cond)) Foundation::Bugcheck::assertion(#cond, __FILE__, __LINE__); else (void) 0 + if (!(cond)) Poco::Bugcheck::assertion(#cond, __FILE__, __LINE__); else (void) 0 #define poco_check_ptr(ptr) \ - if (!(ptr)) Foundation::Bugcheck::nullPointer(#ptr, __FILE__, __LINE__); else (void) 0 + if (!(ptr)) Poco::Bugcheck::nullPointer(#ptr, __FILE__, __LINE__); else (void) 0 #define poco_bugcheck() \ - Foundation::Bugcheck::bugcheck(__FILE__, __LINE__) + Poco::Bugcheck::bugcheck(__FILE__, __LINE__) #define poco_bugcheck_msg(msg) \ - Foundation::Bugcheck::bugcheck(msg, __FILE__, __LINE__) + Poco::Bugcheck::bugcheck(msg, __FILE__, __LINE__) #define poco_debugger() \ - Foundation::Bugcheck::debugger(__FILE__, __LINE__) + Poco::Bugcheck::debugger(__FILE__, __LINE__) #define poco_debugger_msg(msg) \ - Foundation::Bugcheck::debugger(msg, __FILE__, __LINE__) + Poco::Bugcheck::debugger(msg, __FILE__, __LINE__) -Foundation_END +} // namespace Poco #endif // Foundation_Bugcheck_INCLUDED diff --git a/Foundation/include/Foundation/ByteOrder.h b/Foundation/include/Poco/ByteOrder.h similarity index 93% rename from Foundation/include/Foundation/ByteOrder.h rename to Foundation/include/Poco/ByteOrder.h index fb1ba7229..c0610ca35 100644 --- a/Foundation/include/Foundation/ByteOrder.h +++ b/Foundation/include/Poco/ByteOrder.h @@ -1,7 +1,7 @@ // // ByteOrder.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/ByteOrder.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/ByteOrder.h#1 $ // // Library: Foundation // Package: Core @@ -38,15 +38,11 @@ #define Foundation_ByteOrder_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Types_INCLUDED -#include "Foundation/Types.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/Types.h" -Foundation_BEGIN +namespace Poco { class Foundation_API ByteOrder @@ -225,7 +221,7 @@ POCO_IMPLEMENT_BYTEORDER_LIT(toLittleEndian) POCO_IMPLEMENT_BYTEORDER_LIT(fromLittleEndian) -Foundation_END +} // namespace Poco #endif // Foundation_ByteOrder_INCLUDED diff --git a/Foundation/include/Foundation/Channel.h b/Foundation/include/Poco/Channel.h similarity index 84% rename from Foundation/include/Foundation/Channel.h rename to Foundation/include/Poco/Channel.h index b5d7661f2..1d91d73f7 100644 --- a/Foundation/include/Foundation/Channel.h +++ b/Foundation/include/Poco/Channel.h @@ -1,7 +1,7 @@ // // Channel.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Channel.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Channel.h#1 $ // // Library: Foundation // Package: Logging @@ -40,21 +40,13 @@ #define Foundation_Channel_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Configurable_INCLUDED -#include "Foundation/Configurable.h" -#endif -#ifndef Foundation_Mutex_INCLUDED -#include "Foundation/Mutex.h" -#endif -#ifndef Foundation_RefCountedObject_INCLUDED -#include "Foundation/RefCountedObject.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/Configurable.h" +#include "Poco/Mutex.h" +#include "Poco/RefCountedObject.h" -Foundation_BEGIN +namespace Poco { class Message; @@ -98,7 +90,7 @@ protected: }; -Foundation_END +} // namespace Poco #endif // Foundation_Channel_INCLUDED diff --git a/Foundation/include/Foundation/ClassLibrary.h b/Foundation/include/Poco/ClassLibrary.h similarity index 76% rename from Foundation/include/Foundation/ClassLibrary.h rename to Foundation/include/Poco/ClassLibrary.h index 036073aca..7ab7f278e 100644 --- a/Foundation/include/Foundation/ClassLibrary.h +++ b/Foundation/include/Poco/ClassLibrary.h @@ -1,7 +1,7 @@ // // ClassLibrary.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/ClassLibrary.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/ClassLibrary.h#1 $ // // Library: Foundation // Package: SharedLibrary @@ -40,16 +40,9 @@ #define Foundation_ClassLibrary_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Manifest_INCLUDED -#include "Foundation/Manifest.h" -#endif -#ifndef STD_TYPEINFO_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/Manifest.h" #include -#define STD_TYPEINFO_INCLUDED -#endif #if defined(_WIN32) @@ -64,7 +57,7 @@ // extern "C" { - bool POCO_LIBRARY_API pocoBuildManifest(Foundation::ManifestBase* pManifest); + bool POCO_LIBRARY_API pocoBuildManifest(Poco::ManifestBase* pManifest); void POCO_LIBRARY_API pocoInitializeLibrary(); void POCO_LIBRARY_API pocoUninitializeLibrary(); } @@ -82,15 +75,15 @@ extern "C" // POCO_END_MANIFEST // #define POCO_BEGIN_MANIFEST(base) \ - bool pocoBuildManifest(Foundation::ManifestBase* pManifest_) \ + bool pocoBuildManifest(Poco::ManifestBase* pManifest_) \ { \ typedef base _Base; \ - typedef Foundation::Manifest<_Base> _Manifest; \ + typedef Poco::Manifest<_Base> _Manifest; \ std::string requiredType(typeid(_Manifest).name()); \ std::string actualType(pManifest_->className()); \ if (requiredType == actualType) \ { \ - Foundation::Manifest<_Base>* pManifest = static_cast<_Manifest*>(pManifest_); + Poco::Manifest<_Base>* pManifest = static_cast<_Manifest*>(pManifest_); #define POCO_END_MANIFEST \ @@ -101,11 +94,11 @@ extern "C" #define POCO_EXPORT_CLASS(cls) \ - pManifest->insert(new Foundation::MetaObject(#cls)); + pManifest->insert(new Poco::MetaObject(#cls)); #define POCO_EXPORT_SINGLETON(cls) \ - pManifest->insert(new Foundation::MetaSingleton(#cls)); + pManifest->insert(new Poco::MetaSingleton(#cls)); #endif // Foundation_ClassLibrary_INCLUDED diff --git a/Foundation/include/Foundation/ClassLoader.h b/Foundation/include/Poco/ClassLoader.h similarity index 90% rename from Foundation/include/Foundation/ClassLoader.h rename to Foundation/include/Poco/ClassLoader.h index d9d1c84d6..d7bd564cf 100644 --- a/Foundation/include/Foundation/ClassLoader.h +++ b/Foundation/include/Poco/ClassLoader.h @@ -1,7 +1,7 @@ // // ClassLoader.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/ClassLoader.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/ClassLoader.h#1 $ // // Library: Foundation // Package: SharedLibrary @@ -40,31 +40,16 @@ #define Foundation_ClassLoader_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_MetaObject_INCLUDED -#include "Foundation/MetaObject.h" -#endif -#ifndef Foundation_Manifest_INCLUDED -#include "Foundation/Manifest.h" -#endif -#ifndef Foundation_SharedLibrary_INCLUDED -#include "Foundation/SharedLibrary.h" -#endif -#ifndef Foundation_Mutex_INCLUDED -#include "Foundation/Mutex.h" -#endif -#ifndef Foundation_Exception_INCLUDED -#include "Foundation/Exception.h" -#endif -#ifndef STD_MAP_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/MetaObject.h" +#include "Poco/Manifest.h" +#include "Poco/SharedLibrary.h" +#include "Poco/Mutex.h" +#include "Poco/Exception.h" #include -#define STD_MAP_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { template @@ -367,7 +352,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_ClassLoader_INCLUDED diff --git a/Foundation/include/Foundation/CompareFunctions.h b/Foundation/include/Poco/CompareFunctions.h similarity index 90% rename from Foundation/include/Foundation/CompareFunctions.h rename to Foundation/include/Poco/CompareFunctions.h index 374aa43cd..8da3cb5de 100644 --- a/Foundation/include/Foundation/CompareFunctions.h +++ b/Foundation/include/Poco/CompareFunctions.h @@ -1,7 +1,7 @@ // // CompareFunctions.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/CompareFunctions.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/CompareFunctions.h#1 $ // // Library: Foundation // Package: Events @@ -40,11 +40,11 @@ #define Foundation_CompareFunctions_INCLUDED -#include "Foundation/Foundation.h" +#include "Poco/Foundation.h" #include -Foundation_BEGIN +namespace Poco { template @@ -57,7 +57,7 @@ struct p_less: std::binary_function }; -Foundation_END +} // namespace Poco #endif diff --git a/Foundation/include/Poco/Config.h b/Foundation/include/Poco/Config.h new file mode 100644 index 000000000..cb361c7fe --- /dev/null +++ b/Foundation/include/Poco/Config.h @@ -0,0 +1,55 @@ +// +// Config.h +// +// $Id: //poco/1.2/Foundation/include/Poco/Config.h#1 $ +// +// Library: Foundation +// Package: Core +// Module: Foundation +// +// Feature configuration for the POCO libraries. +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef Foundation_Config_INCLUDED +#define Foundation_Config_INCLUDED + + +// Define to enable Windows Unicode (UTF-8) support. +#undef POCO_WIN32_UTF8 + + +// Define to disable FPEnvironment support +#undef POCO_NO_FPENVIRONMENT + + +// Define if std::wstring is not available +#undef POCO_NO_WSTRING + + +#endif // Foundation_Config_INCLUDED diff --git a/Foundation/include/Foundation/Configurable.h b/Foundation/include/Poco/Configurable.h similarity index 91% rename from Foundation/include/Foundation/Configurable.h rename to Foundation/include/Poco/Configurable.h index 7b28ca496..a3e74647e 100644 --- a/Foundation/include/Foundation/Configurable.h +++ b/Foundation/include/Poco/Configurable.h @@ -1,7 +1,7 @@ // // Configurable.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Configurable.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Configurable.h#1 $ // // Library: Foundation // Package: Logging @@ -40,12 +40,10 @@ #define Foundation_Configurable_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif +#include "Poco/Foundation.h" -Foundation_BEGIN +namespace Poco { class Foundation_API Configurable @@ -81,7 +79,7 @@ public: }; -Foundation_END +} // namespace Poco #endif // Foundation_Configurable_INCLUDED diff --git a/Foundation/include/Foundation/ConsoleChannel.h b/Foundation/include/Poco/ConsoleChannel.h similarity index 83% rename from Foundation/include/Foundation/ConsoleChannel.h rename to Foundation/include/Poco/ConsoleChannel.h index 6b600be87..fb436b752 100644 --- a/Foundation/include/Foundation/ConsoleChannel.h +++ b/Foundation/include/Poco/ConsoleChannel.h @@ -1,7 +1,7 @@ // // ConsoleChannel.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/ConsoleChannel.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/ConsoleChannel.h#1 $ // // Library: Foundation // Package: Logging @@ -40,22 +40,13 @@ #define Foundation_ConsoleChannel_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Channel_INCLUDED -#include "Foundation/Channel.h" -#endif -#ifndef Foundation_Mutex_INCLUDED -#include "Foundation/Mutex.h" -#endif -#ifndef STD_OSTREAM_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/Channel.h" +#include "Poco/Mutex.h" #include -#define STD_OSTREAM_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API ConsoleChannel: public Channel @@ -92,7 +83,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_ConsoleChannel_INCLUDED diff --git a/Foundation/include/Foundation/CountingStream.h b/Foundation/include/Poco/CountingStream.h similarity index 89% rename from Foundation/include/Foundation/CountingStream.h rename to Foundation/include/Poco/CountingStream.h index 481c07041..042db5d3d 100644 --- a/Foundation/include/Foundation/CountingStream.h +++ b/Foundation/include/Poco/CountingStream.h @@ -1,7 +1,7 @@ // // CountingStream.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/CountingStream.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/CountingStream.h#1 $ // // Library: Foundation // Package: Streams @@ -40,23 +40,13 @@ #define Foundation_CountingStream_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_UnbufferedStreamBuf_INCLUDED -#include "Foundation/UnbufferedStreamBuf.h" -#endif -#ifndef STD_ISTREAM_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/UnbufferedStreamBuf.h" #include -#define STD_ISTREAM_INCLUDED -#endif -#ifndef STD_OSTREAM_INCLUDED #include -#define STD_OSTREAM_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API CountingStreamBuf: public UnbufferedStreamBuf @@ -245,7 +235,7 @@ inline int CountingIOS::getCurrentLineNumber() const } -Foundation_END +} // namespace Poco #endif // Foundation_CountingStream_INCLUDED diff --git a/Foundation/include/Foundation/DateTime.h b/Foundation/include/Poco/DateTime.h similarity index 83% rename from Foundation/include/Foundation/DateTime.h rename to Foundation/include/Poco/DateTime.h index 262933993..3091b888b 100644 --- a/Foundation/include/Foundation/DateTime.h +++ b/Foundation/include/Poco/DateTime.h @@ -1,7 +1,7 @@ // // DateTime.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/DateTime.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/DateTime.h#1 $ // // Library: Foundation // Package: DateTime @@ -40,18 +40,12 @@ #define Foundation_DateTime_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Timestamp_INCLUDED -#include "Foundation/Timestamp.h" -#endif -#ifndef Foundation_Timespan_INCLUDED -#include "Foundation/Timespan.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/Timestamp.h" +#include "Poco/Timespan.h" -Foundation_BEGIN +namespace Poco { class Foundation_API DateTime @@ -65,10 +59,21 @@ class Foundation_API DateTime /// collected and described by Peter Baum at /// http://vsg.cape.com/~pbaum/date/date0.htm /// - /// Internally, this class stores a date/time in three - /// forms for performance reasons. Only use this - /// class for conversions between date/time representations. + /// Internally, this class stores a date/time in two + /// forms (UTC and broken down) for performance reasons. Only use + /// this class for conversions between date/time representations. /// Use the Timestamp class for everything else. + /// + /// Notes: + /// * Zero is a valid year (in accordance with ISO 8601 and astronomical year numbering) + /// * Year zero (0) is a leap year + /// * Negative years (years preceding 1 BC) are not supported + /// + /// For more information, please see: + /// * http://en.wikipedia.org/wiki/Gregorian_Calendar + /// * http://en.wikipedia.org/wiki/Julian_day + /// * http://en.wikipedia.org/wiki/UTC + /// * http://en.wikipedia.org/wiki/ISO_8601 { public: enum Months @@ -99,7 +104,7 @@ public: FRIDAY, SATURDAY }; - + DateTime(); /// Creates a DateTime for the current date and time. @@ -210,7 +215,7 @@ public: /// Returns the microsecond (0 to 999) double julianDay() const; - /// Returns the julian day for the date. + /// Returns the julian day for the date and time. Timestamp timestamp() const; /// Returns the date and time expressed as a Timestamp. @@ -240,29 +245,37 @@ public: static int daysOfMonth(int year, int month); /// Returns the number of days in the given month /// and year. Month is from 1 to 12. - + + static bool isValid(int year, int month, int day, int hour = 0, int minute = 0, int second = 0, int millisecond = 0, int microsecond = 0); + /// Checks if the given date and time is valid + /// (all arguments are within a proper range). + /// + /// Returns true if all arguments are valid, false otherwise. + protected: static double toJulianDay(Timestamp::UtcTimeVal utcTime); /// Computes the Julian day for an UTC time. - static double toJulianDay(int year, int month, int day, int hour, int minute, int second, int millisecond, int microsecond); + static double toJulianDay(int year, int month, int day, int hour = 0, int minute = 0, int second = 0, int millisecond = 0, int microsecond = 0); /// Computes the Julian day for a gregorian calendar date and time. /// See , section 2.3.1 for the algorithm. static Timestamp::UtcTimeVal toUtcTime(double julianDay); /// Computes the UTC time for a Julian day. - - void computeGregorian(); - /// Computes the Gregorian date for the stored Julian day. + + void computeGregorian(double julianDay); + /// Computes the Gregorian date for the given Julian day. /// See , section 3.3.1 for the algorithm. + void computeDaytime(); + /// Extracts the daytime (hours, minutes, seconds, etc.) from the stored utcTime. + private: void checkLimit(short& lower, short& higher, short limit); void normalize(); ///utility functions used to correct the overflow in computeGregorian Timestamp::UtcTimeVal _utcTime; - double _julianDay; short _year; short _month; short _day; @@ -360,12 +373,6 @@ inline int DateTime::microsecond() const } -inline double DateTime::julianDay() const -{ - return _julianDay; -} - - inline bool DateTime::operator == (const DateTime& dateTime) const { return _utcTime == dateTime._utcTime; @@ -414,7 +421,7 @@ inline void swap(DateTime& d1, DateTime& d2) } -Foundation_END +} // namespace Poco #endif // Foundation_DateTime_INCLUDED diff --git a/Foundation/include/Foundation/DateTimeFormat.h b/Foundation/include/Poco/DateTimeFormat.h similarity index 92% rename from Foundation/include/Foundation/DateTimeFormat.h rename to Foundation/include/Poco/DateTimeFormat.h index 661a119cb..4df5285d9 100644 --- a/Foundation/include/Foundation/DateTimeFormat.h +++ b/Foundation/include/Poco/DateTimeFormat.h @@ -1,7 +1,7 @@ // // DateTimeFormat.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/DateTimeFormat.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/DateTimeFormat.h#1 $ // // Library: Foundation // Package: DateTime @@ -40,12 +40,10 @@ #define Foundation_DateTimeFormat_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif +#include "Poco/Foundation.h" -Foundation_BEGIN +namespace Poco { class Foundation_API DateTimeFormat @@ -119,7 +117,7 @@ public: }; -Foundation_END +} // namespace Poco #endif // Foundation_DateTimeFormat_INCLUDED diff --git a/Foundation/include/Foundation/DateTimeFormatter.h b/Foundation/include/Poco/DateTimeFormatter.h similarity index 94% rename from Foundation/include/Foundation/DateTimeFormatter.h rename to Foundation/include/Poco/DateTimeFormatter.h index f0f499a3c..14125c986 100644 --- a/Foundation/include/Foundation/DateTimeFormatter.h +++ b/Foundation/include/Poco/DateTimeFormatter.h @@ -1,7 +1,7 @@ // // DateTimeFormatter.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/DateTimeFormatter.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/DateTimeFormatter.h#1 $ // // Library: Foundation // Package: DateTime @@ -40,12 +40,10 @@ #define Foundation_DateTimeFormatter_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif +#include "Poco/Foundation.h" -Foundation_BEGIN +namespace Poco { class DateTime; @@ -133,7 +131,7 @@ public: }; -Foundation_END +} // namespace Poco #endif // Foundation_DateTimeFormatter_INCLUDED diff --git a/Foundation/include/Foundation/DateTimeParser.h b/Foundation/include/Poco/DateTimeParser.h similarity index 93% rename from Foundation/include/Foundation/DateTimeParser.h rename to Foundation/include/Poco/DateTimeParser.h index 054b1bac0..141151466 100644 --- a/Foundation/include/Foundation/DateTimeParser.h +++ b/Foundation/include/Poco/DateTimeParser.h @@ -1,7 +1,7 @@ // // DateTimeParser.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/DateTimeParser.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/DateTimeParser.h#1 $ // // Library: Foundation // Package: DateTime @@ -40,15 +40,11 @@ #define Foundation_DateTimeParser_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_DateTime_INCLUDED -#include "Foundation/DateTime.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/DateTime.h" -Foundation_BEGIN +namespace Poco { class Foundation_API DateTimeParser @@ -117,7 +113,7 @@ protected: }; -Foundation_END +} // namespace Poco #endif // Foundation_DateTimeParser_INCLUDED diff --git a/Foundation/include/Foundation/Debugger.h b/Foundation/include/Poco/Debugger.h similarity index 92% rename from Foundation/include/Foundation/Debugger.h rename to Foundation/include/Poco/Debugger.h index c03c2d110..62d488409 100644 --- a/Foundation/include/Foundation/Debugger.h +++ b/Foundation/include/Poco/Debugger.h @@ -1,7 +1,7 @@ // // Debugger.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Debugger.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Debugger.h#1 $ // // Library: Foundation // Package: Core @@ -40,12 +40,10 @@ #define Foundation_Debugger_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif +#include "Poco/Foundation.h" -Foundation_BEGIN +namespace Poco { class Foundation_API Debugger @@ -91,7 +89,7 @@ public: }; -Foundation_END +} // namespace Poco #endif // Foundation_Debugger_INCLUDED diff --git a/Foundation/include/Foundation/DefaultStrategy.h b/Foundation/include/Poco/DefaultStrategy.h similarity index 92% rename from Foundation/include/Foundation/DefaultStrategy.h rename to Foundation/include/Poco/DefaultStrategy.h index 500895646..cd068063d 100644 --- a/Foundation/include/Foundation/DefaultStrategy.h +++ b/Foundation/include/Poco/DefaultStrategy.h @@ -1,7 +1,7 @@ // // DefaultStrategy.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/DefaultStrategy.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/DefaultStrategy.h#1 $ // // Library: Foundation // Package: Events @@ -40,13 +40,13 @@ #define Foundation_DefaultStrategy_INCLUDED -#include "Foundation/NotificationStrategy.h" +#include "Poco/NotificationStrategy.h" #include #include #include -Foundation_BEGIN +namespace Poco { template @@ -148,7 +148,7 @@ protected: }; -Foundation_END +} // namespace Poco #endif diff --git a/Foundation/include/Foundation/DeflatingStream.h b/Foundation/include/Poco/DeflatingStream.h similarity index 88% rename from Foundation/include/Foundation/DeflatingStream.h rename to Foundation/include/Poco/DeflatingStream.h index db8dc91a2..c3eebce88 100644 --- a/Foundation/include/Foundation/DeflatingStream.h +++ b/Foundation/include/Poco/DeflatingStream.h @@ -1,7 +1,7 @@ // // DeflatingStream.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/DeflatingStream.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/DeflatingStream.h#1 $ // // Library: Foundation // Package: Streams @@ -40,26 +40,14 @@ #define Foundation_DeflatingStream_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_BufferedStreamBuf_INCLUDED -#include "Foundation/BufferedStreamBuf.h" -#endif -#ifndef STD_ISTREAM_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/BufferedStreamBuf.h" #include -#define STD_ISTREAM_INCLUDED -#endif -#ifndef STD_OSTREAM_INCLUDED #include -#define STD_OSTREAM_INCLUDED -#endif -#ifndef ZLIB_H -#include "Foundation/zlib.h" -#endif +#include "Poco/zlib.h" -Foundation_BEGIN +namespace Poco { class Foundation_API DeflatingStreamBuf: public BufferedStreamBuf @@ -147,7 +135,7 @@ public: }; -Foundation_END +} // namespace Poco #endif // Foundation_DeflatingStream_INCLUDED diff --git a/Foundation/include/Foundation/Delegate.h b/Foundation/include/Poco/Delegate.h similarity index 90% rename from Foundation/include/Foundation/Delegate.h rename to Foundation/include/Poco/Delegate.h index 33d471056..aa63e7216 100644 --- a/Foundation/include/Foundation/Delegate.h +++ b/Foundation/include/Poco/Delegate.h @@ -1,7 +1,7 @@ // // Delegate.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Delegate.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Delegate.h#1 $ // // Library: Foundation // Package: Events @@ -40,12 +40,12 @@ #define Foundation_Delegate_INCLUDED -#include "Foundation/Foundation.h" -#include "Foundation/AbstractDelegate.h" -#include "Foundation/Expire.h" +#include "Poco/Foundation.h" +#include "Poco/AbstractDelegate.h" +#include "Poco/Expire.h" -Foundation_BEGIN +namespace Poco { template @@ -114,7 +114,7 @@ private: }; -Foundation_END +} // namespace Poco #endif diff --git a/Foundation/include/Foundation/DigestEngine.h b/Foundation/include/Poco/DigestEngine.h similarity index 90% rename from Foundation/include/Foundation/DigestEngine.h rename to Foundation/include/Poco/DigestEngine.h index 08dcde105..f2b3d9d67 100644 --- a/Foundation/include/Foundation/DigestEngine.h +++ b/Foundation/include/Poco/DigestEngine.h @@ -1,7 +1,7 @@ // // DigestEngine.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/DigestEngine.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/DigestEngine.h#1 $ // // Library: Foundation // Package: Crypt @@ -40,16 +40,11 @@ #define Foundation_DigestEngine_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef STD_VECTOR_INCLUDED +#include "Poco/Foundation.h" #include -#define STD_VECTOR_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API DigestEngine @@ -124,7 +119,7 @@ inline void DigestEngine::update(const std::string& data) } -Foundation_END +} // namespace Poco #endif // Foundation_DigestEngine_INCLUDED diff --git a/Foundation/include/Foundation/DigestStream.h b/Foundation/include/Poco/DigestStream.h similarity index 84% rename from Foundation/include/Foundation/DigestStream.h rename to Foundation/include/Poco/DigestStream.h index 18916c1eb..bc114ab54 100644 --- a/Foundation/include/Foundation/DigestStream.h +++ b/Foundation/include/Poco/DigestStream.h @@ -1,7 +1,7 @@ // // DigestStream.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/DigestStream.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/DigestStream.h#1 $ // // Library: Foundation // Package: Crypt @@ -40,26 +40,14 @@ #define Foundation_DigestStream_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_BufferedStreamBuf_INCLUDED -#include "Foundation/BufferedStreamBuf.h" -#endif -#ifndef Foundation_DigestEngine_INCLUDED -#include "Foundation/DigestEngine.h" -#endif -#ifndef STD_ISTREAM_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/BufferedStreamBuf.h" +#include "Poco/DigestEngine.h" #include -#define STD_ISTREAM_INCLUDED -#endif -#ifndef STD_OSTREAM_INCLUDED #include -#define STD_OSTREAM_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API DigestBuf: public BufferedStreamBuf @@ -128,7 +116,7 @@ public: }; -Foundation_END +} // namespace Poco #endif // Foundation_DigestStream_INCLUDED diff --git a/Foundation/include/Foundation/DirectoryIterator.h b/Foundation/include/Poco/DirectoryIterator.h similarity index 88% rename from Foundation/include/Foundation/DirectoryIterator.h rename to Foundation/include/Poco/DirectoryIterator.h index b87b176f3..2f8d3d82b 100644 --- a/Foundation/include/Foundation/DirectoryIterator.h +++ b/Foundation/include/Poco/DirectoryIterator.h @@ -1,7 +1,7 @@ // // DirectoryIterator.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/DirectoryIterator.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/DirectoryIterator.h#1 $ // // Library: Foundation // Package: Filesystem @@ -40,18 +40,12 @@ #define Foundation_DirectoryIterator_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_File_INCLUDED -#include "Foundation/File.h" -#endif -#ifndef Foundation_Path_INCLUDED -#include "Foundation/Path.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/File.h" +#include "Poco/Path.h" -Foundation_BEGIN +namespace Poco { class DirectoryIteratorImpl; @@ -158,7 +152,7 @@ inline bool DirectoryIterator::operator != (const DirectoryIterator& iterator) c } -Foundation_END +} // namespace Poco #endif // Foundation_DirectoryIterator_INCLUDED diff --git a/Foundation/include/Foundation/DirectoryIterator_UNIX.h b/Foundation/include/Poco/DirectoryIterator_UNIX.h similarity index 86% rename from Foundation/include/Foundation/DirectoryIterator_UNIX.h rename to Foundation/include/Poco/DirectoryIterator_UNIX.h index c9cafafd7..656877ee7 100644 --- a/Foundation/include/Foundation/DirectoryIterator_UNIX.h +++ b/Foundation/include/Poco/DirectoryIterator_UNIX.h @@ -1,7 +1,7 @@ // // DirectoryIterator_UNIX.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/DirectoryIterator_UNIX.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/DirectoryIterator_UNIX.h#1 $ // // Library: Foundation // Package: Filesystem @@ -40,16 +40,11 @@ #define Foundation_DirectoryIterator_UNIX_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef STD_DIRENT_INCLUDED +#include "Poco/Foundation.h" #include -#define STD_DIRENT_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API DirectoryIteratorImpl @@ -93,7 +88,7 @@ inline void DirectoryIteratorImpl::release() } -Foundation_END +} // namespace Poco #endif // Foundation_DirectoryIterator_UNIX_INCLUDED diff --git a/Foundation/include/Foundation/DirectoryIterator_VMS.h b/Foundation/include/Poco/DirectoryIterator_VMS.h similarity index 87% rename from Foundation/include/Foundation/DirectoryIterator_VMS.h rename to Foundation/include/Poco/DirectoryIterator_VMS.h index 1481babf1..553108d4f 100644 --- a/Foundation/include/Foundation/DirectoryIterator_VMS.h +++ b/Foundation/include/Poco/DirectoryIterator_VMS.h @@ -1,7 +1,7 @@ // // DirectoryIterator_VMS.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/DirectoryIterator_VMS.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/DirectoryIterator_VMS.h#1 $ // // Library: Foundation // Package: Filesystem @@ -40,16 +40,11 @@ #define Foundation_DirectoryIterator_VMS_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef SYS_RMS_INCLUDED +#include "Poco/Foundation.h" #include -#define SYS_RMS_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API DirectoryIteratorImpl @@ -96,7 +91,7 @@ inline void DirectoryIteratorImpl::release() } -Foundation_END +} // namespace Poco #endif // Foundation_DirectoryIterator_VMS_INCLUDED diff --git a/Foundation/include/Foundation/DirectoryIterator_WIN32.h b/Foundation/include/Poco/DirectoryIterator_WIN32.h similarity index 86% rename from Foundation/include/Foundation/DirectoryIterator_WIN32.h rename to Foundation/include/Poco/DirectoryIterator_WIN32.h index 55cfde19d..9cfd70308 100644 --- a/Foundation/include/Foundation/DirectoryIterator_WIN32.h +++ b/Foundation/include/Poco/DirectoryIterator_WIN32.h @@ -1,7 +1,7 @@ // // DirectoryIterator_WIN32.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/DirectoryIterator_WIN32.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/DirectoryIterator_WIN32.h#1 $ // // Library: Foundation // Package: Filesystem @@ -40,16 +40,11 @@ #define Foundation_DirectoryIterator_WIN32_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef STD_WINDOWS_INCLUDED +#include "Poco/Foundation.h" #include -#define STD_WINDOWS_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API DirectoryIteratorImpl @@ -94,7 +89,7 @@ inline void DirectoryIteratorImpl::release() } -Foundation_END +} // namespace Poco #endif // Foundation_DirectoryIterator_WIN32_INCLUDED diff --git a/Foundation/include/Foundation/DirectoryIterator_WIN32U.h b/Foundation/include/Poco/DirectoryIterator_WIN32U.h similarity index 86% rename from Foundation/include/Foundation/DirectoryIterator_WIN32U.h rename to Foundation/include/Poco/DirectoryIterator_WIN32U.h index 8d3589258..2fa57bd0e 100644 --- a/Foundation/include/Foundation/DirectoryIterator_WIN32U.h +++ b/Foundation/include/Poco/DirectoryIterator_WIN32U.h @@ -1,7 +1,7 @@ // // DirectoryIterator_WIN32U.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/DirectoryIterator_WIN32U.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/DirectoryIterator_WIN32U.h#1 $ // // Library: Foundation // Package: Filesystem @@ -40,16 +40,11 @@ #define Foundation_DirectoryIterator_WIN32U_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef STD_WINDOWS_INCLUDED +#include "Poco/Foundation.h" #include -#define STD_WINDOWS_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API DirectoryIteratorImpl @@ -94,7 +89,7 @@ inline void DirectoryIteratorImpl::release() } -Foundation_END +} // namespace Poco #endif // Foundation_DirectoryIterator_WIN32U_INCLUDED diff --git a/Foundation/include/Foundation/DynamicFactory.h b/Foundation/include/Poco/DynamicFactory.h similarity index 86% rename from Foundation/include/Foundation/DynamicFactory.h rename to Foundation/include/Poco/DynamicFactory.h index e176640c3..016a88533 100644 --- a/Foundation/include/Foundation/DynamicFactory.h +++ b/Foundation/include/Poco/DynamicFactory.h @@ -1,7 +1,7 @@ // // DynamicFactory.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/DynamicFactory.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/DynamicFactory.h#1 $ // // Library: Foundation // Package: Core @@ -40,29 +40,15 @@ #define Foundation_DynamicFactory_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Instantiator_INCLUDED -#include "Foundation/Instantiator.h" -#endif -#ifndef Foundation_Exception_INCLUDED -#include "Foundation/Exception.h" -#endif -#ifndef Foundation_Mutex_INCLUDED -#include "Foundation/Mutex.h" -#endif -#ifndef STD_MAP_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/Instantiator.h" +#include "Poco/Exception.h" +#include "Poco/Mutex.h" #include -#define STD_MAP_INCLUDED -#endif -#ifndef STD_MEMORY_INCLUDED #include -#define STD_MEMORY_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { template @@ -166,7 +152,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_DynamicFactory_INCLUDED diff --git a/Foundation/include/Foundation/Environment.h b/Foundation/include/Poco/Environment.h similarity index 90% rename from Foundation/include/Foundation/Environment.h rename to Foundation/include/Poco/Environment.h index df69a7eaa..05b47d9ad 100644 --- a/Foundation/include/Foundation/Environment.h +++ b/Foundation/include/Poco/Environment.h @@ -1,7 +1,7 @@ // // Environment.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Environment.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Environment.h#1 $ // // Library: Foundation // Package: Core @@ -40,12 +40,10 @@ #define Foundation_Environment_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif +#include "Poco/Foundation.h" -Foundation_BEGIN +namespace Poco { class Foundation_API Environment @@ -80,7 +78,7 @@ public: }; -Foundation_END +} // namespace Poco #endif // Foundation_Environment_INCLUDED diff --git a/Foundation/include/Foundation/Environment_UNIX.h b/Foundation/include/Poco/Environment_UNIX.h similarity index 85% rename from Foundation/include/Foundation/Environment_UNIX.h rename to Foundation/include/Poco/Environment_UNIX.h index 397ff0429..3f47cab78 100644 --- a/Foundation/include/Foundation/Environment_UNIX.h +++ b/Foundation/include/Poco/Environment_UNIX.h @@ -1,7 +1,7 @@ // // Environment_UNIX.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Environment_UNIX.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Environment_UNIX.h#1 $ // // Library: Foundation // Package: Core @@ -40,19 +40,12 @@ #define Foundation_Environment_UNIX_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Mutex_INCLUDED -#include "Foundation/Mutex.h" -#endif -#ifndef STD_MAP_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/Mutex.h" #include -#define STD_MAP_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API EnvironmentImpl @@ -74,7 +67,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_Environment_UNIX_INCLUDED diff --git a/Foundation/include/Foundation/Environment_VMS.h b/Foundation/include/Poco/Environment_VMS.h similarity index 87% rename from Foundation/include/Foundation/Environment_VMS.h rename to Foundation/include/Poco/Environment_VMS.h index 7e2246b75..5bb20c484 100644 --- a/Foundation/include/Foundation/Environment_VMS.h +++ b/Foundation/include/Poco/Environment_VMS.h @@ -1,7 +1,7 @@ // // Environment_VMS.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Environment_VMS.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Environment_VMS.h#1 $ // // Library: Foundation // Package: Core @@ -40,15 +40,11 @@ #define Foundation_Environment_VMS_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Mutex_INCLUDED -#include "Foundation/Mutex.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/Mutex.h" -Foundation_BEGIN +namespace Poco { class Foundation_API EnvironmentImpl @@ -72,7 +68,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_Environment_VMS_INCLUDED diff --git a/Foundation/include/Foundation/Environment_WIN32.h b/Foundation/include/Poco/Environment_WIN32.h similarity index 89% rename from Foundation/include/Foundation/Environment_WIN32.h rename to Foundation/include/Poco/Environment_WIN32.h index a805431cf..3677f21bb 100644 --- a/Foundation/include/Foundation/Environment_WIN32.h +++ b/Foundation/include/Poco/Environment_WIN32.h @@ -1,7 +1,7 @@ // // Environment_WIN32.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Environment_WIN32.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Environment_WIN32.h#1 $ // // Library: Foundation // Package: Core @@ -40,12 +40,10 @@ #define Foundation_Environment_WIN32_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif +#include "Poco/Foundation.h" -Foundation_BEGIN +namespace Poco { class Foundation_API EnvironmentImpl @@ -61,7 +59,7 @@ public: }; -Foundation_END +} // namespace Poco #endif // Foundation_Environment_WIN32_INCLUDED diff --git a/Foundation/include/Foundation/Environment_WIN32U.h b/Foundation/include/Poco/Environment_WIN32U.h similarity index 89% rename from Foundation/include/Foundation/Environment_WIN32U.h rename to Foundation/include/Poco/Environment_WIN32U.h index e8b8b0727..ea7c98240 100644 --- a/Foundation/include/Foundation/Environment_WIN32U.h +++ b/Foundation/include/Poco/Environment_WIN32U.h @@ -1,7 +1,7 @@ // // Environment_WIN32U.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Environment_WIN32U.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Environment_WIN32U.h#1 $ // // Library: Foundation // Package: Core @@ -40,12 +40,10 @@ #define Foundation_Environment_WIN32U_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif +#include "Poco/Foundation.h" -Foundation_BEGIN +namespace Poco { class Foundation_API EnvironmentImpl @@ -61,7 +59,7 @@ public: }; -Foundation_END +} // namespace Poco #endif // Foundation_Environment_WIN32U_INCLUDED diff --git a/Foundation/include/Foundation/ErrorHandler.h b/Foundation/include/Poco/ErrorHandler.h similarity index 87% rename from Foundation/include/Foundation/ErrorHandler.h rename to Foundation/include/Poco/ErrorHandler.h index ec387554f..4cd749510 100644 --- a/Foundation/include/Foundation/ErrorHandler.h +++ b/Foundation/include/Poco/ErrorHandler.h @@ -1,7 +1,7 @@ // // ErrorHandler.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/ErrorHandler.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/ErrorHandler.h#1 $ // // Library: Foundation // Package: Threading @@ -40,18 +40,12 @@ #define Foundation_ErrorHandler_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Exception_INCLUDED -#include "Foundation/Exception.h" -#endif -#ifndef Foundation_Mutex_INCLUDED -#include "Foundation/Mutex.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/Exception.h" +#include "Poco/Mutex.h" -Foundation_BEGIN +namespace Poco { class Foundation_API ErrorHandler @@ -78,7 +72,7 @@ public: /// Destroys the ErrorHandler. virtual void exception(const Exception& exc); - /// Called when a Foundation::Exception (or a subclass) + /// Called when a Poco::Exception (or a subclass) /// caused the thread to terminate. /// /// This method should not throw any exception - it would @@ -97,7 +91,7 @@ public: virtual void exception(); /// Called when an exception that is neither a - /// Foundation::Exception nor a std::exception caused + /// Poco::Exception nor a std::exception caused /// the thread to terminate. /// /// This method should not throw any exception - it would @@ -142,7 +136,7 @@ inline ErrorHandler* ErrorHandler::get() } -Foundation_END +} // namespace Poco #endif // Foundation_ErrorHandler_INCLUDED diff --git a/Foundation/include/Foundation/Event.h b/Foundation/include/Poco/Event.h similarity index 87% rename from Foundation/include/Foundation/Event.h rename to Foundation/include/Poco/Event.h index 3510d7550..77786d222 100644 --- a/Foundation/include/Foundation/Event.h +++ b/Foundation/include/Poco/Event.h @@ -1,7 +1,7 @@ // // Event.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Event.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Event.h#1 $ // // Library: Foundation // Package: Threading @@ -40,22 +40,18 @@ #define Foundation_Event_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Exception_INCLUDED -#include "Foundation/Exception.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/Exception.h" #if defined(POCO_OS_FAMILY_WINDOWS) -#include "Foundation/Event_WIN32.h" +#include "Poco/Event_WIN32.h" #else -#include "Foundation/Event_POSIX.h" +#include "Poco/Event_POSIX.h" #endif -Foundation_BEGIN +namespace Poco { class Foundation_API Event: private EventImpl @@ -141,7 +137,7 @@ inline void Event::reset() } -Foundation_END +} // namespace Poco #endif // Foundation_Event_INCLUDED diff --git a/Foundation/include/Foundation/EventArgs.h b/Foundation/include/Poco/EventArgs.h similarity index 90% rename from Foundation/include/Foundation/EventArgs.h rename to Foundation/include/Poco/EventArgs.h index 9465c1dad..9acc68b5c 100644 --- a/Foundation/include/Foundation/EventArgs.h +++ b/Foundation/include/Poco/EventArgs.h @@ -1,7 +1,7 @@ // // EventArgs.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/EventArgs.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/EventArgs.h#1 $ // // Library: Foundation // Package: Events @@ -40,10 +40,10 @@ #define Foundation_EventArgs_INCLUDED -#include "Foundation/Foundation.h" +#include "Poco/Foundation.h" -Foundation_BEGIN +namespace Poco { class Foundation_API EventArgs @@ -60,7 +60,7 @@ public: }; -Foundation_END +} // namespace Poco #endif diff --git a/Foundation/include/Foundation/EventLogChannel.h b/Foundation/include/Poco/EventLogChannel.h similarity index 89% rename from Foundation/include/Foundation/EventLogChannel.h rename to Foundation/include/Poco/EventLogChannel.h index 56f82d8db..d275b3d2e 100644 --- a/Foundation/include/Foundation/EventLogChannel.h +++ b/Foundation/include/Poco/EventLogChannel.h @@ -1,7 +1,7 @@ // // EventLogChannel.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/EventLogChannel.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/EventLogChannel.h#1 $ // // Library: Foundation // Package: Logging @@ -40,19 +40,12 @@ #define Foundation_EventLogChannel_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Channel_INCLUDED -#include "Foundation/Channel.h" -#endif -#ifndef STD_WINDOWS_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/Channel.h" #include -#define STD_WINDOWS_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API EventLogChannel: public Channel @@ -112,7 +105,11 @@ protected: static int getType(const Message& msg); static int getCategory(const Message& msg); void setUpRegistry() const; +#if defined(POCO_WIN32_UTF8) + static std::wstring findLibrary(const wchar_t* name); +#else static std::string findLibrary(const char* name); +#endif private: std::string _name; @@ -122,7 +119,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_EventLogChannel_INCLUDED diff --git a/Foundation/include/Foundation/Event_POSIX.h b/Foundation/include/Poco/Event_POSIX.h similarity index 83% rename from Foundation/include/Foundation/Event_POSIX.h rename to Foundation/include/Poco/Event_POSIX.h index c05f934b7..875b37aa3 100644 --- a/Foundation/include/Foundation/Event_POSIX.h +++ b/Foundation/include/Poco/Event_POSIX.h @@ -1,7 +1,7 @@ // // Event_POSIX.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Event_POSIX.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Event_POSIX.h#1 $ // // Library: Foundation // Package: Threading @@ -40,23 +40,13 @@ #define Foundation_Event_POSIX_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Exception_INCLUDED -#include "Foundation/Exception.h" -#endif -#ifndef STD_PTHREAD_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/Exception.h" #include -#define STD_PTHREAD_INCLUDED -#endif -#ifndef STD_ERRNO_INCLUDED #include -#define STD_ERRNO_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API EventImpl @@ -103,7 +93,7 @@ inline void EventImpl::resetImpl() } -Foundation_END +} // namespace Poco #endif // Foundation_Event_POSIX_INCLUDED diff --git a/Foundation/include/Foundation/Event_WIN32.h b/Foundation/include/Poco/Event_WIN32.h similarity index 83% rename from Foundation/include/Foundation/Event_WIN32.h rename to Foundation/include/Poco/Event_WIN32.h index 62e671745..753782988 100644 --- a/Foundation/include/Foundation/Event_WIN32.h +++ b/Foundation/include/Poco/Event_WIN32.h @@ -1,7 +1,7 @@ // // Event_WIN32.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Event_WIN32.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Event_WIN32.h#1 $ // // Library: Foundation // Package: Threading @@ -40,19 +40,12 @@ #define Foundation_Event_WIN32_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Exception_INCLUDED -#include "Foundation/Exception.h" -#endif -#ifndef STD_WINDOWS_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/Exception.h" #include -#define STD_WINDOWS_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API EventImpl @@ -91,7 +84,7 @@ inline void EventImpl::resetImpl() } -Foundation_END +} // namespace Poco #endif // Foundation_Event_WIN32_INCLUDED diff --git a/Foundation/include/Foundation/Exception.h b/Foundation/include/Poco/Exception.h similarity index 86% rename from Foundation/include/Foundation/Exception.h rename to Foundation/include/Poco/Exception.h index b91636ace..05718e3b0 100644 --- a/Foundation/include/Foundation/Exception.h +++ b/Foundation/include/Poco/Exception.h @@ -1,7 +1,7 @@ // // Exception.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Exception.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Exception.h#1 $ // // Library: Foundation // Package: Core @@ -40,16 +40,11 @@ #define Foundation_Exception_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef STD_EXCEPTION_INCLUDED +#include "Poco/Foundation.h" #include -#define STD_EXCEPTION_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API Exception: public std::exception @@ -98,6 +93,16 @@ public: virtual Exception* clone() const; /// Creates an exact copy of the exception. + /// + /// The copy can later be thrown again by + /// invoking rethrow() on it. + + virtual void rethrow() const; + /// (Re)Throws the exception. + /// + /// This is useful for temporarily storing a + /// copy of an exception (see clone()), then + /// throwing it again. protected: Exception(); @@ -109,6 +114,21 @@ private: }; +// +// inlines +// +inline const Exception* Exception::nested() const +{ + return _pNested; +} + + +inline const std::string& Exception::message() const +{ + return _msg; +} + + // // Macros for quickly declaring and implementing exception classes. // Unfortunately, we cannot use a template here because character @@ -122,13 +142,14 @@ private: CLS(); \ CLS(const std::string& msg); \ CLS(const std::string& msg, const std::string& arg); \ - CLS(const std::string& msg, const Foundation::Exception& exc); \ + CLS(const std::string& msg, const Poco::Exception& exc); \ CLS(const CLS& exc); \ ~CLS() throw(); \ CLS& operator = (const CLS& exc); \ const char* name() const throw(); \ const char* className() const throw(); \ - Foundation::Exception* clone() const; \ + Poco::Exception* clone() const; \ + void rethrow() const; \ }; @@ -142,7 +163,7 @@ private: CLS::CLS(const std::string& msg, const std::string& arg): BASE(msg, arg) \ { \ } \ - CLS::CLS(const std::string& msg, const Foundation::Exception& exc): BASE(msg, exc) \ + CLS::CLS(const std::string& msg, const Poco::Exception& exc): BASE(msg, exc) \ { \ } \ CLS::CLS(const CLS& exc): BASE(exc) \ @@ -164,9 +185,13 @@ private: { \ return typeid(*this).name(); \ } \ - Foundation::Exception* CLS::clone() const \ + Poco::Exception* CLS::clone() const \ { \ return new CLS(*this); \ + } \ + void CLS::rethrow() const \ + { \ + throw *this; \ } @@ -183,6 +208,7 @@ POCO_DECLARE_EXCEPTION(Foundation_API, RangeException, LogicException) POCO_DECLARE_EXCEPTION(Foundation_API, IllegalStateException, LogicException) POCO_DECLARE_EXCEPTION(Foundation_API, InvalidAccessException, LogicException) POCO_DECLARE_EXCEPTION(Foundation_API, SignalException, LogicException) +POCO_DECLARE_EXCEPTION(Foundation_API, UnhandledException, LogicException) POCO_DECLARE_EXCEPTION(Foundation_API, RuntimeException, Exception) POCO_DECLARE_EXCEPTION(Foundation_API, NotFoundException, RuntimeException) @@ -220,7 +246,7 @@ POCO_DECLARE_EXCEPTION(Foundation_API, ApplicationException, Exception) POCO_DECLARE_EXCEPTION(Foundation_API, BadCastException, RuntimeException) -Foundation_END +} // namespace Poco #endif // Foundation_Exception_INCLUDED diff --git a/Foundation/include/Foundation/Expire.h b/Foundation/include/Poco/Expire.h similarity index 82% rename from Foundation/include/Foundation/Expire.h rename to Foundation/include/Poco/Expire.h index f5e639f14..633eb5ce9 100644 --- a/Foundation/include/Foundation/Expire.h +++ b/Foundation/include/Poco/Expire.h @@ -1,7 +1,7 @@ // // Expire.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Expire.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Expire.h#1 $ // // Library: Foundation // Package: Events @@ -40,12 +40,12 @@ #define Foundation_Expire_INCLUDED -#include "Foundation/Foundation.h" -#include "Foundation/AbstractDelegate.h" -#include "Foundation/Timestamp.h" +#include "Poco/Foundation.h" +#include "Poco/AbstractDelegate.h" +#include "Poco/Timestamp.h" -Foundation_BEGIN +namespace Poco { template @@ -54,7 +54,7 @@ class Expire: public AbstractDelegate /// expiring of registrations to AbstractDelegates. { public: - Expire(const AbstractDelegate& p, Foundation::Timestamp::TimeDiff expireMillisecs): + Expire(const AbstractDelegate& p, Timestamp::TimeDiff expireMillisecs): _pDelegate(p.clone()), _expire(expireMillisecs*1000) { @@ -119,7 +119,7 @@ public: } protected: - Expire(AbstractDelegate* p, Foundation::Timestamp::TimeDiff expireMillisecs): + Expire(AbstractDelegate* p, Timestamp::TimeDiff expireMillisecs): _pDelegate(p), _expire(expireMillisecs*1000) { @@ -130,16 +130,16 @@ protected: return _creationTime.isElapsed(_expire); } - AbstractDelegate* _pDelegate; - Foundation::Timestamp::TimeDiff _expire; - Foundation::Timestamp _creationTime; + AbstractDelegate* _pDelegate; + Timestamp::TimeDiff _expire; + Timestamp _creationTime; private: Expire(); }; -Foundation_END +} // namespace Poco #endif diff --git a/Foundation/include/Foundation/ExpireCache.h b/Foundation/include/Poco/ExpireCache.h similarity index 90% rename from Foundation/include/Foundation/ExpireCache.h rename to Foundation/include/Poco/ExpireCache.h index e1946681b..ae99c8960 100644 --- a/Foundation/include/Foundation/ExpireCache.h +++ b/Foundation/include/Poco/ExpireCache.h @@ -1,7 +1,7 @@ // // ExpireCache.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/ExpireCache.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/ExpireCache.h#1 $ // // Library: Foundation // Package: Cache @@ -40,11 +40,11 @@ #define Foundation_ExpireCache_INCLUDED -#include "Foundation/AbstractCache.h" -#include "Foundation/ExpireStrategy.h" +#include "Poco/AbstractCache.h" +#include "Poco/ExpireStrategy.h" -Foundation_BEGIN +namespace Poco { template @@ -72,7 +72,7 @@ private: }; -Foundation_END +} // namespace Poco #endif diff --git a/Foundation/include/Foundation/ExpireLRUCache.h b/Foundation/include/Poco/ExpireLRUCache.h similarity index 85% rename from Foundation/include/Foundation/ExpireLRUCache.h rename to Foundation/include/Poco/ExpireLRUCache.h index 1c66a3164..09d550a1e 100644 --- a/Foundation/include/Foundation/ExpireLRUCache.h +++ b/Foundation/include/Poco/ExpireLRUCache.h @@ -1,7 +1,7 @@ // // ExpireLRUCache.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/ExpireLRUCache.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/ExpireLRUCache.h#1 $ // // Library: Foundation // Package: Cache @@ -40,13 +40,13 @@ #define Foundation_ExpireLRUCache_INCLUDED -#include "Foundation/AbstractCache.h" -#include "Foundation/StrategyCollection.h" -#include "Foundation/ExpireStrategy.h" -#include "Foundation/LRUStrategy.h" +#include "Poco/AbstractCache.h" +#include "Poco/StrategyCollection.h" +#include "Poco/ExpireStrategy.h" +#include "Poco/LRUStrategy.h" -Foundation_BEGIN +namespace Poco { template < @@ -59,7 +59,7 @@ class ExpireLRUCache: public AbstractCache >(StrategyCollection()) { this->_strategy.pushBack(new LRUStrategy(cacheSize)); @@ -76,7 +76,7 @@ private: }; -Foundation_END +} // namespace Poco #endif diff --git a/Foundation/include/Foundation/ExpireStrategy.h b/Foundation/include/Poco/ExpireStrategy.h similarity index 85% rename from Foundation/include/Foundation/ExpireStrategy.h rename to Foundation/include/Poco/ExpireStrategy.h index 2773706d3..84f93c5a0 100644 --- a/Foundation/include/Foundation/ExpireStrategy.h +++ b/Foundation/include/Poco/ExpireStrategy.h @@ -1,7 +1,7 @@ // // ExpireStrategy.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/ExpireStrategy.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/ExpireStrategy.h#1 $ // // Library: Foundation // Package: Cache @@ -40,17 +40,17 @@ #define Foundation_ExpireStrategy_INCLUDED -#include "Foundation/KeyValueArgs.h" -#include "Foundation/ValidArgs.h" -#include "Foundation/AbstractStrategy.h" -#include "Foundation/Bugcheck.h" -#include "Foundation/Timestamp.h" -#include "Foundation/EventArgs.h" +#include "Poco/KeyValueArgs.h" +#include "Poco/ValidArgs.h" +#include "Poco/AbstractStrategy.h" +#include "Poco/Bugcheck.h" +#include "Poco/Timestamp.h" +#include "Poco/EventArgs.h" #include #include -Foundation_BEGIN +namespace Poco { template < @@ -81,10 +81,14 @@ public: void onAdd(const void*, const KeyValueArgs & args) { - poco_assert_dbg(_keys.find(args.key()) == _keys.end()); Timestamp now; IndexIterator it = _keyIndex.insert(std::make_pair(now, args.key())); - _keys.insert(std::make_pair(args.key(), it)); + std::pair < Iterator, bool > stat = _keys.insert(std::make_pair(args.key(), it)); + if (!stat.second) + { + _keyIndex.erase(stat.first->second); + stat.first->second = it; + } } void onRemove(const void*, const TKey& key) @@ -134,13 +138,13 @@ public: } protected: - Foundation::Timestamp::TimeDiff _expireTime; + Timestamp::TimeDiff _expireTime; Keys _keys; /// For faster replacement of keys, the iterator points to the _keyIndex map TimeIndex _keyIndex; /// Maps time to key value }; -Foundation_END +} // namespace Poco #endif diff --git a/Foundation/include/Foundation/FIFOEvent.h b/Foundation/include/Poco/FIFOEvent.h similarity index 88% rename from Foundation/include/Foundation/FIFOEvent.h rename to Foundation/include/Poco/FIFOEvent.h index 64fb64da6..d78cab1f5 100644 --- a/Foundation/include/Foundation/FIFOEvent.h +++ b/Foundation/include/Poco/FIFOEvent.h @@ -1,7 +1,7 @@ // // FIFOEvent.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/FIFOEvent.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/FIFOEvent.h#1 $ // // Library: Foundation // Package: Events @@ -40,13 +40,13 @@ #define Foundation_FIFOEvent_INCLUDED -#include "Foundation/AbstractEvent.h" -#include "Foundation/FIFOStrategy.h" -#include "Foundation/AbstractDelegate.h" -#include "Foundation/CompareFunctions.h" +#include "Poco/AbstractEvent.h" +#include "Poco/FIFOStrategy.h" +#include "Poco/AbstractDelegate.h" +#include "Poco/CompareFunctions.h" -Foundation_BEGIN +namespace Poco { template @@ -84,7 +84,7 @@ private: }; -Foundation_END +} // namespace Poco #endif diff --git a/Foundation/include/Foundation/FIFOStrategy.h b/Foundation/include/Poco/FIFOStrategy.h similarity index 90% rename from Foundation/include/Foundation/FIFOStrategy.h rename to Foundation/include/Poco/FIFOStrategy.h index 1733fbcc8..642073049 100644 --- a/Foundation/include/Foundation/FIFOStrategy.h +++ b/Foundation/include/Poco/FIFOStrategy.h @@ -1,7 +1,7 @@ // // FIFOStrategy.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/FIFOStrategy.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/FIFOStrategy.h#1 $ // // Library: Foundation // Package: Events @@ -39,12 +39,12 @@ #define Foundation_FIFOStrategy_INCLUDED -#include "Foundation/NotificationStrategy.h" +#include "Poco/NotificationStrategy.h" #include #include -Foundation_BEGIN +namespace Poco { template @@ -78,7 +78,7 @@ public: Iterator it = _observers.begin(); Iterator itEnd = _observers.end(); - for (it; it != itEnd; ++it) + for (; it != itEnd; ++it) { if (!(*it)->notify(sender, arguments)) { @@ -139,8 +139,7 @@ public: void clear() { - Iterator it = _observers.begin(); - for (it; it != _observers.end(); ++it) + for (Iterator it = _observers.begin(); it != _observers.end(); ++it) { delete *it; } @@ -155,7 +154,7 @@ protected: }; -Foundation_END +} // namespace Poco #endif diff --git a/Foundation/include/Foundation/FPEnvironment.h b/Foundation/include/Poco/FPEnvironment.h similarity index 87% rename from Foundation/include/Foundation/FPEnvironment.h rename to Foundation/include/Poco/FPEnvironment.h index 0acbe8032..327409ebc 100644 --- a/Foundation/include/Foundation/FPEnvironment.h +++ b/Foundation/include/Poco/FPEnvironment.h @@ -1,7 +1,7 @@ // // FPEnvironment.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/FPEnvironment.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/FPEnvironment.h#1 $ // // Library: Foundation // Package: Core @@ -40,27 +40,25 @@ #define Foundation_FPEnvironment_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif +#include "Poco/Foundation.h" -#if defined(__osf__) || defined(__VMS) -#include "Foundation/FPEnvironment_DEC.h" +#if defined(POCO_NO_FPENVIRONMENT) +#include "Poco/FPEnvironment_DUMMY.h" +#elif defined(__osf__) || defined(__VMS) +#include "Poco/FPEnvironment_DEC.h" #elif defined(sun) || defined(__sun) -#include "Foundation/FPEnvironment_SUN.h" -#elif defined(__CYGWIN__) || (defined(__GNUC__) && __GNUC__ < 3) -#include "Foundation/FPEnvironment_DUMMY.h" +#include "Poco/FPEnvironment_SUN.h" #elif defined(POCO_OS_FAMILY_UNIX) -#include "Foundation/FPEnvironment_C99.h" +#include "Poco/FPEnvironment_C99.h" #elif defined(POCO_OS_FAMILY_WINDOWS) -#include "Foundation/FPEnvironment_WIN32.h" +#include "Poco/FPEnvironment_WIN32.h" #else -#include "Foundation/FPEnvironment_DUMMY.h" +#include "Poco/FPEnvironment_DUMMY.h" #endif -Foundation_BEGIN +namespace Poco { class Foundation_API FPEnvironment: private FPEnvironmentImpl @@ -223,7 +221,7 @@ inline long double FPEnvironment::copySign(long double target, long double sourc } -Foundation_END +} // namespace Poco #endif // Foundation_FPEnvironment_INCLUDED diff --git a/Foundation/include/Foundation/FPEnvironment_C99.h b/Foundation/include/Poco/FPEnvironment_C99.h similarity index 89% rename from Foundation/include/Foundation/FPEnvironment_C99.h rename to Foundation/include/Poco/FPEnvironment_C99.h index df5b5004c..fbdf74640 100644 --- a/Foundation/include/Foundation/FPEnvironment_C99.h +++ b/Foundation/include/Poco/FPEnvironment_C99.h @@ -1,7 +1,7 @@ // // FPEnvironment_C99.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/FPEnvironment_C99.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/FPEnvironment_C99.h#1 $ // // Library: Foundation // Package: Core @@ -40,20 +40,12 @@ #define Foundation_FPEnvironment_C99_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef STD_FENV_INCLUDED +#include "Poco/Foundation.h" #include -#define STD_FENV_INCLUDED -#endif -#ifndef STD_MATH_INCLUDED #include -#define STD_MATH_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class FPEnvironmentImpl @@ -149,7 +141,7 @@ inline double FPEnvironmentImpl::copySignImpl(double target, double source) } -Foundation_END +} // namespace Poco #endif // Foundation_FPEnvironment_C99_INCLUDED diff --git a/Foundation/include/Foundation/FPEnvironment_DEC.h b/Foundation/include/Poco/FPEnvironment_DEC.h similarity index 91% rename from Foundation/include/Foundation/FPEnvironment_DEC.h rename to Foundation/include/Poco/FPEnvironment_DEC.h index 858573019..3adf1b3b8 100644 --- a/Foundation/include/Foundation/FPEnvironment_DEC.h +++ b/Foundation/include/Poco/FPEnvironment_DEC.h @@ -1,7 +1,7 @@ // // FPEnvironment_DEC.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/FPEnvironment_DEC.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/FPEnvironment_DEC.h#1 $ // // Library: Foundation // Package: Core @@ -40,9 +40,7 @@ #define Foundation_FPEnvironment_DEC_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif +#include "Poco/Foundation.h" #if defined(__VMS) #include #else @@ -50,7 +48,7 @@ #endif -Foundation_BEGIN +namespace Poco { class FPEnvironmentImpl @@ -107,7 +105,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_FPEnvironment_DEC_INCLUDED diff --git a/Foundation/include/Foundation/FPEnvironment_DUMMY.h b/Foundation/include/Poco/FPEnvironment_DUMMY.h similarity index 89% rename from Foundation/include/Foundation/FPEnvironment_DUMMY.h rename to Foundation/include/Poco/FPEnvironment_DUMMY.h index 9fb2700d6..e6d13831d 100644 --- a/Foundation/include/Foundation/FPEnvironment_DUMMY.h +++ b/Foundation/include/Poco/FPEnvironment_DUMMY.h @@ -1,7 +1,7 @@ // // FPEnvironment_DUMMY.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/FPEnvironment_DUMMY.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/FPEnvironment_DUMMY.h#1 $ // // Library: Foundation // Package: Core @@ -41,19 +41,14 @@ #define Foundation_FPEnvironment_DUMMY_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef STD_MATH_INCLUDED +#include "Poco/Foundation.h" #include -#define STD_MATH_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { -class FPEnvironmentImpl +class Foundation_API FPEnvironmentImpl { protected: enum RoundingModeImpl @@ -146,7 +141,7 @@ inline double FPEnvironmentImpl::copySignImpl(double target, double source) } -Foundation_END +} // namespace Poco #endif // Foundation_FPEnvironment_DUMMY_INCLUDED diff --git a/Foundation/include/Foundation/FPEnvironment_SUN.h b/Foundation/include/Poco/FPEnvironment_SUN.h similarity index 89% rename from Foundation/include/Foundation/FPEnvironment_SUN.h rename to Foundation/include/Poco/FPEnvironment_SUN.h index f01b7f199..9479475d4 100644 --- a/Foundation/include/Foundation/FPEnvironment_SUN.h +++ b/Foundation/include/Poco/FPEnvironment_SUN.h @@ -1,7 +1,7 @@ // // FPEnvironment_SUN.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/FPEnvironment_SUN.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/FPEnvironment_SUN.h#1 $ // // Library: Foundation // Package: Core @@ -40,16 +40,11 @@ #define Foundation_FPEnvironment_SUN_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef STD_IEEEFP_INCLUDED +#include "Poco/Foundation.h" #include -#define STD_IEEEFP_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class FPEnvironmentImpl @@ -95,7 +90,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_FPEnvironment_SUN_INCLUDED diff --git a/Foundation/include/Foundation/FPEnvironment_WIN32.h b/Foundation/include/Poco/FPEnvironment_WIN32.h similarity index 89% rename from Foundation/include/Foundation/FPEnvironment_WIN32.h rename to Foundation/include/Poco/FPEnvironment_WIN32.h index 8c255a6db..640f38859 100644 --- a/Foundation/include/Foundation/FPEnvironment_WIN32.h +++ b/Foundation/include/Poco/FPEnvironment_WIN32.h @@ -1,7 +1,7 @@ // // FPEnvironment_WIN32.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/FPEnvironment_WIN32.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/FPEnvironment_WIN32.h#1 $ // // Library: Foundation // Package: Core @@ -40,20 +40,12 @@ #define Foundation_FPEnvironment_WIN32_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef STD_FLOAT_INCLUDED +#include "Poco/Foundation.h" #include -#define STD_FLOAT_INCLUDED -#endif -#ifndef STD_MATH_INCLUDED #include -#define STD_MATH_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API FPEnvironmentImpl @@ -155,7 +147,7 @@ inline long double FPEnvironmentImpl::copySignImpl(long double target, long doub } -Foundation_END +} // namespace Poco #endif // Foundation_FPEnvironment_WIN32_INCLUDED diff --git a/Foundation/include/Foundation/File.h b/Foundation/include/Poco/File.h similarity index 89% rename from Foundation/include/Foundation/File.h rename to Foundation/include/Poco/File.h index e93ab3bc3..9b0e532d7 100644 --- a/Foundation/include/Foundation/File.h +++ b/Foundation/include/Poco/File.h @@ -1,7 +1,7 @@ // // File.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/File.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/File.h#1 $ // // Library: Foundation // Package: Filesystem @@ -40,30 +40,23 @@ #define Foundation_File_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Timestamp_INCLUDED -#include "Foundation/Timestamp.h" -#endif -#ifndef STD_VECTOR_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/Timestamp.h" #include -#define STD_VECTOR_INCLUDED -#endif #if defined(POCO_OS_FAMILY_WINDOWS) && defined(POCO_WIN32_UTF8) -#include "Foundation/File_WIN32U.h" +#include "Poco/File_WIN32U.h" #elif defined(POCO_OS_FAMILY_WINDOWS) -#include "Foundation/File_WIN32.h" +#include "Poco/File_WIN32.h" #elif defined(POCO_OS_FAMILY_UNIX) -#include "Foundation/File_UNIX.h" +#include "Poco/File_UNIX.h" #else -#include "Foundation/File_VMS.h" +#include "Poco/File_VMS.h" #endif -Foundation_BEGIN +namespace Poco { class Path; @@ -123,6 +116,9 @@ public: bool isFile() const; /// Returns true iff the file is a regular file. + bool isLink() const; + /// Returns true iff the file is a symbolic link. + bool isDirectory() const; /// Returns true iff the file is a directory. @@ -251,7 +247,7 @@ inline void swap(File& f1, File& f2) } -Foundation_END +} // namespace Poco #endif // Foundation_File_INCLUDED diff --git a/Foundation/include/Foundation/FileChannel.h b/Foundation/include/Poco/FileChannel.h similarity index 93% rename from Foundation/include/Foundation/FileChannel.h rename to Foundation/include/Poco/FileChannel.h index 13d920d2e..7d5f0f0fa 100644 --- a/Foundation/include/Foundation/FileChannel.h +++ b/Foundation/include/Poco/FileChannel.h @@ -1,7 +1,7 @@ // // FileChannel.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/FileChannel.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/FileChannel.h#1 $ // // Library: Foundation // Package: Logging @@ -40,21 +40,13 @@ #define Foundation_FileChannel_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Channel_INCLUDED -#include "Foundation/Channel.h" -#endif -#ifndef Foundation_Timestamp_INCLUDED -#include "Foundation/Timestamp.h" -#endif -#ifndef Foundation_Mutex_INCLUDED -#include "Foundation/Mutex.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/Channel.h" +#include "Poco/Timestamp.h" +#include "Poco/Mutex.h" -Foundation_BEGIN +namespace Poco { class LogFile; @@ -250,7 +242,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_FileChannel_INCLUDED diff --git a/Foundation/include/Foundation/FileStreamFactory.h b/Foundation/include/Poco/FileStreamFactory.h similarity index 87% rename from Foundation/include/Foundation/FileStreamFactory.h rename to Foundation/include/Poco/FileStreamFactory.h index c92aae030..728035069 100644 --- a/Foundation/include/Foundation/FileStreamFactory.h +++ b/Foundation/include/Poco/FileStreamFactory.h @@ -1,7 +1,7 @@ // // FileStreamFactory.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/FileStreamFactory.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/FileStreamFactory.h#1 $ // // Library: Foundation // Package: URI @@ -40,15 +40,11 @@ #define Foundation_FileStreamFactory_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_URIStreamFactory_INCLUDED -#include "Foundation/URIStreamFactory.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/URIStreamFactory.h" -Foundation_BEGIN +namespace Poco { class Path; @@ -81,7 +77,7 @@ public: }; -Foundation_END +} // namespace Poco #endif // Foundation_FileStreamFactory_INCLUDED diff --git a/Foundation/include/Foundation/File_UNIX.h b/Foundation/include/Poco/File_UNIX.h similarity index 90% rename from Foundation/include/Foundation/File_UNIX.h rename to Foundation/include/Poco/File_UNIX.h index 216969dd0..d9fc0ced0 100644 --- a/Foundation/include/Foundation/File_UNIX.h +++ b/Foundation/include/Poco/File_UNIX.h @@ -1,7 +1,7 @@ // // File_UNIX.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/File_UNIX.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/File_UNIX.h#1 $ // // Library: Foundation // Package: Filesystem @@ -40,12 +40,10 @@ #define Foundation_File_UNIX_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif +#include "Poco/Foundation.h" -Foundation_BEGIN +namespace Poco { class FileImpl @@ -64,6 +62,7 @@ protected: bool canWriteImpl() const; bool isFileImpl() const; bool isDirectoryImpl() const; + bool isLinkImpl() const; Timestamp createdImpl() const; Timestamp getLastModifiedImpl() const; void setLastModifiedImpl(const Timestamp& ts); @@ -93,7 +92,7 @@ inline const std::string& FileImpl::getPathImpl() const } -Foundation_END +} // namespace Poco #endif // Foundation_File_UNIX_INCLUDED diff --git a/Foundation/include/Foundation/File_VMS.h b/Foundation/include/Poco/File_VMS.h similarity index 90% rename from Foundation/include/Foundation/File_VMS.h rename to Foundation/include/Poco/File_VMS.h index 668781f6a..5cd67320b 100644 --- a/Foundation/include/Foundation/File_VMS.h +++ b/Foundation/include/Poco/File_VMS.h @@ -1,7 +1,7 @@ // // File_VMS.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/File_VMS.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/File_VMS.h#1 $ // // Library: Foundation // Package: Filesystem @@ -40,12 +40,10 @@ #define Foundation_File_VMS_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif +#include "Poco/Foundation.h" -Foundation_BEGIN +namespace Poco { class FileImpl @@ -65,6 +63,7 @@ protected: bool canWriteImpl() const; bool isFileImpl() const; bool isDirectoryImpl() const; + bool isLinkImpl() const; Timestamp createdImpl() const; Timestamp getLastModifiedImpl() const; void setLastModifiedImpl(const Timestamp& ts); @@ -92,7 +91,7 @@ inline const std::string& FileImpl::getPathImpl() const } -Foundation_END +} // namespace Poco #endif // Foundation_File_VMS_INCLUDED diff --git a/Foundation/include/Foundation/File_WIN32.h b/Foundation/include/Poco/File_WIN32.h similarity index 88% rename from Foundation/include/Foundation/File_WIN32.h rename to Foundation/include/Poco/File_WIN32.h index 014a5983d..0076d7896 100644 --- a/Foundation/include/Foundation/File_WIN32.h +++ b/Foundation/include/Poco/File_WIN32.h @@ -1,7 +1,7 @@ // // File_WIN32.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/File_WIN32.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/File_WIN32.h#1 $ // // Library: Foundation // Package: Filesystem @@ -40,15 +40,11 @@ #define Foundation_File_WIN32_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Timestamp_INCLUDED -#include "Foundation/Timestamp.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/Timestamp.h" -Foundation_BEGIN +namespace Poco { class Foundation_API FileImpl @@ -67,6 +63,7 @@ protected: bool canWriteImpl() const; bool isFileImpl() const; bool isDirectoryImpl() const; + bool isLinkImpl() const; Timestamp createdImpl() const; Timestamp getLastModifiedImpl() const; void setLastModifiedImpl(const Timestamp& ts); @@ -97,7 +94,7 @@ inline const std::string& FileImpl::getPathImpl() const } -Foundation_END +} // namespace Poco #endif // Foundation_File_WIN32_INCLUDED diff --git a/Foundation/include/Foundation/File_WIN32U.h b/Foundation/include/Poco/File_WIN32U.h similarity index 88% rename from Foundation/include/Foundation/File_WIN32U.h rename to Foundation/include/Poco/File_WIN32U.h index 4443725a6..851a46435 100644 --- a/Foundation/include/Foundation/File_WIN32U.h +++ b/Foundation/include/Poco/File_WIN32U.h @@ -1,7 +1,7 @@ // // File_WIN32U.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/File_WIN32U.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/File_WIN32U.h#1 $ // // Library: Foundation // Package: Filesystem @@ -40,15 +40,11 @@ #define Foundation_File_WIN32U_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Timestamp_INCLUDED -#include "Foundation/Timestamp.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/Timestamp.h" -Foundation_BEGIN +namespace Poco { class Foundation_API FileImpl @@ -67,6 +63,7 @@ protected: bool canWriteImpl() const; bool isFileImpl() const; bool isDirectoryImpl() const; + bool isLinkImpl() const; Timestamp createdImpl() const; Timestamp getLastModifiedImpl() const; void setLastModifiedImpl(const Timestamp& ts); @@ -98,7 +95,7 @@ inline const std::string& FileImpl::getPathImpl() const } -Foundation_END +} // namespace Poco #endif // Foundation_File_WIN32U_INCLUDED diff --git a/Foundation/include/Poco/Format.h b/Foundation/include/Poco/Format.h new file mode 100644 index 000000000..d391ed169 --- /dev/null +++ b/Foundation/include/Poco/Format.h @@ -0,0 +1,154 @@ +// +// Format.h +// +// $Id: //poco/1.2/Foundation/include/Poco/Format.h#1 $ +// +// Library: Foundation +// Package: Core +// Module: Format +// +// Definition of the format freestanding function. +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Redistributions in any form must be accompanied by information on +// how to obtain complete source code for this software and any +// accompanying software that uses this software. The source code +// must either be included in the distribution or be available for no +// more than the cost of distribution plus a nominal fee, and must be +// freely redistributable under reasonable conditions. For an +// executable file, complete source code means the source code for all +// modules it contains. It does not include source code for modules or +// files that typically accompany the major components of the operating +// system on which the executable file runs. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + + +#ifndef Foundation_Format_INCLUDED +#define Foundation_Format_INCLUDED + + +#include "Poco/Foundation.h" +#include "Poco/Any.h" +#include + + +namespace Poco { + + +std::string Foundation_API format(const std::string& fmt, const Any& value); + /// This function implements sprintf-style formatting in a typesafe way. + /// Various variants of the function are available, supporting a + /// different number of arguments (up to six). + /// + /// The formatting is controlled by the format string in fmt. + /// Format strings are quite similar to those of the printf() function, but + /// there are some minor differences. + /// + /// The format string can consist of any sequence of characters; certain + /// characters have a special meaning. Characters without a special meaning + /// are copied verbatim to the result. A percent sign (%) marks the beginning + /// of a format specification. Format specifications have the following syntax: + /// + /// %[][][.][] + /// + /// Flags, width, precision and prefix are optional. The only required part of + /// the format specification, apart from the percent sign, is the type. + /// + /// Following are valid type specifications and their meaning: + /// + /// * c character + /// * d signed decimal integer + /// * i signed decimal integer + /// * o unsigned octal integer + /// * u unsigned decimal integer + /// * x unsigned hexadecimal integer (lower case) + /// * X unsigned hexadecimal integer (upper case) + /// * e signed floating-point value in the form [-]d.dddde[]dd[d] + /// * E signed floating-point value in the form [-]d.ddddE[]dd[d] + /// * f signed floating-point value in the form [-]dddd.dddd + /// * s std::string + /// + /// The following flags are supported: + /// + /// * - left align the result within the given field width + /// * + prefix the output value with a sign (+ or –) if the output value is of a signed type + /// * 0 if width is prefixed with 0, zeros are added until the minimum width is reached + /// * # For o, x, X, the # flag prefixes any nonzero output value with 0, 0x, or 0X, respectively; + /// for e, E, f, the # flag forces the output value to contain a decimal point in all cases. + /// + /// The following modifiers are supported: + /// + /// * (none) argument is char (c), int (d, i), unsigned (o, u, x, X) double (e, E, f, g, G) or string (s) + /// * l argument is long (d, i), unsigned long (o, u, x, X) or long double (e, E, f, g, G) + /// * L argument is long long (d, i), unsigned long long (o, u, x, X) + /// * h argument is short (d, i), unsigned short (o, u, x, X) or float (e, E, f, g, G) + /// + /// The width argument is a nonnegative decimal integer controlling the minimum number of characters printed. + /// If the number of characters in the output value is less than the specified width, blanks or + /// leading zeros are added, according to the specified flags (-, +, 0). + /// + /// Precision is a nonnegative decimal integer, preceded by a period (.), which specifies the number of characters + /// to be printed, the number of decimal places, or the number of significant digits. + /// + /// Throws a BadCastException if an argument does not correspond to the type of its format specification. + /// + /// If there are more format specifiers than values, the format specifiers without a corresponding value + /// are copied verbatim to output. + /// + /// If there are more values than format specifiers, the superfluous values are ignored. + /// + /// Usage Example: + /// std::string s = format("The answer to life, the universe, and everything is %d", 42); + +std::string Foundation_API format(const std::string& fmt, const Any& value1, const Any& value2); +std::string Foundation_API format(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3); +std::string Foundation_API format(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4); +std::string Foundation_API format(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5); +std::string Foundation_API format(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6); + + +void Foundation_API format(std::string& result, const std::string& fmt, const Any& value); + /// Appends the formatted string to result. + +void Foundation_API format(std::string& result, const std::string& fmt, const Any& value1, const Any& value2); +void Foundation_API format(std::string& result, const std::string& fmt, const Any& value1, const Any& value2, const Any& value3); +void Foundation_API format(std::string& result, const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4); +void Foundation_API format(std::string& result, const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5); +void Foundation_API format(std::string& result, const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6); + + +void Foundation_API format(std::string& result, const std::string& fmt, const std::vector& values); + /// Supports a variable number of arguments and is used by + /// all other variants of format(). + + +} // namespace Poco + + +#endif // Foundation_Format_INCLUDED diff --git a/Foundation/include/Foundation/Formatter.h b/Foundation/include/Poco/Formatter.h similarity index 86% rename from Foundation/include/Foundation/Formatter.h rename to Foundation/include/Poco/Formatter.h index 1fc9a39af..86963f055 100644 --- a/Foundation/include/Foundation/Formatter.h +++ b/Foundation/include/Poco/Formatter.h @@ -1,7 +1,7 @@ // // Formatter.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Formatter.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Formatter.h#1 $ // // Library: Foundation // Package: Logging @@ -40,18 +40,12 @@ #define Foundation_Formatter_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Configurable_INCLUDED -#include "Foundation/Configurable.h" -#endif -#ifndef Foundation_RefCountedObject_INCLUDED -#include "Foundation/RefCountedObject.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/Configurable.h" +#include "Poco/RefCountedObject.h" -Foundation_BEGIN +namespace Poco { class Message; @@ -96,7 +90,7 @@ public: }; -Foundation_END +} // namespace Poco #endif // Foundation_Formatter_INCLUDED diff --git a/Foundation/include/Foundation/FormattingChannel.h b/Foundation/include/Poco/FormattingChannel.h similarity index 90% rename from Foundation/include/Foundation/FormattingChannel.h rename to Foundation/include/Poco/FormattingChannel.h index 49abc662f..b83367228 100644 --- a/Foundation/include/Foundation/FormattingChannel.h +++ b/Foundation/include/Poco/FormattingChannel.h @@ -1,7 +1,7 @@ // // FormattingChannel.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/FormattingChannel.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/FormattingChannel.h#1 $ // // Library: Foundation // Package: Logging @@ -40,15 +40,11 @@ #define Foundation_FormattingChannel_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Channel_INCLUDED -#include "Foundation/Channel.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/Channel.h" -Foundation_BEGIN +namespace Poco { class Formatter; @@ -114,7 +110,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_FormattingChannel_INCLUDED diff --git a/Foundation/include/Foundation/Foundation.h b/Foundation/include/Poco/Foundation.h similarity index 77% rename from Foundation/include/Foundation/Foundation.h rename to Foundation/include/Poco/Foundation.h index e40346198..8a7721deb 100644 --- a/Foundation/include/Foundation/Foundation.h +++ b/Foundation/include/Poco/Foundation.h @@ -1,13 +1,13 @@ // // Foundation.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Foundation.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Foundation.h#1 $ // // Library: Foundation // Package: Core // Module: Foundation // -// Basic definitions for the Poco Foundation library. +// Basic definitions for the POCO Foundation library. // This file must be the first file included by every other Foundation // header file. // @@ -42,13 +42,6 @@ #define Foundation_Foundation_INCLUDED -// -// Macros to declare the namespace -// -#define Foundation_BEGIN namespace Foundation { -#define Foundation_END } - - // // Ensure that POCO_DLL is default unless POCO_STATIC is defined // @@ -67,7 +60,7 @@ // Foundation_API functions as being imported from a DLL, wheras this DLL sees symbols // defined with this macro as being exported. // -#if (defined(_WIN32) || defined(__CYGWIN__)) && defined(POCO_DLL) +#if defined(_WIN32) && defined(POCO_DLL) #if defined(Foundation_EXPORTS) #define Foundation_API __declspec(dllexport) #else @@ -82,33 +75,30 @@ // -// Pull in basic definitions +// Include library configuration // -#ifndef Foundation_Platform_INCLUDED -#include "Foundation/Platform.h" -#endif -#ifndef Foundation_Bugcheck_INCLUDED -#include "Foundation/Bugcheck.h" -#endif -#ifndef Foundation_Types_INCLUDED -#include "Foundation/Types.h" -#endif -#ifndef STD_STRING_INCLUDED -#include -#define STD_STRING_INCLUDED -#endif +#include "Poco/Config.h" // // Include platform-specific definitions // #if defined(_WIN32) - #include "Foundation/Platform_WIN32.h" + #include "Poco/Platform_WIN32.h" #elif defined(__VMS) - #include "Foundation/Platform_VMS.h" + #include "Poco/Platform_VMS.h" #elif defined(POCO_OS_FAMILY_UNIX) - #include "Foundation/Platform_POSIX.h" + #include "Poco/Platform_POSIX.h" #endif +// +// Pull in basic definitions +// +#include "Poco/Platform.h" +#include "Poco/Bugcheck.h" +#include "Poco/Types.h" +#include + + #endif // Foundation_Foundation_INCLUDED diff --git a/Foundation/include/Foundation/Glob.h b/Foundation/include/Poco/Glob.h similarity index 93% rename from Foundation/include/Foundation/Glob.h rename to Foundation/include/Poco/Glob.h index f7eadeeae..935f6bbe9 100644 --- a/Foundation/include/Foundation/Glob.h +++ b/Foundation/include/Poco/Glob.h @@ -1,7 +1,7 @@ // // Glob.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Glob.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Glob.h#1 $ // // Library: Foundation // Package: Filesystem @@ -40,16 +40,11 @@ #define Foundation_Glob_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef STD_SET_INCLUDED +#include "Poco/Foundation.h" #include -#define STD_SET_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Path; @@ -157,7 +152,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_Glob_INCLUDED diff --git a/Foundation/include/Foundation/HMACEngine.h b/Foundation/include/Poco/HMACEngine.h similarity index 88% rename from Foundation/include/Foundation/HMACEngine.h rename to Foundation/include/Poco/HMACEngine.h index 3ddff207a..ae9a0f4e1 100644 --- a/Foundation/include/Foundation/HMACEngine.h +++ b/Foundation/include/Poco/HMACEngine.h @@ -1,7 +1,7 @@ // // HMACEngine.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/HMACEngine.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/HMACEngine.h#1 $ // // Library: Foundation // Package: Crypt @@ -40,19 +40,12 @@ #define Foundation_HMACEngine_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_DigestEngine_INCLUDED -#include "Foundation/DigestEngine.h" -#endif -#ifndef STD_CSTRING_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/DigestEngine.h" #include -#define STD_CSTRING_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { template @@ -167,7 +160,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_HMACEngine_INCLUDED diff --git a/Foundation/include/Poco/HashFunction.h b/Foundation/include/Poco/HashFunction.h new file mode 100644 index 000000000..ea913423a --- /dev/null +++ b/Foundation/include/Poco/HashFunction.h @@ -0,0 +1,82 @@ +// +// HashFunction.h +// +// $Id: //poco/1.2/Foundation/include/Poco/HashFunction.h#1 $ +// +// Library: Foundation +// Package: Core +// Module: HashFunction +// +// Definition of the HashFunction class. +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef Foundation_HashFunction_INCLUDED +#define Foundation_HashFunction_INCLUDED + + +#include "Poco/Foundation.h" + + +namespace Poco { + +template +struct HashFunction + /// A generic hash function for numeric values. +{ + static UInt32 hash(T key, UInt32 maxValue) + /// Returns the hash value for the given key + { + return key * 0xf4243 % maxValue; + } +}; + + +template <> +struct HashFunction + /// A specialization of HashFunction for strings. +{ + static UInt32 hash(const std::string& key, UInt32 maxValue) + { + // hash function taken from XML expat + UInt32 h = 0; + + for (int i = 0; i < key.length(); ++i) + { + h = h * 0xf4243 ^ key[i]; + } + + return h % maxValue; + } +}; + + +} // namespace Poco + + +#endif // Foundation_HashFunctions_INCLUDED diff --git a/Foundation/include/Poco/HashStatistic.h b/Foundation/include/Poco/HashStatistic.h new file mode 100644 index 000000000..4380c6ea7 --- /dev/null +++ b/Foundation/include/Poco/HashStatistic.h @@ -0,0 +1,147 @@ +// +// HashStatistic.h +// +// $Id: //poco/1.2/Foundation/include/Poco/HashStatistic.h#1 $ +// +// Library: Foundation +// Package: Core +// Module: HashStatistic +// +// Definition of the HashStatistic class. +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef Foundation_HashStatistic_INCLUDED +#define Foundation_HashStatistic_INCLUDED + + +#include "Poco/Foundation.h" +#include + + +namespace Poco { + + +class Foundation_API HashStatistic + /// HashStatistic class bundles statistical information on the current state of a HashTable +{ +public: + HashStatistic( + UInt32 tableSize, + UInt32 numEntries, + UInt32 numZeroEntries, + UInt32 maxEntry, + std::vector details = std::vector()); + /// Creates the HashStatistic. + + virtual ~HashStatistic(); + /// Destroys the HashStatistic. + + UInt32 maxPositionsOfTable() const; + /// Returns the maximum number of different hash values possible for the table + + UInt32 numberOfEntries() const; + /// Returns the total number of entries currently stored in the HashTable + + UInt32 numberOfZeroPositions() const; + /// Returns the number of hash positions that contain no entry. + + double avgEntriesPerHash() const; + /// Returns the average number of entries per position in the Hashtable, the higher this value the less efficient + /// performs hashing. If a large value is returned and getNumberOfZeroPositions also returns a large value, this + /// indicates an inefficient hashing function. If the number of zero entries is low, resizing the HashTable, should + /// be enough to improve performance + + double avgEntriesPerHashExclZeroEntries() const; + /// Same as getAvgEntriesPerHash but hash values that contain no entry are ignored, + /// getAvgEntriesPerHashExclZeroEntries >= getAvgEntriesPerHash will always be true. + + UInt32 maxEntriesPerHash() const; + /// Returns the maximum number of entries per hash value found in the current table. + + const std::vector detailedEntriesPerHash() const; + /// Will either be an empty vector or will contain for each possible hash value, the number of entries currently stored + + std::string toString() const; + /// Converts the whole data structure into a string. + +private: + UInt32 _sizeOfTable; + UInt32 _numberOfEntries; + UInt32 _numZeroEntries; + UInt32 _maxEntriesPerHash; + std::vector _detailedEntriesPerHash; +}; + + +inline UInt32 HashStatistic::maxPositionsOfTable() const +{ + return _sizeOfTable; +} + + +inline UInt32 HashStatistic::numberOfEntries() const +{ + return _numberOfEntries; +} + + +inline UInt32 HashStatistic::numberOfZeroPositions() const +{ + return _numZeroEntries; +} + + +inline double HashStatistic::avgEntriesPerHash() const +{ + return ((double) numberOfEntries()) / maxPositionsOfTable(); +} + + +inline double HashStatistic::avgEntriesPerHashExclZeroEntries() const +{ + return ((double) numberOfEntries()) / (maxPositionsOfTable() - numberOfZeroPositions()); +} + + +inline UInt32 HashStatistic::maxEntriesPerHash() const +{ + return _maxEntriesPerHash; +} + + +inline const std::vector HashStatistic::detailedEntriesPerHash() const +{ + return _detailedEntriesPerHash; +} + + +} // namespace Poco + + +#endif // Foundation_HashStatistic_INCLUDED diff --git a/Foundation/include/Poco/HashTable.h b/Foundation/include/Poco/HashTable.h new file mode 100644 index 000000000..92b682e32 --- /dev/null +++ b/Foundation/include/Poco/HashTable.h @@ -0,0 +1,362 @@ +// +// HashTable.h +// +// $Id: //poco/1.2/Foundation/include/Poco/HashTable.h#1 $ +// +// Library: Foundation +// Package: Core +// Module: HashTable +// +// Definition of the HashTable class. +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef Foundation_HashTable_INCLUDED +#define Foundation_HashTable_INCLUDED + + +#include "Poco/Foundation.h" +#include "Poco/Exception.h" +#include "Poco/HashFunction.h" +#include "Poco/HashStatistic.h" +#include +#include +#include + + +namespace Poco { + + +template > +class HashTable + /// A HashTable stores a key value pair that can be looked up via a hashed key. + /// + /// Collision handling is done via overflow maps(!). With small hash tables performance of this + /// data struct will be closer to that a map than a hash table, i.e. slower. On the plus side, + /// this class offers remove operations. Also HashTable full errors are not possible. If a fast + /// HashTable implementation is needed and the remove operation is not required, use SimpleHashTable + /// instead. + /// + /// This class is NOT thread safe. +{ +public: + typedef std::map HashEntryMap; + typedef HashEntryMap** HashTableVector; + + typedef typename HashEntryMap::const_iterator ConstIterator; + typedef typename HashEntryMap::iterator Iterator; + + HashTable(UInt32 initialSize = 251): + _entries(0), + _size(0), + _maxCapacity(initialSize) + /// Creates the HashTable. + { + _entries = new HashEntryMap*[initialSize]; + memset(_entries, '\0', sizeof(HashEntryMap*)*initialSize); + } + + HashTable(const HashTable& ht): + _entries(new HashEntryMap*[ht._maxCapacity]), + _size(ht._size), + _maxCapacity(ht._maxCapacity) + { + for (int i = 0; i < _maxCapacity; ++i) + { + if (ht._entries[i]) + _entries[i] = new HashEntryMap(ht._entries[i]->begin(), ht._entries[i]->end()); + else + _entries[i] = 0; + } + } + + ~HashTable() + /// Destroys the HashTable. + { + clear(); + } + + HashTable& operator = (const HashTable& ht) + { + if (this != &ht) + { + clear(); + _maxCapacity = ht._maxCapacity; + poco_assert_dbg (_entries == 0); + _entries = new HashEntryMap*[_maxCapacity]; + _size = ht._size; + + for (int i = 0; i < _maxCapacity; ++i) + { + if (ht._entries[i]) + _entries[i] = new HashEntryMap(ht._entries[i]->begin(), ht._entries[i]->end()); + else + _entries[i] = 0; + } + } + return *this; + } + + void clear() + { + if (!_entries) + return; + for (int i = 0; i < _maxCapacity; ++i) + { + if (_entries[i]) + delete _entries[i]; + } + delete[] _entries; + _entries = 0; + _size = 0; + _maxCapacity = 0; + } + + UInt32 insert(const Key& key, const Value& value) + /// Returns the hash value of the inserted item. + /// Throws an exception if the entry was already inserted + { + UInt32 hsh = hash(key); + insertRaw(key, hsh, value); + return hsh; + } + + void insertRaw(const Key& key, UInt32 hsh, const Value& value) + /// Returns the hash value of the inserted item. + /// Throws an exception if the entry was already inserted + { + if (!_entries[hsh]) + _entries[hsh] = new HashEntryMap(); + if (!_entries[hsh]->insert(std::make_pair(key, value)).second) + throw InvalidArgumentException("HashTable::insert, key already exists."); + _size++; + } + + UInt32 update(const Key& key, const Value& value) + /// Returns the hash value of the inserted item. + /// Replaces an existing entry if it finds one + { + UInt32 hsh = hash(key); + updateRaw(key, hsh, value); + return hsh; + } + + void updateRaw(const Key& key, UInt32 hsh, const Value& value) + /// Returns the hash value of the inserted item. + /// Replaces an existing entry if it finds one + { + if (!_entries[hsh]) + _entries[hsh] = new HashEntryMap(); + std::pair < Iterator, bool > res = _entries[hsh]->insert(make_pair(key, value)); + if (res.second == false) + res.first->second = value; + else + _size++; + } + + void remove(const Key& key) + { + UInt32 hsh = hash(key); + removeRaw(key, hsh); + } + + void removeRaw(const Key& key, UInt32 hsh) + /// Performance version, allows to specify the hash value + { + if (_entries[hsh]) + { + _size -= _entries[hsh]->erase(key); + } + } + + UInt32 hash(const Key& key) const + { + return KeyHashFunction::hash(key, _maxCapacity); + } + + const Value& get(const Key& key) const + /// Throws an exception if the value does not exist + { + UInt32 hsh = hash(key); + return getRaw(key, hsh); + } + + const Value& getRaw(const Key& key, UInt32 hsh) const + /// Throws an exception if the value does not exist + { + if (!_entries[hsh]) + throw InvalidArgumentException("key not found"); + + ConstIterator it = _entries[hsh]->find(key); + if (it == _entries[hsh]->end()) + throw InvalidArgumentException("key not found"); + + return it->second; + } + + const Key& getKeyRaw(const Key& key, UInt32 hsh) + /// Throws an exception if the key does not exist. returns a reference to the internally + /// stored key. Useful when someone does an insert and wants for performance reason only to store + /// a pointer to the key in another collection + { + if (!_entries[hsh]) + throw InvalidArgumentException("key not found"); + ConstIterator it = _entries[hsh]->find(key); + if (it == _entries[hsh]->end()) + throw InvalidArgumentException("key not found"); + return it->first; + } + + bool get(const Key& key, Value& v) const + /// Sets v to the found value, returns false if no value was found + { + UInt32 hsh = hash(key); + return getRaw(key, hsh, v); + } + + bool getRaw(const Key& key, UInt32 hsh, Value& v) const + /// Sets v to the found value, returns false if no value was found + { + if (!_entries[hsh]) + return false; + + ConstIterator it = _entries[hsh]->find(key); + if (it == _entries[hsh]->end()) + return false; + + v = it->second; + return true; + } + + bool exists(const Key& key) + { + UInt32 hsh = hash(key); + return existsRaw(key, hsh); + } + + bool existsRaw(const Key& key, UInt32 hsh) + { + return _entries[hsh] && (_entries[hsh]->end() != _entries[hsh]->find(key)); + } + + + size_t size() const + /// Returns the number of elements already inserted into the HashTable + { + return _size; + } + + UInt32 maxCapacity() const + { + return _maxCapacity; + } + + void resize(UInt32 newSize) + /// Resizes the hashtable, rehashes all existing entries. Expensive! + { + if (_maxCapacity != newSize) + { + HashTableVector cpy = _entries; + _entries = 0; + UInt32 oldSize = _maxCapacity; + _maxCapacity = newSize; + _entries = new HashEntryMap*[_maxCapacity]; + memset(_entries, '\0', sizeof(HashEntryMap*)*_maxCapacity); + + if (_size == 0) + { + // no data was yet inserted + delete[] cpy; + return; + } + _size = 0; + for (int i=0; i < oldSize; ++i) + { + if (cpy[i]) + { + ConstIterator it = cpy[i]->begin(); + ConstIterator itEnd = cpy[i]->end(); + for (; it != itEnd; ++it) + { + insert(it->first, it->second); + } + delete cpy[i]; + } + } + delete[] cpy; + } + } + + HashStatistic currentState(bool details = false) const + /// Returns the current internal state + { + UInt32 numberOfEntries = (UInt32)_size; + UInt32 numZeroEntries = 0; + UInt32 maxEntriesPerHash = 0; + std::vector detailedEntriesPerHash; + #ifdef DEBUG + UInt32 totalSize = 0; + #endif + for (int i=0; i < _maxCapacity; ++i) + { + if (_entries[i]) + { + UInt32 size = (UInt32)_entries[i]->size(); + poco_assert_dbg(size != 0); + if (size > maxEntriesPerHash) + maxEntriesPerHash = size; + if (details) + detailedEntriesPerHash.push_back(size); + #ifdef DEBUG + totalSize += size; + #endif + } + else + { + numZeroEntries++; + if (details) + detailedEntriesPerHash.push_back(0); + } + } + #ifdef DEBUG + poco_assert_dbg(totalSize == numberOfEntries); + #endif + return HashStatistic(_maxCapacity, numberOfEntries, numZeroEntries, maxEntriesPerHash, detailedEntriesPerHash); + } + +private: + HashTableVector _entries; + size_t _size; + UInt32 _maxCapacity; +}; + + +} // namespace Poco + + +#endif // Foundation_HashTable_INCLUDED diff --git a/Foundation/include/Foundation/HexBinaryDecoder.h b/Foundation/include/Poco/HexBinaryDecoder.h similarity index 87% rename from Foundation/include/Foundation/HexBinaryDecoder.h rename to Foundation/include/Poco/HexBinaryDecoder.h index 236351c4c..dc8d69b42 100644 --- a/Foundation/include/Foundation/HexBinaryDecoder.h +++ b/Foundation/include/Poco/HexBinaryDecoder.h @@ -1,7 +1,7 @@ // // HexBinaryDecoder.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/HexBinaryDecoder.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/HexBinaryDecoder.h#1 $ // // Library: Foundation // Package: Streams @@ -40,19 +40,12 @@ #define Foundation_HexBinaryDecoder_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_UnbufferedStreamBuf_INCLUDED -#include "Foundation/UnbufferedStreamBuf.h" -#endif -#ifndef STD_ISTREAM_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/UnbufferedStreamBuf.h" #include -#define STD_ISTREAM_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API HexBinaryDecoderBuf: public UnbufferedStreamBuf @@ -105,7 +98,7 @@ public: }; -Foundation_END +} // namespace Poco #endif // Foundation_HexBinaryDecoder_INCLUDED diff --git a/Foundation/include/Foundation/HexBinaryEncoder.h b/Foundation/include/Poco/HexBinaryEncoder.h similarity index 88% rename from Foundation/include/Foundation/HexBinaryEncoder.h rename to Foundation/include/Poco/HexBinaryEncoder.h index 64ad097ec..4a1bb146c 100644 --- a/Foundation/include/Foundation/HexBinaryEncoder.h +++ b/Foundation/include/Poco/HexBinaryEncoder.h @@ -1,7 +1,7 @@ // // HexBinaryEncoder.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/HexBinaryEncoder.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/HexBinaryEncoder.h#1 $ // // Library: Foundation // Package: Streams @@ -40,19 +40,12 @@ #define Foundation_HexBinaryEncoder_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_UnbufferedStreamBuf_INCLUDED -#include "Foundation/UnbufferedStreamBuf.h" -#endif -#ifndef STD_OSTREAM_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/UnbufferedStreamBuf.h" #include -#define STD_OSTREAM_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API HexBinaryEncoderBuf: public UnbufferedStreamBuf @@ -118,7 +111,7 @@ public: }; -Foundation_END +} // namespace Poco #endif // Foundation_HexBinaryEncoder_INCLUDED diff --git a/Foundation/include/Foundation/InflatingStream.h b/Foundation/include/Poco/InflatingStream.h similarity index 87% rename from Foundation/include/Foundation/InflatingStream.h rename to Foundation/include/Poco/InflatingStream.h index 5b52c4e58..8fadbe0e6 100644 --- a/Foundation/include/Foundation/InflatingStream.h +++ b/Foundation/include/Poco/InflatingStream.h @@ -1,7 +1,7 @@ // // InflatingStream.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/InflatingStream.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/InflatingStream.h#1 $ // // Library: Foundation // Package: Streams @@ -40,26 +40,14 @@ #define Foundation_InflatingStream_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_BufferedStreamBuf_INCLUDED -#include "Foundation/BufferedStreamBuf.h" -#endif -#ifndef STD_ISTREAM_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/BufferedStreamBuf.h" #include -#define STD_ISTREAM_INCLUDED -#endif -#ifndef STD_OSTREAM_INCLUDED #include -#define STD_OSTREAM_INCLUDED -#endif -#ifndef ZLIB_H -#include "Foundation/zlib.h" -#endif +#include "Poco/zlib.h" -Foundation_BEGIN +namespace Poco { class Foundation_API InflatingStreamBuf: public BufferedStreamBuf @@ -145,7 +133,7 @@ public: }; -Foundation_END +} // namespace Poco #endif // Foundation_InflatingStream_INCLUDED diff --git a/Foundation/include/Foundation/Instantiator.h b/Foundation/include/Poco/Instantiator.h similarity index 90% rename from Foundation/include/Foundation/Instantiator.h rename to Foundation/include/Poco/Instantiator.h index 074ae68c0..7acf9f960 100644 --- a/Foundation/include/Foundation/Instantiator.h +++ b/Foundation/include/Poco/Instantiator.h @@ -1,7 +1,7 @@ // // Instantiator.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Instantiator.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Instantiator.h#1 $ // // Library: Foundation // Package: Core @@ -40,12 +40,10 @@ #define Foundation_Instantiator_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif +#include "Poco/Foundation.h" -Foundation_BEGIN +namespace Poco { template @@ -100,7 +98,7 @@ public: }; -Foundation_END +} // namespace Poco #endif // Foundation_Instantiator_INCLUDED diff --git a/Foundation/include/Foundation/KeyValueArgs.h b/Foundation/include/Poco/KeyValueArgs.h similarity index 91% rename from Foundation/include/Foundation/KeyValueArgs.h rename to Foundation/include/Poco/KeyValueArgs.h index c2aa20970..c10d9483e 100644 --- a/Foundation/include/Foundation/KeyValueArgs.h +++ b/Foundation/include/Poco/KeyValueArgs.h @@ -1,7 +1,7 @@ // // KeyValueArgs.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/KeyValueArgs.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/KeyValueArgs.h#1 $ // // Library: Foundation // Package: Cache @@ -40,10 +40,10 @@ #define Foundation_KeyValueArgs_INCLUDED -#include "Foundation/Foundation.h" +#include "Poco/Foundation.h" -Foundation_BEGIN +namespace Poco { template @@ -89,7 +89,7 @@ private: }; -Foundation_END +} // namespace Poco #endif diff --git a/Foundation/include/Foundation/LRUCache.h b/Foundation/include/Poco/LRUCache.h similarity index 89% rename from Foundation/include/Foundation/LRUCache.h rename to Foundation/include/Poco/LRUCache.h index db2f66aca..0afa59c4f 100644 --- a/Foundation/include/Foundation/LRUCache.h +++ b/Foundation/include/Poco/LRUCache.h @@ -1,7 +1,7 @@ // // LRUCache.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/LRUCache.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/LRUCache.h#1 $ // // Library: Foundation // Package: Cache @@ -40,11 +40,11 @@ #define Foundation_LRUCache_INCLUDED -#include "Foundation/AbstractCache.h" -#include "Foundation/LRUStrategy.h" +#include "Poco/AbstractCache.h" +#include "Poco/LRUStrategy.h" -Foundation_BEGIN +namespace Poco { template @@ -68,7 +68,7 @@ private: }; -Foundation_END +} // namespace Poco #endif diff --git a/Foundation/include/Foundation/LRUStrategy.h b/Foundation/include/Poco/LRUStrategy.h similarity index 87% rename from Foundation/include/Foundation/LRUStrategy.h rename to Foundation/include/Poco/LRUStrategy.h index 3e4f11c01..49f49b144 100644 --- a/Foundation/include/Foundation/LRUStrategy.h +++ b/Foundation/include/Poco/LRUStrategy.h @@ -1,7 +1,7 @@ // // LRUStrategy.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/LRUStrategy.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/LRUStrategy.h#1 $ // // Library: Foundation // Package: Cache @@ -40,16 +40,16 @@ #define Foundation_LRUStrategy_INCLUDED -#include "Foundation/KeyValueArgs.h" -#include "Foundation/ValidArgs.h" -#include "Foundation/AbstractStrategy.h" -#include "Foundation/EventArgs.h" -#include "Foundation/Exception.h" +#include "Poco/KeyValueArgs.h" +#include "Poco/ValidArgs.h" +#include "Poco/AbstractStrategy.h" +#include "Poco/EventArgs.h" +#include "Poco/Exception.h" #include #include -Foundation_BEGIN +namespace Poco { template @@ -77,9 +77,12 @@ public: void onAdd(const void*, const KeyValueArgs & args) { - poco_assert_dbg(_keyIndex.find(args.key()) == _keyIndex.end()); _keys.push_front(args.key()); - _keyIndex.insert(make_pair(args.key(), _keys.begin())); + std::pair < IndexIterator, bool > stat = _keyIndex.insert(make_pair(args.key(), _keys.begin())); + if (!stat.second) + { + stat.first->second = _keys.begin(); + } } void onRemove(const void*, const TKey& key) @@ -152,7 +155,7 @@ protected: }; -Foundation_END +} // namespace Poco #endif diff --git a/Foundation/include/Foundation/Latin1Encoding.h b/Foundation/include/Poco/Latin1Encoding.h similarity index 85% rename from Foundation/include/Foundation/Latin1Encoding.h rename to Foundation/include/Poco/Latin1Encoding.h index a15121865..901504ac6 100644 --- a/Foundation/include/Foundation/Latin1Encoding.h +++ b/Foundation/include/Poco/Latin1Encoding.h @@ -1,7 +1,7 @@ // // Latin1Encoding.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Latin1Encoding.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Latin1Encoding.h#1 $ // // Library: Foundation // Package: Text @@ -40,15 +40,11 @@ #define Foundation_Latin1Encoding_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_TextEncoding_INCLUDED -#include "Foundation/TextEncoding.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/TextEncoding.h" -Foundation_BEGIN +namespace Poco { class Foundation_API Latin1Encoding: public TextEncoding @@ -66,7 +62,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_Latin1Encoding_INCLUDED diff --git a/Foundation/include/Foundation/Latin9Encoding.h b/Foundation/include/Poco/Latin9Encoding.h similarity index 86% rename from Foundation/include/Foundation/Latin9Encoding.h rename to Foundation/include/Poco/Latin9Encoding.h index 2a188b270..484e42265 100644 --- a/Foundation/include/Foundation/Latin9Encoding.h +++ b/Foundation/include/Poco/Latin9Encoding.h @@ -1,7 +1,7 @@ // // Latin9Encoding.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Latin9Encoding.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Latin9Encoding.h#1 $ // // Library: Foundation // Package: Text @@ -40,15 +40,11 @@ #define Foundation_Latin9Encoding_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_TextEncoding_INCLUDED -#include "Foundation/TextEncoding.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/TextEncoding.h" -Foundation_BEGIN +namespace Poco { class Foundation_API Latin9Encoding: public TextEncoding @@ -69,7 +65,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_Latin9Encoding_INCLUDED diff --git a/Foundation/include/Foundation/LineEndingConverter.h b/Foundation/include/Poco/LineEndingConverter.h similarity index 91% rename from Foundation/include/Foundation/LineEndingConverter.h rename to Foundation/include/Poco/LineEndingConverter.h index 69e5e2d3d..7fc566726 100644 --- a/Foundation/include/Foundation/LineEndingConverter.h +++ b/Foundation/include/Poco/LineEndingConverter.h @@ -1,7 +1,7 @@ // // LineEndingConverter.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/LineEndingConverter.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/LineEndingConverter.h#1 $ // // Library: Foundation // Package: Streams @@ -40,23 +40,13 @@ #define Foundation_LineEndingConverter_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_UnbufferedStreamBuf_INCLUDED -#include "Foundation/UnbufferedStreamBuf.h" -#endif -#ifndef STD_ISTREAM_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/UnbufferedStreamBuf.h" #include -#define STD_ISTREAM_INCLUDED -#endif -#ifndef STD_OSTREAM_INCLUDED #include -#define STD_OSTREAM_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API LineEnding @@ -207,7 +197,7 @@ public: }; -Foundation_END +} // namespace Poco #endif // Foundation_LineEndingConverter_INCLUDED diff --git a/Foundation/include/Foundation/LocalDateTime.h b/Foundation/include/Poco/LocalDateTime.h similarity index 94% rename from Foundation/include/Foundation/LocalDateTime.h rename to Foundation/include/Poco/LocalDateTime.h index 8b22829e3..e34c0cc4f 100644 --- a/Foundation/include/Foundation/LocalDateTime.h +++ b/Foundation/include/Poco/LocalDateTime.h @@ -1,7 +1,7 @@ // // LocalDateTime.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/LocalDateTime.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/LocalDateTime.h#1 $ // // Library: Foundation // Package: DateTime @@ -40,15 +40,11 @@ #define Foundation_LocalDateTime_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_DateTime_INCLUDED -#include "Foundation/DateTime.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/DateTime.h" -Foundation_BEGIN +namespace Poco { class Foundation_API LocalDateTime @@ -368,7 +364,7 @@ inline void swap(LocalDateTime& d1, LocalDateTime& d2) } -Foundation_END +} // namespace Poco #endif // Foundation_LocalDateTime_INCLUDED diff --git a/Foundation/include/Foundation/LogFile.h b/Foundation/include/Poco/LogFile.h similarity index 84% rename from Foundation/include/Foundation/LogFile.h rename to Foundation/include/Poco/LogFile.h index b2df2d0ae..d088b01dd 100644 --- a/Foundation/include/Foundation/LogFile.h +++ b/Foundation/include/Poco/LogFile.h @@ -1,7 +1,7 @@ // // LogFile.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/LogFile.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/LogFile.h#1 $ // // Library: Foundation // Package: Logging @@ -40,21 +40,21 @@ #define Foundation_LogFile_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif +#include "Poco/Foundation.h" -#if defined(POCO_OS_FAMILY_WINDOWS) -#include "Foundation/LogFile_WIN32.h" +#if defined(POCO_OS_FAMILY_WINDOWS) && defined(POCO_WIN32_UTF8) +#include "Poco/LogFile_WIN32U.h" +#elif defined(POCO_OS_FAMILY_WINDOWS) +#include "Poco/LogFile_WIN32.h" #elif defined(POCO_OS_FAMILY_VMS) -#include "Foundation/LogFile_VMS.h" +#include "Poco/LogFile_VMS.h" #else -#include "Foundation/LogFile_STD.h" +#include "Poco/LogFile_STD.h" #endif -Foundation_BEGIN +namespace Poco { class Foundation_API LogFile: public LogFileImpl @@ -109,7 +109,7 @@ inline const std::string& LogFile::path() const } -Foundation_END +} // namespace Poco #endif // Foundation_LogFile_INCLUDED diff --git a/Foundation/include/Foundation/LogFile_STD.h b/Foundation/include/Poco/LogFile_STD.h similarity index 84% rename from Foundation/include/Foundation/LogFile_STD.h rename to Foundation/include/Poco/LogFile_STD.h index a3b548475..1cc003144 100644 --- a/Foundation/include/Foundation/LogFile_STD.h +++ b/Foundation/include/Poco/LogFile_STD.h @@ -1,7 +1,7 @@ // // LogFile_STD.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/LogFile_STD.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/LogFile_STD.h#1 $ // // Library: Foundation // Package: Logging @@ -40,19 +40,12 @@ #define Foundation_LogFile_STD_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Timestamp_INCLUDED -#include "Foundation/Timestamp.h" -#endif -#ifndef STD_FSTREAM_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/Timestamp.h" #include -#define STD_FSTREAM_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API LogFileImpl @@ -75,7 +68,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_LogFile_STD_INCLUDED diff --git a/Foundation/include/Foundation/LogFile_VMS.h b/Foundation/include/Poco/LogFile_VMS.h similarity index 85% rename from Foundation/include/Foundation/LogFile_VMS.h rename to Foundation/include/Poco/LogFile_VMS.h index 9ed525d68..75f2c4cf7 100644 --- a/Foundation/include/Foundation/LogFile_VMS.h +++ b/Foundation/include/Poco/LogFile_VMS.h @@ -1,7 +1,7 @@ // // LogFile_VMS.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/LogFile_VMS.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/LogFile_VMS.h#1 $ // // Library: Foundation // Package: Logging @@ -40,19 +40,12 @@ #define Foundation_LogFile_VMS_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Timestamp_INCLUDED -#include "Foundation/Timestamp.h" -#endif -#ifndef STD_STDIO_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/Timestamp.h" #include -#define STD_STDIO_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API LogFileImpl @@ -76,7 +69,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_LogFile_VMS_INCLUDED diff --git a/Foundation/include/Foundation/LogFile_WIN32.h b/Foundation/include/Poco/LogFile_WIN32.h similarity index 84% rename from Foundation/include/Foundation/LogFile_WIN32.h rename to Foundation/include/Poco/LogFile_WIN32.h index 2197064de..f0b162867 100644 --- a/Foundation/include/Foundation/LogFile_WIN32.h +++ b/Foundation/include/Poco/LogFile_WIN32.h @@ -1,7 +1,7 @@ // // LogFile_WIN32.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/LogFile_WIN32.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/LogFile_WIN32.h#1 $ // // Library: Foundation // Package: Logging @@ -40,19 +40,12 @@ #define Foundation_LogFile_WIN32_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Timestamp_INCLUDED -#include "Foundation/Timestamp.h" -#endif -#ifndef STD_WINDOWS_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/Timestamp.h" #include -#define STD_WINDOWS_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API LogFileImpl @@ -75,7 +68,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_LogFile_WIN32_INCLUDED diff --git a/Foundation/include/Poco/LogFile_WIN32U.h b/Foundation/include/Poco/LogFile_WIN32U.h new file mode 100644 index 000000000..17d877121 --- /dev/null +++ b/Foundation/include/Poco/LogFile_WIN32U.h @@ -0,0 +1,74 @@ +// +// LogFile_WIN32U.h +// +// $Id: //poco/1.2/Foundation/include/Poco/LogFile_WIN32U.h#1 $ +// +// Library: Foundation +// Package: Logging +// Module: LogFile +// +// Definition of the LogFileImpl class using the Windows file APIs. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef Foundation_LogFile_WIN32U_INCLUDED +#define Foundation_LogFile_WIN32U_INCLUDED + + +#include "Poco/Foundation.h" +#include "Poco/Timestamp.h" +#include + + +namespace Poco { + + +class Foundation_API LogFileImpl + /// The implementation of LogFile for Windows. + /// The native filesystem APIs are used for + /// total control over locking behavior. +{ +public: + LogFileImpl(const std::string& path); + ~LogFileImpl(); + void writeImpl(const std::string& text); + UInt64 sizeImpl() const; + Timestamp creationDateImpl() const; + const std::string& pathImpl() const; + +private: + std::string _path; + HANDLE _hFile; + Timestamp _creationDate; +}; + + +} // namespace Poco + + +#endif // Foundation_LogFile_WIN32U_INCLUDED diff --git a/Foundation/include/Poco/LogStream.h b/Foundation/include/Poco/LogStream.h new file mode 100644 index 000000000..86b4564ec --- /dev/null +++ b/Foundation/include/Poco/LogStream.h @@ -0,0 +1,166 @@ +// +// LogStream.h +// +// $Id: //poco/1.2/Foundation/include/Poco/LogStream.h#1 $ +// +// Library: Foundation +// Package: Logging +// Module: LogStream +// +// Definition of the LogStream class. +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef Foundation_LogStream_INCLUDED +#define Foundation_LogStream_INCLUDED + + +#include "Poco/Foundation.h" +#include "Poco/Logger.h" +#include "Poco/UnbufferedStreamBuf.h" +#include + + +namespace Poco { + + +class Foundation_API LogStreamBuf: public UnbufferedStreamBuf + /// This class implements a streambuf interface + /// to a Logger. + /// + /// The streambuf appends all characters written to it + /// to a string. As soon as a CR or LF (std::endl) is written, + /// the string is sent to the Logger, with the set + /// priority. +{ +public: + LogStreamBuf(Logger& logger, Message::Priority priority); + /// Creates the LogStream. + + ~LogStreamBuf(); + /// Destroys the LogStream. + + void setPriority(Message::Priority priority); + /// Sets the priority for log messages. + + Message::Priority getPriority() const; + /// Returns the priority for log messages. + +private: + int writeToDevice(char c); + +private: + Logger& _logger; + Message::Priority _priority; + std::string _message; +}; + + +class Foundation_API LogIOS: public virtual std::ios + /// The base class for LogStream. + /// + /// This class is needed to ensure the correct initialization + /// order of the stream buffer and base classes. +{ +public: + LogIOS(Logger& logger, Message::Priority priority); + ~LogIOS(); + LogStreamBuf* rdbuf(); + +protected: + LogStreamBuf _buf; +}; + + +class Foundation_API LogStream: public LogIOS, public std::ostream + /// This class implements an ostream interface + /// to a Logger. + /// + /// The stream's buffer appends all characters written to it + /// to a string. As soon as a CR or LF (std::endl) is written, + /// the string is sent to the Logger, with the current + /// priority. + /// + /// Usage example: + /// LogStream ls(someLogger); + /// ls << "Some informational message" << std::endl; + /// ls.error() << "Some error message" << std::endl; +{ +public: + LogStream(Logger& logger, Message::Priority priority = Message::PRIO_INFORMATION); + /// Creates the LogStream, using the given logger and priority. + + LogStream(const std::string& loggerName, Message::Priority priority = Message::PRIO_INFORMATION); + /// Creates the LogStream, using the logger identified + /// by loggerName, and sets the priority. + + ~LogStream(); + /// Destroys the LogStream. + + LogStream& fatal(); + /// Sets the priority for log messages to Message::PRIO_FATAL. + + LogStream& critical(); + /// Sets the priority for log messages to Message::PRIO_CRITICAL. + + LogStream& error(); + /// Sets the priority for log messages to Message::PRIO_ERROR. + + LogStream& warning(); + /// Sets the priority for log messages to Message::PRIO_WARNING. + + LogStream& notice(); + /// Sets the priority for log messages to Message::PRIO_NOTICE. + + LogStream& information(); + /// Sets the priority for log messages to Message::PRIO_INFORMATION. + + LogStream& debug(); + /// Sets the priority for log messages to Message::PRIO_DEBUG. + + LogStream& trace(); + /// Sets the priority for log messages to Message::PRIO_TRACE. + + LogStream& priority(Message::Priority priority); + /// Sets the priority for log messages. +}; + + +// +// inlines +// +inline Message::Priority LogStreamBuf::getPriority() const +{ + return _priority; +} + + +} // namespace Poco + + +#endif // Foundation_LogStream_INCLUDED diff --git a/Foundation/include/Foundation/Logger.h b/Foundation/include/Poco/Logger.h similarity index 94% rename from Foundation/include/Foundation/Logger.h rename to Foundation/include/Poco/Logger.h index 5b420f93d..5601d7602 100644 --- a/Foundation/include/Foundation/Logger.h +++ b/Foundation/include/Poco/Logger.h @@ -1,7 +1,7 @@ // // Logger.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Logger.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Logger.h#1 $ // // Library: Foundation // Package: Logging @@ -40,22 +40,14 @@ #define Foundation_Logger_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Channel_INCLUDED -#include "Foundation/Channel.h" -#endif -#ifndef Foundation_Message_INCLUDED -#include "Foundation/Message.h" -#endif -#ifndef STD_MAP_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/Channel.h" +#include "Poco/Message.h" #include -#define STD_MAP_INCLUDED -#endif +#include -Foundation_BEGIN +namespace Poco { class Exception; @@ -278,6 +270,10 @@ public: /// Shuts down the logging framework and releases all /// Loggers. + static void names(std::vector& names); + /// Fills the given vector with the names + /// of all currently defined loggers. + protected: typedef std::map LoggerMap; @@ -464,7 +460,7 @@ inline bool Logger::trace() const } -Foundation_END +} // namespace Poco #endif // Foundation_Logger_INCLUDED diff --git a/Foundation/include/Foundation/LoggingFactory.h b/Foundation/include/Poco/LoggingFactory.h similarity index 86% rename from Foundation/include/Foundation/LoggingFactory.h rename to Foundation/include/Poco/LoggingFactory.h index 1c7507b1f..ff7d0f3b7 100644 --- a/Foundation/include/Foundation/LoggingFactory.h +++ b/Foundation/include/Poco/LoggingFactory.h @@ -1,7 +1,7 @@ // // LoggingFactory.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/LoggingFactory.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/LoggingFactory.h#1 $ // // Library: Foundation // Package: Logging @@ -40,21 +40,13 @@ #define Foundation_LoggingFactory_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_DynamicFactory_INCLUDED -#include "Foundation/DynamicFactory.h" -#endif -#ifndef Foundation_Channel_INCLUDED -#include "Foundation/Channel.h" -#endif -#ifndef Foundation_Formatter_INCLUDED -#include "Foundation/Formatter.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/DynamicFactory.h" +#include "Poco/Channel.h" +#include "Poco/Formatter.h" -Foundation_BEGIN +namespace Poco { class Foundation_API LoggingFactory @@ -117,7 +109,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_LoggingFactory_INCLUDED diff --git a/Foundation/include/Foundation/LoggingRegistry.h b/Foundation/include/Poco/LoggingRegistry.h similarity index 84% rename from Foundation/include/Foundation/LoggingRegistry.h rename to Foundation/include/Poco/LoggingRegistry.h index 374cf8f86..657447e9a 100644 --- a/Foundation/include/Foundation/LoggingRegistry.h +++ b/Foundation/include/Poco/LoggingRegistry.h @@ -1,7 +1,7 @@ // // LoggingRegistry.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/LoggingRegistry.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/LoggingRegistry.h#1 $ // // Library: Foundation // Package: Logging @@ -40,28 +40,15 @@ #define Foundation_LoggingRegistry_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_AutoPtr_INCLUDED -#include "Foundation/AutoPtr.h" -#endif -#ifndef Foundation_Channel_INCLUDED -#include "Foundation/Channel.h" -#endif -#ifndef Foundation_Formatter_INCLUDED -#include "Foundation/Formatter.h" -#endif -#ifndef Foundation_Mutex_INCLUDED -#include "Foundation/Mutex.h" -#endif -#ifndef STD_MAP_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/AutoPtr.h" +#include "Poco/Channel.h" +#include "Poco/Formatter.h" +#include "Poco/Mutex.h" #include -#define STD_MAP_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API LoggingRegistry @@ -128,7 +115,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_LoggingRegistry_INCLUDED diff --git a/Foundation/include/Foundation/MD2Engine.h b/Foundation/include/Poco/MD2Engine.h similarity index 89% rename from Foundation/include/Foundation/MD2Engine.h rename to Foundation/include/Poco/MD2Engine.h index 38c71f429..f9b52c1c4 100644 --- a/Foundation/include/Foundation/MD2Engine.h +++ b/Foundation/include/Poco/MD2Engine.h @@ -1,7 +1,7 @@ // // MD2Engine.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/MD2Engine.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/MD2Engine.h#1 $ // // Library: Foundation // Package: Crypt @@ -59,15 +59,11 @@ #define Foundation_MD2Engine_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_DigestEngine_INCLUDED -#include "Foundation/DigestEngine.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/DigestEngine.h" -Foundation_BEGIN +namespace Poco { class Foundation_API MD2Engine: public DigestEngine @@ -107,7 +103,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_MD2Engine_INCLUDED diff --git a/Foundation/include/Foundation/MD4Engine.h b/Foundation/include/Poco/MD4Engine.h similarity index 90% rename from Foundation/include/Foundation/MD4Engine.h rename to Foundation/include/Poco/MD4Engine.h index 49417875b..978b33807 100644 --- a/Foundation/include/Foundation/MD4Engine.h +++ b/Foundation/include/Poco/MD4Engine.h @@ -1,7 +1,7 @@ // // MD4Engine.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/MD4Engine.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/MD4Engine.h#1 $ // // Library: Foundation // Package: Crypt @@ -63,15 +63,11 @@ #define Foundation_MD4Engine_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_DigestEngine_INCLUDED -#include "Foundation/DigestEngine.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/DigestEngine.h" -Foundation_BEGIN +namespace Poco { class Foundation_API MD4Engine: public DigestEngine @@ -112,7 +108,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_MD5Engine_INCLUDED diff --git a/Foundation/include/Foundation/MD5Engine.h b/Foundation/include/Poco/MD5Engine.h similarity index 90% rename from Foundation/include/Foundation/MD5Engine.h rename to Foundation/include/Poco/MD5Engine.h index 3816cdae2..90d08437d 100644 --- a/Foundation/include/Foundation/MD5Engine.h +++ b/Foundation/include/Poco/MD5Engine.h @@ -1,7 +1,7 @@ // // MD5Engine.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/MD5Engine.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/MD5Engine.h#1 $ // // Library: Foundation // Package: Crypt @@ -63,15 +63,11 @@ #define Foundation_MD5Engine_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_DigestEngine_INCLUDED -#include "Foundation/DigestEngine.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/DigestEngine.h" -Foundation_BEGIN +namespace Poco { class Foundation_API MD5Engine: public DigestEngine @@ -112,7 +108,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_MD5Engine_INCLUDED diff --git a/Foundation/include/Foundation/Manifest.h b/Foundation/include/Poco/Manifest.h similarity index 88% rename from Foundation/include/Foundation/Manifest.h rename to Foundation/include/Poco/Manifest.h index b05096ecc..bcf25fe60 100644 --- a/Foundation/include/Foundation/Manifest.h +++ b/Foundation/include/Poco/Manifest.h @@ -1,7 +1,7 @@ // // Manifest.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Manifest.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Manifest.h#1 $ // // Library: Foundation // Package: SharedLibrary @@ -40,23 +40,13 @@ #define Foundation_Manifest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_MetaObject_INCLUDED -#include "Foundation/MetaObject.h" -#endif -#ifndef STD_MAP_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/MetaObject.h" #include -#define STD_MAP_INCLUDED -#endif -#ifndef STD_TYPEINFO_INCLUDED #include -#define STD_TYPEINFO_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API ManifestBase @@ -206,7 +196,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_Manifest_INCLUDED diff --git a/Foundation/include/Foundation/MemoryPool.h b/Foundation/include/Poco/MemoryPool.h similarity index 88% rename from Foundation/include/Foundation/MemoryPool.h rename to Foundation/include/Poco/MemoryPool.h index eaac5fb91..e49f799b3 100644 --- a/Foundation/include/Foundation/MemoryPool.h +++ b/Foundation/include/Poco/MemoryPool.h @@ -1,7 +1,7 @@ // // MemoryPool.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/MemoryPool.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/MemoryPool.h#1 $ // // Library: Foundation // Package: Core @@ -40,19 +40,12 @@ #define Foundation_MemoryPool_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Mutex_INCLUDED -#include "Foundation/Mutex.h" -#endif -#ifndef STD_VECTOR_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/Mutex.h" #include -#define STD_VECTOR_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API MemoryPool @@ -135,7 +128,7 @@ inline int MemoryPool::available() const } -Foundation_END +} // namespace Poco #endif // Foundation_MemoryPool_INCLUDED diff --git a/Foundation/include/Foundation/Message.h b/Foundation/include/Poco/Message.h similarity index 91% rename from Foundation/include/Foundation/Message.h rename to Foundation/include/Poco/Message.h index c470742d7..d7d8eb68f 100644 --- a/Foundation/include/Foundation/Message.h +++ b/Foundation/include/Poco/Message.h @@ -1,7 +1,7 @@ // // Message.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Message.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Message.h#1 $ // // Library: Foundation // Package: Logging @@ -40,19 +40,12 @@ #define Foundation_Message_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Timestamp_INCLUDED -#include "Foundation/Timestamp.h" -#endif -#ifndef STD_MAP_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/Timestamp.h" #include -#define STD_MAP_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API Message @@ -209,7 +202,7 @@ inline long Message::getPid() const } -Foundation_END +} // namespace Poco #endif // Foundation_Message_INCLUDED diff --git a/Foundation/include/Foundation/MetaObject.h b/Foundation/include/Poco/MetaObject.h similarity index 88% rename from Foundation/include/Foundation/MetaObject.h rename to Foundation/include/Poco/MetaObject.h index d476d08b7..78309c326 100644 --- a/Foundation/include/Foundation/MetaObject.h +++ b/Foundation/include/Poco/MetaObject.h @@ -1,7 +1,7 @@ // // MetaObject.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/MetaObject.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/MetaObject.h#1 $ // // Library: Foundation // Package: SharedLibrary @@ -40,22 +40,13 @@ #define Foundation_MetaObject_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Exception_INCLUDED -#include "Foundation/Exception.h" -#endif -#ifndef Foundation_SingletonHolder_INCLUDED -#include "Foundation/SingletonHolder.h" -#endif -#ifndef STD_SET_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/Exception.h" +#include "Poco/SingletonHolder.h" #include -#define STD_SET_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { template @@ -222,11 +213,11 @@ public: } private: - mutable Foundation::SingletonHolder _object; + mutable SingletonHolder _object; }; -Foundation_END +} // namespace Poco #endif // Foundation_MetaObject_INCLUDED diff --git a/Foundation/include/Foundation/Mutex.h b/Foundation/include/Poco/Mutex.h similarity index 86% rename from Foundation/include/Foundation/Mutex.h rename to Foundation/include/Poco/Mutex.h index 3fc80058d..ceb293ea8 100644 --- a/Foundation/include/Foundation/Mutex.h +++ b/Foundation/include/Poco/Mutex.h @@ -1,7 +1,7 @@ // // Mutex.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Mutex.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Mutex.h#1 $ // // Library: Foundation // Package: Threading @@ -40,22 +40,18 @@ #define Foundation_Mutex_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_ScopedLock_INCLUDED -#include "Foundation/ScopedLock.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/ScopedLock.h" #if defined(POCO_OS_FAMILY_WINDOWS) -#include "Foundation/Mutex_WIN32.h" +#include "Poco/Mutex_WIN32.h" #else -#include "Foundation/Mutex_POSIX.h" +#include "Poco/Mutex_POSIX.h" #endif -Foundation_BEGIN +namespace Poco { class Foundation_API Mutex: private MutexImpl @@ -69,7 +65,7 @@ class Foundation_API Mutex: private MutexImpl /// lock and unlock a mutex. { public: - typedef Foundation::ScopedLock ScopedLock; + typedef Poco::ScopedLock ScopedLock; Mutex(); /// creates the Mutex. @@ -106,7 +102,7 @@ class Foundation_API FastMutex: private FastMutexImpl /// lock and unlock a mutex. { public: - typedef Foundation::ScopedLock ScopedLock; + typedef Poco::ScopedLock ScopedLock; FastMutex(); /// creates the Mutex. @@ -172,7 +168,7 @@ inline void FastMutex::unlock() } -Foundation_END +} // namespace Poco #endif // Foundation_Mutex_INCLUDED diff --git a/Foundation/include/Foundation/Mutex_POSIX.h b/Foundation/include/Poco/Mutex_POSIX.h similarity index 83% rename from Foundation/include/Foundation/Mutex_POSIX.h rename to Foundation/include/Poco/Mutex_POSIX.h index 56c9903af..a9084bf57 100644 --- a/Foundation/include/Foundation/Mutex_POSIX.h +++ b/Foundation/include/Poco/Mutex_POSIX.h @@ -1,7 +1,7 @@ // // Mutex_POSIX.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Mutex_POSIX.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Mutex_POSIX.h#1 $ // // Library: Foundation // Package: Threading @@ -40,23 +40,13 @@ #define Foundation_Mutex_POSIX_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Exception_INCLUDED -#include "Foundation/Exception.h" -#endif -#ifndef STD_PTHREAD_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/Exception.h" #include -#define STD_PTHREAD_INCLUDED -#endif -#ifndef STD_ERRNO_INCLUDED #include -#define STD_ERRNO_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API MutexImpl @@ -112,7 +102,7 @@ inline void MutexImpl::unlockImpl() } -Foundation_END +} // namespace Poco #endif // Foundation_Mutex_POSIX_INCLUDED diff --git a/Foundation/include/Foundation/Mutex_WIN32.h b/Foundation/include/Poco/Mutex_WIN32.h similarity index 84% rename from Foundation/include/Foundation/Mutex_WIN32.h rename to Foundation/include/Poco/Mutex_WIN32.h index f3e3038e6..7dfbd270e 100644 --- a/Foundation/include/Foundation/Mutex_WIN32.h +++ b/Foundation/include/Poco/Mutex_WIN32.h @@ -1,7 +1,7 @@ // // Mutex_WIN32.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Mutex_WIN32.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Mutex_WIN32.h#1 $ // // Library: Foundation // Package: Threading @@ -40,19 +40,12 @@ #define Foundation_Mutex_WIN32_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Exception_INCLUDED -#include "Foundation/Exception.h" -#endif -#ifndef STD_WINDOWS_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/Exception.h" #include -#define STD_WINDOWS_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API MutexImpl @@ -107,7 +100,7 @@ inline void MutexImpl::unlockImpl() } -Foundation_END +} // namespace Poco #endif // Foundation_Mutex_WIN32_INCLUDED diff --git a/Foundation/include/Foundation/NamedEvent.h b/Foundation/include/Poco/NamedEvent.h similarity index 87% rename from Foundation/include/Foundation/NamedEvent.h rename to Foundation/include/Poco/NamedEvent.h index 066b64e60..9d66d7a46 100644 --- a/Foundation/include/Foundation/NamedEvent.h +++ b/Foundation/include/Poco/NamedEvent.h @@ -1,7 +1,7 @@ // // NamedEvent.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/NamedEvent.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/NamedEvent.h#1 $ // // Library: Foundation // Package: Processes @@ -40,22 +40,21 @@ #define Foundation_NamedEvent_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif +#include "Poco/Foundation.h" + #if defined(POCO_OS_FAMILY_WINDOWS) && defined(POCO_WIN32_UTF8) -#include "Foundation/NamedEvent_WIN32U.h" +#include "Poco/NamedEvent_WIN32U.h" #elif defined(POCO_OS_FAMILY_WINDOWS) -#include "Foundation/NamedEvent_WIN32.h" +#include "Poco/NamedEvent_WIN32.h" #elif defined(POCO_OS_FAMILY_UNIX) -#include "Foundation/NamedEvent_UNIX.h" +#include "Poco/NamedEvent_UNIX.h" #else -#include "Foundation/NamedEvent_VMS.h" +#include "Poco/NamedEvent_VMS.h" #endif -Foundation_BEGIN +namespace Poco { class Foundation_API NamedEvent: public NamedEventImpl @@ -113,7 +112,7 @@ inline void NamedEvent::wait() } -Foundation_END +} // namespace Poco #endif // Foundation_NamedEvent_INCLUDED diff --git a/Foundation/include/Foundation/NamedEvent_UNIX.h b/Foundation/include/Poco/NamedEvent_UNIX.h similarity index 89% rename from Foundation/include/Foundation/NamedEvent_UNIX.h rename to Foundation/include/Poco/NamedEvent_UNIX.h index a51b8dcdc..c824e24ce 100644 --- a/Foundation/include/Foundation/NamedEvent_UNIX.h +++ b/Foundation/include/Poco/NamedEvent_UNIX.h @@ -1,7 +1,7 @@ // // NamedEvent_UNIX.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/NamedEvent_UNIX.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/NamedEvent_UNIX.h#1 $ // // Library: Foundation // Package: Processes @@ -40,15 +40,13 @@ #define Foundation_NamedEvent_UNIX_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif +#include "Poco/Foundation.h" #if defined(sun) || defined(__APPLE__) || defined(__osf__) || defined(__QNX__) #include #endif -Foundation_BEGIN +namespace Poco { class Foundation_API NamedEventImpl @@ -73,7 +71,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_NamedEvent_UNIX_INCLUDED diff --git a/Foundation/include/Foundation/NamedEvent_VMS.h b/Foundation/include/Poco/NamedEvent_VMS.h similarity index 88% rename from Foundation/include/Foundation/NamedEvent_VMS.h rename to Foundation/include/Poco/NamedEvent_VMS.h index c7ea81c1f..314e0fc1b 100644 --- a/Foundation/include/Foundation/NamedEvent_VMS.h +++ b/Foundation/include/Poco/NamedEvent_VMS.h @@ -1,7 +1,7 @@ // // NamedEvent_VMS.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/NamedEvent_VMS.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/NamedEvent_VMS.h#1 $ // // Library: Foundation // Package: Processes @@ -40,12 +40,10 @@ #define Foundation_NamedEvent_VMS_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif +#include "Poco/Foundation.h" -Foundation_BEGIN +namespace Poco { class Foundation_API NamedEventImpl @@ -62,7 +60,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_NamedEvent_VMS_INCLUDED diff --git a/Foundation/include/Foundation/NamedEvent_WIN32.h b/Foundation/include/Poco/NamedEvent_WIN32.h similarity index 85% rename from Foundation/include/Foundation/NamedEvent_WIN32.h rename to Foundation/include/Poco/NamedEvent_WIN32.h index a0593be82..09cd3e75b 100644 --- a/Foundation/include/Foundation/NamedEvent_WIN32.h +++ b/Foundation/include/Poco/NamedEvent_WIN32.h @@ -1,7 +1,7 @@ // // NamedEvent_WIN32.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/NamedEvent_WIN32.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/NamedEvent_WIN32.h#1 $ // // Library: Foundation // Package: Processes @@ -40,16 +40,11 @@ #define Foundation_NamedEvent_WIN32_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef STD_WINDOWS_INCLUDED +#include "Poco/Foundation.h" #include -#define STD_WINDOWS_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API NamedEventImpl @@ -66,7 +61,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_NamedEvent_WIN32_INCLUDED diff --git a/Foundation/include/Foundation/NamedEvent_WIN32U.h b/Foundation/include/Poco/NamedEvent_WIN32U.h similarity index 86% rename from Foundation/include/Foundation/NamedEvent_WIN32U.h rename to Foundation/include/Poco/NamedEvent_WIN32U.h index e5d04b416..a12f55773 100644 --- a/Foundation/include/Foundation/NamedEvent_WIN32U.h +++ b/Foundation/include/Poco/NamedEvent_WIN32U.h @@ -1,7 +1,7 @@ // // NamedEvent_WIN32U.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/NamedEvent_WIN32U.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/NamedEvent_WIN32U.h#1 $ // // Library: Foundation // Package: Processes @@ -40,16 +40,11 @@ #define Foundation_NamedEvent_WIN32U_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef STD_WINDOWS_INCLUDED +#include "Poco/Foundation.h" #include -#define STD_WINDOWS_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API NamedEventImpl @@ -67,7 +62,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_NamedEvent_WIN32U_INCLUDED diff --git a/Foundation/include/Foundation/NamedMutex.h b/Foundation/include/Poco/NamedMutex.h similarity index 83% rename from Foundation/include/Foundation/NamedMutex.h rename to Foundation/include/Poco/NamedMutex.h index eb5275736..48da8b971 100644 --- a/Foundation/include/Foundation/NamedMutex.h +++ b/Foundation/include/Poco/NamedMutex.h @@ -1,7 +1,7 @@ // // NamedMutex.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/NamedMutex.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/NamedMutex.h#1 $ // // Library: Foundation // Package: Processes @@ -40,28 +40,22 @@ #define Foundation_NamedMutex_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_ScopedLock_INCLUDED -#include "Foundation/ScopedLock.h" -#endif -#include -#include +#include "Poco/Foundation.h" +#include "Poco/ScopedLock.h" #if defined(POCO_OS_FAMILY_WINDOWS) && defined(POCO_WIN32_UTF8) -#include "Foundation/NamedMutex_WIN32U.h" +#include "Poco/NamedMutex_WIN32U.h" #elif defined(POCO_OS_FAMILY_WINDOWS) -#include "Foundation/NamedMutex_WIN32.h" +#include "Poco/NamedMutex_WIN32.h" #elif defined(POCO_OS_FAMILY_UNIX) -#include "Foundation/NamedMutex_UNIX.h" +#include "Poco/NamedMutex_UNIX.h" #else -#include "Foundation/NamedMutex_VMS.h" +#include "Poco/NamedMutex_VMS.h" #endif -Foundation_BEGIN +namespace Poco { class Foundation_API NamedMutex: private NamedMutexImpl @@ -83,7 +77,7 @@ class Foundation_API NamedMutex: private NamedMutexImpl /// interfere with each other. { public: - typedef Foundation::ScopedLock ScopedLock; + typedef Poco::ScopedLock ScopedLock; NamedMutex(const std::string& name); /// creates the Mutex. @@ -132,7 +126,7 @@ inline void NamedMutex::unlock() } -Foundation_END +} // namespace Poco #endif // Foundation_NamedMutex_INCLUDED diff --git a/Foundation/include/Foundation/NamedMutex_UNIX.h b/Foundation/include/Poco/NamedMutex_UNIX.h similarity index 89% rename from Foundation/include/Foundation/NamedMutex_UNIX.h rename to Foundation/include/Poco/NamedMutex_UNIX.h index 6ae105e26..3f7631c1a 100644 --- a/Foundation/include/Foundation/NamedMutex_UNIX.h +++ b/Foundation/include/Poco/NamedMutex_UNIX.h @@ -1,7 +1,7 @@ // // NamedMutex_UNIX.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/NamedMutex_UNIX.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/NamedMutex_UNIX.h#1 $ // // Library: Foundation // Package: Processes @@ -40,15 +40,15 @@ #define Foundation_NamedMutex_UNIX_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif +#include "Poco/Foundation.h" +#include +#include #if defined(sun) || defined(__APPLE__) || defined(__osf__) || defined(__QNX__) #include #endif -Foundation_BEGIN +namespace Poco { class Foundation_API NamedMutexImpl @@ -74,7 +74,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_NamedMutex_UNIX_INCLUDED diff --git a/Foundation/include/Foundation/NamedMutex_VMS.h b/Foundation/include/Poco/NamedMutex_VMS.h similarity index 84% rename from Foundation/include/Foundation/NamedMutex_VMS.h rename to Foundation/include/Poco/NamedMutex_VMS.h index 5d4ebdc61..4dde0a069 100644 --- a/Foundation/include/Foundation/NamedMutex_VMS.h +++ b/Foundation/include/Poco/NamedMutex_VMS.h @@ -1,7 +1,7 @@ // // NamedMutex_VMS.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/NamedMutex_VMS.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/NamedMutex_VMS.h#1 $ // // Library: Foundation // Package: Processes @@ -40,20 +40,12 @@ #define Foundation_NamedMutex_VMS_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef STD_DESCRIP_INCLUDED +#include "Poco/Foundation.h" #include -#define STD_DESCRIP_INCLUDED -#endif -#ifndef STD_LCKDEF_INCLUDED #include -#define STD_LCKDEF_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API NamedMutexImpl @@ -72,7 +64,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_NamedMutex_VMS_INCLUDED diff --git a/Foundation/include/Foundation/NamedMutex_WIN32.h b/Foundation/include/Poco/NamedMutex_WIN32.h similarity index 86% rename from Foundation/include/Foundation/NamedMutex_WIN32.h rename to Foundation/include/Poco/NamedMutex_WIN32.h index b530f9fad..260ea1cdb 100644 --- a/Foundation/include/Foundation/NamedMutex_WIN32.h +++ b/Foundation/include/Poco/NamedMutex_WIN32.h @@ -1,7 +1,7 @@ // // NamedMutex_WIN32.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/NamedMutex_WIN32.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/NamedMutex_WIN32.h#1 $ // // Library: Foundation // Package: Processes @@ -40,16 +40,11 @@ #define Foundation_NamedMutex_WIN32_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef STD_WINDOWS_INCLUDED +#include "Poco/Foundation.h" #include -#define STD_WINDOWS_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API NamedMutexImpl @@ -67,7 +62,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_NamedMutex_WIN32_INCLUDED diff --git a/Foundation/include/Foundation/NamedMutex_WIN32U.h b/Foundation/include/Poco/NamedMutex_WIN32U.h similarity index 86% rename from Foundation/include/Foundation/NamedMutex_WIN32U.h rename to Foundation/include/Poco/NamedMutex_WIN32U.h index 15179f5da..576a059d1 100644 --- a/Foundation/include/Foundation/NamedMutex_WIN32U.h +++ b/Foundation/include/Poco/NamedMutex_WIN32U.h @@ -1,7 +1,7 @@ // // NamedMutex_WIN32U.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/NamedMutex_WIN32U.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/NamedMutex_WIN32U.h#1 $ // // Library: Foundation // Package: Processes @@ -40,16 +40,11 @@ #define Foundation_NamedMutex_WIN32U_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef STD_WINDOWS_INCLUDED +#include "Poco/Foundation.h" #include -#define STD_WINDOWS_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API NamedMutexImpl @@ -68,7 +63,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_NamedMutex_WIN32U_INCLUDED diff --git a/Foundation/include/Foundation/NestedDiagnosticContext.h b/Foundation/include/Poco/NestedDiagnosticContext.h similarity index 90% rename from Foundation/include/Foundation/NestedDiagnosticContext.h rename to Foundation/include/Poco/NestedDiagnosticContext.h index 46743abd6..86599cdf0 100644 --- a/Foundation/include/Foundation/NestedDiagnosticContext.h +++ b/Foundation/include/Poco/NestedDiagnosticContext.h @@ -1,7 +1,7 @@ // // NestedDiagnosticContext.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/NestedDiagnosticContext.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/NestedDiagnosticContext.h#1 $ // // Library: Foundation // Package: Core @@ -40,20 +40,12 @@ #define Foundation_NestedDiagnosticContext_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef STD_VECTOR_INCLUDED +#include "Poco/Foundation.h" #include -#define STD_VECTOR_INCLUDED -#endif -#ifndef STD_OSTREAM_INCLUDED #include -#define STD_OSTREAM_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class NDCScope; @@ -187,10 +179,10 @@ inline NDCScope::~NDCScope() // helper macros // #define poco_ndc(msg) \ - Foundation::NDCScope _theNdcScope(msg, __LINE__, __FILE__) + Poco::NDCScope _theNdcScope(msg, __LINE__, __FILE__) -Foundation_END +} // namespace Poco #endif // Foundation_NestedDiagnosticContext_INCLUDED diff --git a/Foundation/include/Foundation/Notification.h b/Foundation/include/Poco/Notification.h similarity index 83% rename from Foundation/include/Foundation/Notification.h rename to Foundation/include/Poco/Notification.h index 68f794c7f..6961a3c72 100644 --- a/Foundation/include/Foundation/Notification.h +++ b/Foundation/include/Poco/Notification.h @@ -1,7 +1,7 @@ // // Notification.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Notification.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Notification.h#1 $ // // Library: Foundation // Package: Notifications @@ -40,18 +40,12 @@ #define Foundation_Notification_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Mutex_INCLUDED -#include "Foundation/Mutex.h" -#endif -#ifndef Foundation_RefCountedObject_INCLUDED -#include "Foundation/RefCountedObject.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/Mutex.h" +#include "Poco/RefCountedObject.h" -Foundation_BEGIN +namespace Poco { class Foundation_API Notification: public RefCountedObject @@ -74,7 +68,7 @@ protected: }; -Foundation_END +} // namespace Poco #endif // Foundation_Notification_INCLUDED diff --git a/Foundation/include/Foundation/NotificationCenter.h b/Foundation/include/Poco/NotificationCenter.h similarity index 92% rename from Foundation/include/Foundation/NotificationCenter.h rename to Foundation/include/Poco/NotificationCenter.h index 863241e7d..2bfd686c1 100644 --- a/Foundation/include/Foundation/NotificationCenter.h +++ b/Foundation/include/Poco/NotificationCenter.h @@ -1,7 +1,7 @@ // // NotificationCenter.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/NotificationCenter.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/NotificationCenter.h#1 $ // // Library: Foundation // Package: Notifications @@ -40,19 +40,12 @@ #define Foundation_NotificationCenter_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Mutex_INCLUDED -#include "Foundation/Mutex.h" -#endif -#ifndef STD_LIST_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/Mutex.h" #include -#define STD_LIST_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Notification; @@ -143,7 +136,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_NotificationCenter_INCLUDED diff --git a/Foundation/include/Foundation/NotificationQueue.h b/Foundation/include/Poco/NotificationQueue.h similarity index 90% rename from Foundation/include/Foundation/NotificationQueue.h rename to Foundation/include/Poco/NotificationQueue.h index 60b7403c9..d9034b5fc 100644 --- a/Foundation/include/Foundation/NotificationQueue.h +++ b/Foundation/include/Poco/NotificationQueue.h @@ -1,7 +1,7 @@ // // NotificationQueue.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/NotificationQueue.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/NotificationQueue.h#1 $ // // Library: Foundation // Package: Notifications @@ -40,22 +40,13 @@ #define Foundation_NotificationQueue_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Mutex_INCLUDED -#include "Foundation/Mutex.h" -#endif -#ifndef Foundation_Event_INCLUDED -#include "Foundation/Event.h" -#endif -#ifndef STD_DEQUE_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/Mutex.h" +#include "Poco/Event.h" #include -#define STD_DEQUE_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Notification; @@ -168,7 +159,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_NotificationQueue_INCLUDED diff --git a/Foundation/include/Foundation/NotificationStrategy.h b/Foundation/include/Poco/NotificationStrategy.h similarity index 91% rename from Foundation/include/Foundation/NotificationStrategy.h rename to Foundation/include/Poco/NotificationStrategy.h index ace6d25bb..ef8ceaad8 100644 --- a/Foundation/include/Foundation/NotificationStrategy.h +++ b/Foundation/include/Poco/NotificationStrategy.h @@ -1,7 +1,7 @@ // // NotificationStrategy.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/NotificationStrategy.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/NotificationStrategy.h#1 $ // // Library: Foundation // Package: Events @@ -40,10 +40,10 @@ #define Foundation_NotificationStrategy_INCLUDED -#include "Foundation/Foundation.h" +#include "Poco/Foundation.h" -Foundation_BEGIN +namespace Poco { template @@ -73,7 +73,7 @@ public: }; -Foundation_END +} // namespace Poco #endif diff --git a/Foundation/include/Foundation/NullChannel.h b/Foundation/include/Poco/NullChannel.h similarity index 87% rename from Foundation/include/Foundation/NullChannel.h rename to Foundation/include/Poco/NullChannel.h index 01f824fe3..55acc269d 100644 --- a/Foundation/include/Foundation/NullChannel.h +++ b/Foundation/include/Poco/NullChannel.h @@ -1,7 +1,7 @@ // // NullChannel.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/NullChannel.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/NullChannel.h#1 $ // // Library: Foundation // Package: Logging @@ -40,15 +40,11 @@ #define Foundation_NullChannel_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Channel_INCLUDED -#include "Foundation/Channel.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/Channel.h" -Foundation_BEGIN +namespace Poco { class Foundation_API NullChannel: public Channel @@ -75,7 +71,7 @@ public: }; -Foundation_END +} // namespace Poco #endif // Foundation_NullChannel_INCLUDED diff --git a/Foundation/include/Foundation/NullStream.h b/Foundation/include/Poco/NullStream.h similarity index 84% rename from Foundation/include/Foundation/NullStream.h rename to Foundation/include/Poco/NullStream.h index 74b545722..541eff638 100644 --- a/Foundation/include/Foundation/NullStream.h +++ b/Foundation/include/Poco/NullStream.h @@ -1,7 +1,7 @@ // // NullStream.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/NullStream.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/NullStream.h#1 $ // // Library: Foundation // Package: Streams @@ -40,23 +40,13 @@ #define Foundation_NullStream_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_UnbufferedStreamBuf_INCLUDED -#include "Foundation/UnbufferedStreamBuf.h" -#endif -#ifndef STD_ISTREAM_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/UnbufferedStreamBuf.h" #include -#define STD_ISTREAM_INCLUDED -#endif -#ifndef STD_OSTREAM_INCLUDED #include -#define STD_OSTREAM_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API NullStreamBuf: public UnbufferedStreamBuf @@ -116,7 +106,7 @@ public: }; -Foundation_END +} // namespace Poco #endif // Foundation_NullStream_INCLUDED diff --git a/Foundation/include/Foundation/NumberFormatter.h b/Foundation/include/Poco/NumberFormatter.h similarity index 95% rename from Foundation/include/Foundation/NumberFormatter.h rename to Foundation/include/Poco/NumberFormatter.h index 6ffe94c03..d9baf5e3f 100644 --- a/Foundation/include/Foundation/NumberFormatter.h +++ b/Foundation/include/Poco/NumberFormatter.h @@ -1,7 +1,7 @@ // // NumberFormatter.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/NumberFormatter.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/NumberFormatter.h#1 $ // // Library: Foundation // Package: Core @@ -40,12 +40,10 @@ #define Foundation_NumberFormatter_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif +#include "Poco/Foundation.h" -Foundation_BEGIN +namespace Poco { class Foundation_API NumberFormatter @@ -211,7 +209,7 @@ public: }; -Foundation_END +} // namespace Poco #endif // Foundation_NumberFormatter_INCLUDED diff --git a/Foundation/include/Foundation/NumberParser.h b/Foundation/include/Poco/NumberParser.h similarity index 94% rename from Foundation/include/Foundation/NumberParser.h rename to Foundation/include/Poco/NumberParser.h index 38276e911..15b3b1d50 100644 --- a/Foundation/include/Foundation/NumberParser.h +++ b/Foundation/include/Poco/NumberParser.h @@ -1,7 +1,7 @@ // // NumberParser.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/NumberParser.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/NumberParser.h#1 $ // // Library: Foundation // Package: Core @@ -40,12 +40,10 @@ #define Foundation_NumberParser_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif +#include "Poco/Foundation.h" -Foundation_BEGIN +namespace Poco { class Foundation_API NumberParser @@ -120,7 +118,7 @@ public: }; -Foundation_END +} // namespace Poco #endif // Foundation_NumberParser_INCLUDED diff --git a/Foundation/include/Foundation/Observer.h b/Foundation/include/Poco/Observer.h similarity index 86% rename from Foundation/include/Foundation/Observer.h rename to Foundation/include/Poco/Observer.h index 2415d6ae6..a68de2684 100644 --- a/Foundation/include/Foundation/Observer.h +++ b/Foundation/include/Poco/Observer.h @@ -1,7 +1,7 @@ // // Observer.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Observer.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Observer.h#1 $ // // Library: Foundation // Package: Notifications @@ -40,15 +40,11 @@ #define Foundation_Observer_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Notification_INCLUDED -#include "Foundation/Notification.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/Notification.h" -Foundation_BEGIN +namespace Poco { class Foundation_API AbstractObserver @@ -82,11 +78,16 @@ class Observer: public AbstractObserver public: typedef void (C::*Callback)(N*); - Observer(C& object, Callback method): _pObject(&object), _method(method) + Observer(C& object, Callback method): + _pObject(&object), + _method(method) { } - Observer(const Observer& observer): _pObject(observer._pObject), _method(observer._method) + Observer(const Observer& observer): + AbstractObserver(observer), + _pObject(observer._pObject), + _method(observer._method) { } @@ -138,7 +139,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_Observer_INCLUDED diff --git a/Foundation/include/Foundation/OpcomChannel.h b/Foundation/include/Poco/OpcomChannel.h similarity index 89% rename from Foundation/include/Foundation/OpcomChannel.h rename to Foundation/include/Poco/OpcomChannel.h index a231e27e2..13e997d17 100644 --- a/Foundation/include/Foundation/OpcomChannel.h +++ b/Foundation/include/Poco/OpcomChannel.h @@ -1,7 +1,7 @@ // // OpcomChannel.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/OpcomChannel.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/OpcomChannel.h#1 $ // // Library: Foundation // Package: Logging @@ -40,15 +40,11 @@ #define Foundation_OpcomChannel_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Channel_INCLUDED -#include "Foundation/Channel.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/Channel.h" -Foundation_BEGIN +namespace Poco { class Foundation_API OpcomChannel: public Channel @@ -100,7 +96,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_OpcomChannel_INCLUDED diff --git a/Foundation/include/Foundation/Path.h b/Foundation/include/Poco/Path.h similarity index 94% rename from Foundation/include/Foundation/Path.h rename to Foundation/include/Poco/Path.h index ec20f8c8c..a231acc0e 100644 --- a/Foundation/include/Foundation/Path.h +++ b/Foundation/include/Poco/Path.h @@ -1,7 +1,7 @@ // // Path.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Path.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Path.h#1 $ // // Library: Foundation // Package: Filesystem @@ -40,16 +40,11 @@ #define Foundation_Path_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef STD_VECTOR_INCLUDED +#include "Poco/Foundation.h" #include -#define STD_VECTOR_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API Path @@ -475,7 +470,7 @@ inline void swap(Path& p1, Path& p2) } -Foundation_END +} // namespace Poco #endif // Foundation_Path_INCLUDED diff --git a/Foundation/include/Foundation/Path_UNIX.h b/Foundation/include/Poco/Path_UNIX.h similarity index 86% rename from Foundation/include/Foundation/Path_UNIX.h rename to Foundation/include/Poco/Path_UNIX.h index bb35b8763..60320f47b 100644 --- a/Foundation/include/Foundation/Path_UNIX.h +++ b/Foundation/include/Poco/Path_UNIX.h @@ -1,7 +1,7 @@ // // Path_UNIX.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Path_UNIX.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Path_UNIX.h#1 $ // // Library: Foundation // Package: Filesystem @@ -40,16 +40,11 @@ #define Foundation_Path_UNIX_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef STD_VECTOR_INCLUDED +#include "Poco/Foundation.h" #include -#define STD_VECTOR_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class PathImpl @@ -64,7 +59,7 @@ public: }; -Foundation_END +} // namespace Poco #endif // Foundation_Path_UNIX_INCLUDED diff --git a/Foundation/include/Foundation/Path_VMS.h b/Foundation/include/Poco/Path_VMS.h similarity index 86% rename from Foundation/include/Foundation/Path_VMS.h rename to Foundation/include/Poco/Path_VMS.h index d813eeef9..3c0aa8454 100644 --- a/Foundation/include/Foundation/Path_VMS.h +++ b/Foundation/include/Poco/Path_VMS.h @@ -1,7 +1,7 @@ // // Path_VMS.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Path_VMS.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Path_VMS.h#1 $ // // Library: Foundation // Package: Filesystem @@ -40,16 +40,11 @@ #define Foundation_Path_VMS_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef STD_VECTOR_INCLUDED +#include "Poco/Foundation.h" #include -#define STD_VECTOR_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class PathImpl @@ -64,7 +59,7 @@ public: }; -Foundation_END +} // namespace Poco #endif // Foundation_Path_VMS_INCLUDED diff --git a/Foundation/include/Foundation/Path_WIN32.h b/Foundation/include/Poco/Path_WIN32.h similarity index 86% rename from Foundation/include/Foundation/Path_WIN32.h rename to Foundation/include/Poco/Path_WIN32.h index 06dafb7d9..196b4387c 100644 --- a/Foundation/include/Foundation/Path_WIN32.h +++ b/Foundation/include/Poco/Path_WIN32.h @@ -1,7 +1,7 @@ // // Path_WIN32.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Path_WIN32.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Path_WIN32.h#1 $ // // Library: Foundation // Package: Filesystem @@ -40,16 +40,11 @@ #define Foundation_Path_WIN32_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef STD_VECTOR_INCLUDED +#include "Poco/Foundation.h" #include -#define STD_VECTOR_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API PathImpl @@ -64,7 +59,7 @@ public: }; -Foundation_END +} // namespace Poco #endif // Foundation_Path_WIN32_INCLUDED diff --git a/Foundation/include/Foundation/Path_WIN32U.h b/Foundation/include/Poco/Path_WIN32U.h similarity index 86% rename from Foundation/include/Foundation/Path_WIN32U.h rename to Foundation/include/Poco/Path_WIN32U.h index 5114628e1..abf5e4a7e 100644 --- a/Foundation/include/Foundation/Path_WIN32U.h +++ b/Foundation/include/Poco/Path_WIN32U.h @@ -1,7 +1,7 @@ // // Path_WIN32U.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Path_WIN32U.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Path_WIN32U.h#1 $ // // Library: Foundation // Package: Filesystem @@ -40,16 +40,11 @@ #define Foundation_Path_WIN32U_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef STD_VECTOR_INCLUDED +#include "Poco/Foundation.h" #include -#define STD_VECTOR_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API PathImpl @@ -69,7 +64,7 @@ public: }; -Foundation_END +} // namespace Poco #endif // Foundation_Path_WIN32U_INCLUDED diff --git a/Foundation/include/Foundation/PatternFormatter.h b/Foundation/include/Poco/PatternFormatter.h similarity index 91% rename from Foundation/include/Foundation/PatternFormatter.h rename to Foundation/include/Poco/PatternFormatter.h index 1ecf72b5b..d59b918b4 100644 --- a/Foundation/include/Foundation/PatternFormatter.h +++ b/Foundation/include/Poco/PatternFormatter.h @@ -1,7 +1,7 @@ // // PatternFormatter.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/PatternFormatter.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/PatternFormatter.h#1 $ // // Library: Foundation // Package: Logging @@ -40,18 +40,12 @@ #define Foundation_PatternFormatter_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Formatter_INCLUDED -#include "Foundation/Formatter.h" -#endif -#ifndef Foundation_Message_INCLUDED -#include "Foundation/Message.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/Formatter.h" +#include "Poco/Message.h" -Foundation_BEGIN +namespace Poco { class Foundation_API PatternFormatter: public Formatter @@ -145,7 +139,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_PatternFormatter_INCLUDED diff --git a/Foundation/include/Poco/Pipe.h b/Foundation/include/Poco/Pipe.h new file mode 100644 index 000000000..36477932f --- /dev/null +++ b/Foundation/include/Poco/Pipe.h @@ -0,0 +1,164 @@ +// +// Pipe.h +// +// $Id: //poco/1.2/Foundation/include/Poco/Pipe.h#1 $ +// +// Library: Foundation +// Package: Processes +// Module: Pipe +// +// Definition of the Pipe class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef Foundation_Pipe_INCLUDED +#define Foundation_Pipe_INCLUDED + + +#include "Poco/Foundation.h" +#include "Poco/PipeImpl.h" + + +namespace Poco { + + +class Foundation_API Pipe + /// This class implements an anonymous pipe. + /// + /// Pipes are a common method of inter-process communication - + /// on Unix, pipes are the oldest form of IPC. + /// + /// A pipe is a half-duplex communication channel, which means + /// that data only flows in one direction. + /// Pipes have a read-end and a write-end. One process writes to + /// the pipe and another process reads the data written by + /// its peer. + /// Read and write operations are always synchronous. A read will + /// block until data is available and a write will block until + /// the reader reads the data. + /// + /// The sendBytes() and readBytes() methods of Pipe are usually + /// used through a PipeOutputStream or PipeInputStream and are + /// not called directly. + /// + /// Pipe objects have value semantics; the actual work is delegated + /// to a reference-counted PipeImpl object. +{ +public: + typedef PipeImpl::Handle Handle; /// The read/write handle or file descriptor. + + enum CloseMode /// used by close() + { + CLOSE_READ = 0x01, /// Close reading end of pipe. + CLOSE_WRITE = 0x02, /// Close writing end of pipe. + CLOSE_BOTH = 0x03 /// Close both ends of pipe. + }; + + Pipe(); + /// Creates the Pipe. + /// + /// Throws a CreateFileException if the pipe cannot be + /// created. + + Pipe(const Pipe& pipe); + /// Creates the Pipe using the PipeImpl from another one. + + ~Pipe(); + /// Closes and destroys the Pipe. + + Pipe& operator = (const Pipe& pipe); + /// Releases the Pipe's PipeImpl and assigns another one. + + int writeBytes(const void* buffer, int length); + /// Sends the contents of the given buffer through + /// the pipe. Blocks until the receiver is ready + /// to read the data. + /// + /// Returns the number of bytes sent. + /// + /// Throws a WriteFileException if the data cannot be written. + + int readBytes(void* buffer, int length); + /// Receives data from the pipe and stores it + /// in buffer. Up to length bytes are received. + /// Blocks until data becomes available. + /// + /// Returns the number of bytes received, or 0 + /// if the pipe has been closed. + /// + /// Throws a ReadFileException if nothing can be read. + + Handle readHandle() const; + /// Returns the read handle or file descriptor + /// for the Pipe. For internal use only. + + Handle writeHandle() const; + /// Returns the write handle or file descriptor + /// for the Pipe. For internal use only. + + void close(CloseMode mode = CLOSE_BOTH); + /// Depending on the argument, closes either the + /// reading end, the writing end, or both ends + /// of the Pipe. + +private: + PipeImpl* _pImpl; +}; + + +// +// inlines +// +inline int Pipe::writeBytes(const void* buffer, int length) +{ + return _pImpl->writeBytes(buffer, length); +} + + +inline int Pipe::readBytes(void* buffer, int length) +{ + return _pImpl->readBytes(buffer, length); +} + + +inline Pipe::Handle Pipe::readHandle() const +{ + return _pImpl->readHandle(); +} + + +inline Pipe::Handle Pipe::writeHandle() const +{ + return _pImpl->writeHandle(); +} + + +} // namespace Poco + + +#endif // Foundation_Pipe_INCLUDED diff --git a/Foundation/include/Poco/PipeImpl.h b/Foundation/include/Poco/PipeImpl.h new file mode 100644 index 000000000..fa9030dc5 --- /dev/null +++ b/Foundation/include/Poco/PipeImpl.h @@ -0,0 +1,55 @@ +// +// PipeImpl.h +// +// $Id: //poco/1.2/Foundation/include/Poco/PipeImpl.h#1 $ +// +// Library: Foundation +// Package: Processes +// Module: PipeImpl +// +// Definition of the PipeImpl class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef Foundation_PipeImpl_INCLUDED +#define Foundation_PipeImpl_INCLUDED + + +#include "Poco/Foundation.h" + + +#if defined(POCO_OS_FAMILY_WINDOWS) +#include "Poco/PipeImpl_WIN32.h" +#elif defined(POCO_OS_FAMILY_UNIX) +#include "Poco/PipeImpl_POSIX.h" +#else +#include "Poco/PipeImpl_DUMMY.h" +#endif + + +#endif // Foundation_PipeImpl_INCLUDED diff --git a/Foundation/include/Poco/PipeImpl_DUMMY.h b/Foundation/include/Poco/PipeImpl_DUMMY.h new file mode 100644 index 000000000..b01e14b27 --- /dev/null +++ b/Foundation/include/Poco/PipeImpl_DUMMY.h @@ -0,0 +1,71 @@ +// +// PipeImpl_DUMMY.h +// +// $Id: //poco/1.2/Foundation/include/Poco/PipeImpl_DUMMY.h#1 $ +// +// Library: Foundation +// Package: Processes +// Module: PipeImpl +// +// Definition of the PipeImpl_DUMMY class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef Foundation_PipeImpl_DUMMY_INCLUDED +#define Foundation_PipeImpl_DUMMY_INCLUDED + + +#include "Poco/Foundation.h" +#include "Poco/RefCountedObject.h" + + +namespace Poco { + + +class Foundation_API PipeImpl: public RefCountedObject + /// A dummy implementation of PipeImpl for platforms + /// that do not support pipes. +{ +public: + typedef int Handle; + + PipeImpl(); + ~PipeImpl(); + int writeBytes(const void* buffer, int length); + int readBytes(void* buffer, int length); + Handle readHandle() const; + Handle writeHandle() const; + void closeRead(); + void closeWrite(); +}; + + +} // namespace Poco + + +#endif // Foundation_PipeImpl_DUMMY_INCLUDED diff --git a/Foundation/include/Poco/PipeImpl_POSIX.h b/Foundation/include/Poco/PipeImpl_POSIX.h new file mode 100644 index 000000000..b6b4bc455 --- /dev/null +++ b/Foundation/include/Poco/PipeImpl_POSIX.h @@ -0,0 +1,75 @@ +// +// PipeImpl_POSIX.h +// +// $Id: //poco/1.2/Foundation/include/Poco/PipeImpl_POSIX.h#1 $ +// +// Library: Foundation +// Package: Processes +// Module: PipeImpl +// +// Definition of the PipeImpl class for POSIX. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef Foundation_PipeImpl_POSIX_INCLUDED +#define Foundation_PipeImpl_POSIX_INCLUDED + + +#include "Poco/Foundation.h" +#include "Poco/RefCountedObject.h" + + +namespace Poco { + + +class Foundation_API PipeImpl: public RefCountedObject + /// A dummy implementation of PipeImpl for platforms + /// that do not support pipes. +{ +public: + typedef int Handle; + + PipeImpl(); + ~PipeImpl(); + int writeBytes(const void* buffer, int length); + int readBytes(void* buffer, int length); + Handle readHandle() const; + Handle writeHandle() const; + void closeRead(); + void closeWrite(); + +private: + int _readfd; + int _writefd; +}; + + +} // namespace Poco + + +#endif // Foundation_PipeImpl_POSIX_INCLUDED diff --git a/Foundation/include/Poco/PipeImpl_WIN32.h b/Foundation/include/Poco/PipeImpl_WIN32.h new file mode 100644 index 000000000..cb7d60318 --- /dev/null +++ b/Foundation/include/Poco/PipeImpl_WIN32.h @@ -0,0 +1,76 @@ +// +// PipeImpl_WIN32.h +// +// $Id: //poco/1.2/Foundation/include/Poco/PipeImpl_WIN32.h#1 $ +// +// Library: Foundation +// Package: Processes +// Module: PipeImpl +// +// Definition of the PipeImpl class for WIN32. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef Foundation_PipeImpl_WIN32_INCLUDED +#define Foundation_PipeImpl_WIN32_INCLUDED + + +#include "Poco/Foundation.h" +#include "Poco/RefCountedObject.h" +#include + + +namespace Poco { + + +class Foundation_API PipeImpl: public RefCountedObject + /// A dummy implementation of PipeImpl for platforms + /// that do not support pipes. +{ +public: + typedef HANDLE Handle; + + PipeImpl(); + ~PipeImpl(); + int writeBytes(const void* buffer, int length); + int readBytes(void* buffer, int length); + Handle readHandle() const; + Handle writeHandle() const; + void closeRead(); + void closeWrite(); + +private: + HANDLE _readHandle; + HANDLE _writeHandle; +}; + + +} // namespace Poco + + +#endif // Foundation_PipeImpl_WIN32_INCLUDED diff --git a/Foundation/include/Poco/PipeStream.h b/Foundation/include/Poco/PipeStream.h new file mode 100644 index 000000000..c856ac2b2 --- /dev/null +++ b/Foundation/include/Poco/PipeStream.h @@ -0,0 +1,142 @@ +// +// PipeStream.h +// +// $Id: //poco/1.2/Foundation/include/Poco/PipeStream.h#1 $ +// +// Library: Foundation +// Package: Processes +// Module: PipeStream +// +// Definition of the PipeStream class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef Foundation_PipeStream_INCLUDED +#define Foundation_PipeStream_INCLUDED + + +#include "Poco/Foundation.h" +#include "Poco/Pipe.h" +#include "Poco/BufferedStreamBuf.h" +#include +#include + + +namespace Poco { + + +class Foundation_API PipeStreamBuf: public BufferedStreamBuf + /// This is the streambuf class used for reading from and writing to a Pipe. +{ +public: + typedef BufferedStreamBuf::openmode openmode; + + PipeStreamBuf(const Pipe& pipe, openmode mode); + /// Creates a PipeStreamBuf with the given Pipe. + + ~PipeStreamBuf(); + /// Destroys the PipeStreamBuf. + + void close(); + /// Closes the pipe. + +protected: + int readFromDevice(char* buffer, std::streamsize length); + int writeToDevice(const char* buffer, std::streamsize length); + +private: + enum + { + STREAM_BUFFER_SIZE = 1024 + }; + + Pipe _pipe; +}; + + +class Foundation_API PipeIOS: public virtual std::ios + /// The base class for PipeInputStream and + /// PipeOutputStream. + /// + /// This class is needed to ensure the correct initialization + /// order of the stream buffer and base classes. +{ +public: + PipeIOS(const Pipe& pipe, openmode mode); + /// Creates the PipeIOS with the given Pipe. + + ~PipeIOS(); + /// Destroys the PipeIOS. + /// + /// Flushes the buffer, but does not close the pipe. + + PipeStreamBuf* rdbuf(); + /// Returns a pointer to the internal PipeStreamBuf. + + void close(); + /// Flushes the stream and closes the pipe. + +protected: + PipeStreamBuf _buf; +}; + + +class Foundation_API PipeOutputStream: public PipeIOS, public std::ostream + /// An output stream for writing to a Pipe. +{ +public: + PipeOutputStream(const Pipe& pipe); + /// Creates the PipeOutputStream with the given Pipe. + + ~PipeOutputStream(); + /// Destroys the PipeOutputStream. + /// + /// Flushes the buffer, but does not close the pipe. +}; + + +class Foundation_API PipeInputStream: public PipeIOS, public std::istream + /// An input stream for reading from a Pipe. + /// + /// Using formatted input from a PipeInputStream + /// is not recommended, due to the read-ahead behavior of + /// istream with formatted reads. +{ +public: + PipeInputStream(const Pipe& pipe); + /// Creates the PipeInputStream with the given Pipe. + + ~PipeInputStream(); + /// Destroys the PipeInputStream. +}; + + +} // namespace Poco + + +#endif // Foundation_PipeStream_INCLUDED diff --git a/Foundation/include/Foundation/Platform.h b/Foundation/include/Poco/Platform.h similarity index 96% rename from Foundation/include/Foundation/Platform.h rename to Foundation/include/Poco/Platform.h index 5375c7420..b638bb538 100644 --- a/Foundation/include/Foundation/Platform.h +++ b/Foundation/include/Poco/Platform.h @@ -1,7 +1,7 @@ // // Platform.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Platform.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Platform.h#1 $ // // Library: Foundation // Package: Core @@ -102,9 +102,6 @@ #elif defined(__QNX__) #define POCO_OS_FAMILY_UNIX 1 #define POCO_OS POCO_OS_QNX -#elif defined(__CYGWIN__) - #define POCO_OS_FAMILY_UNIX 1 - #define POCO_OS POCO_OS_CYGWIN #elif defined(unix) || defined(__unix) || defined(__unix__) #define POCO_OS_FAMILY_UNIX 1 #define POCO_OS POCO_OS_UNKNOWN_UNIX @@ -114,6 +111,9 @@ #elif defined(_WIN32) || defined(_WIN64) #define POCO_OS_FAMILY_WINDOWS 1 #define POCO_OS POCO_OS_WINDOWS_NT +#elif defined(__CYGWIN__) + #define POCO_OS_FAMILY_UNIX 1 + #define POCO_OS POCO_OS_CYGWIN #elif defined(__VMS) #define POCO_OS_FAMILY_VMS 1 #define POCO_OS POCO_OS_VMS diff --git a/Foundation/include/Foundation/Platform_POSIX.h b/Foundation/include/Poco/Platform_POSIX.h similarity index 94% rename from Foundation/include/Foundation/Platform_POSIX.h rename to Foundation/include/Poco/Platform_POSIX.h index 7b201f851..c87e24c1f 100644 --- a/Foundation/include/Foundation/Platform_POSIX.h +++ b/Foundation/include/Poco/Platform_POSIX.h @@ -1,7 +1,7 @@ // // Platform_POSIX.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Platform_POSIX.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Platform_POSIX.h#1 $ // // Library: Foundation // Package: Core diff --git a/Foundation/include/Foundation/Platform_VMS.h b/Foundation/include/Poco/Platform_VMS.h similarity index 94% rename from Foundation/include/Foundation/Platform_VMS.h rename to Foundation/include/Poco/Platform_VMS.h index a97e04816..27b23b73d 100644 --- a/Foundation/include/Foundation/Platform_VMS.h +++ b/Foundation/include/Poco/Platform_VMS.h @@ -1,7 +1,7 @@ // // Platform_VMS.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Platform_VMS.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Platform_VMS.h#1 $ // // Library: Foundation // Package: Core diff --git a/Foundation/include/Foundation/Platform_WIN32.h b/Foundation/include/Poco/Platform_WIN32.h similarity index 89% rename from Foundation/include/Foundation/Platform_WIN32.h rename to Foundation/include/Poco/Platform_WIN32.h index 6c39740a4..d00ae3079 100644 --- a/Foundation/include/Foundation/Platform_WIN32.h +++ b/Foundation/include/Poco/Platform_WIN32.h @@ -1,7 +1,7 @@ // // Platform_WIN32.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Platform_WIN32.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Platform_WIN32.h#1 $ // // Library: Foundation // Package: Core @@ -65,6 +65,15 @@ #endif +// Unicode Support +#if defined(UNICODE) && !defined(POCO_WIN32_UTF8) +#define POCO_WIN32_UTF8 +#endif +#if defined(POCO_WIN32_UTF8) && !defined(UNICODE) +#define UNICODE +#endif + + // Turn off some annoying warnings #if defined(_MSC_VER) #pragma warning(disable:4018) // signed/unsigned comparison diff --git a/Foundation/include/Poco/Poco.h b/Foundation/include/Poco/Poco.h new file mode 100644 index 000000000..4d55fb490 --- /dev/null +++ b/Foundation/include/Poco/Poco.h @@ -0,0 +1,46 @@ +// +// Poco.h +// +// $Id: //poco/1.2/Foundation/include/Poco/Poco.h#1 $ +// +// Library: Foundation +// Package: Core +// Module: Foundation +// +// Basic definitions for the POCO libraries. +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef Foundation_Poco_INCLUDED +#define Foundation_Poco_INCLUDED + + +#include "Poco/Foundation.h" + + +#endif // Foundation_Poco_INCLUDED diff --git a/Foundation/include/Foundation/PriorityDelegate.h b/Foundation/include/Poco/PriorityDelegate.h similarity index 90% rename from Foundation/include/Foundation/PriorityDelegate.h rename to Foundation/include/Poco/PriorityDelegate.h index abb60e162..e10db8bb8 100644 --- a/Foundation/include/Foundation/PriorityDelegate.h +++ b/Foundation/include/Poco/PriorityDelegate.h @@ -1,7 +1,7 @@ // // PriorityDelegate.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/PriorityDelegate.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/PriorityDelegate.h#1 $ // // Library: Foundation // Package: Events @@ -40,12 +40,12 @@ #define Foundation_PriorityDelegate_INCLUDED -#include "Foundation/Foundation.h" -#include "Foundation/AbstractPriorityDelegate.h" -#include "Foundation/PriorityExpire.h" +#include "Poco/Foundation.h" +#include "Poco/AbstractPriorityDelegate.h" +#include "Poco/PriorityExpire.h" -Foundation_BEGIN +namespace Poco { template @@ -129,7 +129,7 @@ private: }; -Foundation_END +} // namespace Poco #endif diff --git a/Foundation/include/Foundation/PriorityEvent.h b/Foundation/include/Poco/PriorityEvent.h similarity index 88% rename from Foundation/include/Foundation/PriorityEvent.h rename to Foundation/include/Poco/PriorityEvent.h index d3e5f8b55..af20a5fa8 100644 --- a/Foundation/include/Foundation/PriorityEvent.h +++ b/Foundation/include/Poco/PriorityEvent.h @@ -1,7 +1,7 @@ // // PriorityEvent.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/PriorityEvent.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/PriorityEvent.h#1 $ // // Library: Foundation // Package: Events @@ -40,13 +40,13 @@ #define Foundation_PriorityEvent_INCLUDED -#include "Foundation/AbstractEvent.h" -#include "Foundation/DefaultStrategy.h" -#include "Foundation/AbstractPriorityDelegate.h" -#include "Foundation/CompareFunctions.h" +#include "Poco/AbstractEvent.h" +#include "Poco/DefaultStrategy.h" +#include "Poco/AbstractPriorityDelegate.h" +#include "Poco/CompareFunctions.h" -Foundation_BEGIN +namespace Poco { template @@ -84,7 +84,7 @@ private: }; -Foundation_END +} // namespace Poco #endif diff --git a/Foundation/include/Foundation/PriorityExpire.h b/Foundation/include/Poco/PriorityExpire.h similarity index 83% rename from Foundation/include/Foundation/PriorityExpire.h rename to Foundation/include/Poco/PriorityExpire.h index ba80026ce..b90c774c3 100644 --- a/Foundation/include/Foundation/PriorityExpire.h +++ b/Foundation/include/Poco/PriorityExpire.h @@ -1,7 +1,7 @@ // // PriorityExpire.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/PriorityExpire.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/PriorityExpire.h#1 $ // // Library: Foundation // Package: Events @@ -40,12 +40,12 @@ #define Foundation_PriorityExpire_INCLUDED -#include "Foundation/Foundation.h" -#include "Foundation/Timestamp.h" -#include "Foundation/AbstractPriorityDelegate.h" +#include "Poco/Foundation.h" +#include "Poco/Timestamp.h" +#include "Poco/AbstractPriorityDelegate.h" -Foundation_BEGIN +namespace Poco { template @@ -54,7 +54,7 @@ class PriorityExpire: public AbstractPriorityDelegate /// expiring of registrations to AbstractPriorityDelegate. { public: - PriorityExpire(const AbstractPriorityDelegate& p, Foundation::Timestamp::TimeDiff expireMilliSec): + PriorityExpire(const AbstractPriorityDelegate& p, Timestamp::TimeDiff expireMilliSec): _pDelegate(p.clone()), _expire(expireMilliSec*1000) { @@ -119,7 +119,7 @@ public: } protected: - PriorityExpire(AbstractPriorityDelegate* p, Foundation::Timestamp::TimeDiff expireMilliSec): + PriorityExpire(AbstractPriorityDelegate* p, Timestamp::TimeDiff expireMilliSec): _pDelegate(p), _expire(expireMilliSec*1000) { @@ -131,15 +131,15 @@ protected: } AbstractPriorityDelegate* _pDelegate; - Foundation::Timestamp::TimeDiff _expire; - Foundation::Timestamp _creationTime; + Timestamp::TimeDiff _expire; + Timestamp _creationTime; private: PriorityExpire(); }; -Foundation_END +} // namespace Poco #endif diff --git a/Foundation/include/Foundation/Process.h b/Foundation/include/Poco/Process.h similarity index 72% rename from Foundation/include/Foundation/Process.h rename to Foundation/include/Poco/Process.h index 414e2fd7b..b83761119 100644 --- a/Foundation/include/Foundation/Process.h +++ b/Foundation/include/Poco/Process.h @@ -1,7 +1,7 @@ // // Process.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Process.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Process.h#1 $ // // Library: Foundation // Package: Processes @@ -40,23 +40,24 @@ #define Foundation_Process_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif +#include "Poco/Foundation.h" #if defined(POCO_OS_FAMILY_WINDOWS) && defined(POCO_WIN32_UTF8) -#include "Foundation/Process_WIN32U.h" +#include "Poco/Process_WIN32U.h" #elif defined(POCO_OS_FAMILY_WINDOWS) -#include "Foundation/Process_WIN32.h" +#include "Poco/Process_WIN32.h" #elif defined(POCO_OS_FAMILY_UNIX) -#include "Foundation/Process_UNIX.h" +#include "Poco/Process_UNIX.h" #else -#include "Foundation/Process_VMS.h" +#include "Poco/Process_VMS.h" #endif -Foundation_BEGIN +namespace Poco { + + +class Pipe; class Foundation_API ProcessHandle @@ -115,6 +116,33 @@ public: /// Creates a new process for the given command and returns /// a ProcessHandle of the new process. The given arguments are /// passed to the command on the command line. + + static ProcessHandle launch(const std::string& command, const Args& args, Pipe* inPipe, Pipe* outPipe, Pipe* errPipe); + /// Creates a new process for the given command and returns + /// a ProcessHandle of the new process. The given arguments are + /// passed to the command on the command line. + /// + /// If inPipe, outPipe or errPipe is non-null, the corresponding + /// standard input, standard output or standard error stream + /// of the launched process is redirected to the Pipe. + /// PipeInputStream or PipeOutputStream can be used to + /// send receive data from, or send data to the process. + /// + /// Note: the same Pipe can be used for both outPipe and errPipe. + /// + /// After a Pipe has been passed as inPipe, only write operations + /// are valid. After a Pipe has been passed as outPipe or errPipe, + /// only read operations are valid. + /// + /// It is forbidden to pass the same pipe as inPipe and outPipe or errPipe. + /// + /// Usage example: + /// Pipe outPipe; + /// Process::Args args; + /// ProcessHandle ph(launch("/bin/ps", args, &outPipe, 0, 0)); + /// PipeInputStream istr(outPipe); + /// ... // read output of ps from istr + /// int rc = ph.wait(); static int wait(const ProcessHandle& handle); /// Waits for the process specified by handle to terminate @@ -152,7 +180,7 @@ inline void Process::times(long& userTime, long& kernelTime) } -Foundation_END +} // namespace Poco #endif // Foundation_Process_INCLUDED diff --git a/Foundation/include/Foundation/Process_UNIX.h b/Foundation/include/Poco/Process_UNIX.h similarity index 80% rename from Foundation/include/Foundation/Process_UNIX.h rename to Foundation/include/Poco/Process_UNIX.h index 91329c00b..86e514653 100644 --- a/Foundation/include/Foundation/Process_UNIX.h +++ b/Foundation/include/Poco/Process_UNIX.h @@ -1,7 +1,7 @@ // // Process_UNIX.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Process_UNIX.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Process_UNIX.h#1 $ // // Library: Foundation // Package: Processes @@ -40,23 +40,16 @@ #define Foundation_Process_UNIX_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_RefCountedObject_INCLUDED -#include "Foundation/RefCountedObject.h" -#endif -#ifndef STD_UNISTD_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/RefCountedObject.h" #include -#define STD_UNISTD_INCLUDED -#endif -#ifndef STD_VECTOR_INCLUDED #include -#define STD_VECTOR_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { + + +class Pipe; class Foundation_API ProcessHandleImpl: public RefCountedObject @@ -73,7 +66,7 @@ private: }; -class ProcessImpl +class Foundation_API ProcessImpl { public: typedef pid_t PIDImpl; @@ -81,13 +74,13 @@ public: static PIDImpl idImpl(); static void timesImpl(long& userTime, long& kernelTime); - static ProcessHandleImpl* launchImpl(const std::string& command, const ArgsImpl& args); + static ProcessHandleImpl* launchImpl(const std::string& command, const ArgsImpl& args, Pipe* inPipe, Pipe* outPipe, Pipe* errPipe); static void killImpl(PIDImpl pid); static void requestTerminationImpl(PIDImpl pid); }; -Foundation_END +} // namespace Poco #endif // Foundation_Process_UNIX_INCLUDED diff --git a/Foundation/include/Foundation/Process_VMS.h b/Foundation/include/Poco/Process_VMS.h similarity index 79% rename from Foundation/include/Foundation/Process_VMS.h rename to Foundation/include/Poco/Process_VMS.h index 023f857d4..91c4c09dd 100644 --- a/Foundation/include/Foundation/Process_VMS.h +++ b/Foundation/include/Poco/Process_VMS.h @@ -1,7 +1,7 @@ // // Process_VMS.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Process_VMS.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Process_VMS.h#1 $ // // Library: Foundation // Package: Processes @@ -40,26 +40,19 @@ #define Foundation_Process_VMS_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_RefCountedObject_INCLUDED -#include "Foundation/RefCountedObject.h" -#endif -#ifndef STD_VECTOR_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/RefCountedObject.h" #include -#define STD_VECTOR_INCLUDED -#endif -#ifndef STD_UNISTD_INCLUDED #include -#define STD_UNISTD_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { -class Foundation_API ProcessHandleImpl: public RefCountedObject +class Pipe; + + +class ProcessHandleImpl: public RefCountedObject { public: ProcessHandleImpl(pid_t pid); @@ -81,14 +74,14 @@ public: static PIDImpl idImpl(); static void timesImpl(long& userTime, long& kernelTime); - static ProcessHandleImpl* launchImpl(const std::string& command, const ArgsImpl& args); + static ProcessHandleImpl* launchImpl(const std::string& command, const ArgsImpl& args, Pipe* inPipe, Pipe* outPipe, Pipe* errPipe); static int waitImpl(PIDImpl pid); static void killImpl(PIDImpl pid); static void requestTerminationImpl(PIDImpl pid); }; -Foundation_END +} // namespace Poco #endif // Foundation_Process_VMS_INCLUDED diff --git a/Foundation/include/Foundation/Process_WIN32.h b/Foundation/include/Poco/Process_WIN32.h similarity index 81% rename from Foundation/include/Foundation/Process_WIN32.h rename to Foundation/include/Poco/Process_WIN32.h index 57f73b14c..41d455e83 100644 --- a/Foundation/include/Foundation/Process_WIN32.h +++ b/Foundation/include/Poco/Process_WIN32.h @@ -1,7 +1,7 @@ // // Process_WIN32.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Process_WIN32.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Process_WIN32.h#1 $ // // Library: Foundation // Package: Processes @@ -40,23 +40,16 @@ #define Foundation_Process_WIN32_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_RefCountedObject_INCLUDED -#include "Foundation/RefCountedObject.h" -#endif -#ifndef STD_VECTOR_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/RefCountedObject.h" #include -#define STD_VECTOR_INCLUDED -#endif -#ifndef STD_WINDOWS_INCLUDED #include -#define STD_WINDOWS_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { + + +class Pipe; class Foundation_API ProcessHandleImpl: public RefCountedObject @@ -82,13 +75,13 @@ public: static PIDImpl idImpl(); static void timesImpl(long& userTime, long& kernelTime); - static ProcessHandleImpl* launchImpl(const std::string& command, const ArgsImpl& args); + static ProcessHandleImpl* launchImpl(const std::string& command, const ArgsImpl& args, Pipe* inPipe, Pipe* outPipe, Pipe* errPipe); static void killImpl(PIDImpl pid); static void requestTerminationImpl(PIDImpl pid); }; -Foundation_END +} // namespace Poco #endif // Foundation_Process_WIN32_INCLUDED diff --git a/Foundation/include/Foundation/Process_WIN32U.h b/Foundation/include/Poco/Process_WIN32U.h similarity index 81% rename from Foundation/include/Foundation/Process_WIN32U.h rename to Foundation/include/Poco/Process_WIN32U.h index 360779982..757c89c3d 100644 --- a/Foundation/include/Foundation/Process_WIN32U.h +++ b/Foundation/include/Poco/Process_WIN32U.h @@ -1,7 +1,7 @@ // // Process_WIN32U.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Process_WIN32U.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Process_WIN32U.h#1 $ // // Library: Foundation // Package: Processes @@ -40,23 +40,16 @@ #define Foundation_Process_WIN32U_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_RefCountedObject_INCLUDED -#include "Foundation/RefCountedObject.h" -#endif -#ifndef STD_VECTOR_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/RefCountedObject.h" #include -#define STD_VECTOR_INCLUDED -#endif -#ifndef STD_WINDOWS_INCLUDED #include -#define STD_WINDOWS_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { + + +class Pipe; class Foundation_API ProcessHandleImpl: public RefCountedObject @@ -82,13 +75,13 @@ public: static PIDImpl idImpl(); static void timesImpl(long& userTime, long& kernelTime); - static ProcessHandleImpl* launchImpl(const std::string& command, const ArgsImpl& args); + static ProcessHandleImpl* launchImpl(const std::string& command, const ArgsImpl& args, Pipe* inPipe, Pipe* outPipe, Pipe* errPipe); static void killImpl(PIDImpl pid); static void requestTerminationImpl(PIDImpl pid); }; -Foundation_END +} // namespace Poco #endif // Foundation_Process_WIN32U_INCLUDED diff --git a/Foundation/include/Foundation/PurgeStrategy.h b/Foundation/include/Poco/PurgeStrategy.h similarity index 86% rename from Foundation/include/Foundation/PurgeStrategy.h rename to Foundation/include/Poco/PurgeStrategy.h index 1ec7453b6..6b0e1dbf6 100644 --- a/Foundation/include/Foundation/PurgeStrategy.h +++ b/Foundation/include/Poco/PurgeStrategy.h @@ -1,7 +1,7 @@ // // PurgeStrategy.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/PurgeStrategy.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/PurgeStrategy.h#1 $ // // Library: Foundation // Package: Logging @@ -40,22 +40,13 @@ #define Foundation_PurgeStrategy_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_File_INCLUDED -#include "Foundation/File.h" -#endif -#ifndef Foundation_Timespan_INCLUDED -#include "Foundation/Timespan.h" -#endif -#ifndef STD_VECTOR_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/File.h" +#include "Poco/Timespan.h" #include -#define STD_VECTOR_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API PurgeStrategy @@ -122,7 +113,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_PurgeStrategy_INCLUDED diff --git a/Foundation/include/Foundation/RWLock.h b/Foundation/include/Poco/RWLock.h similarity index 88% rename from Foundation/include/Foundation/RWLock.h rename to Foundation/include/Poco/RWLock.h index d3cd318f6..4ff91f595 100644 --- a/Foundation/include/Foundation/RWLock.h +++ b/Foundation/include/Poco/RWLock.h @@ -1,7 +1,7 @@ // // RWLock.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/RWLock.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/RWLock.h#1 $ // // Library: Foundation // Package: Threading @@ -40,22 +40,18 @@ #define Foundation_RWLock_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Exception_INCLUDED -#include "Foundation/Exception.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/Exception.h" #if defined(POCO_OS_FAMILY_WINDOWS) -#include "Foundation/RWLock_WIN32.h" +#include "Poco/RWLock_WIN32.h" #else -#include "Foundation/RWLock_POSIX.h" +#include "Poco/RWLock_POSIX.h" #endif -Foundation_BEGIN +namespace Poco { class ScopedRWLock; @@ -166,7 +162,7 @@ inline ScopedRWLock::~ScopedRWLock() } -Foundation_END +} // namespace Poco #endif // Foundation_RWLock_INCLUDED diff --git a/Foundation/include/Foundation/RWLock_POSIX.h b/Foundation/include/Poco/RWLock_POSIX.h similarity index 84% rename from Foundation/include/Foundation/RWLock_POSIX.h rename to Foundation/include/Poco/RWLock_POSIX.h index df8b677b9..63593d7c2 100644 --- a/Foundation/include/Foundation/RWLock_POSIX.h +++ b/Foundation/include/Poco/RWLock_POSIX.h @@ -1,7 +1,7 @@ // // RWLock_POSIX.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/RWLock_POSIX.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/RWLock_POSIX.h#1 $ // // Library: Foundation // Package: Threading @@ -40,23 +40,13 @@ #define Foundation_RWLock_POSIX_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Exception_INCLUDED -#include "Foundation/Exception.h" -#endif -#ifndef STD_PTHREAD_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/Exception.h" #include -#define STD_PTHREAD_INCLUDED -#endif -#ifndef STD_ERRNO_INCLUDED #include -#define STD_ERRNO_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API RWLockImpl @@ -125,7 +115,7 @@ inline void RWLockImpl::unlockImpl() } -Foundation_END +} // namespace Poco #endif // Foundation_RWLock_POSIX_INCLUDED diff --git a/Foundation/include/Foundation/RWLock_WIN32.h b/Foundation/include/Poco/RWLock_WIN32.h similarity index 83% rename from Foundation/include/Foundation/RWLock_WIN32.h rename to Foundation/include/Poco/RWLock_WIN32.h index 76715166b..dc53aab0b 100644 --- a/Foundation/include/Foundation/RWLock_WIN32.h +++ b/Foundation/include/Poco/RWLock_WIN32.h @@ -1,7 +1,7 @@ // // RWLock_WIN32.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/RWLock_WIN32.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/RWLock_WIN32.h#1 $ // // Library: Foundation // Package: Threading @@ -40,19 +40,12 @@ #define Foundation_RWLock_WIN32_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Exception_INCLUDED -#include "Foundation/Exception.h" -#endif -#ifndef STD_WINDOWS_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/Exception.h" #include -#define STD_WINDOWS_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API RWLockImpl @@ -78,7 +71,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_RWLock_WIN32_INCLUDED diff --git a/Foundation/include/Foundation/Random.h b/Foundation/include/Poco/Random.h similarity index 93% rename from Foundation/include/Foundation/Random.h rename to Foundation/include/Poco/Random.h index 95f99884c..ded3e79e9 100644 --- a/Foundation/include/Foundation/Random.h +++ b/Foundation/include/Poco/Random.h @@ -1,7 +1,7 @@ // // Random.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Random.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Random.h#1 $ // // Library: Foundation // Package: Crypt @@ -74,12 +74,10 @@ #define Foundation_Random_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif +#include "Poco/Foundation.h" -Foundation_BEGIN +namespace Poco { class Foundation_API Random @@ -187,7 +185,7 @@ inline double Random::nextDouble() } -Foundation_END +} // namespace Poco #endif // Foundation_Random_INCLUDED diff --git a/Foundation/include/Foundation/RandomStream.h b/Foundation/include/Poco/RandomStream.h similarity index 85% rename from Foundation/include/Foundation/RandomStream.h rename to Foundation/include/Poco/RandomStream.h index 57195e7d7..e9651e094 100644 --- a/Foundation/include/Foundation/RandomStream.h +++ b/Foundation/include/Poco/RandomStream.h @@ -1,7 +1,7 @@ // // RandomStream.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/RandomStream.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/RandomStream.h#1 $ // // Library: Foundation // Package: Crypt @@ -40,19 +40,12 @@ #define Foundation_RandomStream_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_BufferedStreamBuf_INCLUDED -#include "Foundation/BufferedStreamBuf.h" -#endif -#ifndef STD_ISTREAM_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/BufferedStreamBuf.h" #include -#define STD_ISTREAM_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API RandomBuf: public BufferedStreamBuf @@ -96,7 +89,7 @@ public: }; -Foundation_END +} // namespace Poco #endif // Foundation_RandomStream_INCLUDED diff --git a/Foundation/include/Foundation/RefCountedObject.h b/Foundation/include/Poco/RefCountedObject.h similarity index 88% rename from Foundation/include/Foundation/RefCountedObject.h rename to Foundation/include/Poco/RefCountedObject.h index e0443463f..5d610213d 100644 --- a/Foundation/include/Foundation/RefCountedObject.h +++ b/Foundation/include/Poco/RefCountedObject.h @@ -1,7 +1,7 @@ // // RefCountedObject.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/RefCountedObject.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/RefCountedObject.h#1 $ // // Library: Foundation // Package: Core @@ -40,15 +40,11 @@ #define Foundation_RefCountedObject_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Mutex_INCLUDED -#include "Foundation/Mutex.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/Mutex.h" -Foundation_BEGIN +namespace Poco { class Foundation_API RefCountedObject @@ -96,7 +92,7 @@ inline int RefCountedObject::referenceCount() const } -Foundation_END +} // namespace Poco #endif // Foundation_RefCountedObject_INCLUDED diff --git a/Foundation/include/Foundation/RegularExpression.h b/Foundation/include/Poco/RegularExpression.h similarity index 95% rename from Foundation/include/Foundation/RegularExpression.h rename to Foundation/include/Poco/RegularExpression.h index 5578e173e..a13ce7aa5 100644 --- a/Foundation/include/Foundation/RegularExpression.h +++ b/Foundation/include/Poco/RegularExpression.h @@ -1,7 +1,7 @@ // // RegularExpression.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/RegularExpression.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/RegularExpression.h#1 $ // // Library: Foundation // Package: RegExp @@ -43,13 +43,8 @@ #define Foundation_RegularExpression_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef STD_VECTOR_INCLUDED +#include "Poco/Foundation.h" #include -#define STD_VECTOR_INCLUDED -#endif // @@ -64,7 +59,7 @@ extern "C" } -Foundation_BEGIN +namespace Poco { class Foundation_API RegularExpression @@ -231,7 +226,7 @@ inline int RegularExpression::subst(std::string& subject, const std::string& rep } -Foundation_END +} // namespace Poco #endif // Foundation_RegularExpression_INCLUDED diff --git a/Foundation/include/Foundation/RotateStrategy.h b/Foundation/include/Poco/RotateStrategy.h similarity index 82% rename from Foundation/include/Foundation/RotateStrategy.h rename to Foundation/include/Poco/RotateStrategy.h index a243f3b91..291efe00f 100644 --- a/Foundation/include/Foundation/RotateStrategy.h +++ b/Foundation/include/Poco/RotateStrategy.h @@ -1,7 +1,7 @@ // // RotateStrategy.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/RotateStrategy.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/RotateStrategy.h#1 $ // // Library: Foundation // Package: Logging @@ -40,33 +40,17 @@ #define Foundation_RotateStrategy_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Timespan_INCUDED -#include "Foundation/Timespan.h" -#endif -#ifndef Foundation_Timestamp_INCUDED -#include "Foundation/Timestamp.h" -#endif -#ifndef Foundation_Exception_INCUDED -#include "Foundation/Exception.h" -#endif -#ifndef Foundation_LogFile_INCUDED -#include "Foundation/LogFile.h" -#endif -#ifndef Foundation_StringTokenizer_INCUDED -#include "Foundation/StringTokenizer.h" -#endif -#ifndef Foundation_DateTimeParser_INCUDED -#include "Foundation/DateTimeParser.h" -#endif -#ifndef Foundation_NumberParser_INCUDED -#include "Foundation/NumberParser.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/Timespan.h" +#include "Poco/Timestamp.h" +#include "Poco/Exception.h" +#include "Poco/LogFile.h" +#include "Poco/StringTokenizer.h" +#include "Poco/DateTimeParser.h" +#include "Poco/NumberParser.h" -Foundation_BEGIN +namespace Poco { class Foundation_API RotateStrategy @@ -190,7 +174,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_RotateStrategy_INCLUDED diff --git a/Foundation/include/Foundation/Runnable.h b/Foundation/include/Poco/Runnable.h similarity index 89% rename from Foundation/include/Foundation/Runnable.h rename to Foundation/include/Poco/Runnable.h index dd4cdc1cf..451e09b2c 100644 --- a/Foundation/include/Foundation/Runnable.h +++ b/Foundation/include/Poco/Runnable.h @@ -1,7 +1,7 @@ // // Runnable.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Runnable.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Runnable.h#1 $ // // Library: Foundation // Package: Threading @@ -40,12 +40,10 @@ #define Foundation_Runnable_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif +#include "Poco/Foundation.h" -Foundation_BEGIN +namespace Poco { class Foundation_API Runnable @@ -63,7 +61,7 @@ public: }; -Foundation_END +} // namespace Poco #endif // Foundation_Runnable_INCLUDED diff --git a/Foundation/include/Foundation/RunnableAdapter.h b/Foundation/include/Poco/RunnableAdapter.h similarity index 87% rename from Foundation/include/Foundation/RunnableAdapter.h rename to Foundation/include/Poco/RunnableAdapter.h index affdba5da..23ef1bf43 100644 --- a/Foundation/include/Foundation/RunnableAdapter.h +++ b/Foundation/include/Poco/RunnableAdapter.h @@ -1,7 +1,7 @@ // // RunnableAdapter.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/RunnableAdapter.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/RunnableAdapter.h#1 $ // // Library: Foundation // Package: Threading @@ -40,15 +40,11 @@ #define Foundation_RunnableAdapter_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Runnable_INCLUDED -#include "Foundation/Runnable.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/Runnable.h" -Foundation_BEGIN +namespace Poco { template @@ -94,7 +90,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_RunnableAdapter_INCLUDED diff --git a/Foundation/include/Foundation/SHA1Engine.h b/Foundation/include/Poco/SHA1Engine.h similarity index 88% rename from Foundation/include/Foundation/SHA1Engine.h rename to Foundation/include/Poco/SHA1Engine.h index 7fb97cb71..b54265808 100644 --- a/Foundation/include/Foundation/SHA1Engine.h +++ b/Foundation/include/Poco/SHA1Engine.h @@ -1,7 +1,7 @@ // // SHA1Engine.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/SHA1Engine.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/SHA1Engine.h#1 $ // // Library: Foundation // Package: Crypt @@ -46,15 +46,11 @@ #define Foundation_SHA1Engine_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_DigestEngine_INCLUDED -#include "Foundation/DigestEngine.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/DigestEngine.h" -Foundation_BEGIN +namespace Poco { class Foundation_API SHA1Engine: public DigestEngine @@ -98,7 +94,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_SHA1Engine_INCLUDED diff --git a/Foundation/include/Foundation/ScopedLock.h b/Foundation/include/Poco/ScopedLock.h similarity index 89% rename from Foundation/include/Foundation/ScopedLock.h rename to Foundation/include/Poco/ScopedLock.h index 2b2165ceb..12a8b684b 100644 --- a/Foundation/include/Foundation/ScopedLock.h +++ b/Foundation/include/Poco/ScopedLock.h @@ -1,7 +1,7 @@ // // ScopedLock.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/ScopedLock.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/ScopedLock.h#1 $ // // Library: Foundation // Package: Threading @@ -40,12 +40,10 @@ #define Foundation_ScopedLock_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif +#include "Poco/Foundation.h" -Foundation_BEGIN +namespace Poco { template @@ -74,7 +72,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_ScopedLock_INCLUDED diff --git a/Foundation/include/Foundation/Semaphore.h b/Foundation/include/Poco/Semaphore.h similarity index 89% rename from Foundation/include/Foundation/Semaphore.h rename to Foundation/include/Poco/Semaphore.h index 5d0aa96d1..ec83fa62c 100644 --- a/Foundation/include/Foundation/Semaphore.h +++ b/Foundation/include/Poco/Semaphore.h @@ -1,7 +1,7 @@ // // Semaphore.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Semaphore.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Semaphore.h#1 $ // // Library: Foundation // Package: Threading @@ -40,22 +40,18 @@ #define Foundation_Semaphore_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Exception_INCLUDED -#include "Foundation/Exception.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/Exception.h" #if defined(POCO_OS_FAMILY_WINDOWS) -#include "Foundation/Semaphore_WIN32.h" +#include "Poco/Semaphore_WIN32.h" #else -#include "Foundation/Semaphore_POSIX.h" +#include "Poco/Semaphore_POSIX.h" #endif -Foundation_BEGIN +namespace Poco { class Foundation_API Semaphore: private SemaphoreImpl @@ -155,7 +151,7 @@ inline bool Semaphore::tryWait(long milliseconds) } -Foundation_END +} // namespace Poco #endif // Foundation_Semaphore_INCLUDED diff --git a/Foundation/include/Foundation/Semaphore_POSIX.h b/Foundation/include/Poco/Semaphore_POSIX.h similarity index 83% rename from Foundation/include/Foundation/Semaphore_POSIX.h rename to Foundation/include/Poco/Semaphore_POSIX.h index 31cb6a8a2..3fe06e4f4 100644 --- a/Foundation/include/Foundation/Semaphore_POSIX.h +++ b/Foundation/include/Poco/Semaphore_POSIX.h @@ -1,7 +1,7 @@ // // Semaphore_POSIX.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Semaphore_POSIX.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Semaphore_POSIX.h#1 $ // // Library: Foundation // Package: Threading @@ -40,23 +40,13 @@ #define Foundation_Semaphore_POSIX_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Exception_INCLUDED -#include "Foundation/Exception.h" -#endif -#ifndef STD_PTHREAD_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/Exception.h" #include -#define STD_PTHREAD_INCLUDED -#endif -#ifndef STD_ERRNO_INCLUDED #include -#define STD_ERRNO_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API SemaphoreImpl @@ -101,7 +91,7 @@ inline void SemaphoreImpl::setImpl() } -Foundation_END +} // namespace Poco #endif // Foundation_Semaphore_POSIX_INCLUDED diff --git a/Foundation/include/Foundation/Semaphore_WIN32.h b/Foundation/include/Poco/Semaphore_WIN32.h similarity index 83% rename from Foundation/include/Foundation/Semaphore_WIN32.h rename to Foundation/include/Poco/Semaphore_WIN32.h index 6ed1209c7..917776450 100644 --- a/Foundation/include/Foundation/Semaphore_WIN32.h +++ b/Foundation/include/Poco/Semaphore_WIN32.h @@ -1,7 +1,7 @@ // // Semaphore_WIN32.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Semaphore_WIN32.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Semaphore_WIN32.h#1 $ // // Library: Foundation // Package: Threading @@ -40,19 +40,12 @@ #define Foundation_Semaphore_WIN32_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Exception_INCLUDED -#include "Foundation/Exception.h" -#endif -#ifndef STD_WINDOWS_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/Exception.h" #include -#define STD_WINDOWS_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API SemaphoreImpl @@ -81,7 +74,7 @@ inline void SemaphoreImpl::setImpl() } -Foundation_END +} // namespace Poco #endif // Foundation_Semaphore_WIN32_INCLUDED diff --git a/Foundation/include/Foundation/SharedLibrary.h b/Foundation/include/Poco/SharedLibrary.h similarity index 87% rename from Foundation/include/Foundation/SharedLibrary.h rename to Foundation/include/Poco/SharedLibrary.h index 7d2b05ed1..861a280cf 100644 --- a/Foundation/include/Foundation/SharedLibrary.h +++ b/Foundation/include/Poco/SharedLibrary.h @@ -1,7 +1,7 @@ // // SharedLibrary.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/SharedLibrary.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/SharedLibrary.h#1 $ // // Library: Foundation // Package: SharedLibrary @@ -40,23 +40,23 @@ #define Foundation_SharedLibrary_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif +#include "Poco/Foundation.h" #if defined(hpux) || defined(_hpux) -#include "Foundation/SharedLibrary_HPUX.h" +#include "Poco/SharedLibrary_HPUX.h" #elif defined(POCO_OS_FAMILY_UNIX) -#include "Foundation/SharedLibrary_UNIX.h" +#include "Poco/SharedLibrary_UNIX.h" +#elif defined(POCO_OS_FAMILY_WINDOWS) && defined(POCO_WIN32_UTF8) +#include "Poco/SharedLibrary_WIN32U.h" #elif defined(POCO_OS_FAMILY_WINDOWS) -#include "Foundation/SharedLibrary_WIN32.h" +#include "Poco/SharedLibrary_WIN32.h" #elif defined(POCO_OS_FAMILY_VMS) -#include "Foundation/SharedLibrary_VMS.h" +#include "Poco/SharedLibrary_VMS.h" #endif -Foundation_BEGIN +namespace Poco { class Foundation_API SharedLibrary: private SharedLibraryImpl @@ -116,7 +116,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_SharedLibrary_INCLUDED diff --git a/Foundation/include/Foundation/SharedLibrary_HPUX.h b/Foundation/include/Poco/SharedLibrary_HPUX.h similarity index 84% rename from Foundation/include/Foundation/SharedLibrary_HPUX.h rename to Foundation/include/Poco/SharedLibrary_HPUX.h index c29407cdb..bf4986a62 100644 --- a/Foundation/include/Foundation/SharedLibrary_HPUX.h +++ b/Foundation/include/Poco/SharedLibrary_HPUX.h @@ -1,7 +1,7 @@ // // SharedLibrary_HPUX.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/SharedLibrary_HPUX.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/SharedLibrary_HPUX.h#1 $ // // Library: Foundation // Package: SharedLibrary @@ -40,19 +40,12 @@ #define Foundation_SharedLibrary_HPUX_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Mutex_INCLUDED -#include "Foundation/Mutex.h" -#endif -#ifndef STD_DL_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/Mutex.h" #include -#define STD_DL_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API SharedLibraryImpl @@ -74,7 +67,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_SharedLibrary_HPUX_INCLUDED diff --git a/Foundation/include/Foundation/SharedLibrary_UNIX.h b/Foundation/include/Poco/SharedLibrary_UNIX.h similarity index 86% rename from Foundation/include/Foundation/SharedLibrary_UNIX.h rename to Foundation/include/Poco/SharedLibrary_UNIX.h index 5d16a8995..302593196 100644 --- a/Foundation/include/Foundation/SharedLibrary_UNIX.h +++ b/Foundation/include/Poco/SharedLibrary_UNIX.h @@ -1,7 +1,7 @@ // // SharedLibrary_UNIX.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/SharedLibrary_UNIX.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/SharedLibrary_UNIX.h#1 $ // // Library: Foundation // Package: SharedLibrary @@ -40,15 +40,11 @@ #define Foundation_SharedLibrary_UNIX_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Mutex_INCLUDED -#include "Foundation/Mutex.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/Mutex.h" -Foundation_BEGIN +namespace Poco { class Foundation_API SharedLibraryImpl @@ -70,7 +66,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_SharedLibrary_UNIX_INCLUDED diff --git a/Foundation/include/Foundation/SharedLibrary_VMS.h b/Foundation/include/Poco/SharedLibrary_VMS.h similarity index 86% rename from Foundation/include/Foundation/SharedLibrary_VMS.h rename to Foundation/include/Poco/SharedLibrary_VMS.h index 50a601d51..78322703a 100644 --- a/Foundation/include/Foundation/SharedLibrary_VMS.h +++ b/Foundation/include/Poco/SharedLibrary_VMS.h @@ -1,7 +1,7 @@ // // SharedLibrary_VMS.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/SharedLibrary_VMS.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/SharedLibrary_VMS.h#1 $ // // Library: Foundation // Package: SharedLibrary @@ -40,15 +40,11 @@ #define Foundation_SharedLibrary_VMS_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Mutex_INCLUDED -#include "Foundation/Mutex.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/Mutex.h" -Foundation_BEGIN +namespace Poco { class Foundation_API SharedLibraryImpl @@ -69,7 +65,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_SharedLibrary_VMS_INCLUDED diff --git a/Foundation/include/Foundation/SharedLibrary_WIN32.h b/Foundation/include/Poco/SharedLibrary_WIN32.h similarity index 86% rename from Foundation/include/Foundation/SharedLibrary_WIN32.h rename to Foundation/include/Poco/SharedLibrary_WIN32.h index ff6b8fda1..f54a92129 100644 --- a/Foundation/include/Foundation/SharedLibrary_WIN32.h +++ b/Foundation/include/Poco/SharedLibrary_WIN32.h @@ -1,7 +1,7 @@ // // SharedLibrary_WIN32.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/SharedLibrary_WIN32.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/SharedLibrary_WIN32.h#1 $ // // Library: Foundation // Package: SharedLibrary @@ -40,15 +40,11 @@ #define Foundation_SharedLibrary_WIN32_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Mutex_INCLUDED -#include "Foundation/Mutex.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/Mutex.h" -Foundation_BEGIN +namespace Poco { class Foundation_API SharedLibraryImpl @@ -70,7 +66,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_SharedLibrary_WIN32_INCLUDED diff --git a/Foundation/include/Foundation/SharedPtr.h b/Foundation/include/Poco/SharedPtr.h similarity index 61% rename from Foundation/include/Foundation/SharedPtr.h rename to Foundation/include/Poco/SharedPtr.h index 7c5a3a88c..f8901bf8a 100644 --- a/Foundation/include/Foundation/SharedPtr.h +++ b/Foundation/include/Poco/SharedPtr.h @@ -1,7 +1,7 @@ // // SharedPtr.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/SharedPtr.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/SharedPtr.h#1 $ // // Library: Foundation // Package: Core @@ -40,59 +40,38 @@ #define Foundation_SharedPtr_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_RefCountedObject_INCLUDED -#include "Foundation/RefCountedObject.h" -#endif -#ifndef Foundation_Exception_INCLUDED -#include "Foundation/Exception.h" -#endif -#ifndef STD_ALGORITHM_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/Exception.h" +#include "Poco/Mutex.h" #include -#define STD_ALGORITHM_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { -template -class SmartHandle: public RefCountedObject - /// The SmartHandle class is used internally by SharedPtr - /// to manage the reference count of objects. +class ReferenceCounter + /// Simple ReferenceCounter object, does not delete itself when count reaches 0 { public: - SmartHandle(): _ptr(0) - { - } - - SmartHandle(C* ptr): _ptr(ptr) + ReferenceCounter(): _cnt(1) { } - inline C* ptr() const + void duplicate() { - return _ptr; + FastMutex::ScopedLock lock(_mutex); + ++_cnt; } - inline C* deref() const + int release() { - if (_ptr) - return _ptr; - else - throw NullPointerException(); + FastMutex::ScopedLock lock(_mutex); + return --_cnt; } -protected: - ~SmartHandle() - { - delete _ptr; - } - private: - C* _ptr; + FastMutex _mutex; + int _cnt; }; @@ -120,35 +99,43 @@ class SharedPtr /// SharedPtr supports dereferencing with both the -> /// and the * operator. An attempt to dereference a null /// SharedPtr results in a NullPointerException being thrown. - /// SharedPtr also implements all relational operators. + /// SharedPtr also implements all relational operators and + /// a cast operator in case dynamic casting of the encapsulated data types + /// is required. { public: - typedef SmartHandle Handle; - SharedPtr(): _handle(new Handle) + SharedPtr(): _pCounter(new ReferenceCounter), _ptr(0) { } - SharedPtr(C* ptr): _handle(new Handle(ptr)) + SharedPtr(C* ptr): _pCounter(new ReferenceCounter), _ptr(ptr) { } - SharedPtr(const SharedPtr& ptr): _handle(ptr._handle) + template + SharedPtr(const SharedPtr& ptr): _pCounter(ptr._pCounter), _ptr(const_cast(ptr.get())) { - _handle->duplicate(); + _pCounter->duplicate(); + } + + SharedPtr(const SharedPtr& ptr): _pCounter(ptr._pCounter), _ptr(ptr._ptr) + { + _pCounter->duplicate(); } ~SharedPtr() { - _handle->release(); + release(); } SharedPtr& operator = (C* ptr) { if (get() != ptr) { - _handle->release(); - _handle = new Handle(ptr); + release(); + _pCounter = new ReferenceCounter; + _ptr = ptr; } return *this; } @@ -157,56 +144,85 @@ public: { if (&ptr != this) { - _handle->release(); - _handle = ptr._handle; - _handle->duplicate(); + release(); + _pCounter = ptr._pCounter; + _pCounter->duplicate(); + _ptr = const_cast(ptr.get()); } return *this; } - + + template + SharedPtr& operator = (const SharedPtr& ptr) + { + if (ptr.get() != _ptr) + { + release(); + _pCounter = ptr._pCounter; + _pCounter->duplicate(); + _ptr = const_cast(ptr.get()); + } + return *this; + } + + template + SharedPtr < Other > cast() + /// Casts the SharedPtr via a dynamic cast to the given type. + /// Returns an SharedPtr containing NULL if the cast fails. + /// Example: (assume class Sub: public Super) + /// SharedPtr < Super > super(new Sub()); + /// SharedPtr < Sub > sub = super.cast(); + /// poco_assert (sub.get()); + { + Other* pOther = dynamic_cast (_ptr); + if (pOther) + return SharedPtr < Other > (_pCounter, pOther); + return SharedPtr < Other > (); + } + void swap(SharedPtr& ptr) { - std::swap(_handle, ptr._handle); + std::swap(_ptr, ptr._ptr); } C* operator -> () { - return _handle->deref(); + return deref(); } const C* operator -> () const { - return _handle->deref(); + return deref(); } C& operator * () { - return *_handle->deref(); + return *deref(); } const C& operator * () const { - return *_handle->deref(); + return *deref(); } C* get() { - return _handle->ptr(); + return _ptr; } operator C* () { - return _handle->ptr(); + return _ptr; } operator const C* () const { - return _handle->ptr(); + return _ptr; } const C* get() const { - return _handle->ptr(); + return _ptr; } bool operator == (const SharedPtr& ptr) const @@ -300,7 +316,42 @@ public: } private: - Handle* _handle; + C* deref() const + { + if (!_ptr) + throw NullPointerException(); + + return _ptr; + } + + void release() + { + poco_assert_dbg (_pCounter); + int i = _pCounter->release(); + if (i == 0) + { + if (_ptr) + delete _ptr; + _ptr = 0; + + delete _pCounter; + _pCounter = 0; + } + } + + SharedPtr(ReferenceCounter* pCounter, C* ptr):_pCounter(pCounter), _ptr(ptr) + /// for cast operation + { + poco_assert_dbg (_pCounter); + _pCounter->duplicate(); + } + + +private: + ReferenceCounter* _pCounter; + C* _ptr; + + template < class Other > friend class SharedPtr; }; @@ -311,7 +362,7 @@ inline void swap(SharedPtr& p1, SharedPtr& p2) } -Foundation_END +} // namespace Poco #endif // Foundation_SharedPtr_INCLUDED diff --git a/Foundation/include/Foundation/SignalHandler.h b/Foundation/include/Poco/SignalHandler.h similarity index 88% rename from Foundation/include/Foundation/SignalHandler.h rename to Foundation/include/Poco/SignalHandler.h index 3b34e8cca..83941d0ec 100644 --- a/Foundation/include/Foundation/SignalHandler.h +++ b/Foundation/include/Poco/SignalHandler.h @@ -1,7 +1,7 @@ // // SignalHandler.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/SignalHandler.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/SignalHandler.h#1 $ // // Library: Foundation // Package: Threading @@ -40,25 +40,17 @@ #define Foundation_SignalHandler_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif +#include "Poco/Foundation.h" #if defined(POCO_OS_FAMILY_UNIX) -#ifndef STD_VECTOR_INCLUDED #include -#define STD_VECTOR_INCLUDED -#endif -#ifndef STD_SETJMP_H_INCLUDED #include -#define STD_SETJMP_H_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API SignalHandler @@ -89,7 +81,7 @@ class Foundation_API SignalHandler /// poco_throw_on_signal; /// ... /// } - /// catch (Foundation::SignalException&) + /// catch (Poco::SignalException&) /// { /// ... /// } @@ -138,12 +130,12 @@ private: #define poco_throw_on_signal \ - Foundation::SignalHandler _poco_signalHandler; \ + Poco::SignalHandler _poco_signalHandler; \ int _poco_signal = sigsetjmp(_poco_signalHandler.jumpBuffer(), 1); \ if (_poco_signal) _poco_signalHandler.throwSignalException(_poco_signal); -Foundation_END +} // namespace Poco #endif // POCO_OS_FAMILY_UNIX diff --git a/Foundation/include/Foundation/SimpleFileChannel.h b/Foundation/include/Poco/SimpleFileChannel.h similarity index 89% rename from Foundation/include/Foundation/SimpleFileChannel.h rename to Foundation/include/Poco/SimpleFileChannel.h index 8b010b791..09f04d8d4 100644 --- a/Foundation/include/Foundation/SimpleFileChannel.h +++ b/Foundation/include/Poco/SimpleFileChannel.h @@ -1,7 +1,7 @@ // // SimpleFileChannel.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/SimpleFileChannel.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/SimpleFileChannel.h#1 $ // // Library: Foundation // Package: Logging @@ -40,21 +40,13 @@ #define Foundation_SimpleFileChannel_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Channel_INCLUDED -#include "Foundation/Channel.h" -#endif -#ifndef Foundation_Timestamp_INCLUDED -#include "Foundation/Timestamp.h" -#endif -#ifndef Foundation_Mutex_INCLUDED -#include "Foundation/Mutex.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/Channel.h" +#include "Poco/Timestamp.h" +#include "Poco/Mutex.h" -Foundation_BEGIN +namespace Poco { class LogFile; @@ -158,7 +150,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_SimpleFileChannel_INCLUDED diff --git a/Foundation/include/Poco/SimpleHashTable.h b/Foundation/include/Poco/SimpleHashTable.h new file mode 100644 index 000000000..605066a26 --- /dev/null +++ b/Foundation/include/Poco/SimpleHashTable.h @@ -0,0 +1,407 @@ +// +// SimpleHashTable.h +// +// $Id: //poco/1.2/Foundation/include/Poco/SimpleHashTable.h#1 $ +// +// Library: Foundation +// Package: Core +// Module: SimpleHashTable +// +// Definition of the SimpleHashTable class. +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef Foundation_SimpleHashTable_INCLUDED +#define Foundation_SimpleHashTable_INCLUDED + + +#include "Poco/Foundation.h" +#include "Poco/Exception.h" +#include "Poco/HashFunction.h" +#include "Poco/HashStatistic.h" +#include +#include +#include + + +namespace Poco { + + +template< class Key, class Value, class KeyHashFunction = HashFunction< Key> > +class SimpleHashTable + /// A SimpleHashTable stores a key value pair that can be looked up via a hashed key. + /// + /// In comparision to a HashTable, this class handles collisions by sequentially searching the next + /// free location. This also means that the maximum size of this table is limited, i.e. if the hash table + /// is full, it will throw an exception and that this class does not support remove operations. + /// On the plus side it is faster than the HashTable. + /// + /// This class is NOT thread safe. +{ +public: + class HashEntry + { + public: + Key key; + Value value; + HashEntry(const Key k, const Value v): + key(k), + value(v) + { + } + }; + + typedef HashEntry** HashTableVector; + + SimpleHashTable(UInt32 initialSize = 251): _entries(0), _size(0), _maxCapacity(initialSize) + /// Creates the SimpleHashTable. + { + _entries = new HashEntry*[initialSize]; + memset(_entries, '\0', sizeof(HashEntry*)*initialSize); + } + + SimpleHashTable(const SimpleHashTable& ht): + _entries (new HashEntry*[ht._maxCapacity]), + _size(ht._size), + _maxCapacity(ht._maxCapacity) + { + for (int i = 0; i < _maxCapacity; ++i) + { + if (ht._entries[i]) + _entries[i] = new HashEntry(*ht._entries[i]); + else + _entries[i] = 0; + } + } + + ~SimpleHashTable() + /// Destroys the SimpleHashTable. + { + clear(); + } + + SimpleHashTable& operator = (const SimpleHashTable& ht) + { + if (this != &ht) + { + clear(); + _maxCapacity = ht._maxCapacity; + delete[] _entries; + _entries = new HashEntry*[_maxCapacity]; + _size = ht._size; + + for (int i = 0; i < _maxCapacity; ++i) + { + if (ht._entries[i]) + _entries[i] = new HashEntry(*ht._entries[i]); + else + _entries[i] = 0; + } + } + return *this; + } + + void clear() + { + if (!_entries) + return; + for (int i = 0; i < _maxCapacity; ++i) + { + if (_entries[i]) + delete _entries[i]; + } + delete[] _entries; + _entries = 0; + _size = 0; + _maxCapacity = 0; + } + + UInt32 insert(const Key& key, const Value& value) + /// Returns the hash value of the inserted item. + /// Throws an exception if the entry was already inserted + { + UInt32 hsh = hash(key); + insertRaw(key, hsh, value); + return hsh; + } + + void insertRaw(const Key& key, UInt32 hsh, const Value& value) + /// Returns the hash value of the inserted item. + /// Throws an exception if the entry was already inserted + { + if (!_entries[hsh]) + _entries[hsh] = new HashEntry(key, value); + else + { + UInt32 origHash = hsh; + while (_entries[hsh % _maxCapacity]) + { + poco_assert_dbg(_entries[hsh % _maxCapacity]->key != key); + if (hsh - origHash > _maxCapacity) + throw PoolOverflowException("SimpleHashTable full"); + hsh++; + } + _entries[hsh % _maxCapacity] = new HashEntry(key, value); + } + _size++; + } + + UInt32 update(const Key& key, const Value& value) + /// Returns the hash value of the inserted item. + /// Replaces an existing entry if it finds one + { + UInt32 hsh = hash(key); + updateRaw(key, hsh, value); + return hsh; + } + + void updateRaw(const Key& key, UInt32 hsh, const Value& value) + /// Returns the hash value of the inserted item. + /// Replaces an existing entry if it finds one + { + if (!_entries[hsh]) + _entries[hsh] = new HashEntry(key, value); + else + { + UInt32 origHash = hsh; + while (_entries[hsh % _maxCapacity]) + { + if(_entries[hsh % _maxCapacity]->key == key) + { + _entries[hsh % _maxCapacity]->value = value; + return; + } + if (hsh - origHash > _maxCapacity) + throw PoolOverflowException("SimpleHashTable full"); + hsh++; + } + _entries[hsh % _maxCapacity] = new HashEntry(key, value); + } + _size++; + } + + UInt32 hash(const Key& key) const + { + return KeyHashFunction::hash(key, _maxCapacity); + } + + const Value& get(const Key& key) const + /// Throws an exception if the value does not exist + { + UInt32 hsh = hash(key); + return getRaw(key, hsh); + } + + const Value& getRaw(const Key& key, UInt32 hsh) const + /// Throws an exception if the value does not exist + { + UInt32 origHash = hsh; + while (true) + { + if (_entries[hsh % _maxCapacity]) + { + if(_entries[hsh % _maxCapacity]->key == key) + { + return _entries[hsh % _maxCapacity]->value; + } + } + else + throw InvalidArgumentException("value not found"); + if (hsh - origHash > _maxCapacity) + throw InvalidArgumentException("value not found"); + hsh++; + } + } + + const Key& getKeyRaw(const Key& key, UInt32 hsh) + /// Throws an exception if the key does not exist. returns a reference to the internally + /// stored key. Useful when someone does an insert and wants for performance reason only to store + /// a pointer to the key in another collection + { + UInt32 origHash = hsh; + while (true) + { + if (_entries[hsh % _maxCapacity]) + { + if(_entries[hsh % _maxCapacity]->key == key) + { + return _entries[hsh % _maxCapacity]->key; + } + } + else + throw InvalidArgumentException("key not found"); + + if (hsh - origHash > _maxCapacity) + throw InvalidArgumentException("key not found"); + hsh++; + } + } + + bool get(const Key& key, Value& v) const + /// Sets v to the found value, returns false if no value was found + { + UInt32 hsh = hash(key); + return getRaw(key, hsh, v); + } + + bool getRaw(const Key& key, UInt32 hsh, Value& v) const + /// Sets v to the found value, returns false if no value was found + { + UInt32 origHash = hsh; + while (true) + { + if (_entries[hsh % _maxCapacity]) + { + if(_entries[hsh % _maxCapacity]->key == key) + { + v = _entries[hsh % _maxCapacity]->value; + return true; + } + } + else + return false; + if (hsh - origHash > _maxCapacity) + return false; + hsh++; + } + } + + bool exists(const Key& key) + { + UInt32 hsh = hash(key); + return existsRaw(key, hsh); + } + + bool existsRaw(const Key& key, UInt32 hsh) + { + UInt32 origHash = hsh; + while (true) + { + if (_entries[hsh % _maxCapacity]) + { + if(_entries[hsh % _maxCapacity]->key == key) + { + return true; + } + } + else + return false; + if (hsh - origHash > _maxCapacity) + return false; + hsh++; + } + } + + size_t size() const + /// Returns the number of elements already inserted into the SimpleHashTable + { + return _size; + } + + UInt32 maxCapacity() const + { + return _maxCapacity; + } + + void resize(UInt32 newSize) + /// Resizes the hashtable, rehashes all existing entries. Expensive! + { + if (_maxCapacity != newSize) + { + HashTableVector cpy = _entries; + _entries = 0; + UInt32 oldSize = _maxCapacity; + _maxCapacity = newSize; + _entries = new HashEntry*[_maxCapacity]; + memset(_entries, '\0', sizeof(HashEntry*)*_maxCapacity); + + if (_size == 0) + { + // no data was yet inserted + delete[] cpy; + return; + } + _size = 0; + for (int i=0; i < oldSize; ++i) + { + if (cpy[i]) + { + insert(cpy[i]->key, cpy[i]->value); + delete cpy[i]; + } + } + delete[] cpy; + } + } + + HashStatistic currentState(bool details = false) const + /// Returns the current internal state + { + UInt32 numberOfEntries = (UInt32)_size; + UInt32 numZeroEntries = 0; + UInt32 maxEntriesPerHash = 0; + std::vector detailedEntriesPerHash; + #ifdef _DEBUG + UInt32 totalSize = 0; + #endif + for (int i=0; i < _maxCapacity; ++i) + { + if (_entries[i]) + { + maxEntriesPerHash = 1; + UInt32 size = 1; + if (details) + detailedEntriesPerHash.push_back(size); + #ifdef DEBUG + totalSize += size; + #endif + } + else + { + numZeroEntries++; + if (details) + detailedEntriesPerHash.push_back(0); + } + } + #ifdef DEBUG + poco_assert_dbg(totalSize == numberOfEntries); + #endif + return HashStatistic(_maxCapacity, numberOfEntries, numZeroEntries, maxEntriesPerHash, detailedEntriesPerHash); + } + +private: + HashTableVector _entries; + size_t _size; + UInt32 _maxCapacity; +}; + + +} // namespace Poco + + +#endif // Foundation_HashTable_INCLUDED diff --git a/Foundation/include/Foundation/SingletonHolder.h b/Foundation/include/Poco/SingletonHolder.h similarity index 87% rename from Foundation/include/Foundation/SingletonHolder.h rename to Foundation/include/Poco/SingletonHolder.h index 6212dcac7..d0c34af4f 100644 --- a/Foundation/include/Foundation/SingletonHolder.h +++ b/Foundation/include/Poco/SingletonHolder.h @@ -1,7 +1,7 @@ // // SingletonHolder.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/SingletonHolder.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/SingletonHolder.h#1 $ // // Library: Foundation // Package: Core @@ -40,15 +40,11 @@ #define Foundation_SingletonHolder_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Mutex_INCLUDED -#include "Foundation/Mutex.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/Mutex.h" -Foundation_BEGIN +namespace Poco { template @@ -87,7 +83,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_SingletonHolder_INCLUDED diff --git a/Foundation/include/Foundation/SplitterChannel.h b/Foundation/include/Poco/SplitterChannel.h similarity index 85% rename from Foundation/include/Foundation/SplitterChannel.h rename to Foundation/include/Poco/SplitterChannel.h index 4e64686b6..85dcc1a10 100644 --- a/Foundation/include/Foundation/SplitterChannel.h +++ b/Foundation/include/Poco/SplitterChannel.h @@ -1,7 +1,7 @@ // // SplitterChannel.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/SplitterChannel.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/SplitterChannel.h#1 $ // // Library: Foundation // Package: Logging @@ -40,22 +40,13 @@ #define Foundation_SplitterChannel_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Channel_INCLUDED -#include "Foundation/Channel.h" -#endif -#ifndef Foundation_Mutex_INCLUDED -#include "Foundation/Mutex.h" -#endif -#ifndef STD_VECTOR_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/Channel.h" +#include "Poco/Mutex.h" #include -#define STD_VECTOR_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API SplitterChannel: public Channel @@ -102,7 +93,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_SplitterChannel_INCLUDED diff --git a/Foundation/include/Foundation/Stopwatch.h b/Foundation/include/Poco/Stopwatch.h similarity index 88% rename from Foundation/include/Foundation/Stopwatch.h rename to Foundation/include/Poco/Stopwatch.h index 64e7c5df3..45471d756 100644 --- a/Foundation/include/Foundation/Stopwatch.h +++ b/Foundation/include/Poco/Stopwatch.h @@ -1,7 +1,7 @@ // // Stopwatch.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Stopwatch.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Stopwatch.h#1 $ // // Library: Foundation // Package: DateTime @@ -40,15 +40,11 @@ #define Foundation_Stopwatch_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Timestamp_INCLUDED -#include "Foundation/Timestamp.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/Timestamp.h" -Foundation_BEGIN +namespace Poco { class Foundation_API Stopwatch @@ -122,7 +118,7 @@ inline Timestamp::TimeVal Stopwatch::resolution() } -Foundation_END +} // namespace Poco #endif // Foundation_Stopwatch_INCLUDED diff --git a/Foundation/include/Foundation/StrategyCollection.h b/Foundation/include/Poco/StrategyCollection.h similarity index 86% rename from Foundation/include/Foundation/StrategyCollection.h rename to Foundation/include/Poco/StrategyCollection.h index 5589bdc96..be6ef1e62 100644 --- a/Foundation/include/Foundation/StrategyCollection.h +++ b/Foundation/include/Poco/StrategyCollection.h @@ -1,7 +1,7 @@ // // StrategyCollection.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/StrategyCollection.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/StrategyCollection.h#1 $ // // Library: Foundation // Package: Cache @@ -40,14 +40,14 @@ #define Foundation_StrategyCollection_INCLUDED -#include "Foundation/KeyValueArgs.h" -#include "Foundation/ValidArgs.h" -#include "Foundation/AbstractStrategy.h" -#include "Foundation/SharedPtr.h" +#include "Poco/KeyValueArgs.h" +#include "Poco/ValidArgs.h" +#include "Poco/AbstractStrategy.h" +#include "Poco/SharedPtr.h" #include -Foundation_BEGIN +namespace Poco { template @@ -86,7 +86,7 @@ public: { Iterator it = _strategies.begin(); Iterator endIt = _strategies.end(); - for (it; it != endIt; ++it) + for (; it != endIt; ++it) { (*it)->onAdd(pSender, key); } @@ -98,7 +98,7 @@ public: { Iterator it = _strategies.begin(); Iterator endIt = _strategies.end(); - for (it; it != endIt; ++it) + for (; it != endIt; ++it) { (*it)->onRemove(pSender, key); } @@ -108,7 +108,7 @@ public: { Iterator it = _strategies.begin(); Iterator endIt = _strategies.end(); - for (it; it != endIt; ++it) + for (; it != endIt; ++it) { (*it)->onGet(pSender, key); } @@ -118,7 +118,7 @@ public: { Iterator it = _strategies.begin(); Iterator endIt = _strategies.end(); - for (it; it != endIt; ++it) + for (; it != endIt; ++it) { (*it)->onClear(pSender, args); } @@ -128,7 +128,7 @@ public: { Iterator it = _strategies.begin(); Iterator endIt = _strategies.end(); - for (it; it != endIt && key.isValid (); ++it) + for (; it != endIt && key.isValid (); ++it) { (*it)->onIsValid(pSender, key); } @@ -138,7 +138,7 @@ public: { Iterator it = _strategies.begin(); Iterator endIt = _strategies.end(); - for (it; it != endIt; ++it) + for (; it != endIt; ++it) { (*it)->onReplace(pSender, elemsToRemove); } @@ -149,7 +149,7 @@ protected: }; -Foundation_END +} // namespace Poco #endif diff --git a/Foundation/include/Foundation/StreamChannel.h b/Foundation/include/Poco/StreamChannel.h similarity index 82% rename from Foundation/include/Foundation/StreamChannel.h rename to Foundation/include/Poco/StreamChannel.h index 363492802..06348ce96 100644 --- a/Foundation/include/Foundation/StreamChannel.h +++ b/Foundation/include/Poco/StreamChannel.h @@ -1,7 +1,7 @@ // // StreamChannel.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/StreamChannel.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/StreamChannel.h#1 $ // // Library: Foundation // Package: Logging @@ -40,22 +40,13 @@ #define Foundation_StreamChannel_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Channel_INCLUDED -#include "Foundation/Channel.h" -#endif -#ifndef Foundation_Mutex_INCLUDED -#include "Foundation/Mutex.h" -#endif -#ifndef STD_OSTREAM_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/Channel.h" +#include "Poco/Mutex.h" #include -#define STD_OSTREAM_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API StreamChannel: public Channel @@ -84,7 +75,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_StreamChannel_INCLUDED diff --git a/Foundation/include/Foundation/StreamConverter.h b/Foundation/include/Poco/StreamConverter.h similarity index 88% rename from Foundation/include/Foundation/StreamConverter.h rename to Foundation/include/Poco/StreamConverter.h index e37268eb2..e01f6e543 100644 --- a/Foundation/include/Foundation/StreamConverter.h +++ b/Foundation/include/Poco/StreamConverter.h @@ -1,7 +1,7 @@ // // StreamConverter.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/StreamConverter.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/StreamConverter.h#1 $ // // Library: Foundation // Package: Text @@ -40,26 +40,14 @@ #define Foundation_StreamConverter_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_TextEncoding_INCLUDED -#include "Foundation/TextEncoding.h" -#endif -#ifndef Foundation_UnbufferedStreamBuf_INCLUDED -#include "Foundation/UnbufferedStreamBuf.h" -#endif -#ifndef STD_ISTREAM_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/TextEncoding.h" +#include "Poco/UnbufferedStreamBuf.h" #include -#define STD_ISTREAM_INCLUDED -#endif -#ifndef STD_OSTREAM_INCLUDED #include -#define STD_OSTREAM_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API StreamConverterBuf: public UnbufferedStreamBuf @@ -156,7 +144,7 @@ public: }; -Foundation_END +} // namespace Poco #endif // Foundation_StreamConverter_INCLUDED diff --git a/Foundation/include/Foundation/StreamCopier.h b/Foundation/include/Poco/StreamCopier.h similarity index 86% rename from Foundation/include/Foundation/StreamCopier.h rename to Foundation/include/Poco/StreamCopier.h index c83d1a9b3..920b80380 100644 --- a/Foundation/include/Foundation/StreamCopier.h +++ b/Foundation/include/Poco/StreamCopier.h @@ -1,7 +1,7 @@ // // StreamCopier.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/StreamCopier.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/StreamCopier.h#1 $ // // Library: Foundation // Package: Streams @@ -40,20 +40,12 @@ #define Foundation_StreamCopier_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef STD_ISTREAM_INCLUDED +#include "Poco/Foundation.h" #include -#define STD_ISTREAM_INCLUDED -#endif -#ifndef STD_OSTREAM_INCLUDED #include -#define STD_OSTREAM_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API StreamCopier @@ -78,7 +70,7 @@ public: }; -Foundation_END +} // namespace Poco #endif // Foundation_StreamCopier_INCLUDED diff --git a/Foundation/include/Foundation/StreamTokenizer.h b/Foundation/include/Poco/StreamTokenizer.h similarity index 87% rename from Foundation/include/Foundation/StreamTokenizer.h rename to Foundation/include/Poco/StreamTokenizer.h index 7e705c04c..a2c7f2901 100644 --- a/Foundation/include/Foundation/StreamTokenizer.h +++ b/Foundation/include/Poco/StreamTokenizer.h @@ -1,7 +1,7 @@ // // StreamTokenizer.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/StreamTokenizer.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/StreamTokenizer.h#1 $ // // Library: Foundation // Package: Streams @@ -40,23 +40,13 @@ #define Foundation_StreamTokenizer_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Token_INCLUDED -#include "Foundation/Token.h" -#endif -#ifndef STD_ISTREAM_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/Token.h" #include -#define STD_ISTREAM_INCLUDED -#endif -#ifndef STD_VECTOR_INCLUDED #include -#define STD_VECTOR_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API StreamTokenizer @@ -123,7 +113,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_StreamTokenizer_INCLUDED diff --git a/Foundation/include/Foundation/StreamUtil.h b/Foundation/include/Poco/StreamUtil.h similarity index 92% rename from Foundation/include/Foundation/StreamUtil.h rename to Foundation/include/Poco/StreamUtil.h index a3f86ac2f..4d9f4c8a7 100644 --- a/Foundation/include/Foundation/StreamUtil.h +++ b/Foundation/include/Poco/StreamUtil.h @@ -1,7 +1,7 @@ // // StreamUtil.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/StreamUtil.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/StreamUtil.h#1 $ // // Library: Foundation // Package: Streams @@ -40,9 +40,7 @@ #define Foundation_StreamUtil_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif +#include "Poco/Foundation.h" // poco_ios_init diff --git a/Foundation/include/Foundation/String.h b/Foundation/include/Poco/String.h similarity index 94% rename from Foundation/include/Foundation/String.h rename to Foundation/include/Poco/String.h index 36d745605..a5b8ac954 100644 --- a/Foundation/include/Foundation/String.h +++ b/Foundation/include/Poco/String.h @@ -1,7 +1,7 @@ // // String.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/String.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/String.h#1 $ // // Library: Foundation // Package: Core @@ -40,16 +40,11 @@ #define Foundation_String_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef STD_LOCALE_INCLUDED +#include "Poco/Foundation.h" #include -#define STD_LOCALE_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { template @@ -504,7 +499,7 @@ S cat(const S& delim, const It& begin, const It& end) } -Foundation_END +} // namespace Poco #endif // Foundation_String_INCLUDED diff --git a/Foundation/include/Foundation/StringTokenizer.h b/Foundation/include/Poco/StringTokenizer.h similarity index 88% rename from Foundation/include/Foundation/StringTokenizer.h rename to Foundation/include/Poco/StringTokenizer.h index 2d1cbeee7..401c89668 100644 --- a/Foundation/include/Foundation/StringTokenizer.h +++ b/Foundation/include/Poco/StringTokenizer.h @@ -1,7 +1,7 @@ // // StringTokenizer.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/StringTokenizer.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/StringTokenizer.h#1 $ // // Library: Foundation // Package: Core @@ -40,19 +40,12 @@ #define Foundation_StringTokenizer_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Exception_INCLUDED -#include "Foundation/Exception.h" -#endif -#ifndef STD_VECTOR_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/Exception.h" #include -#define STD_VECTOR_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API StringTokenizer @@ -131,7 +124,7 @@ inline int StringTokenizer::count() const } -Foundation_END +} // namespace Poco #endif // Foundation_StringTokenizer_INCLUDED diff --git a/Foundation/include/Foundation/SynchronizedObject.h b/Foundation/include/Poco/SynchronizedObject.h similarity index 87% rename from Foundation/include/Foundation/SynchronizedObject.h rename to Foundation/include/Poco/SynchronizedObject.h index 5c4956390..0e3ff5cd7 100644 --- a/Foundation/include/Foundation/SynchronizedObject.h +++ b/Foundation/include/Poco/SynchronizedObject.h @@ -1,7 +1,7 @@ // // SynchronizedObject.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/SynchronizedObject.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/SynchronizedObject.h#1 $ // // Library: Foundation // Package: Threading @@ -40,18 +40,12 @@ #define Foundation_SynchronizedObject_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Mutex_INCLUDED -#include "Foundation/Mutex.h" -#endif -#ifndef Foundation_Event_INCLUDED -#include "Foundation/Event.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/Mutex.h" +#include "Poco/Event.h" -Foundation_BEGIN +namespace Poco { class Foundation_API SynchronizedObject @@ -61,7 +55,7 @@ class Foundation_API SynchronizedObject /// scenario. { public: - typedef Foundation::ScopedLock ScopedLock; + typedef Poco::ScopedLock ScopedLock; SynchronizedObject(); /// Creates the object. @@ -153,7 +147,7 @@ inline bool SynchronizedObject::tryWait(long milliseconds) const } -Foundation_END +} // namespace Poco #endif // Foundation_SynchronizedObject_INCLUDED diff --git a/Foundation/include/Foundation/SyslogChannel.h b/Foundation/include/Poco/SyslogChannel.h similarity index 92% rename from Foundation/include/Foundation/SyslogChannel.h rename to Foundation/include/Poco/SyslogChannel.h index 36d6d52b0..831265165 100644 --- a/Foundation/include/Foundation/SyslogChannel.h +++ b/Foundation/include/Poco/SyslogChannel.h @@ -1,7 +1,7 @@ // // SyslogChannel.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/SyslogChannel.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/SyslogChannel.h#1 $ // // Library: Foundation // Package: Logging @@ -40,15 +40,11 @@ #define Foundation_SyslogChannel_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Channel_INCLUDED -#include "Foundation/Channel.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/Channel.h" -Foundation_BEGIN +namespace Poco { class Foundation_API SyslogChannel: public Channel @@ -129,7 +125,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_SyslogChannel_INCLUDED diff --git a/Foundation/include/Foundation/Task.h b/Foundation/include/Poco/Task.h similarity index 87% rename from Foundation/include/Foundation/Task.h rename to Foundation/include/Poco/Task.h index 2aa6bf48c..3bc62a9b7 100644 --- a/Foundation/include/Foundation/Task.h +++ b/Foundation/include/Poco/Task.h @@ -1,7 +1,7 @@ // // Task.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Task.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Task.h#1 $ // // Library: Foundation // Package: Tasks @@ -40,24 +40,14 @@ #define Foundation_Task_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Runnable_INCLUDED -#include "Foundation/Runnable.h" -#endif -#ifndef Foundation_RefCountedObject_INCLUDED -#include "Foundation/RefCountedObject.h" -#endif -#ifndef Foundation_Mutex_INCLUDED -#include "Foundation/Mutex.h" -#endif -#ifndef Foundation_Event_INCLUDED -#include "Foundation/Event.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/Runnable.h" +#include "Poco/RefCountedObject.h" +#include "Poco/Mutex.h" +#include "Poco/Event.h" -Foundation_BEGIN +namespace Poco { class TaskManager; @@ -211,7 +201,7 @@ inline TaskManager* Task::getOwner() const } -Foundation_END +} // namespace Poco #endif // Foundation_Task_INCLUDED diff --git a/Foundation/include/Foundation/TaskManager.h b/Foundation/include/Poco/TaskManager.h similarity index 84% rename from Foundation/include/Foundation/TaskManager.h rename to Foundation/include/Poco/TaskManager.h index e9831ff9b..1048568bd 100644 --- a/Foundation/include/Foundation/TaskManager.h +++ b/Foundation/include/Poco/TaskManager.h @@ -1,7 +1,7 @@ // // TaskManager.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/TaskManager.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/TaskManager.h#1 $ // // Library: Foundation // Package: Tasks @@ -40,31 +40,16 @@ #define Foundation_TaskManager_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Mutex_INCLUDED -#include "Foundation/Mutex.h" -#endif -#ifndef Foundation_Task_INCLUDED -#include "Foundation/Task.h" -#endif -#ifndef Foundation_AutoPtr_INCLUDED -#include "Foundation/AutoPtr.h" -#endif -#ifndef Foundation_NotificationCenter_INCLUDED -#include "Foundation/NotificationCenter.h" -#endif -#ifndef Foundation_Timestamp_INCLUDED -#include "Foundation/Timestamp.h" -#endif -#ifndef STD_LIST_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/Mutex.h" +#include "Poco/Task.h" +#include "Poco/AutoPtr.h" +#include "Poco/NotificationCenter.h" +#include "Poco/Timestamp.h" #include -#define STD_LIST_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Notification; @@ -162,7 +147,7 @@ inline int TaskManager::count() const } -Foundation_END +} // namespace Poco #endif // Foundation_TaskManager_INCLUDED diff --git a/Foundation/include/Foundation/TaskNotification.h b/Foundation/include/Poco/TaskNotification.h similarity index 89% rename from Foundation/include/Foundation/TaskNotification.h rename to Foundation/include/Poco/TaskNotification.h index 93efbefc4..8a97e411c 100644 --- a/Foundation/include/Foundation/TaskNotification.h +++ b/Foundation/include/Poco/TaskNotification.h @@ -1,7 +1,7 @@ // // TaskNotification.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/TaskNotification.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/TaskNotification.h#1 $ // // Library: Foundation // Package: Tasks @@ -40,18 +40,12 @@ #define Foundation_TaskNotification_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Notification_INCLUDED -#include "Foundation/Notification.h" -#endif -#ifndef Foundation_Task_INCLUDED -#include "Foundation/Task.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/Notification.h" +#include "Poco/Task.h" -Foundation_BEGIN +namespace Poco { class Foundation_API TaskNotification: public Notification @@ -192,7 +186,7 @@ inline float TaskProgressNotification::progress() const } -Foundation_END +} // namespace Poco #endif // Foundation_TaskNotification_INCLUDED diff --git a/Foundation/include/Foundation/TeeStream.h b/Foundation/include/Poco/TeeStream.h similarity index 86% rename from Foundation/include/Foundation/TeeStream.h rename to Foundation/include/Poco/TeeStream.h index e16258454..8f05c8529 100644 --- a/Foundation/include/Foundation/TeeStream.h +++ b/Foundation/include/Poco/TeeStream.h @@ -1,7 +1,7 @@ // // TeeStream.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/TeeStream.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/TeeStream.h#1 $ // // Library: Foundation // Package: Streams @@ -40,27 +40,14 @@ #define Foundation_TeeStream_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_UnbufferedStreamBuf_INCLUDED -#include "Foundation/UnbufferedStreamBuf.h" -#endif -#ifndef STD_VECTOR_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/UnbufferedStreamBuf.h" #include -#define STD_VECTOR_INCLUDED -#endif -#ifndef STD_ISTREAM_INCLUDED #include -#define STD_ISTREAM_INCLUDED -#endif -#ifndef STD_OSTREAM_INCLUDED #include -#define STD_OSTREAM_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API TeeStreamBuf: public UnbufferedStreamBuf @@ -161,7 +148,7 @@ public: }; -Foundation_END +} // namespace Poco #endif // Foundation_TeeStream_INCLUDED diff --git a/Foundation/include/Foundation/TemporaryFile.h b/Foundation/include/Poco/TemporaryFile.h similarity index 89% rename from Foundation/include/Foundation/TemporaryFile.h rename to Foundation/include/Poco/TemporaryFile.h index 51a75a655..7feb73357 100644 --- a/Foundation/include/Foundation/TemporaryFile.h +++ b/Foundation/include/Poco/TemporaryFile.h @@ -1,7 +1,7 @@ // // TemporaryFile.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/TemporaryFile.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/TemporaryFile.h#1 $ // // Library: Foundation // Package: Filesystem @@ -40,15 +40,11 @@ #define Foundation_TemporaryFile_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_File_INCLUDED -#include "Foundation/File.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/File.h" -Foundation_BEGIN +namespace Poco { class Foundation_API TemporaryFile: public File @@ -100,7 +96,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_TemporaryFile_INCLUDED diff --git a/Foundation/include/Foundation/TextConverter.h b/Foundation/include/Poco/TextConverter.h similarity index 91% rename from Foundation/include/Foundation/TextConverter.h rename to Foundation/include/Poco/TextConverter.h index 0aaaea85e..20dfc3345 100644 --- a/Foundation/include/Foundation/TextConverter.h +++ b/Foundation/include/Poco/TextConverter.h @@ -1,7 +1,7 @@ // // TextConverter.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/TextConverter.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/TextConverter.h#1 $ // // Library: Foundation // Package: Text @@ -40,12 +40,10 @@ #define Foundation_TextConverter_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif +#include "Poco/Foundation.h" -Foundation_BEGIN +namespace Poco { class TextEncoding; @@ -90,7 +88,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_TextConverter_INCLUDED diff --git a/Foundation/include/Foundation/TextEncoding.h b/Foundation/include/Poco/TextEncoding.h similarity index 93% rename from Foundation/include/Foundation/TextEncoding.h rename to Foundation/include/Poco/TextEncoding.h index efbd9aa62..ef26be456 100644 --- a/Foundation/include/Foundation/TextEncoding.h +++ b/Foundation/include/Poco/TextEncoding.h @@ -1,7 +1,7 @@ // // TextEncoding.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/TextEncoding.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/TextEncoding.h#1 $ // // Library: Foundation // Package: Text @@ -40,12 +40,10 @@ #define Foundation_TextEncoding_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif +#include "Poco/Foundation.h" -Foundation_BEGIN +namespace Poco { class Foundation_API TextEncoding @@ -102,7 +100,7 @@ public: }; -Foundation_END +} // namespace Poco #endif // Foundation_TextEncoding_INCLUDED diff --git a/Foundation/include/Foundation/TextIterator.h b/Foundation/include/Poco/TextIterator.h similarity index 92% rename from Foundation/include/Foundation/TextIterator.h rename to Foundation/include/Poco/TextIterator.h index b00557a53..35b0df2f2 100644 --- a/Foundation/include/Foundation/TextIterator.h +++ b/Foundation/include/Poco/TextIterator.h @@ -1,7 +1,7 @@ // // TextIterator.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/TextIterator.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/TextIterator.h#1 $ // // Library: Foundation // Package: Text @@ -40,12 +40,10 @@ #define Foundation_TextIterator_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif +#include "Poco/Foundation.h" -Foundation_BEGIN +namespace Poco { class TextEncoding; @@ -147,7 +145,7 @@ inline void swap(TextIterator& it1, TextIterator& it2) } -Foundation_END +} // namespace Poco #endif // Foundation_TextIterator_INCLUDED diff --git a/Foundation/include/Foundation/Thread.h b/Foundation/include/Poco/Thread.h similarity index 90% rename from Foundation/include/Foundation/Thread.h rename to Foundation/include/Poco/Thread.h index f843a6854..6d37de02f 100644 --- a/Foundation/include/Foundation/Thread.h +++ b/Foundation/include/Poco/Thread.h @@ -1,7 +1,7 @@ // // Thread.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Thread.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Thread.h#1 $ // // Library: Foundation // Package: Threading @@ -40,19 +40,17 @@ #define Foundation_Thread_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif +#include "Poco/Foundation.h" #if defined(POCO_OS_FAMILY_WINDOWS) -#include "Foundation/Thread_WIN32.h" +#include "Poco/Thread_WIN32.h" #else -#include "Foundation/Thread_POSIX.h" +#include "Poco/Thread_POSIX.h" #endif -Foundation_BEGIN +namespace Poco { class Runnable; @@ -95,6 +93,9 @@ public: void setPriority(Priority prio); /// Sets the thread's priority. + /// + /// Some platform only allow changing a thread's priority + /// if the process has certain privileges. Priority getPriority() const; /// Returns the thread's priority. @@ -189,7 +190,7 @@ inline Thread* Thread::current() } -Foundation_END +} // namespace Poco #endif // Foundation_Thread_INCLUDED diff --git a/Foundation/include/Foundation/ThreadLocal.h b/Foundation/include/Poco/ThreadLocal.h similarity index 91% rename from Foundation/include/Foundation/ThreadLocal.h rename to Foundation/include/Poco/ThreadLocal.h index c4942e266..70c1618df 100644 --- a/Foundation/include/Foundation/ThreadLocal.h +++ b/Foundation/include/Poco/ThreadLocal.h @@ -1,7 +1,7 @@ // // ThreadLocal.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/ThreadLocal.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/ThreadLocal.h#1 $ // // Library: Foundation // Package: Threading @@ -40,16 +40,11 @@ #define Foundation_ThreadLocal_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef STD_MAP_INCLUDED +#include "Poco/Foundation.h" #include -#define STD_MAP_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API TLSAbstractSlot @@ -177,7 +172,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_ThreadLocal_INCLUDED diff --git a/Foundation/include/Foundation/ThreadPool.h b/Foundation/include/Poco/ThreadPool.h similarity index 84% rename from Foundation/include/Foundation/ThreadPool.h rename to Foundation/include/Poco/ThreadPool.h index 5fbb1b3c1..14ad6b01d 100644 --- a/Foundation/include/Foundation/ThreadPool.h +++ b/Foundation/include/Poco/ThreadPool.h @@ -1,7 +1,7 @@ // // ThreadPool.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/ThreadPool.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/ThreadPool.h#1 $ // // Library: Foundation // Package: Threading @@ -40,19 +40,13 @@ #define Foundation_ThreadPool_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Mutex_INCLUDED -#include "Foundation/Mutex.h" -#endif -#ifndef STD_VECTOR_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/Thread.h" +#include "Poco/Mutex.h" #include -#define STD_VECTOR_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Runnable; @@ -115,6 +109,17 @@ public: /// Throws a NoThreadAvailableException if no more /// threads are available. + void startWithPriority(Thread::Priority priority, Runnable& target); + /// Obtains a thread, adjusts the thread's priority, and starts the target. + /// Throws a NoThreadAvailableException if no more + /// threads are available. + + void startWithPriority(Thread::Priority priority, Runnable& target, const std::string& name); + /// Obtains a thread, adjusts the thread's priority, and starts the target. + /// Assigns the given name to the thread. + /// Throws a NoThreadAvailableException if no more + /// threads are available. + void stopAll(); /// Stops all running threads. /// Will also delete all thread objects. @@ -158,7 +163,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_ThreadPool_INCLUDED diff --git a/Foundation/include/Foundation/Thread_POSIX.h b/Foundation/include/Poco/Thread_POSIX.h similarity index 82% rename from Foundation/include/Foundation/Thread_POSIX.h rename to Foundation/include/Poco/Thread_POSIX.h index 3bf7f99e7..43b31e202 100644 --- a/Foundation/include/Foundation/Thread_POSIX.h +++ b/Foundation/include/Poco/Thread_POSIX.h @@ -1,7 +1,7 @@ // // Thread_POSIX.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Thread_POSIX.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Thread_POSIX.h#1 $ // // Library: Foundation // Package: Threading @@ -40,32 +40,17 @@ #define Foundation_Thread_POSIX_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Runnable_INCLUDED -#include "Foundation/Runnable.h" -#endif -#ifndef Foundation_SignalHandler_INCLUDED -#include "Foundation/SignalHandler.h" -#endif -#ifndef STD_PTHREAD_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/Runnable.h" +#include "Poco/SignalHandler.h" #include -#define STD_PTHREAD_INCLUDED -#endif #if !defined(POCO_NO_SYS_SELECT_H) -#ifndef STD_SYS_SELECT_INCLUDED #include -#define STD_SYS_SELECT_INCLUDED #endif -#endif -#ifndef STD_ERRNO_INCLUDED #include -#define STD_ERRNO_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API ThreadImpl @@ -145,7 +130,7 @@ inline void ThreadImpl::yieldImpl() } -Foundation_END +} // namespace Poco #endif // Foundation_Thread_POSIX_INCLUDED diff --git a/Foundation/include/Foundation/Thread_WIN32.h b/Foundation/include/Poco/Thread_WIN32.h similarity index 86% rename from Foundation/include/Foundation/Thread_WIN32.h rename to Foundation/include/Poco/Thread_WIN32.h index 0046018a7..a2da30522 100644 --- a/Foundation/include/Foundation/Thread_WIN32.h +++ b/Foundation/include/Poco/Thread_WIN32.h @@ -1,7 +1,7 @@ // // Thread_WIN32.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Thread_WIN32.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Thread_WIN32.h#1 $ // // Library: Foundation // Package: Threading @@ -40,19 +40,12 @@ #define Foundation_Thread_WIN32_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Runnable_INCLUDED -#include "Foundation/Runnable.h" -#endif -#ifndef STD_WINDOWS_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/Runnable.h" #include -#define STD_WINDOWS_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API ThreadImpl @@ -117,7 +110,7 @@ inline void ThreadImpl::yieldImpl() } -Foundation_END +} // namespace Poco #endif // Foundation_Thread_WIN32_INCLUDED diff --git a/Foundation/include/Foundation/Timer.h b/Foundation/include/Poco/Timer.h similarity index 88% rename from Foundation/include/Foundation/Timer.h rename to Foundation/include/Poco/Timer.h index 278eafa2b..d40f2eb2e 100644 --- a/Foundation/include/Foundation/Timer.h +++ b/Foundation/include/Poco/Timer.h @@ -1,7 +1,7 @@ // // Timer.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Timer.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Timer.h#1 $ // // Library: Foundation // Package: Threading @@ -40,24 +40,17 @@ #define Foundation_Timer_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Runnable_INCLUDED -#include "Foundation/Runnable.h" -#endif -#ifndef Foundation_Mutex_INCLUDED -#include "Foundation/Mutex.h" -#endif -#ifndef Foundation_Event_INCLUDED -#include "Foundation/Event.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/Runnable.h" +#include "Poco/Mutex.h" +#include "Poco/Event.h" -Foundation_BEGIN +namespace Poco { class AbstractTimerCallback; +class ThreadPool; class Foundation_API Timer: protected Runnable @@ -77,7 +70,7 @@ class Foundation_API Timer: protected Runnable /// factors like operating system, CPU performance and system load and /// may differ from the specified interval. /// - /// The timer thread is taken from the global default thread pool, so + /// The timer thread is taken from a thread pool, so /// there is a limit to the number of available concurrent timers. { public: @@ -96,6 +89,14 @@ public: /// Create the TimerCallback as follows: /// TimerCallback callback(*this, &MyClass::onTimer); /// timer.start(callback); + /// + /// The timer thread is taken from the global default thread pool. + + void start(const AbstractTimerCallback& method, ThreadPool& threadPool); + /// Starts the timer. + /// Create the TimerCallback as follows: + /// TimerCallback callback(*this, &MyClass::onTimer); + /// timer.start(callback); void stop(); /// Stops the timer. If the callback method is currently running @@ -208,7 +209,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_Timer_INCLUDED diff --git a/Foundation/include/Foundation/Timespan.h b/Foundation/include/Poco/Timespan.h similarity index 92% rename from Foundation/include/Foundation/Timespan.h rename to Foundation/include/Poco/Timespan.h index c58443333..69f628841 100644 --- a/Foundation/include/Foundation/Timespan.h +++ b/Foundation/include/Poco/Timespan.h @@ -1,7 +1,7 @@ // // Timespan.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Timespan.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Timespan.h#1 $ // // Library: Foundation // Package: DateTime @@ -40,15 +40,11 @@ #define Foundation_Timespan_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Timestamp_INCLUDED -#include "Foundation/Timestamp.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/Timestamp.h" -Foundation_BEGIN +namespace Poco { class Foundation_API Timespan @@ -318,7 +314,7 @@ inline void swap(Timespan& s1, Timespan& s2) } -Foundation_END +} // namespace Poco #endif // Foundation_Timespan_INCLUDED diff --git a/Foundation/include/Foundation/Timestamp.h b/Foundation/include/Poco/Timestamp.h similarity index 92% rename from Foundation/include/Foundation/Timestamp.h rename to Foundation/include/Poco/Timestamp.h index 1bf22d4fb..7a8f39928 100644 --- a/Foundation/include/Foundation/Timestamp.h +++ b/Foundation/include/Poco/Timestamp.h @@ -1,7 +1,7 @@ // // Timestamp.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Timestamp.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Timestamp.h#1 $ // // Library: Foundation // Package: DateTime @@ -40,16 +40,11 @@ #define Foundation_Timestamp_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef STD_TIME_INCLUDED +#include "Poco/Foundation.h" #include -#define STD_TIME_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API Timestamp @@ -258,7 +253,7 @@ inline void swap(Timestamp& s1, Timestamp& s2) } -Foundation_END +} // namespace Poco #endif // Foundation_Timestamp_INCLUDED diff --git a/Foundation/include/Foundation/Timezone.h b/Foundation/include/Poco/Timezone.h similarity index 89% rename from Foundation/include/Foundation/Timezone.h rename to Foundation/include/Poco/Timezone.h index c1c67c179..2ded0e4e2 100644 --- a/Foundation/include/Foundation/Timezone.h +++ b/Foundation/include/Poco/Timezone.h @@ -1,7 +1,7 @@ // // Timezone.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Timezone.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Timezone.h#1 $ // // Library: Foundation // Package: DateTime @@ -40,15 +40,11 @@ #define Foundation_Timezone_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Timestamp_INCLUDED -#include "Foundation/Timestamp.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/Timestamp.h" -Foundation_BEGIN +namespace Poco { class Foundation_API Timezone @@ -87,7 +83,7 @@ public: }; -Foundation_END +} // namespace Poco #endif // Foundation_Timezone_INCLUDED diff --git a/Foundation/include/Foundation/Token.h b/Foundation/include/Poco/Token.h similarity index 91% rename from Foundation/include/Foundation/Token.h rename to Foundation/include/Poco/Token.h index c155daee0..1dfc02151 100644 --- a/Foundation/include/Foundation/Token.h +++ b/Foundation/include/Poco/Token.h @@ -1,7 +1,7 @@ // // Token.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Token.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Token.h#1 $ // // Library: Foundation // Package: Streams @@ -40,16 +40,11 @@ #define Foundation_Token_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef STD_ISTREAM_INCLUDED +#include "Poco/Foundation.h" #include -#define STD_ISTREAM_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API Token @@ -182,7 +177,7 @@ inline bool Token::is(Token::Class cls) const } -Foundation_END +} // namespace Poco #endif // Foundation_Token_INCLUDED diff --git a/Foundation/include/Foundation/Types.h b/Foundation/include/Poco/Types.h similarity index 94% rename from Foundation/include/Foundation/Types.h rename to Foundation/include/Poco/Types.h index f553e3d1e..86380619c 100644 --- a/Foundation/include/Foundation/Types.h +++ b/Foundation/include/Poco/Types.h @@ -1,7 +1,7 @@ // // Types.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Types.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Types.h#1 $ // // Library: Foundation // Package: Core @@ -40,12 +40,10 @@ #define Foundation_Types_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif +#include "Poco/Foundation.h" -Foundation_BEGIN +namespace Poco { #if defined(_MSC_VER) @@ -210,7 +208,7 @@ Foundation_BEGIN #endif -Foundation_END +} // namespace Poco #endif // Foundation_Types_INCLUDED diff --git a/Foundation/include/Foundation/URI.h b/Foundation/include/Poco/URI.h similarity index 95% rename from Foundation/include/Foundation/URI.h rename to Foundation/include/Poco/URI.h index 03c3605b9..1590e8355 100644 --- a/Foundation/include/Foundation/URI.h +++ b/Foundation/include/Poco/URI.h @@ -1,7 +1,7 @@ // // URI.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/URI.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/URI.h#1 $ // // Library: Foundation // Package: URI @@ -40,16 +40,11 @@ #define Foundation_URI_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef STD_VECTOR_INCLUDED +#include "Poco/Foundation.h" #include -#define STD_VECTOR_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class Foundation_API URI @@ -364,7 +359,7 @@ inline void swap(URI& u1, URI& u2) } -Foundation_END +} // namespace Poco #endif // Foundation_URI_INCLUDED diff --git a/Foundation/include/Foundation/URIStreamFactory.h b/Foundation/include/Poco/URIStreamFactory.h similarity index 88% rename from Foundation/include/Foundation/URIStreamFactory.h rename to Foundation/include/Poco/URIStreamFactory.h index c22e686ed..8085069f9 100644 --- a/Foundation/include/Foundation/URIStreamFactory.h +++ b/Foundation/include/Poco/URIStreamFactory.h @@ -1,7 +1,7 @@ // // URIStreamFactory.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/URIStreamFactory.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/URIStreamFactory.h#1 $ // // Library: Foundation // Package: URI @@ -40,16 +40,11 @@ #define Foundation_URIStreamFactory_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef STD_ISTREAM_INCLUDED +#include "Poco/Foundation.h" #include -#define STD_ISTREAM_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class URI; @@ -84,7 +79,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_URIStreamFactory_INCLUDED diff --git a/Foundation/include/Foundation/URIStreamOpener.h b/Foundation/include/Poco/URIStreamOpener.h similarity index 90% rename from Foundation/include/Foundation/URIStreamOpener.h rename to Foundation/include/Poco/URIStreamOpener.h index c2537cdfe..fd8f26c2d 100644 --- a/Foundation/include/Foundation/URIStreamOpener.h +++ b/Foundation/include/Poco/URIStreamOpener.h @@ -1,7 +1,7 @@ // // URIStreamOpener.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/URIStreamOpener.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/URIStreamOpener.h#1 $ // // Library: Foundation // Package: URI @@ -40,23 +40,13 @@ #define Foundation_URIStreamOpener_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_Mutex_INCLUDED -#include "Foundation/Mutex.h" -#endif -#ifndef STD_ISTREAM_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/Mutex.h" #include -#define STD_ISTREAM_INCLUDED -#endif -#ifndef STD_MAP_INCLUDED #include -#define STD_MAP_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { class URI; @@ -155,7 +145,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_URIStreamOpener_INCLUDED diff --git a/Foundation/include/Foundation/UTF16Encoding.h b/Foundation/include/Poco/UTF16Encoding.h similarity index 89% rename from Foundation/include/Foundation/UTF16Encoding.h rename to Foundation/include/Poco/UTF16Encoding.h index 6c6ce6923..0a84c4a2d 100644 --- a/Foundation/include/Foundation/UTF16Encoding.h +++ b/Foundation/include/Poco/UTF16Encoding.h @@ -1,7 +1,7 @@ // // UTF16Encoding.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/UTF16Encoding.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/UTF16Encoding.h#1 $ // // Library: Foundation // Package: Text @@ -40,15 +40,11 @@ #define Foundation_UTF16Encoding_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_TextEncoding_INCLUDED -#include "Foundation/TextEncoding.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/TextEncoding.h" -Foundation_BEGIN +namespace Poco { class Foundation_API UTF16Encoding: public TextEncoding @@ -100,7 +96,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_UTF16Encoding_INCLUDED diff --git a/Foundation/include/Foundation/UTF8Encoding.h b/Foundation/include/Poco/UTF8Encoding.h similarity index 85% rename from Foundation/include/Foundation/UTF8Encoding.h rename to Foundation/include/Poco/UTF8Encoding.h index a7754f2bc..ce516271f 100644 --- a/Foundation/include/Foundation/UTF8Encoding.h +++ b/Foundation/include/Poco/UTF8Encoding.h @@ -1,7 +1,7 @@ // // UTF8Encoding.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/UTF8Encoding.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/UTF8Encoding.h#1 $ // // Library: Foundation // Package: Text @@ -40,15 +40,11 @@ #define Foundation_UTF8Encoding_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_TextEncoding_INCLUDED -#include "Foundation/TextEncoding.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/TextEncoding.h" -Foundation_BEGIN +namespace Poco { class Foundation_API UTF8Encoding: public TextEncoding @@ -66,7 +62,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_UTF8Encoding_INCLUDED diff --git a/Foundation/include/Foundation/UUID.h b/Foundation/include/Poco/UUID.h similarity index 90% rename from Foundation/include/Foundation/UUID.h rename to Foundation/include/Poco/UUID.h index 8f35fc0f0..29595ae1b 100644 --- a/Foundation/include/Foundation/UUID.h +++ b/Foundation/include/Poco/UUID.h @@ -1,7 +1,7 @@ // // UUID.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/UUID.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/UUID.h#1 $ // // Library: Foundation // Package: UUID @@ -40,12 +40,10 @@ #define Foundation_UUID_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif +#include "Poco/Foundation.h" -Foundation_BEGIN +namespace Poco { class Foundation_API UUID @@ -119,10 +117,10 @@ public: int variant() const; /// Returns the variant number of the UUID: - /// 0 reserved for NCS backward compatibility - /// 2 the Leach-Salz variant (used by this class) - /// 6 reserved, Microsoft Corporation backward compatibility - /// 7 reserved for future definition + /// - 0 reserved for NCS backward compatibility + /// - 2 the Leach-Salz variant (used by this class) + /// - 6 reserved, Microsoft Corporation backward compatibility + /// - 7 reserved for future definition bool operator == (const UUID& uuid) const; bool operator != (const UUID& uuid) const; @@ -229,7 +227,7 @@ inline void swap(UUID& u1, UUID& u2) } -Foundation_END +} // namespace Poco #endif // Foundation_UUID_INCLUDED diff --git a/Foundation/include/Foundation/UUIDGenerator.h b/Foundation/include/Poco/UUIDGenerator.h similarity index 85% rename from Foundation/include/Foundation/UUIDGenerator.h rename to Foundation/include/Poco/UUIDGenerator.h index 9611cfa28..4120fc4e0 100644 --- a/Foundation/include/Foundation/UUIDGenerator.h +++ b/Foundation/include/Poco/UUIDGenerator.h @@ -1,7 +1,7 @@ // // UUIDGenerator.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/UUIDGenerator.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/UUIDGenerator.h#1 $ // // Library: Foundation // Package: UUID @@ -40,24 +40,14 @@ #define Foundation_UUIDGenerator_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_UUID_INCLUDED -#include "Foundation/UUID.h" -#endif -#ifndef Foundation_Mutex_INCLUDED -#include "Foundation/Mutex.h" -#endif -#ifndef Foundation_Random_INCLUDED -#include "Foundation/Random.h" -#endif -#ifndef Foundation_Timestamp_INCLUDED -#include "Foundation/Timestamp.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/UUID.h" +#include "Poco/Mutex.h" +#include "Poco/Random.h" +#include "Poco/Timestamp.h" -Foundation_BEGIN +namespace Poco { class DigestEngine; @@ -122,7 +112,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_UUIDGenerator_INCLUDED diff --git a/Foundation/include/Foundation/UnbufferedStreamBuf.h b/Foundation/include/Poco/UnbufferedStreamBuf.h similarity index 86% rename from Foundation/include/Foundation/UnbufferedStreamBuf.h rename to Foundation/include/Poco/UnbufferedStreamBuf.h index fe7ff081a..276dcfd3d 100644 --- a/Foundation/include/Foundation/UnbufferedStreamBuf.h +++ b/Foundation/include/Poco/UnbufferedStreamBuf.h @@ -1,7 +1,7 @@ // // UnufferedStreamBuf.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/UnbufferedStreamBuf.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/UnbufferedStreamBuf.h#1 $ // // Library: Foundation // Package: Streams @@ -40,27 +40,14 @@ #define Foundation_UnbufferedStreamBuf_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_StreamUtil_INCLUDED -#include "Foundation/StreamUtil.h" -#endif -#ifndef STD_STREAMBUF_INCLUDED +#include "Poco/Foundation.h" +#include "Poco/StreamUtil.h" #include -#define STD_STREAMBUF_INCLUDED -#endif -#ifndef STD_IOSFWD_INCLUDED #include -#define STD_IOSFWD_INCLUDED -#endif -#ifndef STD_IOS_INCLUDED #include -#define STD_IOS_INCLUDED -#endif -Foundation_BEGIN +namespace Poco { template @@ -198,7 +185,7 @@ private: typedef BasicUnbufferedStreamBuf > UnbufferedStreamBuf; -Foundation_END +} // namespace Poco #endif // Foundation_UnbufferedStreamBuf_INCLUDED diff --git a/Foundation/include/Foundation/UnicodeConverter.h b/Foundation/include/Poco/UnicodeConverter.h similarity index 92% rename from Foundation/include/Foundation/UnicodeConverter.h rename to Foundation/include/Poco/UnicodeConverter.h index 891e33310..71110d645 100644 --- a/Foundation/include/Foundation/UnicodeConverter.h +++ b/Foundation/include/Poco/UnicodeConverter.h @@ -1,7 +1,7 @@ // // UnicodeConverter.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/UnicodeConverter.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/UnicodeConverter.h#1 $ // // Library: Foundation // Package: Text @@ -40,12 +40,10 @@ #define Foundation_UnicodeConverter_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif +#include "Poco/Foundation.h" -Foundation_BEGIN +namespace Poco { class Foundation_API UnicodeConverter @@ -77,7 +75,7 @@ public: }; -Foundation_END +} // namespace Poco #endif // Foundation_UnicodeConverter_INCLUDED diff --git a/Foundation/include/Foundation/ValidArgs.h b/Foundation/include/Poco/ValidArgs.h similarity index 90% rename from Foundation/include/Foundation/ValidArgs.h rename to Foundation/include/Poco/ValidArgs.h index ca6c23764..c3bcf9aa7 100644 --- a/Foundation/include/Foundation/ValidArgs.h +++ b/Foundation/include/Poco/ValidArgs.h @@ -1,7 +1,7 @@ // // ValidArgs.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/ValidArgs.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/ValidArgs.h#1 $ // // Library: Foundation // Package: Cache @@ -40,10 +40,10 @@ #define Foundation_ValidArgs_INCLUDED -#include "Foundation/Foundation.h" +#include "Poco/Foundation.h" -Foundation_BEGIN +namespace Poco { template @@ -90,7 +90,7 @@ private: }; -Foundation_END +} // namespace Poco #endif diff --git a/Foundation/include/Poco/Void.h b/Foundation/include/Poco/Void.h new file mode 100644 index 000000000..7a01a0eaa --- /dev/null +++ b/Foundation/include/Poco/Void.h @@ -0,0 +1,90 @@ +// +// Void.h +// +// $Id: //poco/1.2/Foundation/include/Poco/Void.h#1 $ +// +// Library: Foundation +// Package: Core +// Module: Void +// +// Definition of the Void class. +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Redistributions in any form must be accompanied by information on +// how to obtain complete source code for this software and any +// accompanying software that uses this software. The source code +// must either be included in the distribution or be available for no +// more than the cost of distribution plus a nominal fee, and must be +// freely redistributable under reasonable conditions. For an +// executable file, complete source code means the source code for all +// modules it contains. It does not include source code for modules or +// files that typically accompany the major components of the operating +// system on which the executable file runs. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + + +#ifndef Foundation_Void_INCLUDED +#define Foundation_Void_INCLUDED + + +#include "Poco/Foundation.h" + + +namespace Poco { + + +class Foundation_API Void + /// A dummy class with value-type semantics, + /// mostly useful as a template argument. + /// + /// This class is typically used together with ActiveMethod, + /// if no argument or return value is needed. +{ +public: + Void(); + /// Creates the Void. + + Void(const Void& v); + /// Creates the Void from another Void. + /// + /// The philosophical aspects of this operation + /// remain undiscussed for now. + + ~Void(); + /// Destroys the Void. + + Void& operator = (const Void& v); + /// Assigns another void. +}; + + +} // namespace Poco + + +#endif // Foundation_Void_INCLUDED diff --git a/Foundation/include/Foundation/Windows1252Encoding.h b/Foundation/include/Poco/Windows1252Encoding.h similarity index 85% rename from Foundation/include/Foundation/Windows1252Encoding.h rename to Foundation/include/Poco/Windows1252Encoding.h index 8ddb0744e..f3c4e48c9 100644 --- a/Foundation/include/Foundation/Windows1252Encoding.h +++ b/Foundation/include/Poco/Windows1252Encoding.h @@ -1,7 +1,7 @@ // // Windows1252Encoding.h // -// $Id: //poco/1.1.0/Foundation/include/Foundation/Windows1252Encoding.h#2 $ +// $Id: //poco/1.2/Foundation/include/Poco/Windows1252Encoding.h#1 $ // // Library: Foundation // Package: Text @@ -40,15 +40,11 @@ #define Foundation_Windows1252Encoding_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef Foundation_TextEncoding_INCLUDED -#include "Foundation/TextEncoding.h" -#endif +#include "Poco/Foundation.h" +#include "Poco/TextEncoding.h" -Foundation_BEGIN +namespace Poco { class Foundation_API Windows1252Encoding: public TextEncoding @@ -66,7 +62,7 @@ private: }; -Foundation_END +} // namespace Poco #endif // Foundation_Windows1252Encoding_INCLUDED diff --git a/Foundation/include/Foundation/zconf.h b/Foundation/include/Poco/zconf.h similarity index 95% rename from Foundation/include/Foundation/zconf.h rename to Foundation/include/Poco/zconf.h index 958a8a425..2b2d092f1 100644 --- a/Foundation/include/Foundation/zconf.h +++ b/Foundation/include/Poco/zconf.h @@ -3,7 +3,7 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -/* @(#) $Id: //poco/1.1.0/Foundation/include/Foundation/zconf.h#1 $ */ +/* @(#) $Id: //poco/1.2/Foundation/include/Poco/zconf.h#1 $ */ #ifndef ZCONF_H #define ZCONF_H diff --git a/Foundation/include/Foundation/zlib.h b/Foundation/include/Poco/zlib.h similarity index 100% rename from Foundation/include/Foundation/zlib.h rename to Foundation/include/Poco/zlib.h diff --git a/Foundation/samples/ActiveMethod/ActiveMethod.vmsbuild b/Foundation/samples/ActiveMethod/ActiveMethod.vmsbuild index 7d6bf435b..11e108168 100644 --- a/Foundation/samples/ActiveMethod/ActiveMethod.vmsbuild +++ b/Foundation/samples/ActiveMethod/ActiveMethod.vmsbuild @@ -1,7 +1,7 @@ # # sample.vmsbuild # -# $Id: //poco/1.1.0/Foundation/samples/ActiveMethod/ActiveMethod.vmsbuild#1 $ +# $Id: //poco/1.2/Foundation/samples/ActiveMethod/ActiveMethod.vmsbuild#1 $ # EXE=ActiveMethod ActiveMethod diff --git a/Foundation/samples/ActiveMethod/Makefile b/Foundation/samples/ActiveMethod/Makefile index d1d1898ec..97da55bc6 100644 --- a/Foundation/samples/ActiveMethod/Makefile +++ b/Foundation/samples/ActiveMethod/Makefile @@ -1,7 +1,7 @@ # # Makefile # -# $Id: //poco/1.1.0/Foundation/samples/ActiveMethod/Makefile#1 $ +# $Id: //poco/1.2/Foundation/samples/ActiveMethod/Makefile#1 $ # # Makefile for Poco ActiveMethod # diff --git a/Foundation/samples/ActiveMethod/src/ActiveMethod.cpp b/Foundation/samples/ActiveMethod/src/ActiveMethod.cpp index fa9cc9407..1e113789a 100644 --- a/Foundation/samples/ActiveMethod/src/ActiveMethod.cpp +++ b/Foundation/samples/ActiveMethod/src/ActiveMethod.cpp @@ -1,7 +1,7 @@ // // ActiveMethod.cpp // -// $Id: //poco/1.1.0/Foundation/samples/ActiveMethod/src/ActiveMethod.cpp#2 $ +// $Id: //poco/1.2/Foundation/samples/ActiveMethod/src/ActiveMethod.cpp#1 $ // // This sample demonstrates the ActiveMethod and ActiveResult classes. // @@ -32,13 +32,13 @@ // -#include "Foundation/ActiveMethod.h" -#include "Foundation/ActiveResult.h" +#include "Poco/ActiveMethod.h" +#include "Poco/ActiveResult.h" #include -using Foundation::ActiveMethod; -using Foundation::ActiveResult; +using Poco::ActiveMethod; +using Poco::ActiveResult; class ActiveMethodExample diff --git a/Foundation/samples/Activity/Activity.vmsbuild b/Foundation/samples/Activity/Activity.vmsbuild index ddcd66797..60e454309 100644 --- a/Foundation/samples/Activity/Activity.vmsbuild +++ b/Foundation/samples/Activity/Activity.vmsbuild @@ -1,7 +1,7 @@ # # sample.vmsbuild # -# $Id: //poco/1.1.0/Foundation/samples/Activity/Activity.vmsbuild#1 $ +# $Id: //poco/1.2/Foundation/samples/Activity/Activity.vmsbuild#1 $ # EXE=Activity Activity diff --git a/Foundation/samples/Activity/src/Activity.cpp b/Foundation/samples/Activity/src/Activity.cpp index bc09b1af3..648452c8c 100644 --- a/Foundation/samples/Activity/src/Activity.cpp +++ b/Foundation/samples/Activity/src/Activity.cpp @@ -1,7 +1,7 @@ // // Activity.cpp // -// $Id: //poco/1.1.0/Foundation/samples/Activity/src/Activity.cpp#2 $ +// $Id: //poco/1.2/Foundation/samples/Activity/src/Activity.cpp#1 $ // // This sample demonstrates the Activity class. // @@ -32,13 +32,13 @@ // -#include "Foundation/Activity.h" -#include "Foundation/Thread.h" +#include "Poco/Activity.h" +#include "Poco/Thread.h" #include -using Foundation::Activity; -using Foundation::Thread; +using Poco::Activity; +using Poco::Thread; class ActivityExample diff --git a/Foundation/samples/BinaryReaderWriter/BinaryReaderWriter.vmsbuild b/Foundation/samples/BinaryReaderWriter/BinaryReaderWriter.vmsbuild index 25695e83d..3e61e0ec2 100644 --- a/Foundation/samples/BinaryReaderWriter/BinaryReaderWriter.vmsbuild +++ b/Foundation/samples/BinaryReaderWriter/BinaryReaderWriter.vmsbuild @@ -1,7 +1,7 @@ # # sample.vmsbuild # -# $Id: //poco/1.1.0/Foundation/samples/BinaryReaderWriter/BinaryReaderWriter.vmsbuild#1 $ +# $Id: //poco/1.2/Foundation/samples/BinaryReaderWriter/BinaryReaderWriter.vmsbuild#1 $ # EXE=BinaryReaderWriter BinaryReaderWriter diff --git a/Foundation/samples/BinaryReaderWriter/Makefile b/Foundation/samples/BinaryReaderWriter/Makefile index 771717d73..345243dfb 100644 --- a/Foundation/samples/BinaryReaderWriter/Makefile +++ b/Foundation/samples/BinaryReaderWriter/Makefile @@ -1,7 +1,7 @@ # # Makefile # -# $Id: //poco/1.1.0/Foundation/samples/BinaryReaderWriter/Makefile#1 $ +# $Id: //poco/1.2/Foundation/samples/BinaryReaderWriter/Makefile#1 $ # # Makefile for Poco BinaryReaderWriter # diff --git a/Foundation/samples/BinaryReaderWriter/src/BinaryReaderWriter.cpp b/Foundation/samples/BinaryReaderWriter/src/BinaryReaderWriter.cpp index 46e387791..8eed7a89f 100644 --- a/Foundation/samples/BinaryReaderWriter/src/BinaryReaderWriter.cpp +++ b/Foundation/samples/BinaryReaderWriter/src/BinaryReaderWriter.cpp @@ -1,7 +1,7 @@ // // BinaryReaderWriter.cpp // -// $Id: //poco/1.1.0/Foundation/samples/BinaryReaderWriter/src/BinaryReaderWriter.cpp#2 $ +// $Id: //poco/1.2/Foundation/samples/BinaryReaderWriter/src/BinaryReaderWriter.cpp#1 $ // // This sample demonstrates the BinaryWriter and BinaryReader classes. // @@ -32,14 +32,14 @@ // -#include "Foundation/BinaryWriter.h" -#include "Foundation/BinaryReader.h" +#include "Poco/BinaryWriter.h" +#include "Poco/BinaryReader.h" #include #include -using Foundation::BinaryWriter; -using Foundation::BinaryReader; +using Poco::BinaryWriter; +using Poco::BinaryReader; int main(int argc, char** argv) diff --git a/Foundation/samples/DateTime/DateTime.vmsbuild b/Foundation/samples/DateTime/DateTime.vmsbuild index 9dd8ad915..d7ab16d07 100644 --- a/Foundation/samples/DateTime/DateTime.vmsbuild +++ b/Foundation/samples/DateTime/DateTime.vmsbuild @@ -1,7 +1,7 @@ # # sample.vmsbuild # -# $Id: //poco/1.1.0/Foundation/samples/DateTime/DateTime.vmsbuild#1 $ +# $Id: //poco/1.2/Foundation/samples/DateTime/DateTime.vmsbuild#1 $ # EXE=DateTime DateTime diff --git a/Foundation/samples/DateTime/Makefile b/Foundation/samples/DateTime/Makefile index b43c2273b..6ae986f5a 100644 --- a/Foundation/samples/DateTime/Makefile +++ b/Foundation/samples/DateTime/Makefile @@ -1,7 +1,7 @@ # # Makefile # -# $Id: //poco/1.1.0/Foundation/samples/DateTime/Makefile#1 $ +# $Id: //poco/1.2/Foundation/samples/DateTime/Makefile#1 $ # # Makefile for Poco DateTime # diff --git a/Foundation/samples/DateTime/src/DateTime.cpp b/Foundation/samples/DateTime/src/DateTime.cpp index e8595408d..c69cc76fe 100644 --- a/Foundation/samples/DateTime/src/DateTime.cpp +++ b/Foundation/samples/DateTime/src/DateTime.cpp @@ -1,7 +1,7 @@ // // DateTime.cpp // -// $Id: //poco/1.1.0/Foundation/samples/DateTime/src/DateTime.cpp#2 $ +// $Id: //poco/1.2/Foundation/samples/DateTime/src/DateTime.cpp#1 $ // // This sample demonstrates the DateTime class. // @@ -32,13 +32,13 @@ // -#include "Foundation/DateTime.h" -#include "Foundation/DateTimeFormat.h" +#include "Poco/DateTime.h" +#include "Poco/DateTimeFormat.h" #include -using Foundation::DateTime; -using Foundation::DateTimeFormat; +using Poco::DateTime; +using Poco::DateTimeFormat; int main(int argc, char** argv) diff --git a/Foundation/samples/Logger/Logger.vmsbuild b/Foundation/samples/Logger/Logger.vmsbuild index 694383d55..15ec53619 100644 --- a/Foundation/samples/Logger/Logger.vmsbuild +++ b/Foundation/samples/Logger/Logger.vmsbuild @@ -1,7 +1,7 @@ # # sample.vmsbuild # -# $Id: //poco/1.1.0/Foundation/samples/Logger/Logger.vmsbuild#1 $ +# $Id: //poco/1.2/Foundation/samples/Logger/Logger.vmsbuild#1 $ # EXE=Logger Logger diff --git a/Foundation/samples/Logger/Makefile b/Foundation/samples/Logger/Makefile index e07fada49..b5650ad3f 100644 --- a/Foundation/samples/Logger/Makefile +++ b/Foundation/samples/Logger/Makefile @@ -1,7 +1,7 @@ # # Makefile # -# $Id: //poco/1.1.0/Foundation/samples/Logger/Makefile#1 $ +# $Id: //poco/1.2/Foundation/samples/Logger/Makefile#1 $ # # Makefile for Poco Logger # diff --git a/Foundation/samples/Logger/src/Logger.cpp b/Foundation/samples/Logger/src/Logger.cpp index d9d174618..fc20cd43c 100644 --- a/Foundation/samples/Logger/src/Logger.cpp +++ b/Foundation/samples/Logger/src/Logger.cpp @@ -1,7 +1,7 @@ // // Logger.cpp // -// $Id: //poco/1.1.0/Foundation/samples/Logger/src/Logger.cpp#2 $ +// $Id: //poco/1.2/Foundation/samples/Logger/src/Logger.cpp#1 $ // // This class demonstrates the Logger, PatternFormatter, FormattingChannel, // ConsoleChannel and FileChannel classes. @@ -33,20 +33,20 @@ // -#include "Foundation/Logger.h" -#include "Foundation/PatternFormatter.h" -#include "Foundation/FormattingChannel.h" -#include "Foundation/ConsoleChannel.h" -#include "Foundation/FileChannel.h" -#include "Foundation/Message.h" +#include "Poco/Logger.h" +#include "Poco/PatternFormatter.h" +#include "Poco/FormattingChannel.h" +#include "Poco/ConsoleChannel.h" +#include "Poco/FileChannel.h" +#include "Poco/Message.h" -using Foundation::Logger; -using Foundation::PatternFormatter; -using Foundation::FormattingChannel; -using Foundation::ConsoleChannel; -using Foundation::FileChannel; -using Foundation::Message; +using Poco::Logger; +using Poco::PatternFormatter; +using Poco::FormattingChannel; +using Poco::ConsoleChannel; +using Poco::FileChannel; +using Poco::Message; int main(int argc, char** argv) diff --git a/Foundation/samples/Makefile b/Foundation/samples/Makefile index 3bae9b137..e0f1e9e00 100644 --- a/Foundation/samples/Makefile +++ b/Foundation/samples/Makefile @@ -1,12 +1,14 @@ # # Makefile # -# $Id: //poco/1.1.0/Foundation/samples/Makefile#1 $ +# $Id: //poco/1.2/Foundation/samples/Makefile#1 $ # # Makefile for Poco Foundation Samples # -.DEFAULT all: +.PHONY: projects +clean all: projects +projects: $(MAKE) -C ActiveMethod $(MAKECMDGOALS) $(MAKE) -C Activity $(MAKECMDGOALS) $(MAKE) -C Timer $(MAKECMDGOALS) diff --git a/Foundation/samples/NotificationQueue/Makefile b/Foundation/samples/NotificationQueue/Makefile index f8add3120..655b57868 100644 --- a/Foundation/samples/NotificationQueue/Makefile +++ b/Foundation/samples/NotificationQueue/Makefile @@ -1,7 +1,7 @@ # # Makefile # -# $Id: //poco/1.1.0/Foundation/samples/NotificationQueue/Makefile#1 $ +# $Id: //poco/1.2/Foundation/samples/NotificationQueue/Makefile#1 $ # # Makefile for Poco NotificationQueue # diff --git a/Foundation/samples/NotificationQueue/NotificationQueue.vmsbuild b/Foundation/samples/NotificationQueue/NotificationQueue.vmsbuild index 147f996d2..59a1ac3c0 100644 --- a/Foundation/samples/NotificationQueue/NotificationQueue.vmsbuild +++ b/Foundation/samples/NotificationQueue/NotificationQueue.vmsbuild @@ -1,7 +1,7 @@ # # sample.vmsbuild # -# $Id: //poco/1.1.0/Foundation/samples/NotificationQueue/NotificationQueue.vmsbuild#1 $ +# $Id: //poco/1.2/Foundation/samples/NotificationQueue/NotificationQueue.vmsbuild#1 $ # EXE=NotificationQueue NotificationQueue diff --git a/Foundation/samples/NotificationQueue/src/NotificationQueue.cpp b/Foundation/samples/NotificationQueue/src/NotificationQueue.cpp index 5c626cf70..85e4e7afb 100644 --- a/Foundation/samples/NotificationQueue/src/NotificationQueue.cpp +++ b/Foundation/samples/NotificationQueue/src/NotificationQueue.cpp @@ -1,7 +1,7 @@ // // NotificationQueue.cpp // -// $Id: //poco/1.1.0/Foundation/samples/NotificationQueue/src/NotificationQueue.cpp#2 $ +// $Id: //poco/1.2/Foundation/samples/NotificationQueue/src/NotificationQueue.cpp#1 $ // // This sample demonstrates the NotificationQueue, ThreadPool, // FastMutex and ScopedLock classes. @@ -33,25 +33,25 @@ // -#include "Foundation/Notification.h" -#include "Foundation/NotificationQueue.h" -#include "Foundation/ThreadPool.h" -#include "Foundation/Thread.h" -#include "Foundation/Runnable.h" -#include "Foundation/Mutex.h" -#include "Foundation/Random.h" -#include "Foundation/AutoPtr.h" +#include "Poco/Notification.h" +#include "Poco/NotificationQueue.h" +#include "Poco/ThreadPool.h" +#include "Poco/Thread.h" +#include "Poco/Runnable.h" +#include "Poco/Mutex.h" +#include "Poco/Random.h" +#include "Poco/AutoPtr.h" #include -using Foundation::Notification; -using Foundation::NotificationQueue; -using Foundation::ThreadPool; -using Foundation::Thread; -using Foundation::Runnable; -using Foundation::FastMutex; -using Foundation::Random; -using Foundation::AutoPtr; +using Poco::Notification; +using Poco::NotificationQueue; +using Poco::ThreadPool; +using Poco::Thread; +using Poco::Runnable; +using Poco::FastMutex; +using Poco::Random; +using Poco::AutoPtr; class WorkNotification: public Notification diff --git a/Foundation/samples/StringTokenizer/Makefile b/Foundation/samples/StringTokenizer/Makefile index 7f3b8ba26..9f2e01a1b 100644 --- a/Foundation/samples/StringTokenizer/Makefile +++ b/Foundation/samples/StringTokenizer/Makefile @@ -1,7 +1,7 @@ # # Makefile # -# $Id: //poco/1.1.0/Foundation/samples/StringTokenizer/Makefile#1 $ +# $Id: //poco/1.2/Foundation/samples/StringTokenizer/Makefile#1 $ # # Makefile for Poco StringTokenizer # diff --git a/Foundation/samples/StringTokenizer/StringTokenizer.vmsbuild b/Foundation/samples/StringTokenizer/StringTokenizer.vmsbuild index 9dd49f6de..ef238c918 100644 --- a/Foundation/samples/StringTokenizer/StringTokenizer.vmsbuild +++ b/Foundation/samples/StringTokenizer/StringTokenizer.vmsbuild @@ -1,7 +1,7 @@ # # sample.vmsbuild # -# $Id: //poco/1.1.0/Foundation/samples/StringTokenizer/StringTokenizer.vmsbuild#1 $ +# $Id: //poco/1.2/Foundation/samples/StringTokenizer/StringTokenizer.vmsbuild#1 $ # EXE=StringTokenizer StringTokenizer diff --git a/Foundation/samples/StringTokenizer/src/StringTokenizer.cpp b/Foundation/samples/StringTokenizer/src/StringTokenizer.cpp index e7de3d50e..2410f77c7 100644 --- a/Foundation/samples/StringTokenizer/src/StringTokenizer.cpp +++ b/Foundation/samples/StringTokenizer/src/StringTokenizer.cpp @@ -1,7 +1,7 @@ // // StringTokenizer.cpp // -// $Id: //poco/1.1.0/Foundation/samples/StringTokenizer/src/StringTokenizer.cpp#2 $ +// $Id: //poco/1.2/Foundation/samples/StringTokenizer/src/StringTokenizer.cpp#1 $ // // This sample demonstrates the usage of the StringTokenizer class. // @@ -32,11 +32,11 @@ // -#include "Foundation/StringTokenizer.h" +#include "Poco/StringTokenizer.h" #include -using Foundation::StringTokenizer; +using Poco::StringTokenizer; int main(int argc, char** argv) diff --git a/Foundation/samples/Timer/Makefile b/Foundation/samples/Timer/Makefile index 979e6d437..dc0147765 100644 --- a/Foundation/samples/Timer/Makefile +++ b/Foundation/samples/Timer/Makefile @@ -1,7 +1,7 @@ # # Makefile # -# $Id: //poco/1.1.0/Foundation/samples/Timer/Makefile#1 $ +# $Id: //poco/1.2/Foundation/samples/Timer/Makefile#1 $ # # Makefile for Poco Timer # diff --git a/Foundation/samples/Timer/Timer.vmsbuild b/Foundation/samples/Timer/Timer.vmsbuild index c7fb25b91..cec0f3bbd 100644 --- a/Foundation/samples/Timer/Timer.vmsbuild +++ b/Foundation/samples/Timer/Timer.vmsbuild @@ -1,7 +1,7 @@ # # sample.vmsbuild # -# $Id: //poco/1.1.0/Foundation/samples/Timer/Timer.vmsbuild#1 $ +# $Id: //poco/1.2/Foundation/samples/Timer/Timer.vmsbuild#1 $ # EXE=Timer Timer diff --git a/Foundation/samples/Timer/src/Timer.cpp b/Foundation/samples/Timer/src/Timer.cpp index c428f8c94..fb67e415b 100644 --- a/Foundation/samples/Timer/src/Timer.cpp +++ b/Foundation/samples/Timer/src/Timer.cpp @@ -1,7 +1,7 @@ // // Timer.cpp // -// $Id: //poco/1.1.0/Foundation/samples/Timer/src/Timer.cpp#2 $ +// $Id: //poco/1.2/Foundation/samples/Timer/src/Timer.cpp#1 $ // // This sample demonstrates the Timer and Stopwatch classes. // @@ -32,16 +32,16 @@ // -#include "Foundation/Timer.h" -#include "Foundation/Thread.h" -#include "Foundation/Stopwatch.h" +#include "Poco/Timer.h" +#include "Poco/Thread.h" +#include "Poco/Stopwatch.h" #include -using Foundation::Timer; -using Foundation::TimerCallback; -using Foundation::Thread; -using Foundation::Stopwatch; +using Poco::Timer; +using Poco::TimerCallback; +using Poco::Thread; +using Poco::Stopwatch; class TimerExample diff --git a/Foundation/samples/URI/Makefile b/Foundation/samples/URI/Makefile index b3bd4ea67..def3d7510 100644 --- a/Foundation/samples/URI/Makefile +++ b/Foundation/samples/URI/Makefile @@ -1,7 +1,7 @@ # # Makefile # -# $Id: //poco/1.1.0/Foundation/samples/URI/Makefile#1 $ +# $Id: //poco/1.2/Foundation/samples/URI/Makefile#1 $ # # Makefile for Poco URI # diff --git a/Foundation/samples/URI/URI.vmsbuild b/Foundation/samples/URI/URI.vmsbuild index bd7e7ae3a..7439e9f43 100644 --- a/Foundation/samples/URI/URI.vmsbuild +++ b/Foundation/samples/URI/URI.vmsbuild @@ -1,7 +1,7 @@ # # sample.vmsbuild # -# $Id: //poco/1.1.0/Foundation/samples/URI/URI.vmsbuild#1 $ +# $Id: //poco/1.2/Foundation/samples/URI/URI.vmsbuild#1 $ # EXE=URI URI diff --git a/Foundation/samples/URI/src/URI.cpp b/Foundation/samples/URI/src/URI.cpp index 295f2af61..2c67d45bf 100644 --- a/Foundation/samples/URI/src/URI.cpp +++ b/Foundation/samples/URI/src/URI.cpp @@ -1,7 +1,7 @@ // // URI.cpp // -// $Id: //poco/1.1.0/Foundation/samples/URI/src/URI.cpp#2 $ +// $Id: //poco/1.2/Foundation/samples/URI/src/URI.cpp#1 $ // // This sample demonstrates the URI class. // @@ -32,11 +32,11 @@ // -#include "Foundation/URI.h" +#include "Poco/URI.h" #include -using Foundation::URI; +using Poco::URI; int main(int argc, char** argv) diff --git a/Foundation/samples/base64decode/Makefile b/Foundation/samples/base64decode/Makefile index cce8eb15e..10fdd3dad 100644 --- a/Foundation/samples/base64decode/Makefile +++ b/Foundation/samples/base64decode/Makefile @@ -1,7 +1,7 @@ # # Makefile # -# $Id: //poco/1.1.0/Foundation/samples/base64decode/Makefile#1 $ +# $Id: //poco/1.2/Foundation/samples/base64decode/Makefile#1 $ # # Makefile for Poco base64decode # diff --git a/Foundation/samples/base64decode/base64decode.vmsbuild b/Foundation/samples/base64decode/base64decode.vmsbuild index fe960e50e..b269f836c 100644 --- a/Foundation/samples/base64decode/base64decode.vmsbuild +++ b/Foundation/samples/base64decode/base64decode.vmsbuild @@ -1,7 +1,7 @@ # # sample.vmsbuild # -# $Id: //poco/1.1.0/Foundation/samples/base64decode/base64decode.vmsbuild#1 $ +# $Id: //poco/1.2/Foundation/samples/base64decode/base64decode.vmsbuild#1 $ # EXE=base64decode base64decode diff --git a/Foundation/samples/base64decode/src/base64decode.cpp b/Foundation/samples/base64decode/src/base64decode.cpp index 3ddb4e1fa..383f16b01 100644 --- a/Foundation/samples/base64decode/src/base64decode.cpp +++ b/Foundation/samples/base64decode/src/base64decode.cpp @@ -1,7 +1,7 @@ // // base64decode.cpp // -// $Id: //poco/1.1.0/Foundation/samples/base64decode/src/base64decode.cpp#2 $ +// $Id: //poco/1.2/Foundation/samples/base64decode/src/base64decode.cpp#1 $ // // This sample demonstrates the Base64Decoder and StreamCopier classes. // @@ -32,14 +32,14 @@ // -#include "Foundation/Base64Decoder.h" -#include "Foundation/StreamCopier.h" +#include "Poco/Base64Decoder.h" +#include "Poco/StreamCopier.h" #include #include -using Foundation::Base64Decoder; -using Foundation::StreamCopier; +using Poco::Base64Decoder; +using Poco::StreamCopier; int main(int argc, char** argv) diff --git a/Foundation/samples/base64encode/Makefile b/Foundation/samples/base64encode/Makefile index 1bff0caa8..c4904910c 100644 --- a/Foundation/samples/base64encode/Makefile +++ b/Foundation/samples/base64encode/Makefile @@ -1,7 +1,7 @@ # # Makefile # -# $Id: //poco/1.1.0/Foundation/samples/base64encode/Makefile#1 $ +# $Id: //poco/1.2/Foundation/samples/base64encode/Makefile#1 $ # # Makefile for Poco base64encode # diff --git a/Foundation/samples/base64encode/base64encode.vmsbuild b/Foundation/samples/base64encode/base64encode.vmsbuild index 0737c32dc..00d69ec4e 100644 --- a/Foundation/samples/base64encode/base64encode.vmsbuild +++ b/Foundation/samples/base64encode/base64encode.vmsbuild @@ -1,7 +1,7 @@ # # sample.vmsbuild # -# $Id: //poco/1.1.0/Foundation/samples/base64encode/base64encode.vmsbuild#1 $ +# $Id: //poco/1.2/Foundation/samples/base64encode/base64encode.vmsbuild#1 $ # EXE=base64encode base64encode diff --git a/Foundation/samples/base64encode/src/base64encode.cpp b/Foundation/samples/base64encode/src/base64encode.cpp index 8e6e5f6c4..879999b1d 100644 --- a/Foundation/samples/base64encode/src/base64encode.cpp +++ b/Foundation/samples/base64encode/src/base64encode.cpp @@ -1,7 +1,7 @@ // // base64encode.cpp // -// $Id: //poco/1.1.0/Foundation/samples/base64encode/src/base64encode.cpp#2 $ +// $Id: //poco/1.2/Foundation/samples/base64encode/src/base64encode.cpp#1 $ // // This sample demonstrates the Base64Encoder and StreamCopier classes. // @@ -32,14 +32,14 @@ // -#include "Foundation/Base64Encoder.h" -#include "Foundation/StreamCopier.h" +#include "Poco/Base64Encoder.h" +#include "Poco/StreamCopier.h" #include #include -using Foundation::Base64Encoder; -using Foundation::StreamCopier; +using Poco::Base64Encoder; +using Poco::StreamCopier; int main(int argc, char** argv) diff --git a/Foundation/samples/deflate/Makefile b/Foundation/samples/deflate/Makefile index 3af5ce341..3abdd6489 100644 --- a/Foundation/samples/deflate/Makefile +++ b/Foundation/samples/deflate/Makefile @@ -1,7 +1,7 @@ # # Makefile # -# $Id: //poco/1.1.0/Foundation/samples/deflate/Makefile#1 $ +# $Id: //poco/1.2/Foundation/samples/deflate/Makefile#1 $ # # Makefile for Poco deflate # diff --git a/Foundation/samples/deflate/deflate.vmsbuild b/Foundation/samples/deflate/deflate.vmsbuild index 8ca47efe4..296c645d5 100644 --- a/Foundation/samples/deflate/deflate.vmsbuild +++ b/Foundation/samples/deflate/deflate.vmsbuild @@ -1,7 +1,7 @@ # # sample.vmsbuild # -# $Id: //poco/1.1.0/Foundation/samples/deflate/deflate.vmsbuild#1 $ +# $Id: //poco/1.2/Foundation/samples/deflate/deflate.vmsbuild#1 $ # EXE=deflate deflate diff --git a/Foundation/samples/deflate/src/deflate.cpp b/Foundation/samples/deflate/src/deflate.cpp index 66d7f97ae..835a86ab6 100644 --- a/Foundation/samples/deflate/src/deflate.cpp +++ b/Foundation/samples/deflate/src/deflate.cpp @@ -1,7 +1,7 @@ // // deflate.cpp // -// $Id: //poco/1.1.0/Foundation/samples/deflate/src/deflate.cpp#2 $ +// $Id: //poco/1.2/Foundation/samples/deflate/src/deflate.cpp#1 $ // // This sample demonstrates the DeflatingOutputStream and StreamCopier classes. // @@ -32,14 +32,14 @@ // -#include "Foundation/DeflatingStream.h" -#include "Foundation/StreamCopier.h" +#include "Poco/DeflatingStream.h" +#include "Poco/StreamCopier.h" #include #include -using Foundation::DeflatingOutputStream; -using Foundation::StreamCopier; +using Poco::DeflatingOutputStream; +using Poco::StreamCopier; int main(int argc, char** argv) diff --git a/Foundation/samples/dir/Makefile b/Foundation/samples/dir/Makefile index f78528350..1d33f0a4d 100644 --- a/Foundation/samples/dir/Makefile +++ b/Foundation/samples/dir/Makefile @@ -1,7 +1,7 @@ # # Makefile # -# $Id: //poco/1.1.0/Foundation/samples/dir/Makefile#1 $ +# $Id: //poco/1.2/Foundation/samples/dir/Makefile#1 $ # # Makefile for Poco dir # diff --git a/Foundation/samples/dir/dir.vmsbuild b/Foundation/samples/dir/dir.vmsbuild index 4bfefad01..6f61db86d 100644 --- a/Foundation/samples/dir/dir.vmsbuild +++ b/Foundation/samples/dir/dir.vmsbuild @@ -1,7 +1,7 @@ # # sample.vmsbuild # -# $Id: //poco/1.1.0/Foundation/samples/dir/dir.vmsbuild#1 $ +# $Id: //poco/1.2/Foundation/samples/dir/dir.vmsbuild#1 $ # EXE=dir dir diff --git a/Foundation/samples/dir/src/dir.cpp b/Foundation/samples/dir/src/dir.cpp index efa2d9345..79abf66c7 100644 --- a/Foundation/samples/dir/src/dir.cpp +++ b/Foundation/samples/dir/src/dir.cpp @@ -1,7 +1,7 @@ // // dir.cpp // -// $Id: //poco/1.1.0/Foundation/samples/dir/src/dir.cpp#2 $ +// $Id: //poco/1.2/Foundation/samples/dir/src/dir.cpp#1 $ // // This sample demonstrates the DirectoryIterator, File and Path classes. // @@ -32,19 +32,20 @@ // -#include "Foundation/DirectoryIterator.h" -#include "Foundation/File.h" -#include "Foundation/Path.h" -#include "Foundation/DateTimeFormatter.h" -#include "Foundation/DateTimeFormat.h" +#include "Poco/DirectoryIterator.h" +#include "Poco/File.h" +#include "Poco/Path.h" +#include "Poco/DateTimeFormatter.h" +#include "Poco/DateTimeFormat.h" +#include "Poco/Exception.h" #include -using Foundation::DirectoryIterator; -using Foundation::File; -using Foundation::Path; -using Foundation::DateTimeFormatter; -using Foundation::DateTimeFormat; +using Poco::DirectoryIterator; +using Poco::File; +using Poco::Path; +using Poco::DateTimeFormatter; +using Poco::DateTimeFormat; int main(int argc, char** argv) @@ -55,20 +56,28 @@ int main(int argc, char** argv) else dir = Path::current(); - DirectoryIterator it(dir); - DirectoryIterator end; - while (it != end) + try { - Path p(it->path()); - std::cout << (it->isDirectory() ? 'd' : '-') - << (it->canRead() ? 'r' : '-') - << (it->canWrite() ? 'w' : '-') - << ' ' - << DateTimeFormatter::format(it->getLastModified(), DateTimeFormat::SORTABLE_FORMAT) - << ' ' - << p.getFileName() - << std::endl; - ++it; + DirectoryIterator it(dir); + DirectoryIterator end; + while (it != end) + { + Path p(it->path()); + std::cout << (it->isDirectory() ? 'd' : '-') + << (it->canRead() ? 'r' : '-') + << (it->canWrite() ? 'w' : '-') + << ' ' + << DateTimeFormatter::format(it->getLastModified(), DateTimeFormat::SORTABLE_FORMAT) + << ' ' + << p.getFileName() + << std::endl; + ++it; + } + } + catch (Poco::Exception& exc) + { + std::cerr << exc.displayText() << std::endl; + return 1; } return 0; diff --git a/Foundation/samples/grep/Makefile b/Foundation/samples/grep/Makefile index a3bc75117..5241a9429 100644 --- a/Foundation/samples/grep/Makefile +++ b/Foundation/samples/grep/Makefile @@ -1,7 +1,7 @@ # # Makefile # -# $Id: //poco/1.1.0/Foundation/samples/grep/Makefile#1 $ +# $Id: //poco/1.2/Foundation/samples/grep/Makefile#1 $ # # Makefile for Poco grep # diff --git a/Foundation/samples/grep/grep.vmsbuild b/Foundation/samples/grep/grep.vmsbuild index 2e7488c95..7a0ce078a 100644 --- a/Foundation/samples/grep/grep.vmsbuild +++ b/Foundation/samples/grep/grep.vmsbuild @@ -1,7 +1,7 @@ # # sample.vmsbuild # -# $Id: //poco/1.1.0/Foundation/samples/grep/grep.vmsbuild#1 $ +# $Id: //poco/1.2/Foundation/samples/grep/grep.vmsbuild#1 $ # EXE=grep grep diff --git a/Foundation/samples/grep/src/grep.cpp b/Foundation/samples/grep/src/grep.cpp index cb4aba546..09b8b54ae 100644 --- a/Foundation/samples/grep/src/grep.cpp +++ b/Foundation/samples/grep/src/grep.cpp @@ -1,7 +1,7 @@ // // grep.cpp // -// $Id: //poco/1.1.0/Foundation/samples/grep/src/grep.cpp#2 $ +// $Id: //poco/1.2/Foundation/samples/grep/src/grep.cpp#1 $ // // This sample demonstrates the RegularExpression class. // @@ -32,11 +32,11 @@ // -#include "Foundation/RegularExpression.h" +#include "Poco/RegularExpression.h" #include -using Foundation::RegularExpression; +using Poco::RegularExpression; int main(int argc, char** argv) diff --git a/Foundation/samples/hmacmd5/Makefile b/Foundation/samples/hmacmd5/Makefile index 2d03c3b68..6c9386163 100644 --- a/Foundation/samples/hmacmd5/Makefile +++ b/Foundation/samples/hmacmd5/Makefile @@ -1,7 +1,7 @@ # # Makefile # -# $Id: //poco/1.1.0/Foundation/samples/hmacmd5/Makefile#1 $ +# $Id: //poco/1.2/Foundation/samples/hmacmd5/Makefile#1 $ # # Makefile for Poco hmacmd5 # diff --git a/Foundation/samples/hmacmd5/hmacmd5.vmsbuild b/Foundation/samples/hmacmd5/hmacmd5.vmsbuild index 87b9bbf7f..0b2248605 100644 --- a/Foundation/samples/hmacmd5/hmacmd5.vmsbuild +++ b/Foundation/samples/hmacmd5/hmacmd5.vmsbuild @@ -1,7 +1,7 @@ # # sample.vmsbuild # -# $Id: //poco/1.1.0/Foundation/samples/hmacmd5/hmacmd5.vmsbuild#1 $ +# $Id: //poco/1.2/Foundation/samples/hmacmd5/hmacmd5.vmsbuild#1 $ # EXE=hmacmd5 hmacmd5 diff --git a/Foundation/samples/hmacmd5/src/hmacmd5.cpp b/Foundation/samples/hmacmd5/src/hmacmd5.cpp index 56f4a9e7e..b221f79c4 100644 --- a/Foundation/samples/hmacmd5/src/hmacmd5.cpp +++ b/Foundation/samples/hmacmd5/src/hmacmd5.cpp @@ -1,7 +1,7 @@ // // hmacmd5.cpp // -// $Id: //poco/1.1.0/Foundation/samples/hmacmd5/src/hmacmd5.cpp#2 $ +// $Id: //poco/1.2/Foundation/samples/hmacmd5/src/hmacmd5.cpp#1 $ // // This sample demonstrates the HMACEngine class. // @@ -32,19 +32,19 @@ // -#include "Foundation/HMACEngine.h" -#include "Foundation/MD5Engine.h" -#include "Foundation/DigestStream.h" -#include "Foundation/StreamCopier.h" +#include "Poco/HMACEngine.h" +#include "Poco/MD5Engine.h" +#include "Poco/DigestStream.h" +#include "Poco/StreamCopier.h" #include #include -using Foundation::DigestEngine; -using Foundation::HMACEngine; -using Foundation::MD5Engine; -using Foundation::DigestOutputStream; -using Foundation::StreamCopier; +using Poco::DigestEngine; +using Poco::HMACEngine; +using Poco::MD5Engine; +using Poco::DigestOutputStream; +using Poco::StreamCopier; int main(int argc, char** argv) diff --git a/Foundation/samples/inflate/Makefile b/Foundation/samples/inflate/Makefile index db9766efb..408f9f48a 100644 --- a/Foundation/samples/inflate/Makefile +++ b/Foundation/samples/inflate/Makefile @@ -1,7 +1,7 @@ # # Makefile # -# $Id: //poco/1.1.0/Foundation/samples/inflate/Makefile#1 $ +# $Id: //poco/1.2/Foundation/samples/inflate/Makefile#1 $ # # Makefile for Poco inflate # diff --git a/Foundation/samples/inflate/inflate.vmsbuild b/Foundation/samples/inflate/inflate.vmsbuild index 47702c135..15e99619b 100644 --- a/Foundation/samples/inflate/inflate.vmsbuild +++ b/Foundation/samples/inflate/inflate.vmsbuild @@ -1,7 +1,7 @@ # # sample.vmsbuild # -# $Id: //poco/1.1.0/Foundation/samples/inflate/inflate.vmsbuild#1 $ +# $Id: //poco/1.2/Foundation/samples/inflate/inflate.vmsbuild#1 $ # EXE=inflate inflate diff --git a/Foundation/samples/inflate/src/inflate.cpp b/Foundation/samples/inflate/src/inflate.cpp index 7fae3b21f..8c408feae 100644 --- a/Foundation/samples/inflate/src/inflate.cpp +++ b/Foundation/samples/inflate/src/inflate.cpp @@ -1,7 +1,7 @@ // // inflate.cpp // -// $Id: //poco/1.1.0/Foundation/samples/inflate/src/inflate.cpp#2 $ +// $Id: //poco/1.2/Foundation/samples/inflate/src/inflate.cpp#1 $ // // This sample demonstrates the InflatingInputStream and StreamCopier classes. // @@ -32,14 +32,14 @@ // -#include "Foundation/InflatingStream.h" -#include "Foundation/StreamCopier.h" +#include "Poco/InflatingStream.h" +#include "Poco/StreamCopier.h" #include #include -using Foundation::InflatingInputStream; -using Foundation::StreamCopier; +using Poco::InflatingInputStream; +using Poco::StreamCopier; int main(int argc, char** argv) diff --git a/Foundation/samples/md5/Makefile b/Foundation/samples/md5/Makefile index 691749d70..a5ef4f19a 100644 --- a/Foundation/samples/md5/Makefile +++ b/Foundation/samples/md5/Makefile @@ -1,7 +1,7 @@ # # Makefile # -# $Id: //poco/1.1.0/Foundation/samples/md5/Makefile#1 $ +# $Id: //poco/1.2/Foundation/samples/md5/Makefile#1 $ # # Makefile for Poco md5 # diff --git a/Foundation/samples/md5/md5.vmsbuild b/Foundation/samples/md5/md5.vmsbuild index 4d403f596..333e79741 100644 --- a/Foundation/samples/md5/md5.vmsbuild +++ b/Foundation/samples/md5/md5.vmsbuild @@ -1,7 +1,7 @@ # # sample.vmsbuild # -# $Id: //poco/1.1.0/Foundation/samples/md5/md5.vmsbuild#1 $ +# $Id: //poco/1.2/Foundation/samples/md5/md5.vmsbuild#1 $ # EXE=md5 md5 diff --git a/Foundation/samples/md5/src/md5.cpp b/Foundation/samples/md5/src/md5.cpp index 9b69f2d00..e1d3aac93 100644 --- a/Foundation/samples/md5/src/md5.cpp +++ b/Foundation/samples/md5/src/md5.cpp @@ -1,7 +1,7 @@ // // md5.cpp // -// $Id: //poco/1.1.0/Foundation/samples/md5/src/md5.cpp#2 $ +// $Id: //poco/1.2/Foundation/samples/md5/src/md5.cpp#1 $ // // This sample demonstrates the DigestEngine, DigestOutputStream and // MD5Engine classes. @@ -33,17 +33,17 @@ // -#include "Foundation/MD5Engine.h" -#include "Foundation/DigestStream.h" -#include "Foundation/StreamCopier.h" +#include "Poco/MD5Engine.h" +#include "Poco/DigestStream.h" +#include "Poco/StreamCopier.h" #include #include -using Foundation::DigestEngine; -using Foundation::MD5Engine; -using Foundation::DigestOutputStream; -using Foundation::StreamCopier; +using Poco::DigestEngine; +using Poco::MD5Engine; +using Poco::DigestOutputStream; +using Poco::StreamCopier; int main(int argc, char** argv) diff --git a/Foundation/samples/uuidgen/Makefile b/Foundation/samples/uuidgen/Makefile index 396ba52d0..23e11eaf0 100644 --- a/Foundation/samples/uuidgen/Makefile +++ b/Foundation/samples/uuidgen/Makefile @@ -1,7 +1,7 @@ # # Makefile # -# $Id: //poco/1.1.0/Foundation/samples/uuidgen/Makefile#1 $ +# $Id: //poco/1.2/Foundation/samples/uuidgen/Makefile#1 $ # # Makefile for Poco uuidgen # diff --git a/Foundation/samples/uuidgen/src/uuidgen.cpp b/Foundation/samples/uuidgen/src/uuidgen.cpp index 062f8a06a..f623ed89c 100644 --- a/Foundation/samples/uuidgen/src/uuidgen.cpp +++ b/Foundation/samples/uuidgen/src/uuidgen.cpp @@ -1,7 +1,7 @@ // // uuidgen.cpp // -// $Id: //poco/1.1.0/Foundation/samples/uuidgen/src/uuidgen.cpp#2 $ +// $Id: //poco/1.2/Foundation/samples/uuidgen/src/uuidgen.cpp#1 $ // // This sample demonstrates the UUIDGenerator and UUID classes. // @@ -32,15 +32,15 @@ // -#include "Foundation/UUID.h" -#include "Foundation/UUIDGenerator.h" -#include "Foundation/Exception.h" +#include "Poco/UUID.h" +#include "Poco/UUIDGenerator.h" +#include "Poco/Exception.h" #include -using Foundation::UUID; -using Foundation::UUIDGenerator; -using Foundation::Exception; +using Poco::UUID; +using Poco::UUIDGenerator; +using Poco::Exception; int main(int argc, char** argv) diff --git a/Foundation/samples/uuidgen/uuidgen.vmsbuild b/Foundation/samples/uuidgen/uuidgen.vmsbuild index 51f85e515..77046a204 100644 --- a/Foundation/samples/uuidgen/uuidgen.vmsbuild +++ b/Foundation/samples/uuidgen/uuidgen.vmsbuild @@ -1,7 +1,7 @@ # # sample.vmsbuild # -# $Id: //poco/1.1.0/Foundation/samples/uuidgen/uuidgen.vmsbuild#1 $ +# $Id: //poco/1.2/Foundation/samples/uuidgen/uuidgen.vmsbuild#1 $ # EXE=uuidgen uuidgen diff --git a/Foundation/src/ASCIIEncoding.cpp b/Foundation/src/ASCIIEncoding.cpp index 9a4d03f14..88f75c9fc 100644 --- a/Foundation/src/ASCIIEncoding.cpp +++ b/Foundation/src/ASCIIEncoding.cpp @@ -1,7 +1,7 @@ // // ASCIIEncoding.cpp // -// $Id: //poco/1.1.0/Foundation/src/ASCIIEncoding.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/ASCIIEncoding.cpp#1 $ // // Library: Foundation // Package: Text @@ -34,10 +34,10 @@ // -#include "Foundation/ASCIIEncoding.h" +#include "Poco/ASCIIEncoding.h" -Foundation_BEGIN +namespace Poco { const TextEncoding::CharacterMap ASCIIEncoding::_charMap = @@ -94,4 +94,4 @@ int ASCIIEncoding::convert(int ch, unsigned char* bytes, int length) const } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/ActiveDispatcher.cpp b/Foundation/src/ActiveDispatcher.cpp new file mode 100644 index 000000000..f6dcde625 --- /dev/null +++ b/Foundation/src/ActiveDispatcher.cpp @@ -0,0 +1,133 @@ +// +// ActiveDispatcher.cpp +// +// $Id: //poco/1.2/Foundation/src/ActiveDispatcher.cpp#1 $ +// +// Library: Foundation +// Package: Threading +// Module: ActiveObjects +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#include "Poco/ActiveDispatcher.h" +#include "Poco/Notification.h" +#include "Poco/AutoPtr.h" + + +namespace Poco { + + +namespace +{ + class MethodNotification: public Notification + { + public: + MethodNotification(Runnable* pRunnable): + _pRunnable(pRunnable) + { + } + + Runnable* runnable() const + { + return _pRunnable; + } + + private: + Runnable* _pRunnable; + }; + + class StopNotification: public Notification + { + }; +} + + +ActiveDispatcher::ActiveDispatcher() +{ + _thread.start(*this); +} + + +ActiveDispatcher::ActiveDispatcher(Thread::Priority prio) +{ + _thread.setPriority(prio); + _thread.start(*this); +} + + +ActiveDispatcher::~ActiveDispatcher() +{ + try + { + stop(); + } + catch (...) + { + } +} + + +void ActiveDispatcher::start(Runnable* pRunnable) +{ + poco_check_ptr (pRunnable); + + _queue.enqueueNotification(new MethodNotification(pRunnable)); +} + + +void ActiveDispatcher::cancel() +{ + _queue.clear(); +} + + +void ActiveDispatcher::run() +{ + AutoPtr pNf = _queue.waitDequeueNotification(); + while (pNf && !dynamic_cast(pNf.get())) + { + MethodNotification* pMethodNf = dynamic_cast(pNf.get()); + poco_check_ptr (pMethodNf); + Runnable* pRunnable = pMethodNf->runnable(); + poco_check_ptr (pRunnable); + pRunnable->run(); + pNf = _queue.waitDequeueNotification(); + } +} + + +void ActiveDispatcher::stop() +{ + _queue.clear(); + _queue.wakeUpAll(); + _queue.enqueueNotification(new StopNotification); + _thread.join(); +} + + +} // namespace Poco diff --git a/Foundation/src/ArchiveStrategy.cpp b/Foundation/src/ArchiveStrategy.cpp index 97726ccca..f84fdb35c 100644 --- a/Foundation/src/ArchiveStrategy.cpp +++ b/Foundation/src/ArchiveStrategy.cpp @@ -1,7 +1,7 @@ // // ArchiveStrategy.cpp // -// $Id: //poco/1.1.0/Foundation/src/ArchiveStrategy.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/ArchiveStrategy.cpp#1 $ // // Library: Foundation // Package: Logging @@ -34,17 +34,63 @@ // -#include "Foundation/ArchiveStrategy.h" -#include "Foundation/NumberFormatter.h" -#include "Foundation/File.h" -#include "Foundation/Path.h" -#include "Foundation/DeflatingStream.h" -#include "Foundation/StreamCopier.h" -#include "Foundation/Exception.h" +#include "Poco/ArchiveStrategy.h" +#include "Poco/NumberFormatter.h" +#include "Poco/File.h" +#include "Poco/Path.h" +#include "Poco/DeflatingStream.h" +#include "Poco/StreamCopier.h" +#include "Poco/Exception.h" +#include "Poco/ActiveDispatcher.h" +#include "Poco/ActiveMethod.h" +#include "Poco/Void.h" #include -Foundation_BEGIN +namespace Poco { + + +// +// ArchiveCompressor +// + + +class ArchiveCompressor: public ActiveDispatcher +{ +public: + ArchiveCompressor(): + compress(this, &ArchiveCompressor::compressImpl) + { + } + + ~ArchiveCompressor() + { + } + + ActiveMethod > compress; + +protected: + Void compressImpl(const std::string& path) + { + std::string gzPath(path); + gzPath.append(".gz"); + std::ifstream istr(path.c_str(), std::ios::binary | std::ios::in); + if (!istr.good()) throw OpenFileException(path); + std::ofstream ostr(gzPath.c_str(), std::ios::binary | std::ios::out); + if (ostr.good()) + { + DeflatingOutputStream deflater(ostr, DeflatingStreamBuf::STREAM_GZIP); + StreamCopier::copyStream(istr, deflater); + deflater.close(); + ostr.close(); + istr.close(); + File f(path); + f.remove(); + } + else throw CreateFileException(gzPath); + return Void(); + } +}; // @@ -52,13 +98,16 @@ Foundation_BEGIN // -ArchiveStrategy::ArchiveStrategy(): _compress(false) +ArchiveStrategy::ArchiveStrategy(): + _compress(false), + _pCompressor(0) { } ArchiveStrategy::~ArchiveStrategy() { + delete _pCompressor; } @@ -87,19 +136,9 @@ void ArchiveStrategy::moveFile(const std::string& oldPath, const std::string& ne } else { - std::ifstream istr(f.path().c_str(), std::ios::binary | std::ios::in); - if (!istr.good()) throw OpenFileException(oldPath); - std::ofstream ostr(mvPath.c_str(), std::ios::binary | std::ios::out); - if (ostr.good()) - { - DeflatingOutputStream deflater(ostr, DeflatingStreamBuf::STREAM_GZIP); - StreamCopier::copyStream(istr, deflater); - deflater.close(); - ostr.close(); - istr.close(); - f.remove(); - } - else throw CreateFileException(mvPath); + f.renameTo(newPath); + if (!_pCompressor) _pCompressor = new ArchiveCompressor; + _pCompressor->compress(newPath); } } @@ -169,4 +208,4 @@ LogFile* ArchiveByNumberStrategy::archive(LogFile* pFile) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/AsyncChannel.cpp b/Foundation/src/AsyncChannel.cpp index c93cdbed1..80ca6b50f 100644 --- a/Foundation/src/AsyncChannel.cpp +++ b/Foundation/src/AsyncChannel.cpp @@ -1,7 +1,7 @@ // // AsyncChannel.cpp // -// $Id: //poco/1.1.0/Foundation/src/AsyncChannel.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/AsyncChannel.cpp#1 $ // // Library: Foundation // Package: Logging @@ -34,15 +34,15 @@ // -#include "Foundation/AsyncChannel.h" -#include "Foundation/Notification.h" -#include "Foundation/Message.h" -#include "Foundation/Formatter.h" -#include "Foundation/AutoPtr.h" -#include "Foundation/LoggingRegistry.h" +#include "Poco/AsyncChannel.h" +#include "Poco/Notification.h" +#include "Poco/Message.h" +#include "Poco/Formatter.h" +#include "Poco/AutoPtr.h" +#include "Poco/LoggingRegistry.h" -Foundation_BEGIN +namespace Poco { class MessageNotification: public Notification @@ -144,4 +144,4 @@ void AsyncChannel::run() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Base64Decoder.cpp b/Foundation/src/Base64Decoder.cpp index 846eecefd..17f4ef3d6 100644 --- a/Foundation/src/Base64Decoder.cpp +++ b/Foundation/src/Base64Decoder.cpp @@ -1,7 +1,7 @@ // // Base64Decoder.cpp // -// $Id: //poco/1.1.0/Foundation/src/Base64Decoder.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Base64Decoder.cpp#1 $ // // Library: Foundation // Package: Streams @@ -34,13 +34,13 @@ // -#include "Foundation/Base64Decoder.h" -#include "Foundation/Base64Encoder.h" -#include "Foundation/Exception.h" -#include "Foundation/Mutex.h" +#include "Poco/Base64Decoder.h" +#include "Poco/Base64Encoder.h" +#include "Poco/Exception.h" +#include "Poco/Mutex.h" -Foundation_BEGIN +namespace Poco { unsigned char Base64DecoderBuf::IN_ENCODING[256]; @@ -56,11 +56,11 @@ Base64DecoderBuf::Base64DecoderBuf(std::istream& istr): FastMutex::ScopedLock lock(mutex); if (!IN_ENCODING_INIT) { - for (int i = 0; i < sizeof(IN_ENCODING); i++) + for (unsigned i = 0; i < sizeof(IN_ENCODING); i++) { IN_ENCODING[i] = 0xFF; } - for (int i = 0; i < sizeof(Base64EncoderBuf::OUT_ENCODING); i++) + for (unsigned i = 0; i < sizeof(Base64EncoderBuf::OUT_ENCODING); i++) { IN_ENCODING[Base64EncoderBuf::OUT_ENCODING[i]] = i; } @@ -150,4 +150,4 @@ Base64Decoder::~Base64Decoder() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Base64Encoder.cpp b/Foundation/src/Base64Encoder.cpp index 6752c8299..15c73d4f8 100644 --- a/Foundation/src/Base64Encoder.cpp +++ b/Foundation/src/Base64Encoder.cpp @@ -1,7 +1,7 @@ // // Base64Encoder.cpp // -// $Id: //poco/1.1.0/Foundation/src/Base64Encoder.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Base64Encoder.cpp#1 $ // // Library: Foundation // Package: Streams @@ -34,10 +34,10 @@ // -#include "Foundation/Base64Encoder.h" +#include "Poco/Base64Encoder.h" -Foundation_BEGIN +namespace Poco { const unsigned char Base64EncoderBuf::OUT_ENCODING[64] = @@ -178,4 +178,4 @@ Base64Encoder::~Base64Encoder() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/BinaryReader.cpp b/Foundation/src/BinaryReader.cpp index 6d1b39a56..45d3e665e 100644 --- a/Foundation/src/BinaryReader.cpp +++ b/Foundation/src/BinaryReader.cpp @@ -1,7 +1,7 @@ // // BinaryReader.cpp // -// $Id: //poco/1.1.0/Foundation/src/BinaryReader.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/BinaryReader.cpp#1 $ // // Library: Foundation // Package: Streams @@ -34,11 +34,11 @@ // -#include "Foundation/BinaryReader.h" -#include "Foundation/ByteOrder.h" +#include "Poco/BinaryReader.h" +#include "Poco/ByteOrder.h" -Foundation_BEGIN +namespace Poco { BinaryReader::BinaryReader(std::istream& istr, StreamByteOrder byteOrder): @@ -147,7 +147,7 @@ BinaryReader& BinaryReader::operator >> (float& value) { char* ptr = (char*) &value; ptr += sizeof(value); - for (int i = 0; i < sizeof(value); ++i) + for (unsigned i = 0; i < sizeof(value); ++i) _istr.read(--ptr, 1); } else @@ -164,7 +164,7 @@ BinaryReader& BinaryReader::operator >> (double& value) { char* ptr = (char*) &value; ptr += sizeof(value); - for (int i = 0; i < sizeof(value); ++i) + for (unsigned i = 0; i < sizeof(value); ++i) _istr.read(--ptr, 1); } else @@ -270,10 +270,10 @@ void BinaryReader::readRaw(int length, std::string& value) void BinaryReader::readBOM() { - UInt32 bom; + UInt16 bom; _istr.read((char*) &bom, sizeof(bom)); _flipBytes = bom != 0xFEFF; } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/BinaryWriter.cpp b/Foundation/src/BinaryWriter.cpp index fa0a2fada..5286d5221 100644 --- a/Foundation/src/BinaryWriter.cpp +++ b/Foundation/src/BinaryWriter.cpp @@ -1,7 +1,7 @@ // // BinaryWriter.cpp // -// $Id: //poco/1.1.0/Foundation/src/BinaryWriter.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/BinaryWriter.cpp#1 $ // // Library: Foundation // Package: Streams @@ -34,12 +34,12 @@ // -#include "Foundation/BinaryWriter.h" -#include "Foundation/ByteOrder.h" +#include "Poco/BinaryWriter.h" +#include "Poco/ByteOrder.h" #include -Foundation_BEGIN +namespace Poco { BinaryWriter::BinaryWriter(std::ostream& ostr, StreamByteOrder byteOrder): @@ -190,7 +190,7 @@ BinaryWriter& BinaryWriter::operator << (float value) { const char* ptr = (const char*) &value; ptr += sizeof(value); - for (int i = 0; i < sizeof(value); ++i) + for (unsigned i = 0; i < sizeof(value); ++i) _ostr.write(--ptr, 1); } else @@ -207,7 +207,7 @@ BinaryWriter& BinaryWriter::operator << (double value) { const char* ptr = (const char*) &value; ptr += sizeof(value); - for (int i = 0; i < sizeof(value); ++i) + for (unsigned i = 0; i < sizeof(value); ++i) _ostr.write(--ptr, 1); } else @@ -313,7 +313,7 @@ void BinaryWriter::writeRaw(const std::string& rawData) void BinaryWriter::writeBOM() { - UInt32 value = 0xFEFF; + UInt16 value = 0xFEFF; if (_flipBytes) value = ByteOrder::flipBytes(value); _ostr.write((const char*) &value, sizeof(value)); } @@ -325,4 +325,4 @@ void BinaryWriter::flush() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Bugcheck.cpp b/Foundation/src/Bugcheck.cpp index 3e1961a93..208a03ca4 100644 --- a/Foundation/src/Bugcheck.cpp +++ b/Foundation/src/Bugcheck.cpp @@ -1,7 +1,7 @@ // // Bugcheck.cpp // -// $Id: //poco/1.1.0/Foundation/src/Bugcheck.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Bugcheck.cpp#1 $ // // Library: Foundation // Package: Core @@ -34,13 +34,13 @@ // -#include "Foundation/Bugcheck.h" -#include "Foundation/Debugger.h" -#include "Foundation/Exception.h" +#include "Poco/Bugcheck.h" +#include "Poco/Debugger.h" +#include "Poco/Exception.h" #include -Foundation_BEGIN +namespace Poco { void Bugcheck::assertion(const char* cond, const char* file, int line) @@ -100,4 +100,4 @@ std::string Bugcheck::what(const char* msg, const char* file, int line) -Foundation_END +} // namespace Poco diff --git a/Foundation/src/ByteOrder.cpp b/Foundation/src/ByteOrder.cpp index 17a99a3f5..f2ad75010 100644 --- a/Foundation/src/ByteOrder.cpp +++ b/Foundation/src/ByteOrder.cpp @@ -1,7 +1,7 @@ // // ByteOrder.cpp // -// $Id: //poco/1.1.0/Foundation/src/ByteOrder.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/ByteOrder.cpp#1 $ // // Library: Foundation // Package: Core @@ -34,4 +34,4 @@ // -#include "Foundation/ByteOrder.h" +#include "Poco/ByteOrder.h" diff --git a/Foundation/src/Channel.cpp b/Foundation/src/Channel.cpp index 453c16511..763a98f42 100644 --- a/Foundation/src/Channel.cpp +++ b/Foundation/src/Channel.cpp @@ -1,7 +1,7 @@ // // Channel.cpp // -// $Id: //poco/1.1.0/Foundation/src/Channel.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Channel.cpp#1 $ // // Library: Foundation // Package: Logging @@ -34,10 +34,10 @@ // -#include "Foundation/Channel.h" +#include "Poco/Channel.h" -Foundation_BEGIN +namespace Poco { Channel::Channel() @@ -72,4 +72,4 @@ std::string Channel::getProperty(const std::string& name) const } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Configurable.cpp b/Foundation/src/Configurable.cpp index 973cc6fd9..b74872dee 100644 --- a/Foundation/src/Configurable.cpp +++ b/Foundation/src/Configurable.cpp @@ -1,7 +1,7 @@ // // Configurable.cpp // -// $Id: //poco/1.1.0/Foundation/src/Configurable.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Configurable.cpp#1 $ // // Library: Foundation // Package: Logging @@ -34,10 +34,10 @@ // -#include "Foundation/Configurable.h" +#include "Poco/Configurable.h" -Foundation_BEGIN +namespace Poco { Configurable::Configurable() @@ -50,4 +50,4 @@ Configurable::~Configurable() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/ConsoleChannel.cpp b/Foundation/src/ConsoleChannel.cpp index c25b5f166..1919fb372 100644 --- a/Foundation/src/ConsoleChannel.cpp +++ b/Foundation/src/ConsoleChannel.cpp @@ -1,7 +1,7 @@ // // ConsoleChannel.cpp // -// $Id: //poco/1.1.0/Foundation/src/ConsoleChannel.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/ConsoleChannel.cpp#1 $ // // Library: Foundation // Package: Logging @@ -34,12 +34,12 @@ // -#include "Foundation/ConsoleChannel.h" -#include "Foundation/Message.h" +#include "Poco/ConsoleChannel.h" +#include "Poco/Message.h" #include -Foundation_BEGIN +namespace Poco { FastMutex ConsoleChannel::_mutex; @@ -68,4 +68,4 @@ void ConsoleChannel::log(const Message& msg) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/CountingStream.cpp b/Foundation/src/CountingStream.cpp index d09874ab1..6e25d0211 100644 --- a/Foundation/src/CountingStream.cpp +++ b/Foundation/src/CountingStream.cpp @@ -1,7 +1,7 @@ // // CountingStream.cpp // -// $Id: //poco/1.1.0/Foundation/src/CountingStream.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/CountingStream.cpp#1 $ // // Library: Foundation // Package: Streams @@ -34,10 +34,10 @@ // -#include "Foundation/CountingStream.h" +#include "Poco/CountingStream.h" -Foundation_BEGIN +namespace Poco { CountingStreamBuf::CountingStreamBuf(): @@ -182,4 +182,4 @@ CountingOutputStream::~CountingOutputStream() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/DateTime.cpp b/Foundation/src/DateTime.cpp index f2ffe8e36..7a0aed35c 100644 --- a/Foundation/src/DateTime.cpp +++ b/Foundation/src/DateTime.cpp @@ -1,7 +1,7 @@ // // DateTime.cpp // -// $Id: //poco/1.1.0/Foundation/src/DateTime.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/DateTime.cpp#1 $ // // Library: Foundation // Package: DateTime @@ -34,12 +34,12 @@ // -#include "Foundation/DateTime.h" +#include "Poco/DateTime.h" #include #include -Foundation_BEGIN +namespace Poco { inline double DateTime::toJulianDay(Timestamp::UtcTimeVal utcTime) @@ -59,16 +59,16 @@ DateTime::DateTime() { Timestamp now; _utcTime = now.utcTime(); - _julianDay = toJulianDay(_utcTime); - computeGregorian(); + computeGregorian(julianDay()); + computeDaytime(); } DateTime::DateTime(const Timestamp& timestamp): - _utcTime(timestamp.utcTime()), - _julianDay(toJulianDay(_utcTime)) + _utcTime(timestamp.utcTime()) { - computeGregorian(); + computeGregorian(julianDay()); + computeDaytime(); } @@ -91,30 +91,27 @@ DateTime::DateTime(int year, int month, int day, int hour, int minute, int secon poco_assert (millisecond >= 0 && millisecond <= 999); poco_assert (microsecond >= 0 && microsecond <= 999); - _julianDay = toJulianDay(year, month, day, hour, minute, second, millisecond, microsecond); - _utcTime = toUtcTime(_julianDay); + _utcTime = toUtcTime(toJulianDay(year, month, day)) + 10*(hour*Timespan::HOURS + minute*Timespan::MINUTES + second*Timespan::SECONDS + millisecond*Timespan::MILLISECONDS + microsecond); } DateTime::DateTime(double julianDay): - _utcTime(toUtcTime(julianDay)), - _julianDay(julianDay) + _utcTime(toUtcTime(julianDay)) { - computeGregorian(); + computeGregorian(julianDay); } DateTime::DateTime(Timestamp::UtcTimeVal utcTime, Timestamp::TimeDiff diff): - _utcTime(utcTime + diff*10), - _julianDay(toJulianDay(_utcTime)) + _utcTime(utcTime + diff*10) { - computeGregorian(); + computeGregorian(julianDay()); + computeDaytime(); } DateTime::DateTime(const DateTime& dateTime): _utcTime(dateTime._utcTime), - _julianDay(dateTime._julianDay), _year(dateTime._year), _month(dateTime._month), _day(dateTime._day), @@ -137,7 +134,6 @@ DateTime& DateTime::operator = (const DateTime& dateTime) if (&dateTime != this) { _utcTime = dateTime._utcTime; - _julianDay = dateTime._julianDay; _year = dateTime._year; _month = dateTime._month; _day = dateTime._day; @@ -153,18 +149,17 @@ DateTime& DateTime::operator = (const DateTime& dateTime) DateTime& DateTime::operator = (const Timestamp& timestamp) { - _utcTime = timestamp.utcTime(); - _julianDay = toJulianDay(_utcTime); - computeGregorian(); + _utcTime = timestamp.utcTime(); + computeGregorian(julianDay()); + computeDaytime(); return *this; } DateTime& DateTime::operator = (double julianDay) { - _julianDay = julianDay; - _utcTime = toUtcTime(julianDay); - computeGregorian(); + _utcTime = toUtcTime(julianDay); + computeGregorian(julianDay); return *this; } @@ -180,8 +175,7 @@ DateTime& DateTime::assign(int year, int month, int day, int hour, int minute, i poco_assert (millisecond >= 0 && millisecond <= 999); poco_assert (microsecond >= 0 && microsecond <= 999); - _julianDay = toJulianDay(year, month, day, hour, minute, second, millisecond, microsecond); - _utcTime = toUtcTime(_julianDay); + _utcTime = toUtcTime(toJulianDay(year, month, day)) + 10*(hour*Timespan::HOURS + minute*Timespan::MINUTES + second*Timespan::SECONDS + millisecond*Timespan::MILLISECONDS + microsecond); _year = year; _month = month; _day = day; @@ -198,7 +192,6 @@ DateTime& DateTime::assign(int year, int month, int day, int hour, int minute, i void DateTime::swap(DateTime& dateTime) { std::swap(_utcTime, dateTime._utcTime); - std::swap(_julianDay, dateTime._julianDay); std::swap(_year, dateTime._year); std::swap(_month, dateTime._month); std::swap(_day, dateTime._day); @@ -212,7 +205,7 @@ void DateTime::swap(DateTime& dateTime) int DateTime::dayOfWeek() const { - return int((floor(_julianDay + 1.5))) % 7; + return int((floor(julianDay() + 1.5))) % 7; } @@ -239,6 +232,20 @@ int DateTime::daysOfMonth(int year, int month) } +bool DateTime::isValid(int year, int month, int day, int hour, int minute, int second, int millisecond, int microsecond) +{ + return + (year >= 0 && year <= 9999) && + (month >= 1 && month <= 12) && + (day >= 1 && day <= daysOfMonth(year, month)) && + (hour >= 0 && hour <= 23) && + (minute >= 0 && minute <= 59) && + (second >= 0 && second <= 59) && + (millisecond >= 0 && millisecond <= 999) && + (microsecond >= 0 && microsecond <= 999); +} + + int DateTime::week(int firstDayOfWeek) const { poco_assert (firstDayOfWeek >= 0 && firstDayOfWeek <= 6); @@ -256,6 +263,12 @@ int DateTime::week(int firstDayOfWeek) const } +double DateTime::julianDay() const +{ + return toJulianDay(_utcTime); +} + + DateTime DateTime::operator + (const Timespan& span) const { return DateTime(_utcTime, span.totalMicroseconds()); @@ -277,8 +290,8 @@ Timespan DateTime::operator - (const DateTime& dateTime) const DateTime& DateTime::operator += (const Timespan& span) { _utcTime += span.totalMicroseconds()*10; - _julianDay = toJulianDay(_utcTime); - computeGregorian(); + computeGregorian(julianDay()); + computeDaytime(); return *this; } @@ -286,8 +299,8 @@ DateTime& DateTime::operator += (const Timespan& span) DateTime& DateTime::operator -= (const Timespan& span) { _utcTime -= span.totalMicroseconds()*10; - _julianDay = toJulianDay(_utcTime); - computeGregorian(); + computeGregorian(julianDay()); + computeDaytime(); return *this; } @@ -339,10 +352,10 @@ void DateTime::normalize() } -void DateTime::computeGregorian() +void DateTime::computeGregorian(double julianDay) { - double z = floor(_julianDay - 1721118.5); - double r = _julianDay - 1721118.5 - z; + double z = floor(julianDay - 1721118.5); + double r = julianDay - 1721118.5 - z; double g = z - 0.25; double a = floor(g / 36524.25); double b = a - floor(a/4); @@ -380,8 +393,18 @@ void DateTime::computeGregorian() poco_assert_dbg (_second >= 0 && _second <= 59); poco_assert_dbg (_millisecond >= 0 && _millisecond <= 999); poco_assert_dbg (_microsecond >= 0 && _microsecond <= 999); - } -Foundation_END +void DateTime::computeDaytime() +{ + Timespan span(_utcTime/10); + _hour = span.hours(); + _minute = span.minutes(); + _second = span.seconds(); + _millisecond = span.milliseconds(); + _microsecond = span.microseconds(); +} + + +} // namespace Poco diff --git a/Foundation/src/DateTimeFormat.cpp b/Foundation/src/DateTimeFormat.cpp index 44bcb6971..62da01fc3 100644 --- a/Foundation/src/DateTimeFormat.cpp +++ b/Foundation/src/DateTimeFormat.cpp @@ -1,7 +1,7 @@ // // DateTimeFormat.cpp // -// $Id: //poco/1.1.0/Foundation/src/DateTimeFormat.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/DateTimeFormat.cpp#1 $ // // Library: Foundation // Package: DateTime @@ -34,10 +34,10 @@ // -#include "Foundation/DateTimeFormat.h" +#include "Poco/DateTimeFormat.h" -Foundation_BEGIN +namespace Poco { const std::string DateTimeFormat::ISO8601_FORMAT = "%Y-%m-%dT%H:%M:%S%z"; @@ -79,4 +79,4 @@ const std::string DateTimeFormat::MONTH_NAMES[] = }; -Foundation_END +} // namespace Poco diff --git a/Foundation/src/DateTimeFormatter.cpp b/Foundation/src/DateTimeFormatter.cpp index 662441a87..d2010cf5b 100644 --- a/Foundation/src/DateTimeFormatter.cpp +++ b/Foundation/src/DateTimeFormatter.cpp @@ -1,7 +1,7 @@ // // DateTimeFormatter.cpp // -// $Id: //poco/1.1.0/Foundation/src/DateTimeFormatter.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/DateTimeFormatter.cpp#1 $ // // Library: Foundation // Package: DateTime @@ -34,15 +34,15 @@ // -#include "Foundation/DateTimeFormatter.h" -#include "Foundation/DateTimeFormat.h" -#include "Foundation/DateTime.h" -#include "Foundation/LocalDateTime.h" -#include "Foundation/Timestamp.h" -#include "Foundation/NumberFormatter.h" +#include "Poco/DateTimeFormatter.h" +#include "Poco/DateTimeFormat.h" +#include "Poco/DateTime.h" +#include "Poco/LocalDateTime.h" +#include "Poco/Timestamp.h" +#include "Poco/NumberFormatter.h" -Foundation_BEGIN +namespace Poco { std::string DateTimeFormatter::format(const Timestamp& timestamp, const std::string& fmt, int timeZoneDifferential) @@ -185,4 +185,4 @@ std::string DateTimeFormatter::tzdRFC(int timeZoneDifferential) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/DateTimeParser.cpp b/Foundation/src/DateTimeParser.cpp index 0ff8d3c3d..7ff3604e4 100644 --- a/Foundation/src/DateTimeParser.cpp +++ b/Foundation/src/DateTimeParser.cpp @@ -1,7 +1,7 @@ // // DateTimeParser.cpp // -// $Id: //poco/1.1.0/Foundation/src/DateTimeParser.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/DateTimeParser.cpp#1 $ // // Library: Foundation // Package: DateTime @@ -34,14 +34,14 @@ // -#include "Foundation/DateTimeParser.h" -#include "Foundation/DateTimeFormat.h" -#include "Foundation/DateTime.h" -#include "Foundation/Exception.h" +#include "Poco/DateTimeParser.h" +#include "Poco/DateTimeFormat.h" +#include "Poco/DateTime.h" +#include "Poco/Exception.h" #include -Foundation_BEGIN +namespace Poco { #define SKIP_JUNK() \ @@ -275,7 +275,7 @@ int DateTimeParser::parseTZD(std::string::const_iterator& it, const std::string: if (it != end && isalpha(*it)) designator += *it++; if (it != end && isalpha(*it)) designator += *it++; if (it != end && isalpha(*it)) designator += *it++; - for (int i = 0; i < sizeof(zones)/sizeof(Zone); ++i) + for (unsigned i = 0; i < sizeof(zones)/sizeof(Zone); ++i) { if (designator == zones[i].designator) return zones[i].timeZoneDifferential; @@ -366,4 +366,4 @@ int DateTimeParser::parseAMPM(std::string::const_iterator& it, const std::string } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Debugger.cpp b/Foundation/src/Debugger.cpp index 0dc0c87c3..876e9ac7d 100644 --- a/Foundation/src/Debugger.cpp +++ b/Foundation/src/Debugger.cpp @@ -1,7 +1,7 @@ // // Debugger.cpp // -// $Id: //poco/1.1.0/Foundation/src/Debugger.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Debugger.cpp#1 $ // // Library: Foundation // Package: Core @@ -34,7 +34,7 @@ // -#include "Foundation/Debugger.h" +#include "Poco/Debugger.h" #include #include #include @@ -47,6 +47,9 @@ #include #include #endif +#if defined(POCO_WIN32_UTF8) +#include "Poco/UnicodeConverter.h" +#endif // NOTE: In this module, we use the C library functions (fputs) for, @@ -54,7 +57,7 @@ // might not have been initialized yet. -Foundation_BEGIN +namespace Poco { bool Debugger::isAvailable() @@ -82,8 +85,15 @@ void Debugger::message(const std::string& msg) #if defined(POCO_OS_FAMILY_WINDOWS) if (IsDebuggerPresent()) { +#if defined(POCO_WIN32_UTF8) + std::wstring umsg; + UnicodeConverter::toUTF16(msg, umsg); + umsg += '\n'; + OutputDebugStringW(umsg.c_str()); +#else OutputDebugString(msg.c_str()); OutputDebugString("\n"); +#endif } #elif defined(POCO_OS_FAMILY_UNIX) #elif defined(POCO_OS_FAMILY_VMS) @@ -152,4 +162,4 @@ void Debugger::enter(const char* file, int line) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/DeflatingStream.cpp b/Foundation/src/DeflatingStream.cpp index 8e88249f4..5bc78a06b 100644 --- a/Foundation/src/DeflatingStream.cpp +++ b/Foundation/src/DeflatingStream.cpp @@ -1,7 +1,7 @@ // // DeflatingStream.cpp // -// $Id: //poco/1.1.0/Foundation/src/DeflatingStream.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/DeflatingStream.cpp#1 $ // // Library: Foundation // Package: Streams @@ -34,11 +34,11 @@ // -#include "Foundation/DeflatingStream.h" -#include "Foundation/Exception.h" +#include "Poco/DeflatingStream.h" +#include "Poco/Exception.h" -Foundation_BEGIN +namespace Poco { DeflatingStreamBuf::DeflatingStreamBuf(std::istream& istr, StreamType type, int level): @@ -136,7 +136,7 @@ int DeflatingStreamBuf::close() int DeflatingStreamBuf::readFromDevice(char* buffer, std::streamsize length) { if (!_pIstr) return 0; - if (!_zstr.next_in && !_eof) + if (_zstr.avail_in == 0 && !_eof) { int n = 0; if (_pIstr->good()) @@ -155,14 +155,9 @@ int DeflatingStreamBuf::readFromDevice(char* buffer, std::streamsize length) _zstr.avail_in = 0; _eof = true; } - _zstr.next_out = (unsigned char*) buffer; - _zstr.avail_out = length; - } - else if (_zstr.avail_out == 0) - { - _zstr.next_out = (unsigned char*) buffer; - _zstr.avail_out = length; } + _zstr.next_out = (unsigned char*) buffer; + _zstr.avail_out = length; for (;;) { int rc = deflate(&_zstr, _eof ? Z_FINISH : Z_NO_FLUSH); @@ -289,4 +284,4 @@ DeflatingInputStream::~DeflatingInputStream() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/DigestEngine.cpp b/Foundation/src/DigestEngine.cpp index 76c391263..91c881461 100644 --- a/Foundation/src/DigestEngine.cpp +++ b/Foundation/src/DigestEngine.cpp @@ -1,7 +1,7 @@ // // DigestEngine.cpp // -// $Id: //poco/1.1.0/Foundation/src/DigestEngine.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/DigestEngine.cpp#1 $ // // Library: Foundation // Package: Crypt @@ -34,10 +34,10 @@ // -#include "Foundation/DigestEngine.h" +#include "Poco/DigestEngine.h" -Foundation_BEGIN +namespace Poco { DigestEngine::DigestEngine() @@ -65,4 +65,4 @@ std::string DigestEngine::digestToHex(const Digest& bytes) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/DigestStream.cpp b/Foundation/src/DigestStream.cpp index 0e2674def..4fe3092e4 100644 --- a/Foundation/src/DigestStream.cpp +++ b/Foundation/src/DigestStream.cpp @@ -1,7 +1,7 @@ // // DigestStream.cpp // -// $Id: //poco/1.1.0/Foundation/src/DigestStream.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/DigestStream.cpp#1 $ // // Library: Foundation // Package: Crypt @@ -34,10 +34,10 @@ // -#include "Foundation/DigestStream.h" +#include "Poco/DigestStream.h" -Foundation_BEGIN +namespace Poco { const int DigestBuf::BUFFER_SIZE = 256; @@ -46,8 +46,8 @@ const int DigestBuf::BUFFER_SIZE = 256; DigestBuf::DigestBuf(DigestEngine& eng): BufferedStreamBuf(BUFFER_SIZE, std::ios::out), _eng(eng), - _pOstr(0), - _pIstr(0) + _pIstr(0), + _pOstr(0) { } @@ -169,4 +169,4 @@ void DigestOutputStream::close() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/DirectoryIterator.cpp b/Foundation/src/DirectoryIterator.cpp index d40b71e26..7ebc831c7 100644 --- a/Foundation/src/DirectoryIterator.cpp +++ b/Foundation/src/DirectoryIterator.cpp @@ -1,7 +1,7 @@ // // DirectoryIterator.cpp // -// $Id: //poco/1.1.0/Foundation/src/DirectoryIterator.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/DirectoryIterator.cpp#1 $ // // Library: Foundation // Package: Filesystem @@ -34,7 +34,7 @@ // -#include "Foundation/DirectoryIterator.h" +#include "Poco/DirectoryIterator.h" #if defined(POCO_OS_FAMILY_WINDOWS) && defined(POCO_WIN32_UTF8) @@ -48,7 +48,7 @@ #endif -Foundation_BEGIN +namespace Poco { DirectoryIterator::DirectoryIterator(): _pImpl(0) @@ -168,4 +168,4 @@ DirectoryIterator DirectoryIterator::operator ++ (int dummy) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/DirectoryIterator_UNIX.cpp b/Foundation/src/DirectoryIterator_UNIX.cpp index 1b4ea7460..b50f27abc 100644 --- a/Foundation/src/DirectoryIterator_UNIX.cpp +++ b/Foundation/src/DirectoryIterator_UNIX.cpp @@ -1,7 +1,7 @@ // // DirectoryIterator_UNIX.cpp // -// $Id: //poco/1.1.0/Foundation/src/DirectoryIterator_UNIX.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/DirectoryIterator_UNIX.cpp#1 $ // // Library: Foundation // Package: Filesystem @@ -34,12 +34,12 @@ // -#include "Foundation/DirectoryIterator_UNIX.h" -#include "Foundation/File_UNIX.h" -#include "Foundation/Path.h" +#include "Poco/DirectoryIterator_UNIX.h" +#include "Poco/File_UNIX.h" +#include "Poco/Path.h" -Foundation_BEGIN +namespace Poco { DirectoryIteratorImpl::DirectoryIteratorImpl(const std::string& path): _pDir(0), _rc(1) @@ -75,4 +75,4 @@ const std::string& DirectoryIteratorImpl::next() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/DirectoryIterator_VMS.cpp b/Foundation/src/DirectoryIterator_VMS.cpp index 9e56131f3..a4d9176ae 100644 --- a/Foundation/src/DirectoryIterator_VMS.cpp +++ b/Foundation/src/DirectoryIterator_VMS.cpp @@ -1,7 +1,7 @@ // // DirectoryIterator_VMS.cpp // -// $Id: //poco/1.1.0/Foundation/src/DirectoryIterator_VMS.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/DirectoryIterator_VMS.cpp#1 $ // // Library: Foundation // Package: Filesystem @@ -34,16 +34,16 @@ // -#include "Foundation/DirectoryIterator_VMS.h" -#include "Foundation/Path.h" -#include "Foundation/Exception.h" +#include "Poco/DirectoryIterator_VMS.h" +#include "Poco/Path.h" +#include "Poco/Exception.h" #include #include #include #include -Foundation_BEGIN +namespace Poco { DirectoryIteratorImpl::DirectoryIteratorImpl(const std::string& path): _rc(1) @@ -84,4 +84,4 @@ const std::string& DirectoryIteratorImpl::next() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/DirectoryIterator_WIN32.cpp b/Foundation/src/DirectoryIterator_WIN32.cpp index 8f95a5b6f..863f78ca6 100644 --- a/Foundation/src/DirectoryIterator_WIN32.cpp +++ b/Foundation/src/DirectoryIterator_WIN32.cpp @@ -1,7 +1,7 @@ // // DirectoryIterator_WIN32.cpp // -// $Id: //poco/1.1.0/Foundation/src/DirectoryIterator_WIN32.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/DirectoryIterator_WIN32.cpp#1 $ // // Library: Foundation // Package: Filesystem @@ -34,12 +34,12 @@ // -#include "Foundation/DirectoryIterator_WIN32.h" -#include "Foundation/File_WIN32.h" -#include "Foundation/Path.h" +#include "Poco/DirectoryIterator_WIN32.h" +#include "Poco/File_WIN32.h" +#include "Poco/Path.h" -Foundation_BEGIN +namespace Poco { DirectoryIteratorImpl::DirectoryIteratorImpl(const std::string& path): _fh(INVALID_HANDLE_VALUE), _rc(1) @@ -82,4 +82,4 @@ const std::string& DirectoryIteratorImpl::next() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/DirectoryIterator_WIN32U.cpp b/Foundation/src/DirectoryIterator_WIN32U.cpp index cfb989e08..03b5063e4 100644 --- a/Foundation/src/DirectoryIterator_WIN32U.cpp +++ b/Foundation/src/DirectoryIterator_WIN32U.cpp @@ -1,7 +1,7 @@ // // DirectoryIterator_WIN32U.cpp // -// $Id: //poco/1.1.0/Foundation/src/DirectoryIterator_WIN32U.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/DirectoryIterator_WIN32U.cpp#1 $ // // Library: Foundation // Package: Filesystem @@ -34,14 +34,14 @@ // -#include "Foundation/DirectoryIterator_WIN32U.h" -#include "Foundation/File_WIN32U.h" -#include "Foundation/Path.h" -#include "Foundation/UnicodeConverter.h" +#include "Poco/DirectoryIterator_WIN32U.h" +#include "Poco/File_WIN32U.h" +#include "Poco/Path.h" +#include "Poco/UnicodeConverter.h" #include -Foundation_BEGIN +namespace Poco { DirectoryIteratorImpl::DirectoryIteratorImpl(const std::string& path): _fh(INVALID_HANDLE_VALUE), _rc(1) @@ -87,4 +87,4 @@ const std::string& DirectoryIteratorImpl::next() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Environment.cpp b/Foundation/src/Environment.cpp index c02cd5eef..a4209a9c3 100644 --- a/Foundation/src/Environment.cpp +++ b/Foundation/src/Environment.cpp @@ -1,7 +1,7 @@ // // Environment.cpp // -// $Id: //poco/1.1.0/Foundation/src/Environment.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Environment.cpp#1 $ // // Library: Foundation // Package: Core @@ -34,7 +34,7 @@ // -#include "Foundation/Environment.h" +#include "Poco/Environment.h" #if defined(POCO_OS_FAMILY_VMS) @@ -48,7 +48,7 @@ #endif -Foundation_BEGIN +namespace Poco { std::string Environment::get(const std::string& name) @@ -93,4 +93,4 @@ std::string Environment::nodeName() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Environment_UNIX.cpp b/Foundation/src/Environment_UNIX.cpp index 2b7404739..dd3269191 100644 --- a/Foundation/src/Environment_UNIX.cpp +++ b/Foundation/src/Environment_UNIX.cpp @@ -1,7 +1,7 @@ // // Environment_UNIX.cpp // -// $Id: //poco/1.1.0/Foundation/src/Environment_UNIX.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Environment_UNIX.cpp#1 $ // // Library: Foundation // Package: Core @@ -34,14 +34,14 @@ // -#include "Foundation/Environment_UNIX.h" -#include "Foundation/Exception.h" +#include "Poco/Environment_UNIX.h" +#include "Poco/Exception.h" #include #include #include -Foundation_BEGIN +namespace Poco { EnvironmentImpl::StringMap EnvironmentImpl::_map; @@ -117,4 +117,4 @@ std::string EnvironmentImpl::nodeNameImpl() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Environment_VMS.cpp b/Foundation/src/Environment_VMS.cpp index fc655a8ad..873ff4773 100644 --- a/Foundation/src/Environment_VMS.cpp +++ b/Foundation/src/Environment_VMS.cpp @@ -1,7 +1,7 @@ // // Environment_VMS.cpp // -// $Id: //poco/1.1.0/Foundation/src/Environment_VMS.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Environment_VMS.cpp#1 $ // // Library: Foundation // Package: Core @@ -34,8 +34,8 @@ // -#include "Foundation/Environment_VMS.h" -#include "Foundation/Exception.h" +#include "Poco/Environment_VMS.h" +#include "Poco/Exception.h" #include #include #include @@ -45,7 +45,7 @@ #include -Foundation_BEGIN +namespace Poco { FastMutex EnvironmentImpl::_mutex; @@ -168,4 +168,4 @@ std::string EnvironmentImpl::trnlnm(const std::string& name) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Environment_WIN32.cpp b/Foundation/src/Environment_WIN32.cpp index 1694b084d..61a9c3fc9 100644 --- a/Foundation/src/Environment_WIN32.cpp +++ b/Foundation/src/Environment_WIN32.cpp @@ -1,7 +1,7 @@ // // Environment_WIN32.cpp // -// $Id: //poco/1.1.0/Foundation/src/Environment_WIN32.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Environment_WIN32.cpp#1 $ // // Library: Foundation // Package: Core @@ -34,13 +34,13 @@ // -#include "Foundation/Environment_WIN32.h" -#include "Foundation/Exception.h" +#include "Poco/Environment_WIN32.h" +#include "Poco/Exception.h" #include #include -Foundation_BEGIN +namespace Poco { std::string EnvironmentImpl::getImpl(const std::string& name) @@ -144,4 +144,4 @@ std::string EnvironmentImpl::nodeNameImpl() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Environment_WIN32U.cpp b/Foundation/src/Environment_WIN32U.cpp index f67957f80..7590c5678 100644 --- a/Foundation/src/Environment_WIN32U.cpp +++ b/Foundation/src/Environment_WIN32U.cpp @@ -1,7 +1,7 @@ // // Environment_WIN32U.cpp // -// $Id: //poco/1.1.0/Foundation/src/Environment_WIN32U.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Environment_WIN32U.cpp#1 $ // // Library: Foundation // Package: Core @@ -34,16 +34,16 @@ // -#include "Foundation/Environment_WIN32U.h" -#include "Foundation/Exception.h" -#include "Foundation/UnicodeConverter.h" -#include "Foundation/Buffer.h" +#include "Poco/Environment_WIN32U.h" +#include "Poco/Exception.h" +#include "Poco/UnicodeConverter.h" +#include "Poco/Buffer.h" #include #include #include -Foundation_BEGIN +namespace Poco { std::string EnvironmentImpl::getImpl(const std::string& name) @@ -110,7 +110,9 @@ std::string EnvironmentImpl::osVersionImpl() if (GetVersionEx(&vi) == 0) throw SystemException("Cannot get OS version information"); std::ostringstream str; str << vi.dwMajorVersion << "." << vi.dwMinorVersion << " (Build " << (vi.dwBuildNumber & 0xFFFF); - if (vi.szCSDVersion[0]) str << ": " << vi.szCSDVersion; + std::string version; + UnicodeConverter::toUTF8(vi.szCSDVersion, version); + if (!version.empty()) str << ": " << version; str << ")"; return str.str(); } @@ -157,4 +159,4 @@ std::string EnvironmentImpl::nodeNameImpl() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/ErrorHandler.cpp b/Foundation/src/ErrorHandler.cpp index 7fe0c509e..e48b85533 100644 --- a/Foundation/src/ErrorHandler.cpp +++ b/Foundation/src/ErrorHandler.cpp @@ -1,7 +1,7 @@ // // ErrorHandler.cpp // -// $Id: //poco/1.1.0/Foundation/src/ErrorHandler.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/ErrorHandler.cpp#1 $ // // Library: Foundation // Package: Threading @@ -34,11 +34,11 @@ // -#include "Foundation/ErrorHandler.h" -#include "Foundation/SingletonHolder.h" +#include "Poco/ErrorHandler.h" +#include "Poco/SingletonHolder.h" -Foundation_BEGIN +namespace Poco { ErrorHandler* ErrorHandler::_pHandler = ErrorHandler::defaultHandler(); @@ -130,4 +130,4 @@ ErrorHandler* ErrorHandler::defaultHandler() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Event.cpp b/Foundation/src/Event.cpp index acfca1064..f145e4577 100644 --- a/Foundation/src/Event.cpp +++ b/Foundation/src/Event.cpp @@ -1,7 +1,7 @@ // // Event.cpp // -// $Id: //poco/1.1.0/Foundation/src/Event.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Event.cpp#1 $ // // Library: Foundation // Package: Threading @@ -34,7 +34,7 @@ // -#include "Foundation/Event.h" +#include "Poco/Event.h" #if defined(POCO_OS_FAMILY_WINDOWS) @@ -44,7 +44,7 @@ #endif -Foundation_BEGIN +namespace Poco { Event::Event(bool autoReset): EventImpl(autoReset) @@ -57,4 +57,4 @@ Event::~Event() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/EventArgs.cpp b/Foundation/src/EventArgs.cpp index 8bf8317e4..d08c7abd0 100644 --- a/Foundation/src/EventArgs.cpp +++ b/Foundation/src/EventArgs.cpp @@ -1,7 +1,7 @@ // // EventArgs.cpp // -// $Id: //poco/1.1.0/Foundation/src/EventArgs.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/EventArgs.cpp#1 $ // // Library: Foundation // Package: Events @@ -36,10 +36,10 @@ // -#include "Foundation/EventArgs.h" +#include "Poco/EventArgs.h" -Foundation_BEGIN +namespace Poco { EventArgs::EventArgs() @@ -52,4 +52,4 @@ EventArgs::~EventArgs() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/EventLogChannel.cpp b/Foundation/src/EventLogChannel.cpp index 6871e9f28..8b80e23f3 100644 --- a/Foundation/src/EventLogChannel.cpp +++ b/Foundation/src/EventLogChannel.cpp @@ -1,7 +1,7 @@ // // EventLogChannel.cpp // -// $Id: //poco/1.1.0/Foundation/src/EventLogChannel.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/EventLogChannel.cpp#1 $ // // Library: Foundation // Package: Logging @@ -34,12 +34,15 @@ // -#include "Foundation/EventLogChannel.h" -#include "Foundation/Message.h" +#include "Poco/EventLogChannel.h" +#include "Poco/Message.h" #include "pocomsg.h" +#if defined(POCO_WIN32_UTF8) +#include "Poco/UnicodeConverter.h" +#endif -Foundation_BEGIN +namespace Poco { const std::string EventLogChannel::PROP_NAME = "name"; @@ -51,6 +54,18 @@ EventLogChannel::EventLogChannel(): _logFile("Application"), _h(0) { +#if defined(POCO_WIN32_UTF8) + wchar_t name[256]; + int n = GetModuleFileNameW(NULL, name, sizeof(name)); + if (n > 0) + { + wchar_t* end = name + n - 1; + while (end > name && *end != '\\') --end; + if (*end == '\\') ++end; + std::wstring uname(end); + UnicodeConverter::toUTF8(uname, _name); + } +#else char name[256]; int n = GetModuleFileName(NULL, name, sizeof(name)); if (n > 0) @@ -60,6 +75,7 @@ EventLogChannel::EventLogChannel(): if (*end == '\\') ++end; _name = end; } +#endif } @@ -89,7 +105,15 @@ EventLogChannel::~EventLogChannel() void EventLogChannel::open() { setUpRegistry(); +#if defined(POCO_WIN32_UTF8) + std::wstring uhost; + UnicodeConverter::toUTF16(_host, uhost); + std::wstring uname; + UnicodeConverter::toUTF16(_name, uname); + _h = RegisterEventSourceW(uhost.empty() ? NULL : uhost.c_str(), uname.c_str()); +#else _h = RegisterEventSource(_host.empty() ? NULL : _host.c_str(), _name.c_str()); +#endif if (!_h) throw SystemException("cannot register event source"); } @@ -104,8 +128,15 @@ void EventLogChannel::close() void EventLogChannel::log(const Message& msg) { if (!_h) open(); +#if defined(POCO_WIN32_UTF8) + std::wstring utext; + UnicodeConverter::toUTF16(msg.getText(), utext); + const wchar_t* pMsg = utext.c_str(); + ReportEventW(_h, getType(msg), getCategory(msg), POCO_MSG_LOG, NULL, 1, 0, &pMsg, NULL); +#else const char* pMsg = msg.getText().c_str(); ReportEvent(_h, getType(msg), getCategory(msg), POCO_MSG_LOG, NULL, 1, 0, &pMsg, NULL); +#endif } @@ -186,13 +217,31 @@ void EventLogChannel::setUpRegistry() const key.append(_name); HKEY hKey; DWORD disp; +#if defined(POCO_WIN32_UTF8) + std::wstring ukey; + UnicodeConverter::toUTF16(key, ukey); + DWORD rc = RegCreateKeyExW(HKEY_LOCAL_MACHINE, ukey.c_str(), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &disp); +#else DWORD rc = RegCreateKeyEx(HKEY_LOCAL_MACHINE, key.c_str(), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &disp); +#endif if (rc != ERROR_SUCCESS) return; if (disp == REG_CREATED_NEW_KEY) { +#if defined(POCO_WIN32_UTF8) + std::wstring path; + #if defined(POCO_DLL) + #if defined(_DEBUG) + path = findLibrary(L"PocoFoundationd.dll"); + #else + path = findLibrary(L"PocoFoundation.dll"); + #endif + #endif + + if (path.empty()) + path = findLibrary(L"PocoMsg.dll"); +#else std::string path; - #if defined(POCO_DLL) #if defined(_DEBUG) path = findLibrary("PocoFoundationd.dll"); @@ -203,21 +252,44 @@ void EventLogChannel::setUpRegistry() const if (path.empty()) path = findLibrary("PocoMsg.dll"); +#endif if (!path.empty()) { DWORD count = 8; DWORD types = 7; +#if defined(POCO_WIN32_UTF8) + RegSetValueExW(hKey, L"CategoryMessageFile", 0, REG_SZ, (const BYTE*) path.c_str(), (DWORD) path.size() + 1); + RegSetValueExW(hKey, L"EventMessageFile", 0, REG_SZ, (const BYTE*) path.c_str(), (DWORD) path.size() + 1); + RegSetValueExW(hKey, L"CategoryCount", 0, REG_DWORD, (const BYTE*) &count, (DWORD) sizeof(count)); + RegSetValueExW(hKey, L"TypesSupported", 0, REG_DWORD, (const BYTE*) &types, (DWORD) sizeof(types)); +#else RegSetValueEx(hKey, "CategoryMessageFile", 0, REG_SZ, (const BYTE*) path.c_str(), (DWORD) path.size() + 1); RegSetValueEx(hKey, "EventMessageFile", 0, REG_SZ, (const BYTE*) path.c_str(), (DWORD) path.size() + 1); RegSetValueEx(hKey, "CategoryCount", 0, REG_DWORD, (const BYTE*) &count, (DWORD) sizeof(count)); RegSetValueEx(hKey, "TypesSupported", 0, REG_DWORD, (const BYTE*) &types, (DWORD) sizeof(types)); +#endif } } RegCloseKey(hKey); } +#if defined(POCO_WIN32_UTF8) +std::wstring EventLogChannel::findLibrary(const wchar_t* name) +{ + std::wstring path; + HMODULE dll = LoadLibraryW(name); + if (dll) + { + wchar_t name[MAX_PATH + 1]; + int n = GetModuleFileNameW(dll, name, sizeof(name)); + if (n > 0) path = name; + FreeLibrary(dll); + } + return path; +} +#else std::string EventLogChannel::findLibrary(const char* name) { std::string path; @@ -231,6 +303,7 @@ std::string EventLogChannel::findLibrary(const char* name) } return path; } +#endif -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Event_POSIX.cpp b/Foundation/src/Event_POSIX.cpp index 46d19db1c..5c711aa6a 100644 --- a/Foundation/src/Event_POSIX.cpp +++ b/Foundation/src/Event_POSIX.cpp @@ -1,7 +1,7 @@ // // Event_POSIX.cpp // -// $Id: //poco/1.1.0/Foundation/src/Event_POSIX.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Event_POSIX.cpp#1 $ // // Library: Foundation // Package: Threading @@ -34,11 +34,11 @@ // -#include "Foundation/Event_POSIX.h" +#include "Poco/Event_POSIX.h" #include -Foundation_BEGIN +namespace Poco { EventImpl::EventImpl(bool autoReset): _auto(autoReset), _state(false) @@ -114,4 +114,4 @@ bool EventImpl::waitImpl(long milliseconds) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Event_WIN32.cpp b/Foundation/src/Event_WIN32.cpp index a5259716d..634a3f3e3 100644 --- a/Foundation/src/Event_WIN32.cpp +++ b/Foundation/src/Event_WIN32.cpp @@ -1,7 +1,7 @@ // // Event_WIN32.cpp // -// $Id: //poco/1.1.0/Foundation/src/Event_WIN32.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Event_WIN32.cpp#1 $ // // Library: Foundation // Package: Threading @@ -34,10 +34,10 @@ // -#include "Foundation/Event_WIN32.h" +#include "Poco/Event_WIN32.h" -Foundation_BEGIN +namespace Poco { EventImpl::EventImpl(bool autoReset) @@ -80,4 +80,4 @@ bool EventImpl::waitImpl(long milliseconds) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Exception.cpp b/Foundation/src/Exception.cpp index 04e5ac7b6..561f4db86 100644 --- a/Foundation/src/Exception.cpp +++ b/Foundation/src/Exception.cpp @@ -1,7 +1,7 @@ // // Exception.cpp // -// $Id: //poco/1.1.0/Foundation/src/Exception.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Exception.cpp#1 $ // // Library: Foundation // Package: Core @@ -34,11 +34,11 @@ // -#include "Foundation/Exception.h" +#include "Poco/Exception.h" #include -Foundation_BEGIN +namespace Poco { Exception::Exception(): _pNested(0) @@ -66,7 +66,7 @@ Exception::Exception(const std::string& msg, const Exception& nested): _msg(msg) } -Exception::Exception(const Exception& exc) +Exception::Exception(const Exception& exc): std::exception(exc) { _msg = exc._msg; _pNested = exc._pNested ? exc._pNested->clone() : 0; @@ -109,18 +109,6 @@ const char* Exception::what() const throw() } -const Exception* Exception::nested() const -{ - return _pNested; -} - - -const std::string& Exception::message() const -{ - return _msg; -} - - std::string Exception::displayText() const { std::string txt = name(); @@ -139,6 +127,12 @@ Exception* Exception::clone() const } +void Exception::rethrow() const +{ + throw *this; +} + + POCO_IMPLEMENT_EXCEPTION(LogicException, Exception, "Logic exception") POCO_IMPLEMENT_EXCEPTION(AssertionViolationException, LogicException, "Assertion violation") POCO_IMPLEMENT_EXCEPTION(NullPointerException, LogicException, "Null pointer") @@ -149,6 +143,7 @@ POCO_IMPLEMENT_EXCEPTION(RangeException, LogicException, "Out of range") POCO_IMPLEMENT_EXCEPTION(IllegalStateException, LogicException, "Illegal state") POCO_IMPLEMENT_EXCEPTION(InvalidAccessException, LogicException, "Invalid access") POCO_IMPLEMENT_EXCEPTION(SignalException, LogicException, "Signal received") +POCO_IMPLEMENT_EXCEPTION(UnhandledException, LogicException, "Signal received") POCO_IMPLEMENT_EXCEPTION(RuntimeException, Exception, "Runtime exception") POCO_IMPLEMENT_EXCEPTION(NotFoundException, RuntimeException, "Not found") @@ -186,4 +181,4 @@ POCO_IMPLEMENT_EXCEPTION(UnknownURISchemeException, RuntimeException, "Unknown U POCO_IMPLEMENT_EXCEPTION(ApplicationException, Exception, "Application exception") POCO_IMPLEMENT_EXCEPTION(BadCastException, RuntimeException, "Bad cast exception") -Foundation_END +} // namespace Poco diff --git a/Foundation/src/FPEnvironment.cpp b/Foundation/src/FPEnvironment.cpp index 4a5387b21..105b215ce 100644 --- a/Foundation/src/FPEnvironment.cpp +++ b/Foundation/src/FPEnvironment.cpp @@ -1,7 +1,7 @@ // // FPEnvironment.cpp // -// $Id: //poco/1.1.0/Foundation/src/FPEnvironment.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/FPEnvironment.cpp#1 $ // // Library: Foundation // Package: Core @@ -35,15 +35,15 @@ // pull in platform identification macros needed below -#include "Foundation/Platform.h" +#include "Poco/Platform.h" -#if defined(__osf__) || defined(__VMS) +#if defined(POCO_NO_FPENVIRONMENT) +#include "FPEnvironment_DUMMY.cpp" +#elif defined(__osf__) || defined(__VMS) #include "FPEnvironment_DEC.cpp" #elif defined(sun) || defined(__sun) #include "FPEnvironment_SUN.cpp" -#elif defined(__CYGWIN__) || (defined(__GNUC__) && __GNUC__ < 3) -#include "FPEnvironment_DUMMY.cpp" #elif defined(POCO_OS_FAMILY_UNIX) #include "FPEnvironment_C99.cpp" #elif defined(POCO_OS_FAMILY_WINDOWS) @@ -55,10 +55,10 @@ // header file must be included after platform-specific part // due to _XOPEN_SOURCE conflict on Tru64 (see FPEnvironment_DEC.cpp) -#include "Foundation/FPEnvironment.h" +#include "Poco/FPEnvironment.h" -Foundation_BEGIN +namespace Poco { FPEnvironment::FPEnvironment() @@ -104,4 +104,4 @@ void FPEnvironment::clearFlags() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/FPEnvironment_C99.cpp b/Foundation/src/FPEnvironment_C99.cpp index b9ff72283..f7aa0641f 100644 --- a/Foundation/src/FPEnvironment_C99.cpp +++ b/Foundation/src/FPEnvironment_C99.cpp @@ -1,7 +1,7 @@ // // FPEnvironment_C99.cpp // -// $Id: //poco/1.1.0/Foundation/src/FPEnvironment_C99.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/FPEnvironment_C99.cpp#1 $ // // Library: Foundation // Package: Core @@ -34,10 +34,10 @@ // -#include "Foundation/FPEnvironment_C99.h" +#include "Poco/FPEnvironment_C99.h" -Foundation_BEGIN +namespace Poco { FPEnvironmentImpl::FPEnvironmentImpl() @@ -101,4 +101,4 @@ long double FPEnvironmentImpl::copySignImpl(long double target, long double sour } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/FPEnvironment_DEC.cpp b/Foundation/src/FPEnvironment_DEC.cpp index 3abb0e5d4..24b26ef99 100644 --- a/Foundation/src/FPEnvironment_DEC.cpp +++ b/Foundation/src/FPEnvironment_DEC.cpp @@ -1,7 +1,7 @@ // // FPEnvironment_DEC.cpp // -// $Id: //poco/1.1.0/Foundation/src/FPEnvironment_DEC.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/FPEnvironment_DEC.cpp#1 $ // // Library: Foundation // Package: Core @@ -47,10 +47,10 @@ #if defined(__VMS) #include #endif -#include "Foundation/FPEnvironment_DEC.h" +#include "Poco/FPEnvironment_DEC.h" -Foundation_BEGIN +namespace Poco { FPEnvironmentImpl::FPEnvironmentImpl() @@ -214,4 +214,4 @@ FPEnvironmentImpl::RoundingModeImpl FPEnvironmentImpl::getRoundingModeImpl() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/FPEnvironment_DUMMY.cpp b/Foundation/src/FPEnvironment_DUMMY.cpp index 8c70bcf78..7ea63d692 100644 --- a/Foundation/src/FPEnvironment_DUMMY.cpp +++ b/Foundation/src/FPEnvironment_DUMMY.cpp @@ -1,7 +1,7 @@ // // FPEnvironment_C99.cpp // -// $Id: //poco/1.1.0/Foundation/src/FPEnvironment_DUMMY.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/FPEnvironment_DUMMY.cpp#1 $ // // Library: Foundation // Package: Core @@ -34,10 +34,10 @@ // -#include "Foundation/FPEnvironment_DUMMY.h" +#include "Poco/FPEnvironment_DUMMY.h" -Foundation_BEGIN +namespace Poco { FPEnvironmentImpl::RoundingModeImpl FPEnvironmentImpl::_roundingMode; @@ -98,4 +98,4 @@ long double FPEnvironmentImpl::copySignImpl(long double target, long double sour } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/FPEnvironment_SUN.cpp b/Foundation/src/FPEnvironment_SUN.cpp index fd721dba6..d24cf8be4 100644 --- a/Foundation/src/FPEnvironment_SUN.cpp +++ b/Foundation/src/FPEnvironment_SUN.cpp @@ -1,7 +1,7 @@ // // FPEnvironment_SUN.cpp // -// $Id: //poco/1.1.0/Foundation/src/FPEnvironment_SUN.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/FPEnvironment_SUN.cpp#1 $ // // Library: Foundation // Package: Core @@ -35,10 +35,10 @@ #include -#include "Foundation/FPEnvironment_SUN.h" +#include "Poco/FPEnvironment_SUN.h" -Foundation_BEGIN +namespace Poco { FPEnvironmentImpl::FPEnvironmentImpl() @@ -158,4 +158,4 @@ FPEnvironmentImpl::RoundingModeImpl FPEnvironmentImpl::getRoundingModeImpl() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/FPEnvironment_WIN32.cpp b/Foundation/src/FPEnvironment_WIN32.cpp index cbf50b409..6b4aa1132 100644 --- a/Foundation/src/FPEnvironment_WIN32.cpp +++ b/Foundation/src/FPEnvironment_WIN32.cpp @@ -1,7 +1,7 @@ // // FPEnvironment_WIN32.cpp // -// $Id: //poco/1.1.0/Foundation/src/FPEnvironment_WIN32.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/FPEnvironment_WIN32.cpp#1 $ // // Library: Foundation // Package: Core @@ -34,10 +34,10 @@ // -#include "Foundation/FPEnvironment_WIN32.h" +#include "Poco/FPEnvironment_WIN32.h" -Foundation_BEGIN +namespace Poco { FPEnvironmentImpl::FPEnvironmentImpl() @@ -95,4 +95,4 @@ FPEnvironmentImpl::RoundingModeImpl FPEnvironmentImpl::getRoundingModeImpl() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/File.cpp b/Foundation/src/File.cpp index 1fb18a565..a2263d5fb 100644 --- a/Foundation/src/File.cpp +++ b/Foundation/src/File.cpp @@ -1,7 +1,7 @@ // // File.cpp // -// $Id: //poco/1.1.0/Foundation/src/File.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/File.cpp#1 $ // // Library: Foundation // Package: Filesystem @@ -34,9 +34,9 @@ // -#include "Foundation/File.h" -#include "Foundation/Path.h" -#include "Foundation/DirectoryIterator.h" +#include "Poco/File.h" +#include "Poco/Path.h" +#include "Poco/DirectoryIterator.h" #if defined(POCO_OS_FAMILY_WINDOWS) && defined(POCO_WIN32_UTF8) @@ -50,7 +50,7 @@ #endif -Foundation_BEGIN +namespace Poco { File::File() @@ -148,6 +148,12 @@ bool File::isDirectory() const } +bool File::isLink() const +{ + return isLinkImpl(); +} + + Timestamp File::created() const { return createdImpl(); @@ -224,7 +230,7 @@ void File::renameTo(const std::string& path) void File::remove(bool recursive) { - if (recursive && isDirectory()) + if (recursive && !isLink() && isDirectory()) { std::vector files; list(files); @@ -292,4 +298,4 @@ void File::list(std::vector& files) const } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/FileChannel.cpp b/Foundation/src/FileChannel.cpp index 448617bd0..928eab6a2 100644 --- a/Foundation/src/FileChannel.cpp +++ b/Foundation/src/FileChannel.cpp @@ -1,7 +1,7 @@ // // FileChannel.cpp // -// $Id: //poco/1.1.0/Foundation/src/FileChannel.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/FileChannel.cpp#1 $ // // Library: Foundation // Package: Logging @@ -34,22 +34,22 @@ // -#include "Foundation/FileChannel.h" -#include "Foundation/ArchiveStrategy.h" -#include "Foundation/RotateStrategy.h" -#include "Foundation/PurgeStrategy.h" -#include "Foundation/Message.h" -#include "Foundation/NumberParser.h" -#include "Foundation/DateTimeFormatter.h" -#include "Foundation/DateTime.h" -#include "Foundation/LocalDateTime.h" -#include "Foundation/String.h" -#include "Foundation/Timespan.h" -#include "Foundation/Exception.h" +#include "Poco/FileChannel.h" +#include "Poco/ArchiveStrategy.h" +#include "Poco/RotateStrategy.h" +#include "Poco/PurgeStrategy.h" +#include "Poco/Message.h" +#include "Poco/NumberParser.h" +#include "Poco/DateTimeFormatter.h" +#include "Poco/DateTime.h" +#include "Poco/LocalDateTime.h" +#include "Poco/String.h" +#include "Poco/Timespan.h" +#include "Poco/Exception.h" #include -Foundation_BEGIN +namespace Poco { const std::string FileChannel::PROP_PATH = "path"; @@ -73,9 +73,9 @@ FileChannel::FileChannel(): FileChannel::FileChannel(const std::string& path): + _path(path), _times("utc"), _compress(false), - _path(path), _pFile(0), _pRotateStrategy(0), _pArchiveStrategy(new ArchiveByNumberStrategy), @@ -315,7 +315,7 @@ void FileChannel::setPurgeAge(const std::string& age) else if (unit == "weeks") factor = 7*Timespan::DAYS; else if (unit == "months") - factor *= 30*Timespan::DAYS; + factor = 30*Timespan::DAYS; else if (unit != "seconds") throw InvalidArgumentException("purgeAge", age); @@ -355,4 +355,4 @@ void FileChannel::purge() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/FileStreamFactory.cpp b/Foundation/src/FileStreamFactory.cpp index 4ef27f355..a2e2f7642 100644 --- a/Foundation/src/FileStreamFactory.cpp +++ b/Foundation/src/FileStreamFactory.cpp @@ -1,7 +1,7 @@ // // FileStreamFactory.cpp // -// $Id: //poco/1.1.0/Foundation/src/FileStreamFactory.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/FileStreamFactory.cpp#1 $ // // Library: Foundation // Package: URI @@ -34,15 +34,15 @@ // -#include "Foundation/FileStreamFactory.h" -#include "Foundation/URI.h" -#include "Foundation/Path.h" -#include "Foundation/File.h" -#include "Foundation/Exception.h" +#include "Poco/FileStreamFactory.h" +#include "Poco/URI.h" +#include "Poco/Path.h" +#include "Poco/File.h" +#include "Poco/Exception.h" #include -Foundation_BEGIN +namespace Poco { FileStreamFactory::FileStreamFactory() @@ -83,4 +83,4 @@ std::istream* FileStreamFactory::open(const Path& path) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/File_UNIX.cpp b/Foundation/src/File_UNIX.cpp index 2fa48013b..cad3dd996 100644 --- a/Foundation/src/File_UNIX.cpp +++ b/Foundation/src/File_UNIX.cpp @@ -1,7 +1,7 @@ // // File_UNIX.cpp // -// $Id: //poco/1.1.0/Foundation/src/File_UNIX.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/File_UNIX.cpp#1 $ // // Library: Foundation // Package: Filesystem @@ -34,9 +34,9 @@ // -#include "Foundation/File_UNIX.h" -#include "Foundation/Buffer.h" -#include "Foundation/Exception.h" +#include "Poco/File_UNIX.h" +#include "Poco/Buffer.h" +#include "Poco/Exception.h" #include #include #include @@ -48,7 +48,7 @@ #include -Foundation_BEGIN +namespace Poco { FileImpl::FileImpl() @@ -154,6 +154,19 @@ bool FileImpl::isDirectoryImpl() const } +bool FileImpl::isLinkImpl() const +{ + poco_assert (!_path.empty()); + + struct stat st; + if (lstat(_path.c_str(), &st) == 0) + return S_ISLNK(st.st_mode); + else + handleError(_path); + return false; +} + + Timestamp FileImpl::createdImpl() const { poco_assert (!_path.empty()); @@ -300,7 +313,7 @@ void FileImpl::removeImpl() poco_assert (!_path.empty()); int rc; - if (isDirectoryImpl()) + if (!isLinkImpl() && isDirectoryImpl()) rc = rmdir(_path.c_str()); else rc = unlink(_path.c_str()); @@ -372,4 +385,4 @@ void FileImpl::handleError(const std::string& path) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/File_VMS.cpp b/Foundation/src/File_VMS.cpp index 9f392c5ad..8e69062ab 100644 --- a/Foundation/src/File_VMS.cpp +++ b/Foundation/src/File_VMS.cpp @@ -1,7 +1,7 @@ // // File_VMS.cpp // -// $Id: //poco/1.1.0/Foundation/src/File_VMS.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/File_VMS.cpp#1 $ // // Library: Foundation // Package: Filesystem @@ -34,9 +34,9 @@ // -#include "Foundation/File_VMS.h" -#include "Foundation/Exception.h" -#include "Foundation/Path.h" +#include "Poco/File_VMS.h" +#include "Poco/Exception.h" +#include "Poco/Path.h" #include #include #include @@ -52,7 +52,7 @@ #include -Foundation_BEGIN +namespace Poco { FileImpl::FileImpl() @@ -160,6 +160,12 @@ bool FileImpl::isDirectoryImpl() const } +bool FileImpl::isLinkImpl() const +{ + return false; +} + + Timestamp FileImpl::createdImpl() const { poco_assert (!_path.empty()); @@ -372,4 +378,4 @@ void FileImpl::handleError(const std::string& path) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/File_WIN32.cpp b/Foundation/src/File_WIN32.cpp index f6981d98e..c6de51f6c 100644 --- a/Foundation/src/File_WIN32.cpp +++ b/Foundation/src/File_WIN32.cpp @@ -1,7 +1,7 @@ // // File_WIN32.cpp // -// $Id: //poco/1.1.0/Foundation/src/File_WIN32.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/File_WIN32.cpp#1 $ // // Library: Foundation // Package: Filesystem @@ -34,12 +34,12 @@ // -#include "Foundation/File_WIN32.h" -#include "Foundation/Exception.h" +#include "Poco/File_WIN32.h" +#include "Poco/Exception.h" #include -Foundation_BEGIN +namespace Poco { class FileHandle @@ -170,6 +170,12 @@ bool FileImpl::isDirectoryImpl() const } +bool FileImpl::isLinkImpl() const +{ + return false; +} + + Timestamp FileImpl::createdImpl() const { poco_assert (!_path.empty()); @@ -350,4 +356,4 @@ void FileImpl::handleError(const std::string& path) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/File_WIN32U.cpp b/Foundation/src/File_WIN32U.cpp index d29f6809f..bbef37384 100644 --- a/Foundation/src/File_WIN32U.cpp +++ b/Foundation/src/File_WIN32U.cpp @@ -1,7 +1,7 @@ // // File_WIN32U.cpp // -// $Id: //poco/1.1.0/Foundation/src/File_WIN32U.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/File_WIN32U.cpp#1 $ // // Library: Foundation // Package: Filesystem @@ -34,13 +34,13 @@ // -#include "Foundation/File_WIN32U.h" -#include "Foundation/Exception.h" -#include "Foundation/UnicodeConverter.h" +#include "Poco/File_WIN32U.h" +#include "Poco/Exception.h" +#include "Poco/UnicodeConverter.h" #include -Foundation_BEGIN +namespace Poco { class FileHandle @@ -174,6 +174,12 @@ bool FileImpl::isDirectoryImpl() const } +bool FileImpl::isLinkImpl() const +{ + return false; +} + + Timestamp FileImpl::createdImpl() const { poco_assert (!_path.empty()); @@ -358,4 +364,4 @@ void FileImpl::handleError(const std::string& path) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Format.cpp b/Foundation/src/Format.cpp new file mode 100644 index 000000000..51ad74ad0 --- /dev/null +++ b/Foundation/src/Format.cpp @@ -0,0 +1,334 @@ +// +// Format.cpp +// +// $Id: //poco/1.2/Foundation/src/Format.cpp#1 $ +// +// Library: Foundation +// Package: Core +// Module: Format +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Redistributions in any form must be accompanied by information on +// how to obtain complete source code for this software and any +// accompanying software that uses this software. The source code +// must either be included in the distribution or be available for no +// more than the cost of distribution plus a nominal fee, and must be +// freely redistributable under reasonable conditions. For an +// executable file, complete source code means the source code for all +// modules it contains. It does not include source code for modules or +// files that typically accompany the major components of the operating +// system on which the executable file runs. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + + +#include "Poco/Format.h" +#include "Poco/Exception.h" +#include +#include + + +namespace Poco { + + +namespace +{ + void parseFlags(std::ostream& str, std::string::const_iterator& itFmt, const std::string::const_iterator& endFmt) + { + bool isFlag = true; + while (isFlag && itFmt != endFmt) + { + switch (*itFmt) + { + case '-': str.setf(std::ios_base::left); ++itFmt; break; + case '+': str.setf(std::ios_base::showpos); ++itFmt; break; + case '0': str.fill('0'); ++itFmt; break; + case '#': str.setf(std::ios_base::showpoint | std::ios_base::showbase); ++itFmt; break; + default: isFlag = false; break; + } + } + } + + + void parseWidth(std::ostream& str, std::string::const_iterator& itFmt, const std::string::const_iterator& endFmt) + { + int width = 0; + while (itFmt != endFmt && isdigit(*itFmt)) + { + width = 10*width + *itFmt - '0'; + ++itFmt; + } + if (width != 0) str.width(width); + } + + + void parsePrec(std::ostream& str, std::string::const_iterator& itFmt, const std::string::const_iterator& endFmt) + { + if (itFmt != endFmt && *itFmt == '.') + { + ++itFmt; + int prec = 0; + while (itFmt != endFmt && isdigit(*itFmt)) + { + prec = 10*prec + *itFmt - '0'; + ++itFmt; + } + if (prec != 0) str.precision(prec); + } + } + + char parseMod(std::string::const_iterator& itFmt, const std::string::const_iterator& endFmt) + { + char mod = 0; + if (itFmt != endFmt) + { + switch (*itFmt) + { + case 'l': + case 'h': + case 'L': mod = *itFmt++; break; + } + } + return mod; + } + + + void prepareFormat(std::ostream& str, char type) + { + switch (type) + { + case 'd': + case 'i': str << std::dec; break; + case 'o': str << std::oct; break; + case 'x': str << std::hex; break; + case 'X': str << std::hex << std::uppercase; break; + case 'e': str << std::scientific; break; + case 'E': str << std::scientific << std::uppercase; break; + case 'f': str << std::fixed; break; + } + } + + + void formatOne(std::string& result, std::string::const_iterator& itFmt, const std::string::const_iterator& endFmt, std::vector::const_iterator& itVal) + { + std::ostringstream str; + parseFlags(str, itFmt, endFmt); + parseWidth(str, itFmt, endFmt); + parsePrec(str, itFmt, endFmt); + char mod = parseMod(itFmt, endFmt); + if (itFmt != endFmt) + { + char type = *itFmt++; + prepareFormat(str, type); + switch (type) + { + case 'c': + str << AnyCast(*itVal++); + break; + case 'd': + case 'i': + switch (mod) + { + case 'l': str << AnyCast(*itVal++); break; + case 'L': str << AnyCast(*itVal++); break; + case 'h': str << AnyCast(*itVal++); break; + default: str << AnyCast(*itVal++); break; + } + break; + case 'o': + case 'u': + case 'x': + case 'X': + switch (mod) + { + case 'l': str << AnyCast(*itVal++); break; + case 'L': str << AnyCast(*itVal++); break; + case 'h': str << AnyCast(*itVal++); break; + default: str << AnyCast(*itVal++); break; + } + break; + case 'e': + case 'E': + case 'f': + switch (mod) + { + case 'l': str << AnyCast(*itVal++); break; + case 'L': str << AnyCast(*itVal++); break; + case 'h': str << AnyCast(*itVal++); break; + default: str << AnyCast(*itVal++); break; + } + break; + case 's': + str << RefAnyCast(*itVal++); + break; + default: + str << type; + } + } + result.append(str.str()); + } +} + + +std::string format(const std::string& fmt, const Any& value) +{ + std::string result; + format(result, fmt, value); + return result; +} + + +std::string format(const std::string& fmt, const Any& value1, const Any& value2) +{ + std::string result; + format(result, fmt, value1, value2); + return result; +} + + +std::string format(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3) +{ + std::string result; + format(result, fmt, value1, value2, value3); + return result; +} + + +std::string format(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4) +{ + std::string result; + format(result, fmt, value1, value2, value3, value4); + return result; +} + + +std::string format(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5) +{ + std::string result; + format(result, fmt, value1, value2, value3, value4, value5); + return result; +} + + +std::string format(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6) +{ + std::string result; + format(result, fmt, value1, value2, value3, value4, value5, value6); + return result; +} + + +void format(std::string& result, const std::string& fmt, const Any& value) +{ + std::vector args; + args.push_back(value); + format(result, fmt, args); +} + + +void format(std::string& result, const std::string& fmt, const Any& value1, const Any& value2) +{ + std::vector args; + args.push_back(value1); + args.push_back(value2); + format(result, fmt, args); +} + + +void format(std::string& result, const std::string& fmt, const Any& value1, const Any& value2, const Any& value3) +{ + std::vector args; + args.push_back(value1); + args.push_back(value2); + args.push_back(value3); + format(result, fmt, args); +} + + +void format(std::string& result, const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4) +{ + std::vector args; + args.push_back(value1); + args.push_back(value2); + args.push_back(value3); + args.push_back(value4); + format(result, fmt, args); +} + + +void format(std::string& result, const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5) +{ + std::vector args; + args.push_back(value1); + args.push_back(value2); + args.push_back(value3); + args.push_back(value4); + args.push_back(value5); + format(result, fmt, args); +} + + +void format(std::string& result, const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6) +{ + std::vector args; + args.push_back(value1); + args.push_back(value2); + args.push_back(value3); + args.push_back(value4); + args.push_back(value5); + args.push_back(value6); + format(result, fmt, args); +} + + +void format(std::string& result, const std::string& fmt, const std::vector& values) +{ + std::string::const_iterator itFmt = fmt.begin(); + std::string::const_iterator endFmt = fmt.end(); + std::vector::const_iterator itVal = values.begin(); + std::vector::const_iterator endVal = values.end(); + while (itFmt != endFmt) + { + switch (*itFmt) + { + case '%': + ++itFmt; + if (itFmt != endFmt && itVal != endVal) + formatOne(result, itFmt, endFmt, itVal); + else + result += *itFmt; + break; + default: + result += *itFmt; + ++itFmt; + } + } +} + + +} // namespace Poco diff --git a/Foundation/src/Formatter.cpp b/Foundation/src/Formatter.cpp index ca81dfd6b..0cad7b5f6 100644 --- a/Foundation/src/Formatter.cpp +++ b/Foundation/src/Formatter.cpp @@ -1,7 +1,7 @@ // // Formatter.cpp // -// $Id: //poco/1.1.0/Foundation/src/Formatter.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Formatter.cpp#1 $ // // Library: Foundation // Package: Logging @@ -34,11 +34,11 @@ // -#include "Foundation/Formatter.h" -#include "Foundation/Exception.h" +#include "Poco/Formatter.h" +#include "Poco/Exception.h" -Foundation_BEGIN +namespace Poco { Formatter::Formatter() @@ -63,4 +63,4 @@ std::string Formatter::getProperty(const std::string& name) const } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/FormattingChannel.cpp b/Foundation/src/FormattingChannel.cpp index 8fa213ba0..6510fa7ae 100644 --- a/Foundation/src/FormattingChannel.cpp +++ b/Foundation/src/FormattingChannel.cpp @@ -1,7 +1,7 @@ // // FormattingChannel.cpp // -// $Id: //poco/1.1.0/Foundation/src/FormattingChannel.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/FormattingChannel.cpp#1 $ // // Library: Foundation // Package: Logging @@ -34,13 +34,13 @@ // -#include "Foundation/FormattingChannel.h" -#include "Foundation/Formatter.h" -#include "Foundation/Message.h" -#include "Foundation/LoggingRegistry.h" +#include "Poco/FormattingChannel.h" +#include "Poco/Formatter.h" +#include "Poco/Message.h" +#include "Poco/LoggingRegistry.h" -Foundation_BEGIN +namespace Poco { FormattingChannel::FormattingChannel(): @@ -145,4 +145,4 @@ void FormattingChannel::close() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Glob.cpp b/Foundation/src/Glob.cpp index 57ddbdbf5..29b289a6e 100644 --- a/Foundation/src/Glob.cpp +++ b/Foundation/src/Glob.cpp @@ -1,7 +1,7 @@ // // Glob.cpp // -// $Id: //poco/1.1.0/Foundation/src/Glob.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Glob.cpp#1 $ // // Library: Foundation // Package: Filesystem @@ -34,14 +34,14 @@ // -#include "Foundation/Glob.h" -#include "Foundation/Path.h" -#include "Foundation/Exception.h" -#include "Foundation/DirectoryIterator.h" -#include "Foundation/File.h" +#include "Poco/Glob.h" +#include "Poco/Path.h" +#include "Poco/Exception.h" +#include "Poco/DirectoryIterator.h" +#include "Poco/File.h" -Foundation_BEGIN +namespace Poco { Glob::Glob(const std::string& pattern, int options): @@ -239,4 +239,4 @@ void Glob::collect(const Path& pathPattern, const Path& base, const Path& curren } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/HashStatistic.cpp b/Foundation/src/HashStatistic.cpp new file mode 100644 index 000000000..fc1e400c3 --- /dev/null +++ b/Foundation/src/HashStatistic.cpp @@ -0,0 +1,86 @@ +// +// HashStatistic.cpp +// +// $Id: //poco/1.2/Foundation/src/HashStatistic.cpp#1 $ +// +// Library: Foundation +// Package: Core +// Module: HashStatistic +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#include "Poco/HashStatistic.h" +#include + +namespace Poco { + + +HashStatistic::HashStatistic( + UInt32 tableSize, + UInt32 numEntries, + UInt32 numZeroEntries, + UInt32 maxEntry, + std::vector details): + _sizeOfTable(tableSize), + _numberOfEntries(numEntries), + _numZeroEntries(numZeroEntries), + _maxEntriesPerHash(maxEntry), + _detailedEntriesPerHash(details) +{ +} + + +HashStatistic::~HashStatistic() +{ +} + + +std::string HashStatistic::toString() const +{ + std::ostringstream str; + str << "HashTable of size " << _sizeOfTable << " containing " << _numberOfEntries << " entries:\n"; + str << " NumberOfZeroEntries: " << _numZeroEntries << "\n"; + str << " MaxEntry: " << _maxEntriesPerHash << "\n"; + str << " AvgEntry: " << avgEntriesPerHash() << ", excl Zero slots: " << avgEntriesPerHashExclZeroEntries() << "\n"; + str << " DetailedStatistics: \n"; + for (int i = 0; i < _detailedEntriesPerHash.size(); ++i) + { + // 10 entries per line + if (i % 10 == 0) + { + str << "\n " << i << ":"; + } + str << " " << _detailedEntriesPerHash[i]; + } + str << "\n"; + str.flush(); + return str.str(); +} + + +} // namespace Poco diff --git a/Foundation/src/HexBinaryDecoder.cpp b/Foundation/src/HexBinaryDecoder.cpp index d645ec32c..7b78b1e71 100644 --- a/Foundation/src/HexBinaryDecoder.cpp +++ b/Foundation/src/HexBinaryDecoder.cpp @@ -1,7 +1,7 @@ // // HexBinaryDecoder.cpp // -// $Id: //poco/1.1.0/Foundation/src/HexBinaryDecoder.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/HexBinaryDecoder.cpp#1 $ // // Library: Foundation // Package: Streams @@ -34,11 +34,11 @@ // -#include "Foundation/HexBinaryDecoder.h" -#include "Foundation/Exception.h" +#include "Poco/HexBinaryDecoder.h" +#include "Poco/Exception.h" -Foundation_BEGIN +namespace Poco { HexBinaryDecoderBuf::HexBinaryDecoderBuf(std::istream& istr): _istr(istr) @@ -112,4 +112,4 @@ HexBinaryDecoder::~HexBinaryDecoder() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/HexBinaryEncoder.cpp b/Foundation/src/HexBinaryEncoder.cpp index c08c4af01..143d949ea 100644 --- a/Foundation/src/HexBinaryEncoder.cpp +++ b/Foundation/src/HexBinaryEncoder.cpp @@ -1,7 +1,7 @@ // // HexBinaryEncoder.cpp // -// $Id: //poco/1.1.0/Foundation/src/HexBinaryEncoder.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/HexBinaryEncoder.cpp#1 $ // // Library: Foundation // Package: Streams @@ -34,10 +34,10 @@ // -#include "Foundation/HexBinaryEncoder.h" +#include "Poco/HexBinaryEncoder.h" -Foundation_BEGIN +namespace Poco { HexBinaryEncoderBuf::HexBinaryEncoderBuf(std::ostream& ostr): @@ -137,4 +137,4 @@ HexBinaryEncoder::~HexBinaryEncoder() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/InflatingStream.cpp b/Foundation/src/InflatingStream.cpp index ad60307ad..46d806bee 100644 --- a/Foundation/src/InflatingStream.cpp +++ b/Foundation/src/InflatingStream.cpp @@ -1,7 +1,7 @@ // // InflatingStream.cpp // -// $Id: //poco/1.1.0/Foundation/src/InflatingStream.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/InflatingStream.cpp#1 $ // // Library: Foundation // Package: Streams @@ -34,11 +34,11 @@ // -#include "Foundation/InflatingStream.h" -#include "Foundation/Exception.h" +#include "Poco/InflatingStream.h" +#include "Poco/Exception.h" -Foundation_BEGIN +namespace Poco { InflatingStreamBuf::InflatingStreamBuf(std::istream& istr, StreamType type): @@ -114,7 +114,7 @@ int InflatingStreamBuf::readFromDevice(char* buffer, std::streamsize length) { if (_eof || !_pIstr) return 0; - if (!_zstr.next_in) + if (_zstr.avail_in == 0) { int n = 0; if (_pIstr->good()) @@ -125,14 +125,9 @@ int InflatingStreamBuf::readFromDevice(char* buffer, std::streamsize length) if (n == 0) return 0; _zstr.next_in = (unsigned char*) _buffer; _zstr.avail_in = n; - _zstr.next_out = (unsigned char*) buffer; - _zstr.avail_out = length; - } - else if (_zstr.avail_out == 0) - { - _zstr.next_out = (unsigned char*) buffer; - _zstr.avail_out = length; } + _zstr.next_out = (unsigned char*) buffer; + _zstr.avail_out = length; for (;;) { int rc = inflate(&_zstr, Z_NO_FLUSH); @@ -255,4 +250,4 @@ InflatingInputStream::~InflatingInputStream() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Latin1Encoding.cpp b/Foundation/src/Latin1Encoding.cpp index cdd25fe6a..ffd685bfd 100644 --- a/Foundation/src/Latin1Encoding.cpp +++ b/Foundation/src/Latin1Encoding.cpp @@ -1,7 +1,7 @@ // // Latin1Encoding.cpp // -// $Id: //poco/1.1.0/Foundation/src/Latin1Encoding.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Latin1Encoding.cpp#1 $ // // Library: Foundation // Package: Text @@ -34,10 +34,10 @@ // -#include "Foundation/Latin1Encoding.h" +#include "Poco/Latin1Encoding.h" -Foundation_BEGIN +namespace Poco { const TextEncoding::CharacterMap Latin1Encoding::_charMap = @@ -94,4 +94,4 @@ int Latin1Encoding::convert(int ch, unsigned char* bytes, int length) const } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Latin9Encoding.cpp b/Foundation/src/Latin9Encoding.cpp index df5e31d21..cd22aa9b6 100644 --- a/Foundation/src/Latin9Encoding.cpp +++ b/Foundation/src/Latin9Encoding.cpp @@ -1,7 +1,7 @@ // // Latin9Encoding.cpp // -// $Id: //poco/1.1.0/Foundation/src/Latin9Encoding.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Latin9Encoding.cpp#1 $ // // Library: Foundation // Package: Text @@ -34,10 +34,10 @@ // -#include "Foundation/Latin9Encoding.h" +#include "Poco/Latin9Encoding.h" -Foundation_BEGIN +namespace Poco { const TextEncoding::CharacterMap Latin9Encoding::_charMap = @@ -105,4 +105,4 @@ int Latin9Encoding::convert(int ch, unsigned char* bytes, int length) const } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/LineEndingConverter.cpp b/Foundation/src/LineEndingConverter.cpp index f5210aecf..1247668af 100644 --- a/Foundation/src/LineEndingConverter.cpp +++ b/Foundation/src/LineEndingConverter.cpp @@ -1,7 +1,7 @@ // // LineEndingConverter.cpp // -// $Id: //poco/1.1.0/Foundation/src/LineEndingConverter.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/LineEndingConverter.cpp#1 $ // // Library: Foundation // Package: Streams @@ -34,10 +34,10 @@ // -#include "Foundation/LineEndingConverter.h" +#include "Poco/LineEndingConverter.h" -Foundation_BEGIN +namespace Poco { #if defined(_WIN32) @@ -201,4 +201,4 @@ OutputLineEndingConverter::~OutputLineEndingConverter() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/LocalDateTime.cpp b/Foundation/src/LocalDateTime.cpp index d16259e9b..435b4a469 100644 --- a/Foundation/src/LocalDateTime.cpp +++ b/Foundation/src/LocalDateTime.cpp @@ -1,7 +1,7 @@ // // LocalDateTime.cpp // -// $Id: //poco/1.1.0/Foundation/src/LocalDateTime.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/LocalDateTime.cpp#1 $ // // Library: Foundation // Package: DateTime @@ -34,13 +34,13 @@ // -#include "Foundation/LocalDateTime.h" -#include "Foundation/Timezone.h" -#include "Foundation/Timespan.h" +#include "Poco/LocalDateTime.h" +#include "Poco/Timezone.h" +#include "Poco/Timespan.h" #include -Foundation_BEGIN +namespace Poco { LocalDateTime::LocalDateTime(): @@ -184,8 +184,6 @@ DateTime LocalDateTime::utc() const bool LocalDateTime::operator == (const LocalDateTime& dateTime) const { - Timestamp::UtcTimeVal t1 = utcTime(); - Timestamp::UtcTimeVal t2 = dateTime.utcTime(); return utcTime() == dateTime.utcTime(); } @@ -252,4 +250,4 @@ LocalDateTime& LocalDateTime::operator -= (const Timespan& span) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/LogFile.cpp b/Foundation/src/LogFile.cpp index 50449045e..909b8cb08 100644 --- a/Foundation/src/LogFile.cpp +++ b/Foundation/src/LogFile.cpp @@ -1,7 +1,7 @@ // // LogFile.cpp // -// $Id: //poco/1.1.0/Foundation/src/LogFile.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/LogFile.cpp#1 $ // // Library: Foundation // Package: Logging @@ -34,10 +34,12 @@ // -#include "Foundation/LogFile.h" +#include "Poco/LogFile.h" -#if defined(POCO_OS_FAMILY_WINDOWS) +#if defined(POCO_OS_FAMILY_WINDOWS) && defined(POCO_WIN32_UTF8) +#include "LogFile_WIN32U.cpp" +#elif defined(POCO_OS_FAMILY_WINDOWS) #include "LogFile_WIN32.cpp" #elif defined(POCO_OS_FAMILY_VMS) #include "LogFile_VMS.cpp" @@ -46,7 +48,7 @@ #endif -Foundation_BEGIN +namespace Poco { LogFile::LogFile(const std::string& path): LogFileImpl(path) @@ -59,4 +61,4 @@ LogFile::~LogFile() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/LogFile_STD.cpp b/Foundation/src/LogFile_STD.cpp index 3271a46ab..d1242d0e6 100644 --- a/Foundation/src/LogFile_STD.cpp +++ b/Foundation/src/LogFile_STD.cpp @@ -1,7 +1,7 @@ // // LogFile_STD.cpp // -// $Id: //poco/1.1.0/Foundation/src/LogFile_STD.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/LogFile_STD.cpp#1 $ // // Library: Foundation // Package: Logging @@ -34,17 +34,17 @@ // -#include "Foundation/LogFile_STD.h" -#include "Foundation/File.h" -#include "Foundation/Exception.h" +#include "Poco/LogFile_STD.h" +#include "Poco/File.h" +#include "Poco/Exception.h" -Foundation_BEGIN +namespace Poco { LogFileImpl::LogFileImpl(const std::string& path): _path(path) { - _str.open(path.c_str(), std::ios::ate); + _str.open(path.c_str(), std::ios::app | std::ios::ate); if (!_str.good()) throw OpenFileException(path); if (sizeImpl() == 0) _creationDate = File(path).getLastModified(); @@ -83,4 +83,4 @@ const std::string& LogFileImpl::pathImpl() const } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/LogFile_VMS.cpp b/Foundation/src/LogFile_VMS.cpp index 37d013772..1d9ebd38b 100644 --- a/Foundation/src/LogFile_VMS.cpp +++ b/Foundation/src/LogFile_VMS.cpp @@ -1,7 +1,7 @@ // // LogFile_VMS.cpp // -// $Id: //poco/1.1.0/Foundation/src/LogFile_VMS.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/LogFile_VMS.cpp#1 $ // // Library: Foundation // Package: Logging @@ -34,12 +34,12 @@ // -#include "Foundation/LogFile_VMS.h" -#include "Foundation/File.h" -#include "Foundation/Exception.h" +#include "Poco/LogFile_VMS.h" +#include "Poco/File.h" +#include "Poco/Exception.h" -Foundation_BEGIN +namespace Poco { LogFileImpl::LogFileImpl(const std::string& path): _path(path) @@ -88,4 +88,4 @@ const std::string& LogFileImpl::pathImpl() const } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/LogFile_WIN32.cpp b/Foundation/src/LogFile_WIN32.cpp index b9248eca4..53552a7f0 100644 --- a/Foundation/src/LogFile_WIN32.cpp +++ b/Foundation/src/LogFile_WIN32.cpp @@ -1,7 +1,7 @@ // // LogFile_WIN32.cpp // -// $Id: //poco/1.1.0/Foundation/src/LogFile_WIN32.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/LogFile_WIN32.cpp#1 $ // // Library: Foundation // Package: Logging @@ -34,12 +34,12 @@ // -#include "Foundation/LogFile_WIN32.h" -#include "Foundation/File.h" -#include "Foundation/Exception.h" +#include "Poco/LogFile_WIN32.h" +#include "Poco/File.h" +#include "Poco/Exception.h" -Foundation_BEGIN +namespace Poco { LogFileImpl::LogFileImpl(const std::string& path): _path(path) @@ -106,4 +106,4 @@ const std::string& LogFileImpl::pathImpl() const } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/LogFile_WIN32U.cpp b/Foundation/src/LogFile_WIN32U.cpp new file mode 100644 index 000000000..921fdcad8 --- /dev/null +++ b/Foundation/src/LogFile_WIN32U.cpp @@ -0,0 +1,112 @@ +// +// LogFile_WIN32U.cpp +// +// $Id: //poco/1.2/Foundation/src/LogFile_WIN32U.cpp#1 $ +// +// Library: Foundation +// Package: Logging +// Module: LogFile +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#include "Poco/LogFile_WIN32U.h" +#include "Poco/File.h" +#include "Poco/Exception.h" +#include "Poco/UnicodeConverter.h" + + +namespace Poco { + + +LogFileImpl::LogFileImpl(const std::string& path): _path(path) +{ + std::wstring upath; + UnicodeConverter::toUTF16(path, upath); + _hFile = CreateFileW(upath.c_str(), GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + if (_hFile == INVALID_HANDLE_VALUE) throw OpenFileException(path); + SetFilePointer(_hFile, 0, 0, FILE_END); + // There seems to be a strange "optimization" in the Windows NTFS + // filesystem that causes it to reuse directory entries of deleted + // files. Example: + // 1. create a file named "test.dat" + // note the file's creation date + // 2. delete the file "test.dat" + // 3. wait a few seconds + // 4. create a file named "test.dat" + // the new file will have the same creation + // date as the old one. + // We work around this bug by taking the file's + // modification date as a reference when the + // file is empty. + if (sizeImpl() == 0) + _creationDate = File(path).getLastModified(); + else + _creationDate = File(path).created(); +} + + +LogFileImpl::~LogFileImpl() +{ + CloseHandle(_hFile); +} + + +void LogFileImpl::writeImpl(const std::string& text) +{ + DWORD bytesWritten; + BOOL res = WriteFile(_hFile, text.data(), (DWORD) text.size(), &bytesWritten, NULL); + if (!res) throw WriteFileException(_path); + res = WriteFile(_hFile, "\r\n", 2, &bytesWritten, NULL); + if (!res) throw WriteFileException(_path); + res = FlushFileBuffers(_hFile); + if (!res) throw WriteFileException(_path); +} + + +UInt64 LogFileImpl::sizeImpl() const +{ + LARGE_INTEGER li; + li.HighPart = 0; + li.LowPart = SetFilePointer(_hFile, 0, &li.HighPart, FILE_CURRENT); + return li.QuadPart; +} + + +Timestamp LogFileImpl::creationDateImpl() const +{ + return _creationDate; +} + + +const std::string& LogFileImpl::pathImpl() const +{ + return _path; +} + + +} // namespace Poco diff --git a/Foundation/src/LogStream.cpp b/Foundation/src/LogStream.cpp new file mode 100644 index 000000000..1594c062f --- /dev/null +++ b/Foundation/src/LogStream.cpp @@ -0,0 +1,181 @@ +// +// LogStream.cpp +// +// $Id: //poco/1.2/Foundation/src/LogStream.cpp#1 $ +// +// Library: Foundation +// Package: Logging +// Module: LogStream +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#include "Poco/LogStream.h" + + +namespace Poco { + + +// +// LogStreamBuf +// + + +LogStreamBuf::LogStreamBuf(Logger& logger, Message::Priority priority): + _logger(logger), + _priority(priority) +{ +} + + +LogStreamBuf::~LogStreamBuf() +{ +} + + +void LogStreamBuf::setPriority(Message::Priority priority) +{ + _priority = priority; +} + + +int LogStreamBuf::writeToDevice(char c) +{ + if (c == '\n' || c == '\r') + { + Message msg(_logger.name(), _message, _priority); + _message.clear(); + _logger.log(msg); + } + else _message += c; + return c; +} + + +// +// LogIOS +// + + +LogIOS::LogIOS(Logger& logger, Message::Priority priority): + _buf(logger, priority) +{ + poco_ios_init(&_buf); +} + + +LogIOS::~LogIOS() +{ +} + + +LogStreamBuf* LogIOS::rdbuf() +{ + return &_buf; +} + + +// +// LogStream +// + + +LogStream::LogStream(Logger& logger, Message::Priority priority): + LogIOS(logger, priority), + std::ostream(&_buf) +{ +} + + +LogStream::LogStream(const std::string& loggerName, Message::Priority priority): + LogIOS(Logger::get(loggerName), priority), + std::ostream(&_buf) +{ +} + + +LogStream::~LogStream() +{ +} + + +LogStream& LogStream::fatal() +{ + return priority(Message::PRIO_FATAL); +} + + +LogStream& LogStream::critical() +{ + return priority(Message::PRIO_CRITICAL); +} + + +LogStream& LogStream::error() +{ + return priority(Message::PRIO_ERROR); +} + + +LogStream& LogStream::warning() +{ + return priority(Message::PRIO_WARNING); +} + + +LogStream& LogStream::notice() +{ + return priority(Message::PRIO_NOTICE); +} + + +LogStream& LogStream::information() +{ + return priority(Message::PRIO_INFORMATION); +} + + +LogStream& LogStream::debug() +{ + return priority(Message::PRIO_DEBUG); +} + + +LogStream& LogStream::trace() +{ + return priority(Message::PRIO_TRACE); +} + + +LogStream& LogStream::priority(Message::Priority priority) +{ + _buf.setPriority(priority); + return *this; +} + + +} // namespace Poco diff --git a/Foundation/src/Logger.cpp b/Foundation/src/Logger.cpp index aff5f7287..00c3a4605 100644 --- a/Foundation/src/Logger.cpp +++ b/Foundation/src/Logger.cpp @@ -1,7 +1,7 @@ // // Logger.cpp // -// $Id: //poco/1.1.0/Foundation/src/Logger.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Logger.cpp#1 $ // // Library: Foundation // Package: Logging @@ -34,14 +34,14 @@ // -#include "Foundation/Logger.h" -#include "Foundation/Formatter.h" -#include "Foundation/LoggingRegistry.h" -#include "Foundation/Exception.h" -#include "Foundation/NumberFormatter.h" +#include "Poco/Logger.h" +#include "Poco/Formatter.h" +#include "Poco/LoggingRegistry.h" +#include "Poco/Exception.h" +#include "Poco/NumberFormatter.h" -Foundation_BEGIN +namespace Poco { Logger::LoggerMap* Logger::_pLoggerMap = 0; @@ -371,6 +371,21 @@ void Logger::destroy(const std::string& name) } +void Logger::names(std::vector& names) +{ + Mutex::ScopedLock lock(_mapMtx); + + names.clear(); + if (_pLoggerMap) + { + for (LoggerMap::const_iterator it = _pLoggerMap->begin(); it != _pLoggerMap->end(); ++it) + { + names.push_back(it->first); + } + } +} + + Logger& Logger::parent(const std::string& name) { std::string::size_type pos = name.rfind('.'); @@ -413,4 +428,4 @@ void Logger::add(Logger* pLogger) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/LoggingFactory.cpp b/Foundation/src/LoggingFactory.cpp index b36dbaf62..d596a8c78 100644 --- a/Foundation/src/LoggingFactory.cpp +++ b/Foundation/src/LoggingFactory.cpp @@ -1,7 +1,7 @@ // // LoggingFactory.cpp // -// $Id: //poco/1.1.0/Foundation/src/LoggingFactory.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/LoggingFactory.cpp#1 $ // // Library: Foundation // Package: Logging @@ -34,27 +34,27 @@ // -#include "Foundation/LoggingFactory.h" -#include "Foundation/SingletonHolder.h" -#include "Foundation/AsyncChannel.h" -#include "Foundation/ConsoleChannel.h" -#include "Foundation/FileChannel.h" -#include "Foundation/FormattingChannel.h" -#include "Foundation/SplitterChannel.h" -#include "Foundation/NullChannel.h" +#include "Poco/LoggingFactory.h" +#include "Poco/SingletonHolder.h" +#include "Poco/AsyncChannel.h" +#include "Poco/ConsoleChannel.h" +#include "Poco/FileChannel.h" +#include "Poco/FormattingChannel.h" +#include "Poco/SplitterChannel.h" +#include "Poco/NullChannel.h" #if defined(POCO_OS_FAMILY_UNIX) -#include "Foundation/SyslogChannel.h" +#include "Poco/SyslogChannel.h" #endif #if defined(POCO_OS_FAMILY_VMS) -#include "Foundation/OpcomChannel.h" +#include "Poco/OpcomChannel.h" #endif #if defined(POCO_OS_FAMILY_WINDOWS) -#include "Foundation/EventLogChannel.h" +#include "Poco/EventLogChannel.h" #endif -#include "Foundation/PatternFormatter.h" +#include "Poco/PatternFormatter.h" -Foundation_BEGIN +namespace Poco { LoggingFactory::LoggingFactory() @@ -122,4 +122,4 @@ void LoggingFactory::registerBuiltins() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/LoggingRegistry.cpp b/Foundation/src/LoggingRegistry.cpp index 0d946a456..36443fc3f 100644 --- a/Foundation/src/LoggingRegistry.cpp +++ b/Foundation/src/LoggingRegistry.cpp @@ -1,7 +1,7 @@ // // LoggingRegistry.cpp // -// $Id: //poco/1.1.0/Foundation/src/LoggingRegistry.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/LoggingRegistry.cpp#1 $ // // Library: Foundation // Package: Logging @@ -34,11 +34,11 @@ // -#include "Foundation/LoggingRegistry.h" -#include "Foundation/SingletonHolder.h" +#include "Poco/LoggingRegistry.h" +#include "Poco/SingletonHolder.h" -Foundation_BEGIN +namespace Poco { LoggingRegistry::LoggingRegistry() @@ -131,4 +131,4 @@ LoggingRegistry& LoggingRegistry::defaultRegistry() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/MD2Engine.cpp b/Foundation/src/MD2Engine.cpp index 6b9de2356..47e9364de 100644 --- a/Foundation/src/MD2Engine.cpp +++ b/Foundation/src/MD2Engine.cpp @@ -1,7 +1,7 @@ // // MD2Engine.cpp // -// $Id: //poco/1.1.0/Foundation/src/MD2Engine.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/MD2Engine.cpp#1 $ // // Library: Foundation // Package: Crypt @@ -53,11 +53,11 @@ // -#include "Foundation/MD2Engine.h" +#include "Poco/MD2Engine.h" #include -Foundation_BEGIN +namespace Poco { MD2Engine::MD2Engine() @@ -213,4 +213,4 @@ void MD2Engine::transform(unsigned char state[16], unsigned char checksum[16], c } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/MD4Engine.cpp b/Foundation/src/MD4Engine.cpp index 3ab7e8425..40e765f29 100644 --- a/Foundation/src/MD4Engine.cpp +++ b/Foundation/src/MD4Engine.cpp @@ -1,7 +1,7 @@ // // MD4Engine.cpp // -// $Id: //poco/1.1.0/Foundation/src/MD4Engine.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/MD4Engine.cpp#1 $ // // Library: Foundation // Package: Crypt @@ -57,11 +57,11 @@ // -#include "Foundation/MD4Engine.h" +#include "Poco/MD4Engine.h" #include -Foundation_BEGIN +namespace Poco { MD4Engine::MD4Engine() @@ -297,4 +297,4 @@ void MD4Engine::decode(UInt32* output, const unsigned char* input, unsigned int } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/MD5Engine.cpp b/Foundation/src/MD5Engine.cpp index 4ec7646e0..db5d552b3 100644 --- a/Foundation/src/MD5Engine.cpp +++ b/Foundation/src/MD5Engine.cpp @@ -1,7 +1,7 @@ // // MD5Engine.cpp // -// $Id: //poco/1.1.0/Foundation/src/MD5Engine.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/MD5Engine.cpp#1 $ // // Library: Foundation // Package: Crypt @@ -57,11 +57,11 @@ // -#include "Foundation/MD5Engine.h" +#include "Poco/MD5Engine.h" #include -Foundation_BEGIN +namespace Poco { MD5Engine::MD5Engine() @@ -328,4 +328,4 @@ void MD5Engine::decode(UInt32* output, const unsigned char* input, unsigned int } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/MSG00001.bin b/Foundation/src/MSG00001.bin index 45ecf37e0e191493b11a2f0fb3028bfbaf9b3945..543d281d35b4ff80181aa41e74638cd0b42a14d4 100644 GIT binary patch delta 116 zcmaFC_>pmf4kPbG9VrQ3E(Q<~VPIr%Wher|d?4m!;GGyF0g;mc%J>0AOBga4k{MFL ka$QPdV0|E6EQSGMwP)3BnGhn03ApVO8@`> delta 122 zcmey!_=0hQ&O}`)F)juW5Mf|saAhb0!h9g+WtbQ*0hW;fiu(b@N*FR3k{MD#GW|+6 mAUz-*ESU #include #if defined(sun) || defined(__APPLE__) || defined(__osf__) || defined(__QNX__) @@ -49,7 +49,7 @@ #endif -Foundation_BEGIN +namespace Poco { #if defined(linux) || defined(__CYGWIN__) @@ -156,4 +156,4 @@ std::string NamedEventImpl::getFileName() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/NamedEvent_VMS.cpp b/Foundation/src/NamedEvent_VMS.cpp index 32cf533a4..fddd2ece0 100644 --- a/Foundation/src/NamedEvent_VMS.cpp +++ b/Foundation/src/NamedEvent_VMS.cpp @@ -1,7 +1,7 @@ // // NamedEvent_VMS.cpp // -// $Id: //poco/1.1.0/Foundation/src/NamedEvent_VMS.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/NamedEvent_VMS.cpp#1 $ // // Library: Foundation // Package: Processes @@ -34,14 +34,14 @@ // -#include "Foundation/NamedEvent_VMS.h" +#include "Poco/NamedEvent_VMS.h" #include #include #include #include -Foundation_BEGIN +namespace Poco { NamedEventImpl::NamedEventImpl(const std::string& name): @@ -82,4 +82,4 @@ void NamedEventImpl::waitImpl() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/NamedEvent_WIN32.cpp b/Foundation/src/NamedEvent_WIN32.cpp index dcbbafff4..c252d6ae6 100644 --- a/Foundation/src/NamedEvent_WIN32.cpp +++ b/Foundation/src/NamedEvent_WIN32.cpp @@ -1,7 +1,7 @@ // // NamedEvent_WIN32.cpp // -// $Id: //poco/1.1.0/Foundation/src/NamedEvent_WIN32.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/NamedEvent_WIN32.cpp#1 $ // // Library: Foundation // Package: Processes @@ -34,11 +34,11 @@ // -#include "Foundation/NamedEvent_WIN32.h" -#include "Foundation/Exception.h" +#include "Poco/NamedEvent_WIN32.h" +#include "Poco/Exception.h" -Foundation_BEGIN +namespace Poco { NamedEventImpl::NamedEventImpl(const std::string& name): @@ -75,4 +75,4 @@ void NamedEventImpl::waitImpl() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/NamedEvent_WIN32U.cpp b/Foundation/src/NamedEvent_WIN32U.cpp index 5001b3533..875a1343c 100644 --- a/Foundation/src/NamedEvent_WIN32U.cpp +++ b/Foundation/src/NamedEvent_WIN32U.cpp @@ -1,7 +1,7 @@ // // NamedEvent_WIN32.cpp // -// $Id: //poco/1.1.0/Foundation/src/NamedEvent_WIN32U.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/NamedEvent_WIN32U.cpp#1 $ // // Library: Foundation // Package: Processes @@ -34,12 +34,12 @@ // -#include "Foundation/NamedEvent_WIN32U.h" -#include "Foundation/Exception.h" -#include "Foundation/UnicodeConverter.h" +#include "Poco/NamedEvent_WIN32U.h" +#include "Poco/Exception.h" +#include "Poco/UnicodeConverter.h" -Foundation_BEGIN +namespace Poco { NamedEventImpl::NamedEventImpl(const std::string& name): @@ -77,4 +77,4 @@ void NamedEventImpl::waitImpl() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/NamedMutex.cpp b/Foundation/src/NamedMutex.cpp index 94cf78467..961439493 100644 --- a/Foundation/src/NamedMutex.cpp +++ b/Foundation/src/NamedMutex.cpp @@ -1,7 +1,7 @@ // // NamedMutex.cpp // -// $Id: //poco/1.1.0/Foundation/src/NamedMutex.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/NamedMutex.cpp#1 $ // // Library: Foundation // Package: Processes @@ -34,7 +34,7 @@ // -#include "Foundation/NamedMutex.h" +#include "Poco/NamedMutex.h" #if defined(POCO_OS_FAMILY_WINDOWS) && defined(POCO_WIN32_UTF8) @@ -48,7 +48,7 @@ #endif -Foundation_BEGIN +namespace Poco { NamedMutex::NamedMutex(const std::string& name): @@ -62,4 +62,4 @@ NamedMutex::~NamedMutex() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/NamedMutex_UNIX.cpp b/Foundation/src/NamedMutex_UNIX.cpp index 27ee55f5d..cbbee2b0b 100644 --- a/Foundation/src/NamedMutex_UNIX.cpp +++ b/Foundation/src/NamedMutex_UNIX.cpp @@ -1,7 +1,7 @@ // // NamedMutex_UNIX.cpp // -// $Id: //poco/1.1.0/Foundation/src/NamedMutex_UNIX.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/NamedMutex_UNIX.cpp#1 $ // // Library: Foundation // Package: Processes @@ -34,8 +34,8 @@ // -#include "Foundation/NamedMutex_UNIX.h" -#include "Foundation/Exception.h" +#include "Poco/NamedMutex_UNIX.h" +#include "Poco/Exception.h" #include #include #if defined(sun) || defined(__APPLE__) || defined(__osf__) @@ -49,7 +49,7 @@ #endif -Foundation_BEGIN +namespace Poco { #if defined(linux) || defined(__CYGWIN__) @@ -170,4 +170,4 @@ std::string NamedMutexImpl::getFileName() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/NamedMutex_VMS.cpp b/Foundation/src/NamedMutex_VMS.cpp index f5a6941c4..ddad77b83 100644 --- a/Foundation/src/NamedMutex_VMS.cpp +++ b/Foundation/src/NamedMutex_VMS.cpp @@ -1,7 +1,7 @@ // // NamedMutex_VMS.cpp // -// $Id: //poco/1.1.0/Foundation/src/NamedMutex_VMS.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/NamedMutex_VMS.cpp#1 $ // // Library: Foundation // Package: Processes @@ -34,12 +34,12 @@ // -#include "Foundation/NamedMutex_VMS.h" +#include "Poco/NamedMutex_VMS.h" #include #include -Foundation_BEGIN +namespace Poco { NamedMutexImpl::NamedMutexImpl(const std::string& name): @@ -84,4 +84,4 @@ void NamedMutexImpl::unlockImpl() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/NamedMutex_WIN32.cpp b/Foundation/src/NamedMutex_WIN32.cpp index 727ff3dd4..be23e92e2 100644 --- a/Foundation/src/NamedMutex_WIN32.cpp +++ b/Foundation/src/NamedMutex_WIN32.cpp @@ -1,7 +1,7 @@ // // NamedMutex_WIN32.cpp // -// $Id: //poco/1.1.0/Foundation/src/NamedMutex_WIN32.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/NamedMutex_WIN32.cpp#1 $ // // Library: Foundation // Package: Processes @@ -34,11 +34,11 @@ // -#include "Foundation/NamedMutex_WIN32.h" -#include "Foundation/Exception.h" +#include "Poco/NamedMutex_WIN32.h" +#include "Poco/Exception.h" -Foundation_BEGIN +namespace Poco { NamedMutexImpl::NamedMutexImpl(const std::string& name): @@ -92,4 +92,4 @@ void NamedMutexImpl::unlockImpl() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/NamedMutex_WIN32U.cpp b/Foundation/src/NamedMutex_WIN32U.cpp index 4ba6f550c..7d1a9819b 100644 --- a/Foundation/src/NamedMutex_WIN32U.cpp +++ b/Foundation/src/NamedMutex_WIN32U.cpp @@ -1,7 +1,7 @@ // // NamedMutex_WIN32.cpp // -// $Id: //poco/1.1.0/Foundation/src/NamedMutex_WIN32U.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/NamedMutex_WIN32U.cpp#1 $ // // Library: Foundation // Package: Processes @@ -34,12 +34,12 @@ // -#include "Foundation/NamedMutex_WIN32U.h" -#include "Foundation/Exception.h" -#include "Foundation/UnicodeConverter.h" +#include "Poco/NamedMutex_WIN32U.h" +#include "Poco/Exception.h" +#include "Poco/UnicodeConverter.h" -Foundation_BEGIN +namespace Poco { NamedMutexImpl::NamedMutexImpl(const std::string& name): @@ -94,4 +94,4 @@ void NamedMutexImpl::unlockImpl() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/NestedDiagnosticContext.cpp b/Foundation/src/NestedDiagnosticContext.cpp index 98c3da173..cd202fba0 100644 --- a/Foundation/src/NestedDiagnosticContext.cpp +++ b/Foundation/src/NestedDiagnosticContext.cpp @@ -1,7 +1,7 @@ // // NestedDiagnosticContext.cpp // -// $Id: //poco/1.1.0/Foundation/src/NestedDiagnosticContext.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/NestedDiagnosticContext.cpp#1 $ // // Library: Foundation // Package: Core @@ -34,12 +34,12 @@ // -#include "Foundation/NestedDiagnosticContext.h" -#include "Foundation/SingletonHolder.h" -#include "Foundation/ThreadLocal.h" +#include "Poco/NestedDiagnosticContext.h" +#include "Poco/SingletonHolder.h" +#include "Poco/ThreadLocal.h" -Foundation_BEGIN +namespace Poco { NestedDiagnosticContext::NestedDiagnosticContext() @@ -143,4 +143,4 @@ NestedDiagnosticContext& NestedDiagnosticContext::current() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Notification.cpp b/Foundation/src/Notification.cpp index 4d85c564c..d36b8ae1f 100644 --- a/Foundation/src/Notification.cpp +++ b/Foundation/src/Notification.cpp @@ -1,7 +1,7 @@ // // Notification.cpp // -// $Id: //poco/1.1.0/Foundation/src/Notification.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Notification.cpp#1 $ // // Library: Foundation // Package: Notifications @@ -34,11 +34,11 @@ // -#include "Foundation/Notification.h" +#include "Poco/Notification.h" #include -Foundation_BEGIN +namespace Poco { Notification::Notification() @@ -57,4 +57,4 @@ std::string Notification::name() const } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/NotificationCenter.cpp b/Foundation/src/NotificationCenter.cpp index c6a6a1b58..89192f275 100644 --- a/Foundation/src/NotificationCenter.cpp +++ b/Foundation/src/NotificationCenter.cpp @@ -1,7 +1,7 @@ // // NotificationCenter.cpp // -// $Id: //poco/1.1.0/Foundation/src/NotificationCenter.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/NotificationCenter.cpp#1 $ // // Library: Foundation // Package: Notifications @@ -34,14 +34,14 @@ // -#include "Foundation/NotificationCenter.h" -#include "Foundation/Notification.h" -#include "Foundation/Observer.h" -#include "Foundation/AutoPtr.h" -#include "Foundation/SingletonHolder.h" +#include "Poco/NotificationCenter.h" +#include "Poco/Notification.h" +#include "Poco/Observer.h" +#include "Poco/AutoPtr.h" +#include "Poco/SingletonHolder.h" -Foundation_BEGIN +namespace Poco { NotificationCenter::NotificationCenter() @@ -116,4 +116,4 @@ NotificationCenter& NotificationCenter::defaultCenter() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/NotificationQueue.cpp b/Foundation/src/NotificationQueue.cpp index ff89a6f2b..e84a2cb22 100644 --- a/Foundation/src/NotificationQueue.cpp +++ b/Foundation/src/NotificationQueue.cpp @@ -1,7 +1,7 @@ // // NotificationQueue.cpp // -// $Id: //poco/1.1.0/Foundation/src/NotificationQueue.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/NotificationQueue.cpp#1 $ // // Library: Foundation // Package: Notifications @@ -34,13 +34,13 @@ // -#include "Foundation/NotificationQueue.h" -#include "Foundation/NotificationCenter.h" -#include "Foundation/Notification.h" -#include "Foundation/SingletonHolder.h" +#include "Poco/NotificationQueue.h" +#include "Poco/NotificationCenter.h" +#include "Poco/Notification.h" +#include "Poco/SingletonHolder.h" -Foundation_BEGIN +namespace Poco { NotificationQueue::NotificationQueue() @@ -224,4 +224,4 @@ NotificationQueue& NotificationQueue::defaultQueue() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/NullChannel.cpp b/Foundation/src/NullChannel.cpp index ab4e5e3ad..2dc2c9056 100644 --- a/Foundation/src/NullChannel.cpp +++ b/Foundation/src/NullChannel.cpp @@ -1,7 +1,7 @@ // // NullChannel.cpp // -// $Id: //poco/1.1.0/Foundation/src/NullChannel.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/NullChannel.cpp#1 $ // // Library: Foundation // Package: Logging @@ -34,10 +34,10 @@ // -#include "Foundation/NullChannel.h" +#include "Poco/NullChannel.h" -Foundation_BEGIN +namespace Poco { NullChannel::NullChannel() @@ -60,4 +60,4 @@ void NullChannel::setProperty(const std::string&, const std::string&) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/NullStream.cpp b/Foundation/src/NullStream.cpp index a7d8612a6..28bf3f81d 100644 --- a/Foundation/src/NullStream.cpp +++ b/Foundation/src/NullStream.cpp @@ -1,7 +1,7 @@ // // NullStream.cpp // -// $Id: //poco/1.1.0/Foundation/src/NullStream.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/NullStream.cpp#1 $ // // Library: Foundation // Package: Streams @@ -34,10 +34,10 @@ // -#include "Foundation/NullStream.h" +#include "Poco/NullStream.h" -Foundation_BEGIN +namespace Poco { NullStreamBuf::NullStreamBuf() @@ -93,4 +93,4 @@ NullOutputStream::~NullOutputStream() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/NumberFormatter.cpp b/Foundation/src/NumberFormatter.cpp index d95454463..a369f63c0 100644 --- a/Foundation/src/NumberFormatter.cpp +++ b/Foundation/src/NumberFormatter.cpp @@ -1,7 +1,7 @@ // // NumberFormatter.cpp // -// $Id: //poco/1.1.0/Foundation/src/NumberFormatter.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/NumberFormatter.cpp#1 $ // // Library: Foundation // Package: Core @@ -34,7 +34,7 @@ // -#include "Foundation/NumberFormatter.h" +#include "Poco/NumberFormatter.h" #include #include @@ -48,7 +48,7 @@ #endif -Foundation_BEGIN +namespace Poco { std::string NumberFormatter::format(int value) @@ -381,4 +381,4 @@ std::string NumberFormatter::format(const void* ptr) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/NumberParser.cpp b/Foundation/src/NumberParser.cpp index 0ed94e84d..b2b291098 100644 --- a/Foundation/src/NumberParser.cpp +++ b/Foundation/src/NumberParser.cpp @@ -1,7 +1,7 @@ // // NumberParser.cpp // -// $Id: //poco/1.1.0/Foundation/src/NumberParser.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/NumberParser.cpp#1 $ // // Library: Foundation // Package: Core @@ -34,8 +34,8 @@ // -#include "Foundation/NumberParser.h" -#include "Foundation/Exception.h" +#include "Poco/NumberParser.h" +#include "Poco/Exception.h" #include #include @@ -49,7 +49,7 @@ #endif -Foundation_BEGIN +namespace Poco { int NumberParser::parse(const std::string& s) @@ -170,4 +170,4 @@ bool NumberParser::tryParseFloat(const std::string& s, double& value) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Observer.cpp b/Foundation/src/Observer.cpp index d1871671d..1c59ecec3 100644 --- a/Foundation/src/Observer.cpp +++ b/Foundation/src/Observer.cpp @@ -1,7 +1,7 @@ // // Observer.cpp // -// $Id: //poco/1.1.0/Foundation/src/Observer.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Observer.cpp#1 $ // // Library: Foundation // Package: Notifications @@ -34,10 +34,10 @@ // -#include "Foundation/Observer.h" +#include "Poco/Observer.h" -Foundation_BEGIN +namespace Poco { AbstractObserver::AbstractObserver() @@ -61,4 +61,4 @@ AbstractObserver& AbstractObserver::operator = (const AbstractObserver& observer } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/OpcomChannel.cpp b/Foundation/src/OpcomChannel.cpp index d3df4702e..5bea21897 100644 --- a/Foundation/src/OpcomChannel.cpp +++ b/Foundation/src/OpcomChannel.cpp @@ -1,7 +1,7 @@ // // OpcomChannel.cpp // -// $Id: //poco/1.1.0/Foundation/src/OpcomChannel.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/OpcomChannel.cpp#1 $ // // Library: Foundation // Package: Logging @@ -34,14 +34,14 @@ // -#include "Foundation/OpcomChannel.h" -#include "Foundation/Message.h" +#include "Poco/OpcomChannel.h" +#include "Poco/Message.h" #include #include #include -Foundation_BEGIN +namespace Poco { const std::string OpcomChannel::PROP_TARGET = "target"; @@ -196,4 +196,4 @@ std::string OpcomChannel::getProperty(const std::string& name) const } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Path.cpp b/Foundation/src/Path.cpp index e6231166b..034baffa7 100644 --- a/Foundation/src/Path.cpp +++ b/Foundation/src/Path.cpp @@ -1,7 +1,7 @@ // // Path.cpp // -// $Id: //poco/1.1.0/Foundation/src/Path.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Path.cpp#1 $ // // Library: Foundation // Package: Filesystem @@ -34,10 +34,10 @@ // -#include "Foundation/Path.h" -#include "Foundation/File.h" -#include "Foundation/Exception.h" -#include "Foundation/StringTokenizer.h" +#include "Poco/Path.h" +#include "Poco/File.h" +#include "Poco/Exception.h" +#include "Poco/StringTokenizer.h" #include @@ -52,7 +52,7 @@ #endif -Foundation_BEGIN +namespace Poco { Path::Path(): _absolute(false) @@ -984,4 +984,4 @@ std::string Path::buildVMS() const } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Path_UNIX.cpp b/Foundation/src/Path_UNIX.cpp index 66b1605a1..6fe41e4cb 100644 --- a/Foundation/src/Path_UNIX.cpp +++ b/Foundation/src/Path_UNIX.cpp @@ -1,7 +1,7 @@ // // Path_UNIX.cpp // -// $Id: //poco/1.1.0/Foundation/src/Path_UNIX.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Path_UNIX.cpp#1 $ // // Library: Foundation // Package: Filesystem @@ -34,9 +34,9 @@ // -#include "Foundation/Path_UNIX.h" -#include "Foundation/Exception.h" -#include "Foundation/Environment_UNIX.h" +#include "Poco/Path_UNIX.h" +#include "Poco/Exception.h" +#include "Poco/Environment_UNIX.h" #include #include #include @@ -51,7 +51,7 @@ #endif -Foundation_BEGIN +namespace Poco { std::string PathImpl::currentImpl() @@ -159,4 +159,4 @@ void PathImpl::listRootsImpl(std::vector& roots) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Path_VMS.cpp b/Foundation/src/Path_VMS.cpp index 83e04ee2c..7135f820a 100644 --- a/Foundation/src/Path_VMS.cpp +++ b/Foundation/src/Path_VMS.cpp @@ -1,7 +1,7 @@ // // Path_VMS.cpp // -// $Id: //poco/1.1.0/Foundation/src/Path_VMS.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Path_VMS.cpp#1 $ // // Library: Foundation // Package: Filesystem @@ -34,8 +34,8 @@ // -#include "Foundation/Path_VMS.h" -#include "Foundation/Environment_VMS.h" +#include "Poco/Path_VMS.h" +#include "Poco/Environment_VMS.h" #include #include #include @@ -45,7 +45,7 @@ #include -Foundation_BEGIN +namespace Poco { std::string PathImpl::currentImpl() @@ -136,4 +136,4 @@ void PathImpl::listRootsImpl(std::vector& roots) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Path_WIN32.cpp b/Foundation/src/Path_WIN32.cpp index 1bca19d0e..97557e36b 100644 --- a/Foundation/src/Path_WIN32.cpp +++ b/Foundation/src/Path_WIN32.cpp @@ -1,7 +1,7 @@ // // Path_WIN32.cpp // -// $Id: //poco/1.1.0/Foundation/src/Path_WIN32.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Path_WIN32.cpp#1 $ // // Library: Foundation // Package: Filesystem @@ -34,12 +34,12 @@ // -#include "Foundation/Path_WIN32.h" -#include "Foundation/Environment_WIN32.h" +#include "Poco/Path_WIN32.h" +#include "Poco/Environment_WIN32.h" #include -Foundation_BEGIN +namespace Poco { std::string PathImpl::currentImpl() @@ -117,4 +117,4 @@ void PathImpl::listRootsImpl(std::vector& roots) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Path_WIN32U.cpp b/Foundation/src/Path_WIN32U.cpp index cece6c07a..df9bbf305 100644 --- a/Foundation/src/Path_WIN32U.cpp +++ b/Foundation/src/Path_WIN32U.cpp @@ -1,7 +1,7 @@ // // Path_WIN32U.cpp // -// $Id: //poco/1.1.0/Foundation/src/Path_WIN32U.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Path_WIN32U.cpp#1 $ // // Library: Foundation // Package: Filesystem @@ -34,15 +34,15 @@ // -#include "Foundation/Path_WIN32U.h" -#include "Foundation/Environment_WIN32.h" -#include "Foundation/UnicodeConverter.h" -#include "Foundation/Buffer.h" -#include "Foundation/Exception.h" +#include "Poco/Path_WIN32U.h" +#include "Poco/Environment_WIN32.h" +#include "Poco/UnicodeConverter.h" +#include "Poco/Buffer.h" +#include "Poco/Exception.h" #include -Foundation_BEGIN +namespace Poco { std::string PathImpl::currentImpl() @@ -118,18 +118,20 @@ std::string PathImpl::expandImpl(const std::string& path) void PathImpl::listRootsImpl(std::vector& roots) { roots.clear(); - char buffer[128]; - DWORD n = GetLogicalDriveStrings(sizeof(buffer) - 1, buffer); - char* it = buffer; - char* end = buffer + (n > sizeof(buffer) ? sizeof(buffer) : n); + wchar_t buffer[128]; + DWORD n = GetLogicalDriveStringsW(sizeof(buffer)/sizeof(wchar_t) - 1, buffer); + wchar_t* it = buffer; + wchar_t* end = buffer + (n > sizeof(buffer) ? sizeof(buffer) : n); while (it < end) { + std::wstring udev; + while (it < end && *it) udev += *it++; std::string dev; - while (it < end && *it) dev += *it++; + UnicodeConverter::toUTF8(udev, dev); roots.push_back(dev); ++it; } } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/PatternFormatter.cpp b/Foundation/src/PatternFormatter.cpp index 5caf7a204..1c7416423 100644 --- a/Foundation/src/PatternFormatter.cpp +++ b/Foundation/src/PatternFormatter.cpp @@ -1,7 +1,7 @@ // // PatternFormatter.cpp // -// $Id: //poco/1.1.0/Foundation/src/PatternFormatter.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/PatternFormatter.cpp#1 $ // // Library: Foundation // Package: Logging @@ -34,18 +34,18 @@ // -#include "Foundation/PatternFormatter.h" -#include "Foundation/Message.h" -#include "Foundation/DateTimeFormat.h" -#include "Foundation/DateTimeFormatter.h" -#include "Foundation/DateTime.h" -#include "Foundation/Timestamp.h" -#include "Foundation/Timezone.h" -#include "Foundation/NumberFormatter.h" -#include "Foundation/Environment.h" +#include "Poco/PatternFormatter.h" +#include "Poco/Message.h" +#include "Poco/DateTimeFormat.h" +#include "Poco/DateTimeFormatter.h" +#include "Poco/DateTime.h" +#include "Poco/Timestamp.h" +#include "Poco/Timezone.h" +#include "Poco/NumberFormatter.h" +#include "Poco/Environment.h" -Foundation_BEGIN +namespace Poco { const std::string PatternFormatter::PROP_PATTERN = "pattern"; @@ -187,4 +187,4 @@ const std::string& PatternFormatter::getPriorityName(int prio) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Pipe.cpp b/Foundation/src/Pipe.cpp new file mode 100644 index 000000000..86cfcfc21 --- /dev/null +++ b/Foundation/src/Pipe.cpp @@ -0,0 +1,92 @@ +// +// Pipe.cpp +// +// $Id: //poco/1.2/Foundation/src/Pipe.cpp#1 $ +// +// Library: Foundation +// Package: Processes +// Module: Pipe +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#include "Poco/Pipe.h" + + +namespace Poco { + + +Pipe::Pipe(): + _pImpl(new PipeImpl) +{ +} + + +Pipe::Pipe(const Pipe& pipe): + _pImpl(pipe._pImpl) +{ + _pImpl->duplicate(); +} + + +Pipe::~Pipe() +{ + _pImpl->release(); +} + + +Pipe& Pipe::operator = (const Pipe& pipe) +{ + if (this != &pipe) + { + _pImpl->release(); + _pImpl = pipe._pImpl; + _pImpl->duplicate(); + } + return *this; +} + + +void Pipe::close(CloseMode mode) +{ + switch (mode) + { + case CLOSE_READ: + _pImpl->closeRead(); + break; + case CLOSE_WRITE: + _pImpl->closeWrite(); + break; + default: + _pImpl->closeRead(); + _pImpl->closeWrite(); + break; + } +} + + +} // namespace Poco diff --git a/Foundation/src/PipeImpl.cpp b/Foundation/src/PipeImpl.cpp new file mode 100644 index 000000000..d1f495672 --- /dev/null +++ b/Foundation/src/PipeImpl.cpp @@ -0,0 +1,46 @@ +// +// PipeImpl.cpp +// +// $Id: //poco/1.2/Foundation/src/PipeImpl.cpp#1 $ +// +// Library: Foundation +// Package: Processes +// Module: PipeImpl +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#include "Poco/PipeImpl.h" + + +#if defined(POCO_OS_FAMILY_WINDOWS) +#include "PipeImpl_WIN32.cpp" +#elif defined(POCO_OS_FAMILY_UNIX) +#include "PipeImpl_POSIX.cpp" +#else +#include "PipeImpl_DUMMY.cpp" +#endif diff --git a/Foundation/src/PipeImpl_DUMMY.cpp b/Foundation/src/PipeImpl_DUMMY.cpp new file mode 100644 index 000000000..89e4f7c8d --- /dev/null +++ b/Foundation/src/PipeImpl_DUMMY.cpp @@ -0,0 +1,87 @@ +// +// PipeImpl_DUMMY.cpp +// +// $Id: //poco/1.2/Foundation/src/PipeImpl_DUMMY.cpp#1 $ +// +// Library: Foundation +// Package: Processes +// Module: PipeImpl +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#include "Poco/PipeImpl_DUMMY.h" + + +namespace Poco { + + +PipeImpl::PipeImpl() +{ +} + + +PipeImpl::~PipeImpl() +{ +} + + +int PipeImpl::writeBytes(const void* buffer, int length) +{ + return 0; +} + + +int PipeImpl::readBytes(void* buffer, int length) +{ + return 0; +} + + +PipeImpl::Handle PipeImpl::readHandle() const +{ + return 0; +} + + +PipeImpl::Handle PipeImpl::writeHandle() const +{ + return 0; +} + + +void PipeImpl::closeRead() +{ +} + + +void PipeImpl::closeWrite() +{ +} + + +} // namespace Poco diff --git a/Foundation/src/PipeImpl_POSIX.cpp b/Foundation/src/PipeImpl_POSIX.cpp new file mode 100644 index 000000000..3451a18cc --- /dev/null +++ b/Foundation/src/PipeImpl_POSIX.cpp @@ -0,0 +1,122 @@ +// +// PipeImpl_POSIX.cpp +// +// $Id: //poco/1.2/Foundation/src/PipeImpl_POSIX.cpp#1 $ +// +// Library: Foundation +// Package: Processes +// Module: PipeImpl +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#include "Poco/PipeImpl_POSIX.h" +#include "Poco/Exception.h" +#include +#include + + +namespace Poco { + + +PipeImpl::PipeImpl() +{ + int fds[2]; + int rc = pipe(fds); + if (rc == 0) + { + _readfd = fds[0]; + _writefd = fds[1]; + } + else throw CreateFileException("anonymous pipe"); +} + + +PipeImpl::~PipeImpl() +{ + closeRead(); + closeWrite(); +} + + +int PipeImpl::writeBytes(const void* buffer, int length) +{ + poco_assert (_writefd != -1); + + int n = write(_writefd, buffer, length); + if (n >= 0) + return n; + else + throw WriteFileException("anonymous pipe"); +} + + +int PipeImpl::readBytes(void* buffer, int length) +{ + poco_assert (_readfd != -1); + + int n = read(_readfd, buffer, length); + if (n >= 0) + return n; + else + throw ReadFileException("anonymous pipe"); +} + + +PipeImpl::Handle PipeImpl::readHandle() const +{ + return _readfd; +} + + +PipeImpl::Handle PipeImpl::writeHandle() const +{ + return _writefd; +} + + +void PipeImpl::closeRead() +{ + if (_readfd != -1) + { + close(_readfd); + _readfd = -1; + } +} + + +void PipeImpl::closeWrite() +{ + if (_writefd != -1) + { + close(_writefd); + _writefd = -1; + } +} + + +} // namespace Poco diff --git a/Foundation/src/PipeImpl_WIN32.cpp b/Foundation/src/PipeImpl_WIN32.cpp new file mode 100644 index 000000000..808500e07 --- /dev/null +++ b/Foundation/src/PipeImpl_WIN32.cpp @@ -0,0 +1,119 @@ +// +// PipeImpl_WIN32.cpp +// +// $Id: //poco/1.2/Foundation/src/PipeImpl_WIN32.cpp#1 $ +// +// Library: Foundation +// Package: Processes +// Module: PipeImpl +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#include "Poco/PipeImpl_WIN32.h" +#include "Poco/Exception.h" + + +namespace Poco { + + +PipeImpl::PipeImpl() +{ + SECURITY_ATTRIBUTES attr; + attr.nLength = sizeof(attr); + attr.lpSecurityDescriptor = NULL; + attr.bInheritHandle = FALSE; + + if (!CreatePipe(&_readHandle, &_writeHandle, &attr, 0)) + throw CreateFileException("anonymous pipe"); +} + + +PipeImpl::~PipeImpl() +{ + closeRead(); + closeWrite(); +} + + +int PipeImpl::writeBytes(const void* buffer, int length) +{ + poco_assert (_writeHandle != INVALID_HANDLE_VALUE); + + DWORD bytesWritten = 0; + if (!WriteFile(_writeHandle, buffer, length, &bytesWritten, NULL)) + throw WriteFileException("anonymous pipe"); + return bytesWritten; +} + + +int PipeImpl::readBytes(void* buffer, int length) +{ + poco_assert (_readHandle != INVALID_HANDLE_VALUE); + + DWORD bytesRead = 0; + BOOL ok = ReadFile(_readHandle, buffer, length, &bytesRead, NULL); + if (ok || GetLastError() == ERROR_BROKEN_PIPE) + return bytesRead; + else + throw ReadFileException("anonymous pipe"); +} + + +PipeImpl::Handle PipeImpl::readHandle() const +{ + return _readHandle; +} + + +PipeImpl::Handle PipeImpl::writeHandle() const +{ + return _writeHandle; +} + + +void PipeImpl::closeRead() +{ + if (_readHandle != INVALID_HANDLE_VALUE) + { + CloseHandle(_readHandle); + _readHandle = INVALID_HANDLE_VALUE; + } +} + + +void PipeImpl::closeWrite() +{ + if (_writeHandle != INVALID_HANDLE_VALUE) + { + CloseHandle(_writeHandle); + _writeHandle = INVALID_HANDLE_VALUE; + } +} + + +} // namespace Poco diff --git a/Foundation/src/PipeStream.cpp b/Foundation/src/PipeStream.cpp new file mode 100644 index 000000000..02d0e6043 --- /dev/null +++ b/Foundation/src/PipeStream.cpp @@ -0,0 +1,149 @@ +// +// PipeStream.cpp +// +// $Id: //poco/1.2/Foundation/src/PipeStream.cpp#1 $ +// +// Library: Foundation +// Package: Processes +// Module: PipeStream +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#include "Poco/PipeStream.h" + + +namespace Poco { + + +// +// PipeStreamBuf +// + + +PipeStreamBuf::PipeStreamBuf(const Pipe& pipe, openmode mode): + BufferedStreamBuf(STREAM_BUFFER_SIZE, mode), + _pipe(pipe) +{ +} + + +PipeStreamBuf::~PipeStreamBuf() +{ +} + + +int PipeStreamBuf::readFromDevice(char* buffer, std::streamsize length) +{ + return _pipe.readBytes(buffer, (int) length); +} + + +int PipeStreamBuf::writeToDevice(const char* buffer, std::streamsize length) +{ + return _pipe.writeBytes(buffer, (int) length); +} + + +void PipeStreamBuf::close() +{ + _pipe.close(Pipe::CLOSE_BOTH); +} + + +// +// PipeIOS +// + + +PipeIOS::PipeIOS(const Pipe& pipe, openmode mode): + _buf(pipe, mode) +{ + poco_ios_init(&_buf); +} + + +PipeIOS::~PipeIOS() +{ + try + { + _buf.sync(); + } + catch (...) + { + } +} + + +PipeStreamBuf* PipeIOS::rdbuf() +{ + return &_buf; +} + + +void PipeIOS::close() +{ + _buf.sync(); + _buf.close(); +} + + +// +// PipeOutputStream +// + + +PipeOutputStream::PipeOutputStream(const Pipe& pipe): + PipeIOS(pipe, std::ios::out), + std::ostream(&_buf) +{ +} + + +PipeOutputStream::~PipeOutputStream() +{ +} + + +// +// PipeInputStream +// + + +PipeInputStream::PipeInputStream(const Pipe& pipe): + PipeIOS(pipe, std::ios::in), + std::istream(&_buf) +{ +} + + +PipeInputStream::~PipeInputStream() +{ +} + + +} // namespace Poco diff --git a/Foundation/src/Process.cpp b/Foundation/src/Process.cpp index a3ea428a9..bdb8abc3a 100644 --- a/Foundation/src/Process.cpp +++ b/Foundation/src/Process.cpp @@ -1,7 +1,7 @@ // // Process.cpp // -// $Id: //poco/1.1.0/Foundation/src/Process.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Process.cpp#1 $ // // Library: Foundation // Package: Processes @@ -34,7 +34,7 @@ // -#include "Foundation/Process.h" +#include "Poco/Process.h" #if defined(POCO_OS_FAMILY_WINDOWS) && defined(POCO_WIN32_UTF8) @@ -48,7 +48,7 @@ #endif -Foundation_BEGIN +namespace Poco { // @@ -103,7 +103,15 @@ int ProcessHandle::wait() const // ProcessHandle Process::launch(const std::string& command, const Args& args) { - return ProcessHandle(launchImpl(command, args)); + return ProcessHandle(launchImpl(command, args, 0, 0, 0)); +} + + +ProcessHandle Process::launch(const std::string& command, const Args& args, Pipe* inPipe, Pipe* outPipe, Pipe* errPipe) +{ + poco_assert (inPipe == 0 || inPipe != outPipe && inPipe != errPipe); + + return ProcessHandle(launchImpl(command, args, inPipe, outPipe, errPipe)); } @@ -125,4 +133,4 @@ void Process::requestTermination(PID pid) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Process_UNIX.cpp b/Foundation/src/Process_UNIX.cpp index 22d001b7f..1be1d0a5c 100644 --- a/Foundation/src/Process_UNIX.cpp +++ b/Foundation/src/Process_UNIX.cpp @@ -1,7 +1,7 @@ // // Process_UNIX.cpp // -// $Id: //poco/1.1.0/Foundation/src/Process_UNIX.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Process_UNIX.cpp#1 $ // // Library: Foundation // Package: Processes @@ -34,9 +34,10 @@ // -#include "Foundation/Process_UNIX.h" -#include "Foundation/Exception.h" -#include "Foundation/NumberFormatter.h" +#include "Poco/Process_UNIX.h" +#include "Poco/Exception.h" +#include "Poco/NumberFormatter.h" +#include "Poco/Pipe.h" #include #include #include @@ -47,10 +48,12 @@ #if defined(__QNX__) #include +#include +#include #endif -Foundation_BEGIN +namespace Poco { // @@ -100,7 +103,7 @@ void ProcessImpl::timesImpl(long& userTime, long& kernelTime) } -ProcessHandleImpl* ProcessImpl::launchImpl(const std::string& command, const ArgsImpl& args) +ProcessHandleImpl* ProcessImpl::launchImpl(const std::string& command, const ArgsImpl& args, Pipe* inPipe, Pipe* outPipe, Pipe* errPipe) { #if defined(__QNX__) /// use QNX's spawn system call which is more efficient than fork/exec. @@ -110,10 +113,16 @@ ProcessHandleImpl* ProcessImpl::launchImpl(const std::string& command, const Arg for (ArgsImpl::const_iterator it = args.begin(); it != args.end(); ++it) argv[i++] = const_cast(it->c_str()); argv[i] = NULL; - int pid = spawnvp(P_NOWAIT, command.c_str(), argv); + struct inheritance inherit; + memset(&inherit, 0, sizeof(inherit)); + inherit.flags = SPAWN_ALIGN_DEFAULT | SPAWN_CHECK_SCRIPT | SPAWN_SEARCH_PATH; + int fdmap[3]; + fdmap[0] = inPipe ? inPipe->readHandle() : 0; + fdmap[1] = outPipe ? outPipe->writeHandle() : 1; + fdmap[2] = errPipe ? errPipe->writeHandle() : 2; + int pid = spawn(command.c_str(), 3, fdmap, &inherit, argv, NULL); delete [] argv; - if (pid == -1) throw SystemException("Cannot spawn", command); - return new ProcessHandleImpl(pid); + if (pid == -1) throw SystemException("cannot spawn", command); #else int pid = fork(); if (pid < 0) @@ -122,6 +131,21 @@ ProcessHandleImpl* ProcessImpl::launchImpl(const std::string& command, const Arg } else if (pid == 0) { + // setup redirection + if (inPipe) + { + dup2(inPipe->readHandle(), STDIN_FILENO); + inPipe->close(Pipe::CLOSE_BOTH); + } + // outPipe and errPipe may be the same, so we dup first and close later + if (outPipe) dup2(outPipe->writeHandle(), STDOUT_FILENO); + if (errPipe) dup2(errPipe->writeHandle(), STDERR_FILENO); + if (outPipe) outPipe->close(Pipe::CLOSE_BOTH); + if (errPipe) errPipe->close(Pipe::CLOSE_BOTH); + // close all open file descriptors other than stdin, stdout, stderr + for (int i = 3; i < getdtablesize(); ++i) + close(i); + char** argv = new char*[args.size() + 2]; int i = 0; argv[i++] = const_cast(command.c_str()); @@ -131,8 +155,11 @@ ProcessHandleImpl* ProcessImpl::launchImpl(const std::string& command, const Arg execvp(command.c_str(), argv); _exit(72); } - return new ProcessHandleImpl(pid); #endif + if (inPipe) inPipe->close(Pipe::CLOSE_READ); + if (outPipe) outPipe->close(Pipe::CLOSE_WRITE); + if (errPipe) errPipe->close(Pipe::CLOSE_WRITE); + return new ProcessHandleImpl(pid); } @@ -170,4 +197,4 @@ void ProcessImpl::requestTerminationImpl(PIDImpl pid) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Process_VMS.cpp b/Foundation/src/Process_VMS.cpp index e7cf28f1b..8f20baf75 100644 --- a/Foundation/src/Process_VMS.cpp +++ b/Foundation/src/Process_VMS.cpp @@ -1,7 +1,7 @@ // // Process_VMS.cpp // -// $Id: //poco/1.1.0/Foundation/src/Process_VMS.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Process_VMS.cpp#1 $ // // Library: Foundation // Package: Processes @@ -34,14 +34,14 @@ // -#include "Foundation/Process_VMS.h" -#include "Foundation/NumberFormatter.h" -#include "Foundation/NamedEvent.h" +#include "Poco/Process_VMS.h" +#include "Poco/NumberFormatter.h" +#include "Poco/NamedEvent.h" #include #include -Foundation_BEGIN +namespace Poco { // @@ -91,7 +91,7 @@ void ProcessImpl::timesImpl(long& userTime, long& kernelTime) } -ProcessHandleImpl* ProcessImpl::launchImpl(const std::string& command, const ArgsImpl& args) +ProcessHandleImpl* ProcessImpl::launchImpl(const std::string& command, const ArgsImpl& args, Pipe* inPipe, Pipe* outPipe, Pipe* errPipe) { char** argv = new char*[args.size() + 2]; int i = 0; @@ -151,4 +151,4 @@ void ProcessImpl::requestTerminationImpl(PIDImpl pid) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Process_WIN32.cpp b/Foundation/src/Process_WIN32.cpp index ba35199e1..99ca0da01 100644 --- a/Foundation/src/Process_WIN32.cpp +++ b/Foundation/src/Process_WIN32.cpp @@ -1,7 +1,7 @@ // // Process_WIN32.cpp // -// $Id: //poco/1.1.0/Foundation/src/Process_WIN32.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Process_WIN32.cpp#1 $ // // Library: Foundation // Package: Processes @@ -34,13 +34,14 @@ // -#include "Foundation/Process_WIN32.h" -#include "Foundation/Exception.h" -#include "Foundation/NumberFormatter.h" -#include "Foundation/NamedEvent.h" +#include "Poco/Process_WIN32.h" +#include "Poco/Exception.h" +#include "Poco/NumberFormatter.h" +#include "Poco/NamedEvent.h" +#include "Poco/Pipe.h" -Foundation_BEGIN +namespace Poco { // @@ -112,7 +113,7 @@ void ProcessImpl::timesImpl(long& userTime, long& kernelTime) } -ProcessHandleImpl* ProcessImpl::launchImpl(const std::string& command, const ArgsImpl& args) +ProcessHandleImpl* ProcessImpl::launchImpl(const std::string& command, const ArgsImpl& args, Pipe* inPipe, Pipe* outPipe, Pipe* errPipe) { std::string commandLine = command; for (ArgsImpl::const_iterator it = args.begin(); it != args.end(); ++it) @@ -127,9 +128,28 @@ ProcessHandleImpl* ProcessImpl::launchImpl(const std::string& command, const Arg startupInfo.lpReserved = NULL; startupInfo.lpDesktop = NULL; startupInfo.lpTitle = NULL; - startupInfo.dwFlags = STARTF_FORCEOFFFEEDBACK; + startupInfo.dwFlags = STARTF_FORCEOFFFEEDBACK | STARTF_USESTDHANDLES; startupInfo.cbReserved2 = 0; startupInfo.lpReserved2 = NULL; + + HANDLE hProc = GetCurrentProcess(); + if (inPipe) + { + DuplicateHandle(hProc, inPipe->readHandle(), hProc, &startupInfo.hStdInput, 0, TRUE, DUPLICATE_SAME_ACCESS); + inPipe->close(Pipe::CLOSE_READ); + } + else DuplicateHandle(hProc, GetStdHandle(STD_INPUT_HANDLE), hProc, &startupInfo.hStdInput, 0, TRUE, DUPLICATE_SAME_ACCESS); + // outPipe may be the same as errPipe, so we duplicate first and close later. + if (outPipe) + DuplicateHandle(hProc, outPipe->writeHandle(), hProc, &startupInfo.hStdOutput, 0, TRUE, DUPLICATE_SAME_ACCESS); + else + DuplicateHandle(hProc, GetStdHandle(STD_OUTPUT_HANDLE), hProc, &startupInfo.hStdOutput, 0, TRUE, DUPLICATE_SAME_ACCESS); + if (errPipe) + DuplicateHandle(hProc, errPipe->writeHandle(), hProc, &startupInfo.hStdError, 0, TRUE, DUPLICATE_SAME_ACCESS); + else + DuplicateHandle(hProc, GetStdHandle(STD_ERROR_HANDLE), hProc, &startupInfo.hStdError, 0, TRUE, DUPLICATE_SAME_ACCESS); + if (outPipe) outPipe->close(Pipe::CLOSE_WRITE); + if (errPipe) errPipe->close(Pipe::CLOSE_WRITE); PROCESS_INFORMATION processInfo; BOOL rc = CreateProcess( @@ -144,6 +164,9 @@ ProcessHandleImpl* ProcessImpl::launchImpl(const std::string& command, const Arg &startupInfo, &processInfo ); + CloseHandle(startupInfo.hStdInput); + CloseHandle(startupInfo.hStdOutput); + CloseHandle(startupInfo.hStdError); if (rc) { CloseHandle(processInfo.hThread); @@ -189,4 +212,4 @@ void ProcessImpl::requestTerminationImpl(PIDImpl pid) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Process_WIN32U.cpp b/Foundation/src/Process_WIN32U.cpp index e3ad2e25e..e40d21a8b 100644 --- a/Foundation/src/Process_WIN32U.cpp +++ b/Foundation/src/Process_WIN32U.cpp @@ -1,7 +1,7 @@ // // Process_WIN32U.cpp // -// $Id: //poco/1.1.0/Foundation/src/Process_WIN32U.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Process_WIN32U.cpp#1 $ // // Library: Foundation // Package: Processes @@ -34,14 +34,15 @@ // -#include "Foundation/Process_WIN32U.h" -#include "Foundation/Exception.h" -#include "Foundation/NumberFormatter.h" -#include "Foundation/NamedEvent.h" -#include "Foundation/UnicodeConverter.h" +#include "Poco/Process_WIN32U.h" +#include "Poco/Exception.h" +#include "Poco/NumberFormatter.h" +#include "Poco/NamedEvent.h" +#include "Poco/UnicodeConverter.h" +#include "Poco/Pipe.h" -Foundation_BEGIN +namespace Poco { // @@ -113,7 +114,7 @@ void ProcessImpl::timesImpl(long& userTime, long& kernelTime) } -ProcessHandleImpl* ProcessImpl::launchImpl(const std::string& command, const ArgsImpl& args) +ProcessHandleImpl* ProcessImpl::launchImpl(const std::string& command, const ArgsImpl& args, Pipe* inPipe, Pipe* outPipe, Pipe* errPipe) { std::string commandLine = command; for (ArgsImpl::const_iterator it = args.begin(); it != args.end(); ++it) @@ -131,9 +132,28 @@ ProcessHandleImpl* ProcessImpl::launchImpl(const std::string& command, const Arg startupInfo.lpReserved = NULL; startupInfo.lpDesktop = NULL; startupInfo.lpTitle = NULL; - startupInfo.dwFlags = STARTF_FORCEOFFFEEDBACK; + startupInfo.dwFlags = STARTF_FORCEOFFFEEDBACK | STARTF_USESTDHANDLES; startupInfo.cbReserved2 = 0; startupInfo.lpReserved2 = NULL; + + HANDLE hProc = GetCurrentProcess(); + if (inPipe) + { + DuplicateHandle(hProc, inPipe->readHandle(), hProc, &startupInfo.hStdInput, 0, TRUE, DUPLICATE_SAME_ACCESS); + inPipe->close(Pipe::CLOSE_READ); + } + else DuplicateHandle(hProc, GetStdHandle(STD_INPUT_HANDLE), hProc, &startupInfo.hStdInput, 0, TRUE, DUPLICATE_SAME_ACCESS); + // outPipe may be the same as errPipe, so we duplicate first and close later. + if (outPipe) + DuplicateHandle(hProc, outPipe->writeHandle(), hProc, &startupInfo.hStdOutput, 0, TRUE, DUPLICATE_SAME_ACCESS); + else + DuplicateHandle(hProc, GetStdHandle(STD_OUTPUT_HANDLE), hProc, &startupInfo.hStdOutput, 0, TRUE, DUPLICATE_SAME_ACCESS); + if (errPipe) + DuplicateHandle(hProc, errPipe->writeHandle(), hProc, &startupInfo.hStdError, 0, TRUE, DUPLICATE_SAME_ACCESS); + else + DuplicateHandle(hProc, GetStdHandle(STD_ERROR_HANDLE), hProc, &startupInfo.hStdError, 0, TRUE, DUPLICATE_SAME_ACCESS); + if (outPipe) outPipe->close(Pipe::CLOSE_WRITE); + if (errPipe) errPipe->close(Pipe::CLOSE_WRITE); PROCESS_INFORMATION processInfo; BOOL rc = CreateProcessW( @@ -148,6 +168,9 @@ ProcessHandleImpl* ProcessImpl::launchImpl(const std::string& command, const Arg &startupInfo, &processInfo ); + CloseHandle(startupInfo.hStdInput); + CloseHandle(startupInfo.hStdOutput); + CloseHandle(startupInfo.hStdError); if (rc) { CloseHandle(processInfo.hThread); @@ -193,4 +216,4 @@ void ProcessImpl::requestTerminationImpl(PIDImpl pid) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/PurgeStrategy.cpp b/Foundation/src/PurgeStrategy.cpp index 62ebdcaad..ac05f2b54 100644 --- a/Foundation/src/PurgeStrategy.cpp +++ b/Foundation/src/PurgeStrategy.cpp @@ -1,7 +1,7 @@ // // PurgeStrategy.cpp // -// $Id: //poco/1.1.0/Foundation/src/PurgeStrategy.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/PurgeStrategy.cpp#1 $ // // Library: Foundation // Package: Logging @@ -34,13 +34,13 @@ // -#include "Foundation/PurgeStrategy.h" -#include "Foundation/Path.h" -#include "Foundation/DirectoryIterator.h" -#include "Foundation/Timestamp.h" +#include "Poco/PurgeStrategy.h" +#include "Poco/Path.h" +#include "Poco/DirectoryIterator.h" +#include "Poco/Timestamp.h" -Foundation_BEGIN +namespace Poco { // @@ -150,4 +150,4 @@ void PurgeByCountStrategy::purge(const std::string& path) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/RWLock.cpp b/Foundation/src/RWLock.cpp index 9c1e04a64..2b580eb45 100644 --- a/Foundation/src/RWLock.cpp +++ b/Foundation/src/RWLock.cpp @@ -1,7 +1,7 @@ // // RWLock.cpp // -// $Id: //poco/1.1.0/Foundation/src/RWLock.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/RWLock.cpp#1 $ // // Library: Foundation // Package: Threading @@ -34,7 +34,7 @@ // -#include "Foundation/RWLock.h" +#include "Poco/RWLock.h" #if defined(POCO_OS_FAMILY_WINDOWS) @@ -44,7 +44,7 @@ #endif -Foundation_BEGIN +namespace Poco { RWLock::RWLock() @@ -57,4 +57,4 @@ RWLock::~RWLock() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/RWLock_POSIX.cpp b/Foundation/src/RWLock_POSIX.cpp index b48300432..ab6b0471a 100644 --- a/Foundation/src/RWLock_POSIX.cpp +++ b/Foundation/src/RWLock_POSIX.cpp @@ -1,7 +1,7 @@ // // RWLock_POSIX.cpp // -// $Id: //poco/1.1.0/Foundation/src/RWLock_POSIX.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/RWLock_POSIX.cpp#1 $ // // Library: Foundation // Package: Threading @@ -34,10 +34,10 @@ // -#include "Foundation/RWLock_POSIX.h" +#include "Poco/RWLock_POSIX.h" -Foundation_BEGIN +namespace Poco { RWLockImpl::RWLockImpl() @@ -53,4 +53,4 @@ RWLockImpl::~RWLockImpl() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/RWLock_WIN32.cpp b/Foundation/src/RWLock_WIN32.cpp index e7141accb..e6198257b 100644 --- a/Foundation/src/RWLock_WIN32.cpp +++ b/Foundation/src/RWLock_WIN32.cpp @@ -1,7 +1,7 @@ // // RWLock_WIN32.cpp // -// $Id: //poco/1.1.0/Foundation/src/RWLock_WIN32.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/RWLock_WIN32.cpp#1 $ // // Library: Foundation // Package: Threading @@ -34,10 +34,10 @@ // -#include "Foundation/RWLock_WIN32.h" +#include "Poco/RWLock_WIN32.h" -Foundation_BEGIN +namespace Poco { RWLockImpl::RWLockImpl(): _readers(0), _writers(0) @@ -196,4 +196,4 @@ void RWLockImpl::unlockImpl() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Random.cpp b/Foundation/src/Random.cpp index 754922f9f..c12ca2d63 100644 --- a/Foundation/src/Random.cpp +++ b/Foundation/src/Random.cpp @@ -1,7 +1,7 @@ // // Random.cpp // -// $Id: //poco/1.1.0/Foundation/src/Random.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Random.cpp#1 $ // // Library: Foundation // Package: Crypt @@ -70,8 +70,8 @@ // -#include "Foundation/Random.h" -#include "Foundation/RandomStream.h" +#include "Poco/Random.h" +#include "Poco/RandomStream.h" #include "time.h" @@ -168,7 +168,7 @@ #define SEP_4 1 -Foundation_BEGIN +namespace Poco { Random::Random(int stateSize) @@ -379,4 +379,4 @@ UInt32 Random::next() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/RandomStream.cpp b/Foundation/src/RandomStream.cpp index 6b77efcda..335a580c0 100644 --- a/Foundation/src/RandomStream.cpp +++ b/Foundation/src/RandomStream.cpp @@ -1,7 +1,7 @@ // // RandomStream.cpp // -// $Id: //poco/1.1.0/Foundation/src/RandomStream.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/RandomStream.cpp#1 $ // // Library: Foundation // Package: Crypt @@ -34,9 +34,9 @@ // -#include "Foundation/RandomStream.h" -#include "Foundation/Random.h" -#include "Foundation/SHA1Engine.h" +#include "Poco/RandomStream.h" +#include "Poco/Random.h" +#include "Poco/SHA1Engine.h" #if defined(POCO_OS_FAMILY_WINDOWS) #include #include @@ -47,7 +47,7 @@ #include -Foundation_BEGIN +namespace Poco { RandomBuf::RandomBuf(): BufferedStreamBuf(256, std::ios::in) @@ -146,4 +146,4 @@ RandomInputStream::~RandomInputStream() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/RefCountedObject.cpp b/Foundation/src/RefCountedObject.cpp index 0f2dbaa7d..01c1ba74c 100644 --- a/Foundation/src/RefCountedObject.cpp +++ b/Foundation/src/RefCountedObject.cpp @@ -1,7 +1,7 @@ // // RefCountedObject.cpp // -// $Id: //poco/1.1.0/Foundation/src/RefCountedObject.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/RefCountedObject.cpp#1 $ // // Library: Foundation // Package: Core @@ -34,10 +34,10 @@ // -#include "Foundation/RefCountedObject.h" +#include "Poco/RefCountedObject.h" -Foundation_BEGIN +namespace Poco { RefCountedObject::RefCountedObject(): _rc(1) @@ -67,4 +67,4 @@ void RefCountedObject::release() const } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/RegularExpression.cpp b/Foundation/src/RegularExpression.cpp index a5b6e364e..3f3e85aa5 100644 --- a/Foundation/src/RegularExpression.cpp +++ b/Foundation/src/RegularExpression.cpp @@ -1,7 +1,7 @@ // // RegularExpression.h // -// $Id: //poco/1.1.0/Foundation/src/RegularExpression.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/RegularExpression.cpp#1 $ // // Library: Foundation // Package: RegExp @@ -34,13 +34,13 @@ // -#include "Foundation/RegularExpression.h" -#include "Foundation/Exception.h" +#include "Poco/RegularExpression.h" +#include "Poco/Exception.h" #include #include "pcre.h" -Foundation_BEGIN +namespace Poco { const int RegularExpression::OVEC_SIZE = 64; @@ -288,4 +288,4 @@ bool RegularExpression::match(const std::string& subject, const std::string& pat } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/RotateStrategy.cpp b/Foundation/src/RotateStrategy.cpp index 86fc26c1a..52e5c10b4 100644 --- a/Foundation/src/RotateStrategy.cpp +++ b/Foundation/src/RotateStrategy.cpp @@ -1,7 +1,7 @@ // // RotateStrategy.cpp // -// $Id: //poco/1.1.0/Foundation/src/RotateStrategy.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/RotateStrategy.cpp#1 $ // // Library: Foundation // Package: Logging @@ -34,10 +34,10 @@ // -#include "Foundation/RotateStrategy.h" +#include "Poco/RotateStrategy.h" -Foundation_BEGIN +namespace Poco { // @@ -100,4 +100,4 @@ bool RotateBySizeStrategy::mustRotate(LogFile* pFile) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Runnable.cpp b/Foundation/src/Runnable.cpp index 0554da609..530010e02 100644 --- a/Foundation/src/Runnable.cpp +++ b/Foundation/src/Runnable.cpp @@ -1,7 +1,7 @@ // // Runnable.cpp // -// $Id: //poco/1.1.0/Foundation/src/Runnable.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Runnable.cpp#1 $ // // Library: Foundation // Package: Threading @@ -34,10 +34,10 @@ // -#include "Foundation/Runnable.h" +#include "Poco/Runnable.h" -Foundation_BEGIN +namespace Poco { Runnable::Runnable() @@ -50,4 +50,4 @@ Runnable::~Runnable() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/SHA1Engine.cpp b/Foundation/src/SHA1Engine.cpp index e152cdf7e..e8d7bbde6 100644 --- a/Foundation/src/SHA1Engine.cpp +++ b/Foundation/src/SHA1Engine.cpp @@ -1,7 +1,7 @@ // // SHA1Engine.cpp // -// $Id: //poco/1.1.0/Foundation/src/SHA1Engine.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/SHA1Engine.cpp#1 $ // // Library: Foundation // Package: Crypt @@ -37,7 +37,7 @@ // -#include "Foundation/SHA1Engine.h" +#include "Poco/SHA1Engine.h" #include @@ -48,7 +48,7 @@ #endif -Foundation_BEGIN +namespace Poco { SHA1Engine::SHA1Engine() @@ -302,4 +302,4 @@ void SHA1Engine::transform() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Semaphore.cpp b/Foundation/src/Semaphore.cpp index 00ff77fb2..676c1c000 100644 --- a/Foundation/src/Semaphore.cpp +++ b/Foundation/src/Semaphore.cpp @@ -1,7 +1,7 @@ // // Semaphore.cpp // -// $Id: //poco/1.1.0/Foundation/src/Semaphore.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Semaphore.cpp#1 $ // // Library: Foundation // Package: Threading @@ -34,7 +34,7 @@ // -#include "Foundation/Semaphore.h" +#include "Poco/Semaphore.h" #if defined(POCO_OS_FAMILY_WINDOWS) @@ -44,7 +44,7 @@ #endif -Foundation_BEGIN +namespace Poco { Semaphore::Semaphore(int n): SemaphoreImpl(n, n) @@ -62,4 +62,4 @@ Semaphore::~Semaphore() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Semaphore_POSIX.cpp b/Foundation/src/Semaphore_POSIX.cpp index d11bb6ab4..10f7fb49c 100644 --- a/Foundation/src/Semaphore_POSIX.cpp +++ b/Foundation/src/Semaphore_POSIX.cpp @@ -1,7 +1,7 @@ // // Semaphore_POSIX.cpp // -// $Id: //poco/1.1.0/Foundation/src/Semaphore_POSIX.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Semaphore_POSIX.cpp#1 $ // // Library: Foundation // Package: Threading @@ -34,11 +34,11 @@ // -#include "Foundation/Semaphore_POSIX.h" +#include "Poco/Semaphore_POSIX.h" #include -Foundation_BEGIN +namespace Poco { SemaphoreImpl::SemaphoreImpl(int n, int max): _n(n), _max(max) @@ -115,4 +115,4 @@ bool SemaphoreImpl::waitImpl(long milliseconds) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Semaphore_WIN32.cpp b/Foundation/src/Semaphore_WIN32.cpp index 64c8eac65..8946d5c42 100644 --- a/Foundation/src/Semaphore_WIN32.cpp +++ b/Foundation/src/Semaphore_WIN32.cpp @@ -1,7 +1,7 @@ // // Semaphore_WIN32.cpp // -// $Id: //poco/1.1.0/Foundation/src/Semaphore_WIN32.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Semaphore_WIN32.cpp#1 $ // // Library: Foundation // Package: Threading @@ -34,10 +34,10 @@ // -#include "Foundation/Semaphore_WIN32.h" +#include "Poco/Semaphore_WIN32.h" -Foundation_BEGIN +namespace Poco { SemaphoreImpl::SemaphoreImpl(int n, int max) @@ -84,4 +84,4 @@ bool SemaphoreImpl::waitImpl(long milliseconds) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/SharedLibrary.cpp b/Foundation/src/SharedLibrary.cpp index b7f23baa3..c503539ab 100644 --- a/Foundation/src/SharedLibrary.cpp +++ b/Foundation/src/SharedLibrary.cpp @@ -1,7 +1,7 @@ // // SharedLibrary.cpp // -// $Id: //poco/1.1.0/Foundation/src/SharedLibrary.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/SharedLibrary.cpp#1 $ // // Library: Foundation // Package: SharedLibrary @@ -34,14 +34,16 @@ // -#include "Foundation/SharedLibrary.h" -#include "Foundation/Exception.h" +#include "Poco/SharedLibrary.h" +#include "Poco/Exception.h" #if defined(hpux) || defined(_hpux) #include "SharedLibrary_HPUX.cpp" #elif defined(POCO_OS_FAMILY_UNIX) #include "SharedLibrary_UNIX.cpp" +#elif defined(POCO_OS_FAMILY_WINDOWS) && defined(POCO_WIN32_UTF8) +#include "SharedLibrary_WIN32U.cpp" #elif defined(POCO_OS_FAMILY_WINDOWS) #include "SharedLibrary_WIN32.cpp" #elif defined(POCO_OS_FAMILY_VMS) @@ -49,7 +51,7 @@ #endif -Foundation_BEGIN +namespace Poco { SharedLibrary::SharedLibrary() @@ -114,4 +116,4 @@ std::string SharedLibrary::suffix() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/SharedLibrary_HPUX.cpp b/Foundation/src/SharedLibrary_HPUX.cpp index 37ed52b7b..38ab61463 100644 --- a/Foundation/src/SharedLibrary_HPUX.cpp +++ b/Foundation/src/SharedLibrary_HPUX.cpp @@ -1,7 +1,7 @@ // // SharedLibrary_HPUX.cpp // -// $Id: //poco/1.1.0/Foundation/src/SharedLibrary_HPUX.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/SharedLibrary_HPUX.cpp#1 $ // // Library: Foundation // Package: SharedLibrary @@ -34,11 +34,11 @@ // -#include "Foundation/SharedLibrary_HPUX.h" +#include "Poco/SharedLibrary_HPUX.h" #include -Foundation_BEGIN +namespace Poco { FastMutex SharedLibraryImpl::_mutex; @@ -113,4 +113,4 @@ std::string SharedLibraryImpl::suffixImpl() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/SharedLibrary_UNIX.cpp b/Foundation/src/SharedLibrary_UNIX.cpp index 017fe4550..7c09cc1ec 100644 --- a/Foundation/src/SharedLibrary_UNIX.cpp +++ b/Foundation/src/SharedLibrary_UNIX.cpp @@ -1,7 +1,7 @@ // // SharedLibrary_UNIX.cpp // -// $Id: //poco/1.1.0/Foundation/src/SharedLibrary_UNIX.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/SharedLibrary_UNIX.cpp#1 $ // // Library: Foundation // Package: SharedLibrary @@ -34,8 +34,8 @@ // -#include "Foundation/SharedLibrary_UNIX.h" -#include "Foundation/Exception.h" +#include "Poco/SharedLibrary_UNIX.h" +#include "Poco/Exception.h" #include @@ -45,7 +45,7 @@ #endif -Foundation_BEGIN +namespace Poco { FastMutex SharedLibraryImpl::_mutex; @@ -128,6 +128,12 @@ std::string SharedLibraryImpl::suffixImpl() #else return ".sl"; #endif +#elif defined(__CYGWIN__) + #if defined(_DEBUG) + return "d.dll"; + #else + return ".dll"; + #endif #else #if defined(_DEBUG) return "d.so"; @@ -138,4 +144,4 @@ std::string SharedLibraryImpl::suffixImpl() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/SharedLibrary_VMS.cpp b/Foundation/src/SharedLibrary_VMS.cpp index 0a756fade..2ac3bcc42 100644 --- a/Foundation/src/SharedLibrary_VMS.cpp +++ b/Foundation/src/SharedLibrary_VMS.cpp @@ -1,7 +1,7 @@ // // SharedLibrary_VMS.cpp // -// $Id: //poco/1.1.0/Foundation/src/SharedLibrary_VMS.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/SharedLibrary_VMS.cpp#1 $ // // Library: Foundation // Package: SharedLibrary @@ -34,8 +34,8 @@ // -#include "Foundation/SharedLibrary_VMS.h" -#include "Foundation/Path.h" +#include "Poco/SharedLibrary_VMS.h" +#include "Poco/Path.h" #include #include #include @@ -43,7 +43,7 @@ #include -Foundation_BEGIN +namespace Poco { FastMutex SharedLibraryImpl::_mutex; @@ -136,4 +136,4 @@ std::string SharedLibraryImpl::suffixImpl() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/SharedLibrary_WIN32.cpp b/Foundation/src/SharedLibrary_WIN32.cpp index 824ab3885..7b9610666 100644 --- a/Foundation/src/SharedLibrary_WIN32.cpp +++ b/Foundation/src/SharedLibrary_WIN32.cpp @@ -1,7 +1,7 @@ // // SharedLibrary_WIN32.cpp // -// $Id: //poco/1.1.0/Foundation/src/SharedLibrary_WIN32.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/SharedLibrary_WIN32.cpp#1 $ // // Library: Foundation // Package: SharedLibrary @@ -34,11 +34,11 @@ // -#include "Foundation/SharedLibrary_WIN32.h" +#include "Poco/SharedLibrary_WIN32.h" #include -Foundation_BEGIN +namespace Poco { FastMutex SharedLibraryImpl::_mutex; @@ -113,4 +113,4 @@ std::string SharedLibraryImpl::suffixImpl() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/SharedLibrary_WIN32U.cpp b/Foundation/src/SharedLibrary_WIN32U.cpp new file mode 100644 index 000000000..aae9e8308 --- /dev/null +++ b/Foundation/src/SharedLibrary_WIN32U.cpp @@ -0,0 +1,119 @@ +// +// SharedLibrary_WIN32U.cpp +// +// $Id: //poco/1.2/Foundation/src/SharedLibrary_WIN32U.cpp#1 $ +// +// Library: Foundation +// Package: SharedLibrary +// Module: SharedLibrary +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#include "Poco/SharedLibrary_WIN32U.h" +#include "Poco/UnicodeConverter.h" +#include + + +namespace Poco { + + +FastMutex SharedLibraryImpl::_mutex; + + +SharedLibraryImpl::SharedLibraryImpl() +{ + _handle = 0; +} + + +SharedLibraryImpl::~SharedLibraryImpl() +{ +} + + +void SharedLibraryImpl::loadImpl(const std::string& path) +{ + FastMutex::ScopedLock lock(_mutex); + + if (_handle) throw LibraryAlreadyLoadedException(_path); + std::wstring upath; + UnicodeConverter::toUTF16(path, upath); + _handle = LoadLibraryW(upath.c_str()); + if (!_handle) throw LibraryLoadException(path); + _path = path; +} + + +void SharedLibraryImpl::unloadImpl() +{ + FastMutex::ScopedLock lock(_mutex); + + if (_handle) + { + FreeLibrary((HMODULE) _handle); + _handle = 0; + } + _path.clear(); +} + + +bool SharedLibraryImpl::isLoadedImpl() const +{ + return _handle != 0; +} + + +void* SharedLibraryImpl::findSymbolImpl(const std::string& name) +{ + FastMutex::ScopedLock lock(_mutex); + + if (_handle) + { + return (void*) GetProcAddress((HMODULE) _handle, name.c_str()); + } + else return 0; +} + + +const std::string& SharedLibraryImpl::getPathImpl() const +{ + return _path; +} + + +std::string SharedLibraryImpl::suffixImpl() +{ +#if defined(_DEBUG) + return "d.dll"; +#else + return ".dll"; +#endif +} + + +} // namespace Poco diff --git a/Foundation/src/SignalHandler.cpp b/Foundation/src/SignalHandler.cpp index 7d53efd58..e4a9cdafc 100644 --- a/Foundation/src/SignalHandler.cpp +++ b/Foundation/src/SignalHandler.cpp @@ -1,7 +1,7 @@ // // SignalHandler.cpp // -// $Id: //poco/1.1.0/Foundation/src/SignalHandler.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/SignalHandler.cpp#1 $ // // Library: Foundation // Package: Threading @@ -34,19 +34,19 @@ // -#include "Foundation/SignalHandler.h" +#include "Poco/SignalHandler.h" #if defined(POCO_OS_FAMILY_UNIX) -#include "Foundation/Thread.h" -#include "Foundation/NumberFormatter.h" -#include "Foundation/Exception.h" +#include "Poco/Thread.h" +#include "Poco/NumberFormatter.h" +#include "Poco/Exception.h" #include -Foundation_BEGIN +namespace Poco { SignalHandler::JumpBufferVec SignalHandler::_jumpBufferVec; @@ -121,7 +121,7 @@ SignalHandler::JumpBufferVec& SignalHandler::jumpBufferVec() } -Foundation_END +} // namespace Poco #endif // POCO_OS_FAMILY_UNIX diff --git a/Foundation/src/SimpleFileChannel.cpp b/Foundation/src/SimpleFileChannel.cpp index 675439b38..e26a61f27 100644 --- a/Foundation/src/SimpleFileChannel.cpp +++ b/Foundation/src/SimpleFileChannel.cpp @@ -1,7 +1,7 @@ // // SimpleFileChannel.cpp // -// $Id: //poco/1.1.0/Foundation/src/SimpleFileChannel.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/SimpleFileChannel.cpp#1 $ // // Library: Foundation // Package: Logging @@ -34,15 +34,15 @@ // -#include "Foundation/SimpleFileChannel.h" -#include "Foundation/LogFile.h" -#include "Foundation/File.h" -#include "Foundation/Message.h" -#include "Foundation/Exception.h" +#include "Poco/SimpleFileChannel.h" +#include "Poco/LogFile.h" +#include "Poco/File.h" +#include "Poco/Message.h" +#include "Poco/Exception.h" #include -Foundation_BEGIN +namespace Poco { const std::string SimpleFileChannel::PROP_PATH = "path"; @@ -225,4 +225,4 @@ void SimpleFileChannel::rotate() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/SplitterChannel.cpp b/Foundation/src/SplitterChannel.cpp index a84e1bfd1..4fc7812b0 100644 --- a/Foundation/src/SplitterChannel.cpp +++ b/Foundation/src/SplitterChannel.cpp @@ -1,7 +1,7 @@ // // SplitterChannel.cpp // -// $Id: //poco/1.1.0/Foundation/src/SplitterChannel.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/SplitterChannel.cpp#1 $ // // Library: Foundation // Package: Logging @@ -34,11 +34,11 @@ // -#include "Foundation/SplitterChannel.h" -#include "Foundation/LoggingRegistry.h" +#include "Poco/SplitterChannel.h" +#include "Poco/LoggingRegistry.h" -Foundation_BEGIN +namespace Poco { SplitterChannel::SplitterChannel() @@ -119,4 +119,4 @@ int SplitterChannel::count() const } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Stopwatch.cpp b/Foundation/src/Stopwatch.cpp index 8dcdb4ef8..b352d555d 100644 --- a/Foundation/src/Stopwatch.cpp +++ b/Foundation/src/Stopwatch.cpp @@ -1,7 +1,7 @@ // // Stopwatch.cpp // -// $Id: //poco/1.1.0/Foundation/src/Stopwatch.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Stopwatch.cpp#1 $ // // Library: Foundation // Package: DateTime @@ -34,10 +34,10 @@ // -#include "Foundation/Stopwatch.h" +#include "Poco/Stopwatch.h" -Foundation_BEGIN +namespace Poco { Stopwatch::Stopwatch(): _elapsed(0), _running(false) @@ -79,4 +79,4 @@ void Stopwatch::restart() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/StreamChannel.cpp b/Foundation/src/StreamChannel.cpp index e45a59fae..3f61e6fe7 100644 --- a/Foundation/src/StreamChannel.cpp +++ b/Foundation/src/StreamChannel.cpp @@ -1,7 +1,7 @@ // // StreamChannel.cpp // -// $Id: //poco/1.1.0/Foundation/src/StreamChannel.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/StreamChannel.cpp#1 $ // // Library: Foundation // Package: Logging @@ -34,11 +34,11 @@ // -#include "Foundation/StreamChannel.h" -#include "Foundation/Message.h" +#include "Poco/StreamChannel.h" +#include "Poco/Message.h" -Foundation_BEGIN +namespace Poco { StreamChannel::StreamChannel(std::ostream& str): _str(str) @@ -59,4 +59,4 @@ void StreamChannel::log(const Message& msg) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/StreamConverter.cpp b/Foundation/src/StreamConverter.cpp index dbc61780b..c35378bde 100644 --- a/Foundation/src/StreamConverter.cpp +++ b/Foundation/src/StreamConverter.cpp @@ -1,7 +1,7 @@ // // StreamConverter.cpp // -// $Id: //poco/1.1.0/Foundation/src/StreamConverter.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/StreamConverter.cpp#1 $ // // Library: Foundation // Package: Text @@ -34,11 +34,11 @@ // -#include "Foundation/StreamConverter.h" -#include "Foundation/TextEncoding.h" +#include "Poco/StreamConverter.h" +#include "Poco/TextEncoding.h" -Foundation_BEGIN +namespace Poco { StreamConverterBuf::StreamConverterBuf(std::istream& istr, const TextEncoding& inEncoding, const TextEncoding& outEncoding, int defaultChar): @@ -216,4 +216,4 @@ OutputStreamConverter::~OutputStreamConverter() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/StreamCopier.cpp b/Foundation/src/StreamCopier.cpp index 90c3bcfd1..37fa877db 100644 --- a/Foundation/src/StreamCopier.cpp +++ b/Foundation/src/StreamCopier.cpp @@ -1,7 +1,7 @@ // // StreamCopier.cpp // -// $Id: //poco/1.1.0/Foundation/src/StreamCopier.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/StreamCopier.cpp#1 $ // // Library: Foundation // Package: Streams @@ -34,11 +34,11 @@ // -#include "Foundation/StreamCopier.h" -#include "Foundation/Buffer.h" +#include "Poco/StreamCopier.h" +#include "Poco/Buffer.h" -Foundation_BEGIN +namespace Poco { std::streamsize StreamCopier::copyStream(std::istream& istr, std::ostream& ostr, unsigned bufferSize) @@ -102,4 +102,4 @@ std::streamsize StreamCopier::copyStreamUnbuffered(std::istream& istr, std::ostr } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/StreamTokenizer.cpp b/Foundation/src/StreamTokenizer.cpp index 61f6a59fd..ab1eed58f 100644 --- a/Foundation/src/StreamTokenizer.cpp +++ b/Foundation/src/StreamTokenizer.cpp @@ -1,7 +1,7 @@ // // StreamTokenizer.cpp // -// $Id: //poco/1.1.0/Foundation/src/StreamTokenizer.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/StreamTokenizer.cpp#1 $ // // Library: Foundation // Package: Streams @@ -34,10 +34,10 @@ // -#include "Foundation/StreamTokenizer.h" +#include "Poco/StreamTokenizer.h" -Foundation_BEGIN +namespace Poco { StreamTokenizer::StreamTokenizer(): @@ -124,4 +124,4 @@ const Token* StreamTokenizer::next() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/String.cpp b/Foundation/src/String.cpp index 2ceac6147..672f84c6b 100644 --- a/Foundation/src/String.cpp +++ b/Foundation/src/String.cpp @@ -1,7 +1,7 @@ // // String.h // -// $Id: //poco/1.1.0/Foundation/src/String.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/String.cpp#1 $ // // Library: Foundation // Package: Core @@ -34,10 +34,10 @@ // -#include "Foundation/String.h" +#include "Poco/String.h" -Foundation_BEGIN +namespace Poco { #if defined(POCO_NO_TEMPLATE_ICOMPARE) @@ -155,4 +155,4 @@ int icompare(const std::string& str, const std::string::value_type* ptr) #endif -Foundation_END +} // namespace Poco diff --git a/Foundation/src/StringTokenizer.cpp b/Foundation/src/StringTokenizer.cpp index 55a6df0fc..33cd3a89e 100644 --- a/Foundation/src/StringTokenizer.cpp +++ b/Foundation/src/StringTokenizer.cpp @@ -1,7 +1,7 @@ // // StringTokenizer.cpp // -// $Id: //poco/1.1.0/Foundation/src/StringTokenizer.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/StringTokenizer.cpp#1 $ // // Library: Foundation // Package: Core @@ -34,11 +34,11 @@ // -#include "Foundation/StringTokenizer.h" +#include "Poco/StringTokenizer.h" #include -Foundation_BEGIN +namespace Poco { StringTokenizer::StringTokenizer(const std::string& str, const std::string& separators, int options) @@ -84,4 +84,4 @@ StringTokenizer::~StringTokenizer() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/SynchronizedObject.cpp b/Foundation/src/SynchronizedObject.cpp index 51e8e633a..24b839b81 100644 --- a/Foundation/src/SynchronizedObject.cpp +++ b/Foundation/src/SynchronizedObject.cpp @@ -1,7 +1,7 @@ // // SynchronizedObject.cpp // -// $Id: //poco/1.1.0/Foundation/src/SynchronizedObject.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/SynchronizedObject.cpp#1 $ // // Library: Foundation // Package: Threading @@ -34,10 +34,10 @@ // -#include "Foundation/SynchronizedObject.h" +#include "Poco/SynchronizedObject.h" -Foundation_BEGIN +namespace Poco { SynchronizedObject::SynchronizedObject() @@ -50,4 +50,4 @@ SynchronizedObject::~SynchronizedObject() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/SyslogChannel.cpp b/Foundation/src/SyslogChannel.cpp index c255c5662..f77203800 100644 --- a/Foundation/src/SyslogChannel.cpp +++ b/Foundation/src/SyslogChannel.cpp @@ -1,7 +1,7 @@ // // SyslogChannel.cpp // -// $Id: //poco/1.1.0/Foundation/src/SyslogChannel.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/SyslogChannel.cpp#1 $ // // Library: Foundation // Package: Logging @@ -34,13 +34,13 @@ // -#include "Foundation/SyslogChannel.h" -#include "Foundation/Message.h" -#include "Foundation/StringTokenizer.h" +#include "Poco/SyslogChannel.h" +#include "Poco/Message.h" +#include "Poco/StringTokenizer.h" #include -Foundation_BEGIN +namespace Poco { const std::string SyslogChannel::PROP_NAME = "name"; @@ -275,4 +275,4 @@ int SyslogChannel::getPrio(const Message& msg) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Task.cpp b/Foundation/src/Task.cpp index 95dbbbe50..358466fbb 100644 --- a/Foundation/src/Task.cpp +++ b/Foundation/src/Task.cpp @@ -1,7 +1,7 @@ // // Task.cpp // -// $Id: //poco/1.1.0/Foundation/src/Task.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Task.cpp#1 $ // // Library: Foundation // Package: Tasks @@ -34,12 +34,12 @@ // -#include "Foundation/Task.h" -#include "Foundation/TaskManager.h" -#include "Foundation/Exception.h" +#include "Poco/Task.h" +#include "Poco/TaskManager.h" +#include "Poco/Exception.h" -Foundation_BEGIN +namespace Poco { Task::Task(const std::string& name): @@ -148,4 +148,4 @@ void Task::postNotification(Notification* pNf) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/TaskManager.cpp b/Foundation/src/TaskManager.cpp index d1b5ee4e6..5db04c0f1 100644 --- a/Foundation/src/TaskManager.cpp +++ b/Foundation/src/TaskManager.cpp @@ -1,7 +1,7 @@ // // TaskManager.cpp // -// $Id: //poco/1.1.0/Foundation/src/TaskManager.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/TaskManager.cpp#1 $ // // Library: Foundation // Package: Tasks @@ -34,12 +34,12 @@ // -#include "Foundation/TaskManager.h" -#include "Foundation/TaskNotification.h" -#include "Foundation/ThreadPool.h" +#include "Poco/TaskManager.h" +#include "Poco/TaskNotification.h" +#include "Poco/ThreadPool.h" -Foundation_BEGIN +namespace Poco { const int TaskManager::MIN_PROGRESS_NOTIFICATION_INTERVAL = 100000; // 100 milliseconds @@ -162,4 +162,4 @@ void TaskManager::taskFailed(Task* pTask, const Exception& exc) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/TaskNotification.cpp b/Foundation/src/TaskNotification.cpp index 9617c77e7..2526913be 100644 --- a/Foundation/src/TaskNotification.cpp +++ b/Foundation/src/TaskNotification.cpp @@ -1,7 +1,7 @@ // // TaskNotification.cpp // -// $Id: //poco/1.1.0/Foundation/src/TaskNotification.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/TaskNotification.cpp#1 $ // // Library: Foundation // Package: Tasks @@ -34,10 +34,10 @@ // -#include "Foundation/TaskNotification.h" +#include "Poco/TaskNotification.h" -Foundation_BEGIN +namespace Poco { TaskNotification::TaskNotification(Task* pTask): @@ -111,4 +111,4 @@ TaskProgressNotification::~TaskProgressNotification() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/TeeStream.cpp b/Foundation/src/TeeStream.cpp index 6e3ce902c..352bd091c 100644 --- a/Foundation/src/TeeStream.cpp +++ b/Foundation/src/TeeStream.cpp @@ -1,7 +1,7 @@ // // TeeStream.cpp // -// $Id: //poco/1.1.0/Foundation/src/TeeStream.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/TeeStream.cpp#1 $ // // Library: Foundation // Package: Streams @@ -34,10 +34,10 @@ // -#include "Foundation/TeeStream.h" +#include "Poco/TeeStream.h" -Foundation_BEGIN +namespace Poco { TeeStreamBuf::TeeStreamBuf(): @@ -152,4 +152,4 @@ TeeOutputStream::~TeeOutputStream() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/TemporaryFile.cpp b/Foundation/src/TemporaryFile.cpp index 8e82b3ffe..0abf61084 100644 --- a/Foundation/src/TemporaryFile.cpp +++ b/Foundation/src/TemporaryFile.cpp @@ -1,7 +1,7 @@ // // TemporaryFile.cpp // -// $Id: //poco/1.1.0/Foundation/src/TemporaryFile.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/TemporaryFile.cpp#1 $ // // Library: Foundation // Package: Filesystem @@ -34,16 +34,16 @@ // -#include "Foundation/TemporaryFile.h" -#include "Foundation/Path.h" -#include "Foundation/Exception.h" -#include "Foundation/Process.h" -#include "Foundation/Mutex.h" +#include "Poco/TemporaryFile.h" +#include "Poco/Path.h" +#include "Poco/Exception.h" +#include "Poco/Process.h" +#include "Poco/Mutex.h" #include #include -Foundation_BEGIN +namespace Poco { class TempFileCollector @@ -141,4 +141,4 @@ std::string TemporaryFile::tempName() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/TextConverter.cpp b/Foundation/src/TextConverter.cpp index 0848e562b..231f5fc49 100644 --- a/Foundation/src/TextConverter.cpp +++ b/Foundation/src/TextConverter.cpp @@ -1,7 +1,7 @@ // // TextConverter.cpp // -// $Id: //poco/1.1.0/Foundation/src/TextConverter.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/TextConverter.cpp#1 $ // // Library: Foundation // Package: Text @@ -34,12 +34,12 @@ // -#include "Foundation/TextConverter.h" -#include "Foundation/TextIterator.h" -#include "Foundation/TextEncoding.h" +#include "Poco/TextConverter.h" +#include "Poco/TextIterator.h" +#include "Poco/TextEncoding.h" -Foundation_BEGIN +namespace Poco { TextConverter::TextConverter(const TextEncoding& inEncoding, const TextEncoding& outEncoding, int defaultChar): @@ -124,4 +124,4 @@ int TextConverter::convert(const void* source, int length, std::string& destinat } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/TextEncoding.cpp b/Foundation/src/TextEncoding.cpp index ecb7b55cd..b4deea3a6 100644 --- a/Foundation/src/TextEncoding.cpp +++ b/Foundation/src/TextEncoding.cpp @@ -1,7 +1,7 @@ // // TextEncoding.cpp // -// $Id: //poco/1.1.0/Foundation/src/TextEncoding.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/TextEncoding.cpp#1 $ // // Library: Foundation // Package: Text @@ -34,10 +34,10 @@ // -#include "Foundation/TextEncoding.h" +#include "Poco/TextEncoding.h" -Foundation_BEGIN +namespace Poco { TextEncoding::~TextEncoding() @@ -57,5 +57,5 @@ int TextEncoding::convert(int ch, unsigned char* bytes, int length) const } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/TextIterator.cpp b/Foundation/src/TextIterator.cpp index 42036a5f5..89787a250 100644 --- a/Foundation/src/TextIterator.cpp +++ b/Foundation/src/TextIterator.cpp @@ -1,7 +1,7 @@ // // TextIterator.cpp // -// $Id: //poco/1.1.0/Foundation/src/TextIterator.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/TextIterator.cpp#1 $ // // Library: Foundation // Package: Text @@ -34,12 +34,12 @@ // -#include "Foundation/TextIterator.h" -#include "Foundation/TextEncoding.h" +#include "Poco/TextIterator.h" +#include "Poco/TextEncoding.h" #include -Foundation_BEGIN +namespace Poco { TextIterator::TextIterator(): @@ -49,32 +49,32 @@ TextIterator::TextIterator(): TextIterator::TextIterator(const std::string& str, const TextEncoding& encoding): + _pEncoding(&encoding), _it(str.begin()), - _end(str.end()), - _pEncoding(&encoding) + _end(str.end()) { } TextIterator::TextIterator(const std::string::const_iterator& begin, const std::string::const_iterator& end, const TextEncoding& encoding): + _pEncoding(&encoding), _it(begin), - _end(end), - _pEncoding(&encoding) + _end(end) { } TextIterator::TextIterator(const std::string& str): + _pEncoding(0), _it(str.end()), - _end(str.end()), - _pEncoding(0) + _end(str.end()) { } TextIterator::TextIterator(const std::string::const_iterator& end): + _pEncoding(0), _it(end), - _end(end), - _pEncoding(0) + _end(end) { } @@ -85,9 +85,9 @@ TextIterator::~TextIterator() TextIterator::TextIterator(const TextIterator& it): + _pEncoding(it._pEncoding), _it(it._it), - _end(it._end), - _pEncoding(it._pEncoding) + _end(it._end) { } @@ -96,9 +96,9 @@ TextIterator& TextIterator::operator = (const TextIterator& it) { if (&it != this) { + _pEncoding = it._pEncoding; _it = it._it; _end = it._end; - _pEncoding = it._pEncoding; } return *this; } @@ -106,9 +106,9 @@ TextIterator& TextIterator::operator = (const TextIterator& it) void TextIterator::swap(TextIterator& it) { + std::swap(_pEncoding, it._pEncoding); std::swap(_it, it._it); std::swap(_end, it._end); - std::swap(_pEncoding, it._pEncoding); } @@ -160,4 +160,4 @@ TextIterator TextIterator::operator ++ (int) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Thread.cpp b/Foundation/src/Thread.cpp index d0d764f2e..a8b3cdb65 100644 --- a/Foundation/src/Thread.cpp +++ b/Foundation/src/Thread.cpp @@ -1,7 +1,7 @@ // // Thread.cpp // -// $Id: //poco/1.1.0/Foundation/src/Thread.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Thread.cpp#1 $ // // Library: Foundation // Package: Threading @@ -34,10 +34,10 @@ // -#include "Foundation/Thread.h" -#include "Foundation/Mutex.h" -#include "Foundation/Exception.h" -#include "Foundation/ThreadLocal.h" +#include "Poco/Thread.h" +#include "Poco/Mutex.h" +#include "Poco/Exception.h" +#include "Poco/ThreadLocal.h" #include @@ -48,7 +48,7 @@ #endif -Foundation_BEGIN +namespace Poco { Thread::Thread(): @@ -140,4 +140,4 @@ void Thread::setName(const std::string& name) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/ThreadLocal.cpp b/Foundation/src/ThreadLocal.cpp index 9738a9801..7ff4da7da 100644 --- a/Foundation/src/ThreadLocal.cpp +++ b/Foundation/src/ThreadLocal.cpp @@ -1,7 +1,7 @@ // // ThreadLocal.cpp // -// $Id: //poco/1.1.0/Foundation/src/ThreadLocal.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/ThreadLocal.cpp#1 $ // // Library: Foundation // Package: Threading @@ -34,12 +34,12 @@ // -#include "Foundation/ThreadLocal.h" -#include "Foundation/SingletonHolder.h" -#include "Foundation/Thread.h" +#include "Poco/ThreadLocal.h" +#include "Poco/SingletonHolder.h" +#include "Poco/Thread.h" -Foundation_BEGIN +namespace Poco { TLSAbstractSlot::TLSAbstractSlot() @@ -99,4 +99,4 @@ void ThreadLocalStorage::clear() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/ThreadPool.cpp b/Foundation/src/ThreadPool.cpp index b1a1281d7..ad1c09da8 100644 --- a/Foundation/src/ThreadPool.cpp +++ b/Foundation/src/ThreadPool.cpp @@ -1,7 +1,7 @@ // // ThreadPool.cpp // -// $Id: //poco/1.1.0/Foundation/src/ThreadPool.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/ThreadPool.cpp#1 $ // // Library: Foundation // Package: Threading @@ -34,17 +34,17 @@ // -#include "Foundation/ThreadPool.h" -#include "Foundation/Runnable.h" -#include "Foundation/Thread.h" -#include "Foundation/Event.h" -#include "Foundation/ThreadLocal.h" -#include "Foundation/ErrorHandler.h" +#include "Poco/ThreadPool.h" +#include "Poco/Runnable.h" +#include "Poco/Thread.h" +#include "Poco/Event.h" +#include "Poco/ThreadLocal.h" +#include "Poco/ErrorHandler.h" #include #include -Foundation_BEGIN +namespace Poco { class PooledThread: public Runnable @@ -54,8 +54,8 @@ public: ~PooledThread(); void start(); - void start(Runnable& target); - void start(Runnable& target, const std::string& name); + void start(Thread::Priority priority, Runnable& target); + void start(Thread::Priority priority, Runnable& target, const std::string& name); bool idle(); int idleTime(); void join(); @@ -66,13 +66,13 @@ public: private: volatile bool _idle; volatile time_t _idleTime; - Runnable* _pTarget; - std::string _name; - Thread _thread; - Event _targetReady; - Event _targetCompleted; - Event _started; - FastMutex _mutex; + Runnable* _pTarget; + std::string _name; + Thread _thread; + Event _targetReady; + Event _targetCompleted; + Event _started; + FastMutex _mutex; }; @@ -99,18 +99,19 @@ void PooledThread::start() } -void PooledThread::start(Runnable& target) +void PooledThread::start(Thread::Priority priority, Runnable& target) { FastMutex::ScopedLock lock(_mutex); poco_assert (_pTarget == 0); _pTarget = ⌖ + _thread.setPriority(priority); _targetReady.set(); } -void PooledThread::start(Runnable& target, const std::string& name) +void PooledThread::start(Thread::Priority priority, Runnable& target, const std::string& name) { FastMutex::ScopedLock lock(_mutex); @@ -126,6 +127,7 @@ void PooledThread::start(Runnable& target, const std::string& name) fullName.append(")"); } _thread.setName(fullName); + _thread.setPriority(priority); poco_assert (_pTarget == 0); @@ -220,6 +222,7 @@ void PooledThread::run() _targetCompleted.set(); ThreadLocalStorage::clear(); _thread.setName(_name); + _thread.setPriority(Thread::PRIO_NORMAL); } else { @@ -325,13 +328,25 @@ int ThreadPool::allocated() const void ThreadPool::start(Runnable& target) { - getThread()->start(target); + getThread()->start(Thread::PRIO_NORMAL, target); } void ThreadPool::start(Runnable& target, const std::string& name) { - getThread()->start(target, name); + getThread()->start(Thread::PRIO_NORMAL, target, name); +} + + +void ThreadPool::startWithPriority(Thread::Priority priority, Runnable& target) +{ + getThread()->start(priority, target); +} + + +void ThreadPool::startWithPriority(Thread::Priority priority, Runnable& target, const std::string& name) +{ + getThread()->start(priority, target, name); } @@ -458,4 +473,4 @@ ThreadPool& ThreadPool::defaultPool() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Thread_POSIX.cpp b/Foundation/src/Thread_POSIX.cpp index 7fcc82b8e..d96cc3ffb 100644 --- a/Foundation/src/Thread_POSIX.cpp +++ b/Foundation/src/Thread_POSIX.cpp @@ -1,7 +1,7 @@ // // Thread_POSIX.cpp // -// $Id: //poco/1.1.0/Foundation/src/Thread_POSIX.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Thread_POSIX.cpp#1 $ // // Library: Foundation // Package: Threading @@ -34,9 +34,9 @@ // -#include "Foundation/Thread_POSIX.h" -#include "Foundation/Exception.h" -#include "Foundation/ErrorHandler.h" +#include "Poco/Thread_POSIX.h" +#include "Poco/Exception.h" +#include "Poco/ErrorHandler.h" #include @@ -66,7 +66,7 @@ namespace #endif -Foundation_BEGIN +namespace Poco { pthread_key_t ThreadImpl::_currentKey; @@ -218,4 +218,4 @@ int ThreadImpl::mapPrio(int prio) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Thread_WIN32.cpp b/Foundation/src/Thread_WIN32.cpp index 218332cdf..23fb3095a 100644 --- a/Foundation/src/Thread_WIN32.cpp +++ b/Foundation/src/Thread_WIN32.cpp @@ -1,7 +1,7 @@ // // Thread_WIN32.h // -// $Id: //poco/1.1.0/Foundation/src/Thread_WIN32.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Thread_WIN32.cpp#1 $ // // Library: Foundation // Package: Threading @@ -34,13 +34,13 @@ // -#include "Foundation/Thread_WIN32.h" -#include "Foundation/Exception.h" -#include "Foundation/ErrorHandler.h" +#include "Poco/Thread_WIN32.h" +#include "Poco/Exception.h" +#include "Poco/ErrorHandler.h" #include -Foundation_BEGIN +namespace Poco { DWORD ThreadImpl::_currentKey = TLS_OUT_OF_INDEXES; @@ -157,4 +157,4 @@ unsigned __stdcall ThreadImpl::entry(void* pThread) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Timer.cpp b/Foundation/src/Timer.cpp index b140fbf89..106979142 100644 --- a/Foundation/src/Timer.cpp +++ b/Foundation/src/Timer.cpp @@ -1,7 +1,7 @@ // // Timer.cpp // -// $Id: //poco/1.1.0/Foundation/src/Timer.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Timer.cpp#1 $ // // Library: Foundation // Package: Threading @@ -34,13 +34,13 @@ // -#include "Foundation/Timer.h" -#include "Foundation/ThreadPool.h" -#include "Foundation/Exception.h" -#include "Foundation/ErrorHandler.h" +#include "Poco/Timer.h" +#include "Poco/ThreadPool.h" +#include "Poco/Exception.h" +#include "Poco/ErrorHandler.h" -Foundation_BEGIN +namespace Poco { Timer::Timer(long startInterval, long periodicInterval): @@ -59,13 +59,19 @@ Timer::~Timer() void Timer::start(const AbstractTimerCallback& method) +{ + start(method, ThreadPool::defaultPool()); +} + + +void Timer::start(const AbstractTimerCallback& method, ThreadPool& threadPool) { poco_assert (!_pCallback); FastMutex::ScopedLock lock(_mutex); _pCallback = method.clone(); _wakeUp.reset(); - ThreadPool::defaultPool().start(*this); + threadPool.start(*this); } @@ -201,4 +207,4 @@ AbstractTimerCallback& AbstractTimerCallback::operator = (const AbstractTimerCal } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Timespan.cpp b/Foundation/src/Timespan.cpp index 454fe0c67..652972e8b 100644 --- a/Foundation/src/Timespan.cpp +++ b/Foundation/src/Timespan.cpp @@ -1,7 +1,7 @@ // // Timespan.cpp // -// $Id: //poco/1.1.0/Foundation/src/Timespan.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Timespan.cpp#1 $ // // Library: Foundation // Package: DateTime @@ -34,11 +34,11 @@ // -#include "Foundation/Timespan.h" +#include "Poco/Timespan.h" #include -Foundation_BEGIN +namespace Poco { const Timespan::TimeDiff Timespan::MILLISECONDS = 1000; @@ -169,4 +169,4 @@ Timespan& Timespan::operator -= (TimeDiff microseconds) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Timestamp.cpp b/Foundation/src/Timestamp.cpp index 436f126d3..3d05f65a9 100644 --- a/Foundation/src/Timestamp.cpp +++ b/Foundation/src/Timestamp.cpp @@ -1,7 +1,7 @@ // // Timestamp.cpp // -// $Id: //poco/1.1.0/Foundation/src/Timestamp.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Timestamp.cpp#1 $ // // Library: Foundation // Package: DateTime @@ -34,8 +34,8 @@ // -#include "Foundation/Timestamp.h" -#include "Foundation/Exception.h" +#include "Poco/Timestamp.h" +#include "Poco/Exception.h" #include #if defined(POCO_OS_FAMILY_UNIX) #include @@ -46,7 +46,7 @@ #endif -Foundation_BEGIN +namespace Poco { Timestamp::Timestamp() @@ -169,4 +169,4 @@ void Timestamp::toFileTimeNP(UInt32& fileTimeLow, UInt32& fileTimeHigh) const -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Timezone.cpp b/Foundation/src/Timezone.cpp index 384303a39..3a3fa6308 100644 --- a/Foundation/src/Timezone.cpp +++ b/Foundation/src/Timezone.cpp @@ -1,7 +1,7 @@ // // Timezone.cpp // -// $Id: //poco/1.1.0/Foundation/src/Timezone.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Timezone.cpp#1 $ // // Library: Foundation // Package: DateTime @@ -34,7 +34,7 @@ // -#include "Foundation/Timezone.h" +#include "Poco/Timezone.h" #include @@ -45,7 +45,7 @@ #endif -Foundation_BEGIN +namespace Poco { int Timezone::tzd() @@ -54,4 +54,4 @@ int Timezone::tzd() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Timezone_UNIX.cpp b/Foundation/src/Timezone_UNIX.cpp index 5fff1a507..fdecaea77 100644 --- a/Foundation/src/Timezone_UNIX.cpp +++ b/Foundation/src/Timezone_UNIX.cpp @@ -1,7 +1,7 @@ // // Timezone_UNIX.cpp // -// $Id: //poco/1.1.0/Foundation/src/Timezone_UNIX.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Timezone_UNIX.cpp#1 $ // // Library: Foundation // Package: DateTime @@ -34,11 +34,11 @@ // -#include "Foundation/Timezone.h" +#include "Poco/Timezone.h" #include -Foundation_BEGIN +namespace Poco { class TZInfo @@ -58,9 +58,9 @@ public: time_t utc = mktime(&t); return now - utc; #elif defined(__CYGWIN__) - return _timezone; + return -_timezone; #else - return timezone; + return -timezone; #endif } @@ -85,7 +85,7 @@ int Timezone::dst() time_t now = time(NULL); struct tm t; localtime_r(&now, &t); - return t.tm_isdst == 1 ? -3600 : 0; + return t.tm_isdst == 1 ? 3600 : 0; } @@ -115,4 +115,4 @@ std::string Timezone::dstName() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Timezone_WIN32.cpp b/Foundation/src/Timezone_WIN32.cpp index 4f07cd360..27bbfd35f 100644 --- a/Foundation/src/Timezone_WIN32.cpp +++ b/Foundation/src/Timezone_WIN32.cpp @@ -1,7 +1,7 @@ // // Timezone_WIN32.cpp // -// $Id: //poco/1.1.0/Foundation/src/Timezone_WIN32.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Timezone_WIN32.cpp#1 $ // // Library: Foundation // Package: DateTime @@ -34,12 +34,12 @@ // -#include "Foundation/Timezone.h" +#include "Poco/Timezone.h" #include #include -Foundation_BEGIN +namespace Poco { int Timezone::utcOffset() @@ -99,4 +99,4 @@ std::string Timezone::dstName() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/Token.cpp b/Foundation/src/Token.cpp index 1736e6be7..ca63488c6 100644 --- a/Foundation/src/Token.cpp +++ b/Foundation/src/Token.cpp @@ -1,7 +1,7 @@ // // Token.cpp // -// $Id: //poco/1.1.0/Foundation/src/Token.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Token.cpp#1 $ // // Library: Foundation // Package: Streams @@ -34,12 +34,12 @@ // -#include "Foundation/Token.h" -#include "Foundation/NumberParser.h" +#include "Poco/Token.h" +#include "Poco/NumberParser.h" #include -Foundation_BEGIN +namespace Poco { Token::Token() @@ -165,4 +165,4 @@ void WhitespaceToken::finish(std::istream& istr) } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/URI.cpp b/Foundation/src/URI.cpp index 788f3363b..8bdf49388 100644 --- a/Foundation/src/URI.cpp +++ b/Foundation/src/URI.cpp @@ -1,7 +1,7 @@ // // URI.cpp // -// $Id: //poco/1.1.0/Foundation/src/URI.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/URI.cpp#1 $ // // Library: Foundation // Package: URI @@ -34,14 +34,14 @@ // -#include "Foundation/URI.h" -#include "Foundation/NumberFormatter.h" -#include "Foundation/Exception.h" -#include "Foundation/String.h" -#include "Foundation/NumberParser.h" +#include "Poco/URI.h" +#include "Poco/NumberFormatter.h" +#include "Poco/Exception.h" +#include "Poco/String.h" +#include "Poco/NumberParser.h" -Foundation_BEGIN +namespace Poco { const std::string URI::RESERVED_PATH = "?#"; @@ -838,4 +838,4 @@ void URI::buildPath(const std::vector& segments, bool leadingSlash, } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/URIStreamFactory.cpp b/Foundation/src/URIStreamFactory.cpp index 82e170062..c3b0a0cb7 100644 --- a/Foundation/src/URIStreamFactory.cpp +++ b/Foundation/src/URIStreamFactory.cpp @@ -1,7 +1,7 @@ // // URIStreamFactory.cpp // -// $Id: //poco/1.1.0/Foundation/src/URIStreamFactory.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/URIStreamFactory.cpp#1 $ // // Library: Foundation // Package: URI @@ -34,10 +34,10 @@ // -#include "Foundation/URIStreamFactory.h" +#include "Poco/URIStreamFactory.h" -Foundation_BEGIN +namespace Poco { URIStreamFactory::URIStreamFactory() @@ -50,4 +50,4 @@ URIStreamFactory::~URIStreamFactory() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/URIStreamOpener.cpp b/Foundation/src/URIStreamOpener.cpp index c3bcb396b..d589b6656 100644 --- a/Foundation/src/URIStreamOpener.cpp +++ b/Foundation/src/URIStreamOpener.cpp @@ -1,7 +1,7 @@ // // URIStreamOpener.cpp // -// $Id: //poco/1.1.0/Foundation/src/URIStreamOpener.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/URIStreamOpener.cpp#1 $ // // Library: Foundation // Package: URI @@ -34,16 +34,16 @@ // -#include "Foundation/URIStreamOpener.h" -#include "Foundation/URIStreamFactory.h" -#include "Foundation/FileStreamFactory.h" -#include "Foundation/URI.h" -#include "Foundation/Path.h" -#include "Foundation/SingletonHolder.h" -#include "Foundation/Exception.h" +#include "Poco/URIStreamOpener.h" +#include "Poco/URIStreamFactory.h" +#include "Poco/FileStreamFactory.h" +#include "Poco/URI.h" +#include "Poco/Path.h" +#include "Poco/SingletonHolder.h" +#include "Poco/Exception.h" -Foundation_BEGIN +namespace Poco { URIStreamOpener::URIStreamOpener() @@ -171,4 +171,4 @@ std::istream* URIStreamOpener::openFile(const Path& path) const -Foundation_END +} // namespace Poco diff --git a/Foundation/src/UTF16Encoding.cpp b/Foundation/src/UTF16Encoding.cpp index e9ac1e242..40ec6a578 100644 --- a/Foundation/src/UTF16Encoding.cpp +++ b/Foundation/src/UTF16Encoding.cpp @@ -1,7 +1,7 @@ // // UTF16Encoding.cpp // -// $Id: //poco/1.1.0/Foundation/src/UTF16Encoding.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/UTF16Encoding.cpp#1 $ // // Library: Foundation // Package: Text @@ -34,11 +34,11 @@ // -#include "Foundation/UTF16Encoding.h" -#include "Foundation/ByteOrder.h" +#include "Poco/UTF16Encoding.h" +#include "Poco/ByteOrder.h" -Foundation_BEGIN +namespace Poco { const TextEncoding::CharacterMap UTF16Encoding::_charMap = @@ -128,7 +128,7 @@ int UTF16Encoding::convert(int ch, unsigned char* bytes, int length) const if (length >= 2) { UInt16 ch1 = _flipBytes ? ByteOrder::flipBytes((UInt16) ch) : (UInt16) ch; - unsigned char* p = (unsigned char*) &ch; + unsigned char* p = (unsigned char*) &ch1; *bytes++ = *p++; *bytes++ = *p++; } @@ -158,4 +158,4 @@ int UTF16Encoding::convert(int ch, unsigned char* bytes, int length) const } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/UTF8Encoding.cpp b/Foundation/src/UTF8Encoding.cpp index 2246dab18..a68f353d8 100644 --- a/Foundation/src/UTF8Encoding.cpp +++ b/Foundation/src/UTF8Encoding.cpp @@ -1,7 +1,7 @@ // // UTF8Encoding.cpp // -// $Id: //poco/1.1.0/Foundation/src/UTF8Encoding.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/UTF8Encoding.cpp#1 $ // // Library: Foundation // Package: Text @@ -34,10 +34,10 @@ // -#include "Foundation/UTF8Encoding.h" +#include "Poco/UTF8Encoding.h" -Foundation_BEGIN +namespace Poco { const TextEncoding::CharacterMap UTF8Encoding::_charMap = @@ -157,4 +157,4 @@ int UTF8Encoding::convert(int ch, unsigned char* bytes, int length) const } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/UUID.cpp b/Foundation/src/UUID.cpp index 708964eb2..76c22aa55 100644 --- a/Foundation/src/UUID.cpp +++ b/Foundation/src/UUID.cpp @@ -1,7 +1,7 @@ // // UUID.cpp // -// $Id: //poco/1.1.0/Foundation/src/UUID.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/UUID.cpp#1 $ // // Library: Foundation // Package: UUID @@ -34,14 +34,14 @@ // -#include "Foundation/UUID.h" -#include "Foundation/ByteOrder.h" -#include "Foundation/Exception.h" +#include "Poco/UUID.h" +#include "Poco/ByteOrder.h" +#include "Poco/Exception.h" #include #include -Foundation_BEGIN +namespace Poco { UUID::UUID(): @@ -369,4 +369,4 @@ const UUID& UUID::x500() } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/UUIDGenerator.cpp b/Foundation/src/UUIDGenerator.cpp index a79748b7e..7d645babf 100644 --- a/Foundation/src/UUIDGenerator.cpp +++ b/Foundation/src/UUIDGenerator.cpp @@ -1,7 +1,7 @@ // // UUIDGenerator.cpp // -// $Id: //poco/1.1.0/Foundation/src/UUIDGenerator.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/UUIDGenerator.cpp#1 $ // // Library: Foundation // Package: UUID @@ -34,16 +34,16 @@ // -#include "Foundation/UUIDGenerator.h" -#include "Foundation/Thread.h" -#include "Foundation/RandomStream.h" -#include "Foundation/DigestEngine.h" -#include "Foundation/MD5Engine.h" -#include "Foundation/SingletonHolder.h" +#include "Poco/UUIDGenerator.h" +#include "Poco/Thread.h" +#include "Poco/RandomStream.h" +#include "Poco/DigestEngine.h" +#include "Poco/MD5Engine.h" +#include "Poco/SingletonHolder.h" #include -Foundation_BEGIN +namespace Poco { UUIDGenerator::UUIDGenerator(): _ticks(0), _haveNode(false) @@ -152,7 +152,7 @@ UUIDGenerator& UUIDGenerator::defaultGenerator() } -Foundation_END +} // namespace Poco // @@ -164,66 +164,59 @@ Foundation_END // // Windows // -// The following code is based on the example code -// from the MSDN knowledge base article ID 118623: -// "How To Get the MAC Address for an Ethernet Adapter". -// #include -#include -#include +#include -Foundation_BEGIN - - -struct ASTAT -{ - ADAPTER_STATUS adapt; - NAME_BUFFER nameBuffer[30]; -}; +namespace Poco { void UUIDGenerator::getNode() { - ASTAT adapter; - NCB ncb; - LANA_ENUM lenum; - - memset(&ncb, 0, sizeof(ncb)); - ncb.ncb_command = NCBENUM; - ncb.ncb_buffer = (UCHAR*) &lenum; - ncb.ncb_length = sizeof(lenum); - UCHAR rc = Netbios(&ncb); - if (rc) throw SystemException("cannot enumerate network adapters"); - bool foundEtherNet = false; - for (int i = 0; i < lenum.length; i++) + PIP_ADAPTER_INFO pAdapterInfo; + PIP_ADAPTER_INFO pAdapter = 0; + ULONG len = sizeof(IP_ADAPTER_INFO); + pAdapterInfo = reinterpret_cast(new char[len]); + // Make an initial call to GetAdaptersInfo to get + // the necessary size into len + DWORD rc = GetAdaptersInfo(pAdapterInfo, &len); + if (rc == ERROR_BUFFER_OVERFLOW) { - memset(&ncb, 0, sizeof(ncb)); - ncb.ncb_command = NCBRESET; - ncb.ncb_lana_num = lenum.lana[i]; - rc = Netbios(&ncb); - if (rc) throw SystemException("cannot determine MAC address (NCBRESET failed)"); - - memset(&ncb, 0, sizeof(ncb)); - ncb.ncb_command = NCBASTAT; - ncb.ncb_lana_num = lenum.lana[i]; - ncb.ncb_buffer = (UCHAR*) &adapter; - ncb.ncb_length = sizeof(adapter); - strcpy((char*) ncb.ncb_callname, "*"); - rc = Netbios(&ncb); - if (rc) throw SystemException("cannot determine MAC address (NCBASTAT failed)"); - if (adapter.adapt.adapter_type == 0xFE) - { - memcpy(_node, adapter.adapt.adapter_address, sizeof(_node)); - foundEtherNet = true; - break; - } + delete [] reinterpret_cast(pAdapterInfo); + pAdapterInfo = reinterpret_cast(new char[len]); } - if (!foundEtherNet) throw SystemException("cannot determine MAC address (no Ethernet adapter found)"); + else if (rc != ERROR_SUCCESS) + { + throw SystemException("cannot get network adapter list"); + } + try + { + bool found = false; + if (GetAdaptersInfo(pAdapterInfo, &len) == NO_ERROR) + { + pAdapter = pAdapterInfo; + while (pAdapter && !found) + { + if (pAdapter->Type == MIB_IF_TYPE_ETHERNET && pAdapter->AddressLength == sizeof(_node)) + { + memcpy(_node, pAdapter->Address, pAdapter->AddressLength); + found = true; + } + } + } + else throw SystemException("cannot get network adapter list"); + if (!found) throw SystemException("no Ethernet adapter found"); + } + catch (Exception&) + { + delete [] reinterpret_cast(pAdapterInfo); + throw; + } + delete [] reinterpret_cast(pAdapterInfo); } -Foundation_END +} // namespace Poco #elif defined(POCO_OS_FAMILY_BSD) || POCO_OS == POCO_OS_QNX @@ -236,7 +229,7 @@ Foundation_END #include -Foundation_BEGIN +namespace Poco { void UUIDGenerator::getNode() @@ -266,7 +259,7 @@ void UUIDGenerator::getNode() } -Foundation_END +} // namespace Poco #elif defined(__CYGWIN__) || POCO_OS == POCO_OS_LINUX @@ -281,7 +274,7 @@ Foundation_END #include -Foundation_BEGIN +namespace Poco { void UUIDGenerator::getNode() @@ -300,7 +293,7 @@ void UUIDGenerator::getNode() } -Foundation_END +} // namespace Poco #elif defined(POCO_OS_FAMILY_UNIX) || defined(POCO_OS_FAMILY_VMS) @@ -335,7 +328,7 @@ Foundation_END #endif -Foundation_BEGIN +namespace Poco { void UUIDGenerator::getNode() @@ -362,7 +355,7 @@ void UUIDGenerator::getNode() } -Foundation_END +} // namespace Poco #endif diff --git a/Foundation/src/UnicodeConverter.cpp b/Foundation/src/UnicodeConverter.cpp index 5939fbb0e..74cf3b3fc 100644 --- a/Foundation/src/UnicodeConverter.cpp +++ b/Foundation/src/UnicodeConverter.cpp @@ -1,7 +1,7 @@ // // UnicodeConverter.cpp // -// $Id: //poco/1.1.0/Foundation/src/UnicodeConverter.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/UnicodeConverter.cpp#1 $ // // Library: Foundation // Package: Text @@ -34,16 +34,19 @@ // -#include "Foundation/UnicodeConverter.h" -#include "Foundation/TextConverter.h" -#include "Foundation/TextIterator.h" -#include "Foundation/UTF8Encoding.h" -#include "Foundation/UTF16Encoding.h" +#ifndef POCO_NO_WSTRING + + +#include "Poco/UnicodeConverter.h" +#include "Poco/TextConverter.h" +#include "Poco/TextIterator.h" +#include "Poco/UTF8Encoding.h" +#include "Poco/UTF16Encoding.h" #include #include -Foundation_BEGIN +namespace Poco { void UnicodeConverter::toUTF16(const std::string& utf8String, std::wstring& utf16String) @@ -71,7 +74,7 @@ void UnicodeConverter::toUTF16(const char* utf8String, int length, std::wstring& { unsigned char c = *it; int n = utf8Encoding.characterMap()[c]; - int uc; + int uc = '?'; if (n == -1) { ++it; @@ -88,10 +91,6 @@ void UnicodeConverter::toUTF16(const char* utf8String, int length, std::wstring& uc = utf8Encoding.convert(it); if (uc == -1) uc = '?'; } - else - { - uc = '?'; - } it -= n; } utf16String += (wchar_t) uc; // TODO: surrogates @@ -131,4 +130,7 @@ void UnicodeConverter::toUTF8(const wchar_t* utf16String, std::string& utf8Strin } -Foundation_END +} // namespace Poco + + +#endif // POCO_NO_WSTRING diff --git a/Foundation/src/Void.cpp b/Foundation/src/Void.cpp new file mode 100644 index 000000000..a8fdfd982 --- /dev/null +++ b/Foundation/src/Void.cpp @@ -0,0 +1,79 @@ +// +// Void.cpp +// +// $Id: //poco/1.2/Foundation/src/Void.cpp#1 $ +// +// Library: Foundation +// Package: Core +// Module: Void +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Redistributions in any form must be accompanied by information on +// how to obtain complete source code for this software and any +// accompanying software that uses this software. The source code +// must either be included in the distribution or be available for no +// more than the cost of distribution plus a nominal fee, and must be +// freely redistributable under reasonable conditions. For an +// executable file, complete source code means the source code for all +// modules it contains. It does not include source code for modules or +// files that typically accompany the major components of the operating +// system on which the executable file runs. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + + +#include "Poco/Void.h" + + +namespace Poco { + + +Void::Void() +{ +} + + +Void::Void(const Void& v) +{ + v; +} + + +Void::~Void() +{ +} + + +Void& Void::operator = (const Void& v) +{ + v; + return *this; +} + + +} // namespace Poco diff --git a/Foundation/src/Windows1252Encoding.cpp b/Foundation/src/Windows1252Encoding.cpp index de081b05d..8e64f6c9d 100644 --- a/Foundation/src/Windows1252Encoding.cpp +++ b/Foundation/src/Windows1252Encoding.cpp @@ -1,7 +1,7 @@ // // Windows1252Encoding.cpp // -// $Id: //poco/1.1.0/Foundation/src/Windows1252Encoding.cpp#2 $ +// $Id: //poco/1.2/Foundation/src/Windows1252Encoding.cpp#1 $ // // Library: Foundation // Package: Text @@ -34,10 +34,10 @@ // -#include "Foundation/Windows1252Encoding.h" +#include "Poco/Windows1252Encoding.h" -Foundation_BEGIN +namespace Poco { const TextEncoding::CharacterMap Windows1252Encoding::_charMap = @@ -95,4 +95,4 @@ int Windows1252Encoding::convert(int ch, unsigned char* bytes, int length) const } -Foundation_END +} // namespace Poco diff --git a/Foundation/src/compress.c b/Foundation/src/compress.c index 1e2f11daa..0d0f2cd37 100644 --- a/Foundation/src/compress.c +++ b/Foundation/src/compress.c @@ -3,7 +3,7 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -/* @(#) $Id: //poco/1.1.0/Foundation/src/compress.c#1 $ */ +/* @(#) $Id: //poco/1.2/Foundation/src/compress.c#1 $ */ #define ZLIB_INTERNAL #include "zlib.h" diff --git a/Foundation/src/crc32.c b/Foundation/src/crc32.c index 61343c4a2..2dacc87c9 100644 --- a/Foundation/src/crc32.c +++ b/Foundation/src/crc32.c @@ -9,7 +9,7 @@ * factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3. */ -/* @(#) $Id: //poco/1.1.0/Foundation/src/crc32.c#1 $ */ +/* @(#) $Id: //poco/1.2/Foundation/src/crc32.c#1 $ */ /* Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore diff --git a/Foundation/src/deflate.c b/Foundation/src/deflate.c index 5e38a0ee7..58091fd5c 100644 --- a/Foundation/src/deflate.c +++ b/Foundation/src/deflate.c @@ -47,7 +47,7 @@ * */ -/* @(#) $Id: //poco/1.1.0/Foundation/src/deflate.c#1 $ */ +/* @(#) $Id: //poco/1.2/Foundation/src/deflate.c#1 $ */ #include "deflate.h" diff --git a/Foundation/src/deflate.h b/Foundation/src/deflate.h index a9f180306..493104dc1 100644 --- a/Foundation/src/deflate.h +++ b/Foundation/src/deflate.h @@ -8,7 +8,7 @@ subject to change. Applications should only use zlib.h. */ -/* @(#) $Id: //poco/1.1.0/Foundation/src/deflate.h#1 $ */ +/* @(#) $Id: //poco/1.2/Foundation/src/deflate.h#1 $ */ #ifndef DEFLATE_H #define DEFLATE_H diff --git a/Foundation/src/gzio.c b/Foundation/src/gzio.c index 36819f7f9..27db80189 100644 --- a/Foundation/src/gzio.c +++ b/Foundation/src/gzio.c @@ -5,7 +5,7 @@ * Compile this file with -DNO_GZCOMPRESS to avoid the compression code. */ -/* @(#) $Id: //poco/1.1.0/Foundation/src/gzio.c#1 $ */ +/* @(#) $Id: //poco/1.2/Foundation/src/gzio.c#1 $ */ #include diff --git a/Foundation/src/pocomsg.h b/Foundation/src/pocomsg.h index e882d6401..7bd92f34c 100644 --- a/Foundation/src/pocomsg.h +++ b/Foundation/src/pocomsg.h @@ -1,7 +1,7 @@ // // pocomsg.mc[.h] // -// $Id: //poco/1.1.0/Foundation/src/pocomsg.mc#1 $ +// $Id: //poco/1.2/Foundation/src/pocomsg.h#1 $ // // The Poco message source/header file. // diff --git a/Foundation/src/pocomsg.mc b/Foundation/src/pocomsg.mc index c3f128aa5..a7483bb9a 100644 --- a/Foundation/src/pocomsg.mc +++ b/Foundation/src/pocomsg.mc @@ -1,7 +1,7 @@ ;// ;// pocomsg.mc[.h] ;// -;// $Id: //poco/1.1.0/Foundation/src/pocomsg.mc#2 $ +;// $Id: //poco/1.2/Foundation/src/pocomsg.mc#1 $ ;// ;// The Poco message source/header file. ;// diff --git a/Foundation/src/trees.c b/Foundation/src/trees.c index eb9f371a0..84f71dda9 100644 --- a/Foundation/src/trees.c +++ b/Foundation/src/trees.c @@ -29,7 +29,7 @@ * Addison-Wesley, 1983. ISBN 0-201-06672-6. */ -/* @(#) $Id: //poco/1.1.0/Foundation/src/trees.c#1 $ */ +/* @(#) $Id: //poco/1.2/Foundation/src/trees.c#1 $ */ /* #define GEN_TREES_H */ diff --git a/Foundation/src/zconf.h b/Foundation/src/zconf.h index a05c0511e..0a98d644d 100644 --- a/Foundation/src/zconf.h +++ b/Foundation/src/zconf.h @@ -3,7 +3,7 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -/* @(#) $Id: //poco/1.1.0/Foundation/src/zconf.h#1 $ */ +/* @(#) $Id: //poco/1.2/Foundation/src/zconf.h#1 $ */ #ifndef ZCONF_H #define ZCONF_H diff --git a/Foundation/src/zutil.c b/Foundation/src/zutil.c index 770d9390e..18cd13b7a 100644 --- a/Foundation/src/zutil.c +++ b/Foundation/src/zutil.c @@ -3,7 +3,7 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -/* @(#) $Id: //poco/1.1.0/Foundation/src/zutil.c#1 $ */ +/* @(#) $Id: //poco/1.2/Foundation/src/zutil.c#1 $ */ #include "zutil.h" diff --git a/Foundation/src/zutil.h b/Foundation/src/zutil.h index a9a702024..e223c12f8 100644 --- a/Foundation/src/zutil.h +++ b/Foundation/src/zutil.h @@ -8,7 +8,7 @@ subject to change. Applications should only use zlib.h. */ -/* @(#) $Id: //poco/1.1.0/Foundation/src/zutil.h#1 $ */ +/* @(#) $Id: //poco/1.2/Foundation/src/zutil.h#1 $ */ #ifndef ZUTIL_H #define ZUTIL_H diff --git a/Foundation/testsuite/Makefile b/Foundation/testsuite/Makefile index a58b26a58..c74021cfb 100644 --- a/Foundation/testsuite/Makefile +++ b/Foundation/testsuite/Makefile @@ -1,12 +1,14 @@ # # Makefile # -# $Id: //poco/1.1.0/Foundation/testsuite/Makefile#1 $ +# $Id: //poco/1.2/Foundation/testsuite/Makefile#1 $ # # Makefile for Poco Foundation testsuite # -.DEFAULT all: +.PHONY: projects +clean all: projects +projects: $(MAKE) -f Makefile-Driver $(MAKECMDGOALS) $(MAKE) -f Makefile-TestLibrary $(MAKECMDGOALS) $(MAKE) -f Makefile-TestApp $(MAKECMDGOALS) diff --git a/Foundation/testsuite/Makefile-Driver b/Foundation/testsuite/Makefile-Driver index b610de568..2c8d103d2 100644 --- a/Foundation/testsuite/Makefile-Driver +++ b/Foundation/testsuite/Makefile-Driver @@ -1,21 +1,22 @@ # # Makefile # -# $Id: //poco/1.1.0/Foundation/testsuite/Makefile-Driver#1 $ +# $Id: //poco/1.2/Foundation/testsuite/Makefile-Driver#1 $ # # Makefile for Poco Foundation testsuite # include $(POCO_BASE)/build/rules/global -objects = ActiveMethodTest ActivityTest AutoPtrTest SharedPtrTest Base64Test \ - AutoReleasePoolTest BinaryReaderWriterTest LineEndingConverterTest \ +objects = ActiveMethodTest ActivityTest ActiveDispatcherTest \ + AutoPtrTest SharedPtrTest AutoReleasePoolTest Base64Test \ + BinaryReaderWriterTest LineEndingConverterTest \ ByteOrderTest ChannelTest ClassLoaderTest CoreTest CoreTestSuite \ CountingStreamTest CryptTestSuite DateTimeFormatterTest \ DateTimeParserTest DateTimeTest LocalDateTimeTest DateTimeTestSuite DigestStreamTest \ Driver DynamicFactoryTest FPETest FileChannelTest FileTest GlobTest FilesystemTestSuite \ FoundationTestSuite HMACEngineTest HexBinaryTest LoggerTest \ - LoggingFactoryTest LoggingRegistryTest LoggingTestSuite \ + LoggingFactoryTest LoggingRegistryTest LoggingTestSuite LogStreamTest \ NamedEventTest NamedMutexTest ProcessesTestSuite ProcessTest \ MemoryPoolTest MD2EngineTest MD4EngineTest MD5EngineTest ManifestTest \ NDCTest NotificationCenterTest NotificationQueueTest \ @@ -32,7 +33,7 @@ objects = ActiveMethodTest ActivityTest AutoPtrTest SharedPtrTest Base64Test \ TimespanTest TimestampTest TimezoneTest URIStreamOpenerTest URITest \ URITestSuite UUIDGeneratorTest UUIDTest UUIDTestSuite ZLibTest \ TestPlugin DummyDelegate BasicEventTest FIFOEventTest PriorityEventTest EventTestSuite \ - LRUCacheTest ExpireCacheTest ExpireLRUCacheTest CacheTestSuite AnyTest + LRUCacheTest ExpireCacheTest ExpireLRUCacheTest CacheTestSuite AnyTest HashTest FormatTest target = testrunner target_version = 1 diff --git a/Foundation/testsuite/Makefile-TestApp b/Foundation/testsuite/Makefile-TestApp index 087e930e4..a57924d52 100644 --- a/Foundation/testsuite/Makefile-TestApp +++ b/Foundation/testsuite/Makefile-TestApp @@ -1,7 +1,7 @@ # # Makefile # -# $Id: //poco/1.1.0/Foundation/testsuite/Makefile-TestApp#1 $ +# $Id: //poco/1.2/Foundation/testsuite/Makefile-TestApp#1 $ # # Makefile for Poco TestApp # diff --git a/Foundation/testsuite/Makefile-TestLibrary b/Foundation/testsuite/Makefile-TestLibrary index 3c0137575..b7191405e 100644 --- a/Foundation/testsuite/Makefile-TestLibrary +++ b/Foundation/testsuite/Makefile-TestLibrary @@ -1,7 +1,7 @@ # # Makefile # -# $Id: //poco/1.1.0/Foundation/testsuite/Makefile-TestLibrary#1 $ +# $Id: //poco/1.2/Foundation/testsuite/Makefile-TestLibrary#1 $ # # Makefile for Poco Foundation testsuite # diff --git a/Foundation/testsuite/TestSuite_vs71.vcproj b/Foundation/testsuite/TestSuite_vs71.vcproj index 02c06037b..4e2e1e7b7 100644 --- a/Foundation/testsuite/TestSuite_vs71.vcproj +++ b/Foundation/testsuite/TestSuite_vs71.vcproj @@ -159,9 +159,15 @@ + + + + @@ -211,9 +217,15 @@ + + + + @@ -420,6 +432,9 @@ + + @@ -451,6 +466,9 @@ + + @@ -546,6 +564,9 @@ + + @@ -577,6 +598,9 @@ + + diff --git a/Foundation/testsuite/TestSuite_vs80.vcproj b/Foundation/testsuite/TestSuite_vs80.vcproj index f26f2c4d8..a6a120ce4 100644 --- a/Foundation/testsuite/TestSuite_vs80.vcproj +++ b/Foundation/testsuite/TestSuite_vs80.vcproj @@ -229,10 +229,18 @@ RelativePath=".\src\DynamicFactoryTest.cpp" > + + + + @@ -297,10 +305,18 @@ RelativePath=".\src\DynamicFactoryTest.h" > + + + + @@ -561,6 +577,10 @@ + + @@ -601,6 +621,10 @@ + + @@ -721,6 +745,10 @@ RelativePath=".\src\LoggingTestSuite.cpp" > + + @@ -761,6 +789,10 @@ RelativePath=".\src\LoggingTestSuite.h" > + + diff --git a/Foundation/testsuite/src/ActiveDispatcherTest.cpp b/Foundation/testsuite/src/ActiveDispatcherTest.cpp new file mode 100644 index 000000000..4d056069c --- /dev/null +++ b/Foundation/testsuite/src/ActiveDispatcherTest.cpp @@ -0,0 +1,190 @@ +// +// ActiveDispatcherTest.cpp +// +// $Id: //poco/1.2/Foundation/testsuite/src/ActiveDispatcherTest.cpp#1 $ +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Redistributions in any form must be accompanied by information on +// how to obtain complete source code for this software and any +// accompanying software that uses this software. The source code +// must either be included in the distribution or be available for no +// more than the cost of distribution plus a nominal fee, and must be +// freely redistributable under reasonable conditions. For an +// executable file, complete source code means the source code for all +// modules it contains. It does not include source code for modules or +// files that typically accompany the major components of the operating +// system on which the executable file runs. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + + +#include "ActiveDispatcherTest.h" +#include "CppUnit/TestCaller.h" +#include "CppUnit/TestSuite.h" +#include "Poco/ActiveDispatcher.h" +#include "Poco/ActiveMethod.h" +#include "Poco/Thread.h" +#include "Poco/Event.h" +#include "Poco/Exception.h" + + +using Poco::ActiveDispatcher; +using Poco::ActiveMethod; +using Poco::ActiveResult; +using Poco::ActiveStarter; +using Poco::Thread; +using Poco::Event; +using Poco::Exception; + + +namespace +{ + class ActiveObject: public ActiveDispatcher + { + public: + ActiveObject(): + testMethod(this, &ActiveObject::testMethodImpl) + { + } + + ~ActiveObject() + { + } + + ActiveMethod > testMethod; + + void cont() + { + _continue.set(); + } + + protected: + int testMethodImpl(const int& n) + { + if (n == 100) throw Exception("n == 100"); + _continue.wait(); + return n; + } + + private: + Event _continue; + }; +} + + +ActiveDispatcherTest::ActiveDispatcherTest(const std::string& name): CppUnit::TestCase(name) +{ +} + + +ActiveDispatcherTest::~ActiveDispatcherTest() +{ +} + + +void ActiveDispatcherTest::testWait() +{ + ActiveObject activeObj; + ActiveResult result = activeObj.testMethod(123); + assert (!result.available()); + activeObj.cont(); + result.wait(); + assert (result.available()); + assert (result.data() == 123); + assert (!result.failed()); +} + + +void ActiveDispatcherTest::testWaitInterval() +{ + ActiveObject activeObj; + ActiveResult result = activeObj.testMethod(123); + assert (!result.available()); + try + { + result.wait(100); + fail("wait must fail"); + } + catch (Exception&) + { + } + activeObj.cont(); + result.wait(10000); + assert (result.available()); + assert (result.data() == 123); + assert (!result.failed()); +} + + +void ActiveDispatcherTest::testTryWait() +{ + ActiveObject activeObj; + ActiveResult result = activeObj.testMethod(123); + assert (!result.available()); + assert (!result.tryWait(200)); + activeObj.cont(); + assert (result.tryWait(10000)); + assert (result.available()); + assert (result.data() == 123); + assert (!result.failed()); +} + + +void ActiveDispatcherTest::testFailure() +{ + ActiveObject activeObj; + ActiveResult result = activeObj.testMethod(100); + result.wait(); + assert (result.available()); + assert (result.failed()); + std::string msg = result.error(); + assert (msg == "n == 100"); +} + + +void ActiveDispatcherTest::setUp() +{ +} + + +void ActiveDispatcherTest::tearDown() +{ +} + + +CppUnit::Test* ActiveDispatcherTest::suite() +{ + CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("ActiveDispatcherTest"); + + CppUnit_addTest(pSuite, ActiveDispatcherTest, testWait); + CppUnit_addTest(pSuite, ActiveDispatcherTest, testWaitInterval); + CppUnit_addTest(pSuite, ActiveDispatcherTest, testTryWait); + CppUnit_addTest(pSuite, ActiveDispatcherTest, testFailure); + + return pSuite; +} diff --git a/Foundation/testsuite/src/ActiveDispatcherTest.h b/Foundation/testsuite/src/ActiveDispatcherTest.h new file mode 100644 index 000000000..c27f9fd68 --- /dev/null +++ b/Foundation/testsuite/src/ActiveDispatcherTest.h @@ -0,0 +1,76 @@ +// +// ActiveDispatcherTest.h +// +// $Id: //poco/1.2/Foundation/testsuite/src/ActiveDispatcherTest.h#1 $ +// +// Definition of the ActiveDispatcherTest class. +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Redistributions in any form must be accompanied by information on +// how to obtain complete source code for this software and any +// accompanying software that uses this software. The source code +// must either be included in the distribution or be available for no +// more than the cost of distribution plus a nominal fee, and must be +// freely redistributable under reasonable conditions. For an +// executable file, complete source code means the source code for all +// modules it contains. It does not include source code for modules or +// files that typically accompany the major components of the operating +// system on which the executable file runs. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + + +#ifndef ActiveDispatcherTest_INCLUDED +#define ActiveDispatcherTest_INCLUDED + + +#include "Poco/Foundation.h" +#include "CppUnit/TestCase.h" + + +class ActiveDispatcherTest: public CppUnit::TestCase +{ +public: + ActiveDispatcherTest(const std::string& name); + ~ActiveDispatcherTest(); + + void testWait(); + void testWaitInterval(); + void testTryWait(); + void testFailure(); + + void setUp(); + void tearDown(); + + static CppUnit::Test* suite(); + +private: +}; + + +#endif // ActiveDispatcherTest_INCLUDED diff --git a/Foundation/testsuite/src/ActiveMethodTest.cpp b/Foundation/testsuite/src/ActiveMethodTest.cpp index 678beccbc..85ce7926d 100644 --- a/Foundation/testsuite/src/ActiveMethodTest.cpp +++ b/Foundation/testsuite/src/ActiveMethodTest.cpp @@ -1,7 +1,7 @@ // // ActiveMethodTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/ActiveMethodTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/ActiveMethodTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,49 +33,52 @@ #include "ActiveMethodTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/ActiveMethod.h" -#include "Foundation/Thread.h" -#include "Foundation/Event.h" -#include "Foundation/Exception.h" +#include "Poco/ActiveMethod.h" +#include "Poco/Thread.h" +#include "Poco/Event.h" +#include "Poco/Exception.h" -using Foundation::ActiveMethod; -using Foundation::ActiveResult; -using Foundation::Thread; -using Foundation::Event; -using Foundation::Exception; +using Poco::ActiveMethod; +using Poco::ActiveResult; +using Poco::Thread; +using Poco::Event; +using Poco::Exception; -class ActiveObject2 +namespace { -public: - ActiveObject2(): - testMethod(this, &ActiveObject2::testMethodImp) + class ActiveObject { - } - - ~ActiveObject2() - { - } - - ActiveMethod testMethod; - - void cont() - { - _continue.set(); - } - -protected: - int testMethodImp(const int& n) - { - if (n == 100) throw Exception("n == 100"); - _continue.wait(); - return n; - } - -private: - Event _continue; -}; + public: + ActiveObject(): + testMethod(this, &ActiveObject::testMethodImpl) + { + } + + ~ActiveObject() + { + } + + ActiveMethod testMethod; + + void cont() + { + _continue.set(); + } + + protected: + int testMethodImpl(const int& n) + { + if (n == 100) throw Exception("n == 100"); + _continue.wait(); + return n; + } + + private: + Event _continue; + }; +} ActiveMethodTest::ActiveMethodTest(const std::string& name): CppUnit::TestCase(name) @@ -90,7 +93,7 @@ ActiveMethodTest::~ActiveMethodTest() void ActiveMethodTest::testWait() { - ActiveObject2 activeObj; + ActiveObject activeObj; ActiveResult result = activeObj.testMethod(123); assert (!result.available()); activeObj.cont(); @@ -103,7 +106,7 @@ void ActiveMethodTest::testWait() void ActiveMethodTest::testWaitInterval() { - ActiveObject2 activeObj; + ActiveObject activeObj; ActiveResult result = activeObj.testMethod(123); assert (!result.available()); try @@ -124,7 +127,7 @@ void ActiveMethodTest::testWaitInterval() void ActiveMethodTest::testTryWait() { - ActiveObject2 activeObj; + ActiveObject activeObj; ActiveResult result = activeObj.testMethod(123); assert (!result.available()); assert (!result.tryWait(200)); @@ -138,7 +141,7 @@ void ActiveMethodTest::testTryWait() void ActiveMethodTest::testFailure() { - ActiveObject2 activeObj; + ActiveObject activeObj; ActiveResult result = activeObj.testMethod(100); result.wait(); assert (result.available()); diff --git a/Foundation/testsuite/src/ActiveMethodTest.h b/Foundation/testsuite/src/ActiveMethodTest.h index 3b0bddd43..2611c6df4 100644 --- a/Foundation/testsuite/src/ActiveMethodTest.h +++ b/Foundation/testsuite/src/ActiveMethodTest.h @@ -1,7 +1,7 @@ // // ActiveMethodTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/ActiveMethodTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/ActiveMethodTest.h#1 $ // // Definition of the ActiveMethodTest class. // @@ -36,12 +36,8 @@ #define ActiveMethodTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class ActiveMethodTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/ActivityTest.cpp b/Foundation/testsuite/src/ActivityTest.cpp index f964ce27a..013450419 100644 --- a/Foundation/testsuite/src/ActivityTest.cpp +++ b/Foundation/testsuite/src/ActivityTest.cpp @@ -1,7 +1,7 @@ // // ActivityTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/ActivityTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/ActivityTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,48 +33,51 @@ #include "ActivityTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/Activity.h" -#include "Foundation/Thread.h" +#include "Poco/Activity.h" +#include "Poco/Thread.h" -using Foundation::Activity; -using Foundation::Thread; +using Poco::Activity; +using Poco::Thread; -class ActiveObject +namespace { -public: - ActiveObject(): - _activity(this, &ActiveObject::run), - _count(0) + class ActiveObject { - } - - ~ActiveObject() - { - } - - Activity& activity() - { - return _activity; - } - - int count() const - { - return _count; - } + public: + ActiveObject(): + _activity(this, &ActiveObject::run), + _count(0) + { + } + + ~ActiveObject() + { + } + + Activity& activity() + { + return _activity; + } + + int count() const + { + return _count; + } -protected: - void run() - { - while (!_activity.isStopped()) - ++_count; - } + protected: + void run() + { + while (!_activity.isStopped()) + ++_count; + } -private: - Activity _activity; - int _count; -}; + private: + Activity _activity; + int _count; + }; +} ActivityTest::ActivityTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/ActivityTest.h b/Foundation/testsuite/src/ActivityTest.h index 9bc0b26d0..043e6af65 100644 --- a/Foundation/testsuite/src/ActivityTest.h +++ b/Foundation/testsuite/src/ActivityTest.h @@ -1,7 +1,7 @@ // // ActivityTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/ActivityTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/ActivityTest.h#1 $ // // Definition of the ActivityTest class. // @@ -36,12 +36,8 @@ #define ActivityTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class ActivityTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/AnyTest.cpp b/Foundation/testsuite/src/AnyTest.cpp index 08ed06f13..242c7aab6 100644 --- a/Foundation/testsuite/src/AnyTest.cpp +++ b/Foundation/testsuite/src/AnyTest.cpp @@ -1,7 +1,7 @@ // // AnyTest.cpp // -// $Id: //poco/Main/Foundation/testsuite/src/AnyTest.cpp#5 $ +// $Id: //poco/1.2/Foundation/testsuite/src/AnyTest.cpp#1 $ // // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -31,17 +31,16 @@ #include "AnyTest.h" - #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" - -#include "Foundation/Exception.h" -#include "Foundation/Any.h" -#include "Foundation/Bugcheck.h" - +#include "Poco/Exception.h" +#include "Poco/Any.h" +#include "Poco/Bugcheck.h" #include -using namespace std; -using namespace Foundation; + + +using namespace Poco; + class SomeClass { @@ -107,15 +106,15 @@ void AnyTest::testComplexType() void AnyTest::testVector() { - vector < int > tmp; + std::vector < int > tmp; tmp.push_back( 1 ); tmp.push_back( 2 ); tmp.push_back( 3 ); Any a = tmp; - poco_assert (a.type() == typeid(vector < int >) ); - vector < int > tmp2 = AnyCast < vector < int > >(a); - const vector < int >& vecCRef = RefAnyCast < vector < int > >(a); - vector < int >& vecRef = RefAnyCast < vector < int > >(a); + poco_assert (a.type() == typeid(std::vector < int >) ); + std::vector < int > tmp2 = AnyCast < std::vector < int > >(a); + const std::vector < int >& vecCRef = RefAnyCast < std::vector < int > >(a); + std::vector < int >& vecRef = RefAnyCast < std::vector < int > >(a); vecRef[0] = 0; poco_assert( vecRef[0] == vecCRef[0] ); } diff --git a/Foundation/testsuite/src/AnyTest.h b/Foundation/testsuite/src/AnyTest.h index 31b515c65..12fd30087 100644 --- a/Foundation/testsuite/src/AnyTest.h +++ b/Foundation/testsuite/src/AnyTest.h @@ -1,7 +1,7 @@ // // AnyTest.h // -// $Id: $ +// $Id: //poco/1.2/Foundation/testsuite/src/AnyTest.h#1 $ // // Tests for Any types // @@ -35,12 +35,9 @@ #define AnyTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif + class AnyTest: public CppUnit::TestCase { diff --git a/Foundation/testsuite/src/AutoPtrTest.cpp b/Foundation/testsuite/src/AutoPtrTest.cpp index bff744788..16197dce2 100644 --- a/Foundation/testsuite/src/AutoPtrTest.cpp +++ b/Foundation/testsuite/src/AutoPtrTest.cpp @@ -1,7 +1,7 @@ // // AutoPtrTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/AutoPtrTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/AutoPtrTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,12 +33,12 @@ #include "AutoPtrTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/AutoPtr.h" -#include "Foundation/Exception.h" +#include "Poco/AutoPtr.h" +#include "Poco/Exception.h" -using Foundation::AutoPtr; -using Foundation::NullPointerException; +using Poco::AutoPtr; +using Poco::NullPointerException; namespace diff --git a/Foundation/testsuite/src/AutoPtrTest.h b/Foundation/testsuite/src/AutoPtrTest.h index fef79595d..c9d680875 100644 --- a/Foundation/testsuite/src/AutoPtrTest.h +++ b/Foundation/testsuite/src/AutoPtrTest.h @@ -1,7 +1,7 @@ // // AutoPtrTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/AutoPtrTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/AutoPtrTest.h#1 $ // // Definition of the AutoPtrTest class. // @@ -36,12 +36,8 @@ #define AutoPtrTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class AutoPtrTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/AutoReleasePoolTest.cpp b/Foundation/testsuite/src/AutoReleasePoolTest.cpp index 72f630f7b..6ad9e7bbb 100644 --- a/Foundation/testsuite/src/AutoReleasePoolTest.cpp +++ b/Foundation/testsuite/src/AutoReleasePoolTest.cpp @@ -1,7 +1,7 @@ // // AutoReleasePoolTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/AutoReleasePoolTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/AutoReleasePoolTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,10 +33,10 @@ #include "AutoReleasePoolTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/AutoReleasePool.h" +#include "Poco/AutoReleasePool.h" -using Foundation::AutoReleasePool; +using Poco::AutoReleasePool; namespace diff --git a/Foundation/testsuite/src/AutoReleasePoolTest.h b/Foundation/testsuite/src/AutoReleasePoolTest.h index c9f6f2bd8..d4cf9d551 100644 --- a/Foundation/testsuite/src/AutoReleasePoolTest.h +++ b/Foundation/testsuite/src/AutoReleasePoolTest.h @@ -1,7 +1,7 @@ // // AutoReleasePoolTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/AutoReleasePoolTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/AutoReleasePoolTest.h#1 $ // // Definition of the AutoReleasePoolTest class. // @@ -36,12 +36,8 @@ #define AutoReleasePoolTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class AutoReleasePoolTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/Base64Test.cpp b/Foundation/testsuite/src/Base64Test.cpp index 19971de13..e1f8d8d29 100644 --- a/Foundation/testsuite/src/Base64Test.cpp +++ b/Foundation/testsuite/src/Base64Test.cpp @@ -1,7 +1,7 @@ // // Base64Test.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/Base64Test.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/Base64Test.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,15 +33,15 @@ #include "Base64Test.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/Base64Encoder.h" -#include "Foundation/Base64Decoder.h" -#include "Foundation/Exception.h" +#include "Poco/Base64Encoder.h" +#include "Poco/Base64Decoder.h" +#include "Poco/Exception.h" #include -using Foundation::Base64Encoder; -using Foundation::Base64Decoder; -using Foundation::DataFormatException; +using Poco::Base64Encoder; +using Poco::Base64Decoder; +using Poco::DataFormatException; Base64Test::Base64Test(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/Base64Test.h b/Foundation/testsuite/src/Base64Test.h index dfc90614b..b83e2a701 100644 --- a/Foundation/testsuite/src/Base64Test.h +++ b/Foundation/testsuite/src/Base64Test.h @@ -1,7 +1,7 @@ // // Base64Test.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/Base64Test.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/Base64Test.h#1 $ // // Definition of the Base64Test class. // @@ -36,12 +36,8 @@ #define Base64Test_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class Base64Test: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/BasicEventTest.cpp b/Foundation/testsuite/src/BasicEventTest.cpp index f2c2d7405..2fd575cfe 100644 --- a/Foundation/testsuite/src/BasicEventTest.cpp +++ b/Foundation/testsuite/src/BasicEventTest.cpp @@ -1,7 +1,7 @@ // // BasicEventTest.cpp // -// $Id: //poco/Main/Foundation/testsuite/src/BasicEventTest.cpp#5 $ +// $Id: //poco/1.2/Foundation/testsuite/src/BasicEventTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -32,16 +32,16 @@ #include "BasicEventTest.h" #include "DummyDelegate.h" - #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" +#include "Poco/Delegate.h" +#include "Poco/Expire.h" +#include "Poco/Thread.h" +#include "Poco/Exception.h" -#include "Foundation/Delegate.h" -#include "Foundation/Expire.h" -#include "Foundation/Thread.h" -#include "Foundation/Exception.h" -using namespace Foundation; +using namespace Poco; + #define LARGEINC 100 @@ -76,24 +76,24 @@ void BasicEventTest::testNoDelegate() //Note: passing &args will not work due to & EventArgs* pArgs = &args; - Complex += Delegate < BasicEventTest, Foundation::EventArgs* > (this, &BasicEventTest::onComplex); - Complex -= Delegate < BasicEventTest, Foundation::EventArgs* > (this, &BasicEventTest::onComplex); + Complex += Delegate < BasicEventTest, Poco::EventArgs* > (this, &BasicEventTest::onComplex); + Complex -= Delegate < BasicEventTest, Poco::EventArgs* > (this, &BasicEventTest::onComplex); Complex.notify ( this, pArgs ); poco_assert ( _count == 0 ); - Complex2 += Delegate < BasicEventTest, Foundation::EventArgs > (this, &BasicEventTest::onComplex2); - Complex2 -= Delegate < BasicEventTest, Foundation::EventArgs > (this, &BasicEventTest::onComplex2); + Complex2 += Delegate < BasicEventTest, Poco::EventArgs > (this, &BasicEventTest::onComplex2); + Complex2 -= Delegate < BasicEventTest, Poco::EventArgs > (this, &BasicEventTest::onComplex2); Complex2.notify ( this, args ); poco_assert ( _count == 0 ); const EventArgs* pCArgs = &args; - ConstComplex += Delegate < BasicEventTest, const Foundation::EventArgs* > (this, &BasicEventTest::onConstComplex); - ConstComplex -= Delegate < BasicEventTest, const Foundation::EventArgs* > (this, &BasicEventTest::onConstComplex); + ConstComplex += Delegate < BasicEventTest, const Poco::EventArgs* > (this, &BasicEventTest::onConstComplex); + ConstComplex -= Delegate < BasicEventTest, const Poco::EventArgs* > (this, &BasicEventTest::onConstComplex); ConstComplex.notify ( this, pCArgs ); poco_assert ( _count == 0 ); - Const2Complex += Delegate < BasicEventTest, const Foundation::EventArgs* const > (this, &BasicEventTest::onConst2Complex); - Const2Complex -= Delegate < BasicEventTest, const Foundation::EventArgs* const > (this, &BasicEventTest::onConst2Complex); + Const2Complex += Delegate < BasicEventTest, const Poco::EventArgs* const > (this, &BasicEventTest::onConst2Complex); + Const2Complex -= Delegate < BasicEventTest, const Poco::EventArgs* const > (this, &BasicEventTest::onConst2Complex); Const2Complex.notify ( this, pArgs ); poco_assert ( _count == 0 ); } @@ -114,20 +114,20 @@ void BasicEventTest::testSingleDelegate() poco_assert ( _count == 2 ); EventArgs* pArgs = &args; - Complex += Delegate < BasicEventTest, Foundation::EventArgs* > (this, &BasicEventTest::onComplex); + Complex += Delegate < BasicEventTest, Poco::EventArgs* > (this, &BasicEventTest::onComplex); Complex.notify ( this, pArgs ); poco_assert ( _count == 3 ); - Complex2 += Delegate < BasicEventTest, Foundation::EventArgs > (this, &BasicEventTest::onComplex2); + Complex2 += Delegate < BasicEventTest, Poco::EventArgs > (this, &BasicEventTest::onComplex2); Complex2.notify ( this, args ); poco_assert ( _count == 4 ); const EventArgs* pCArgs = &args; - ConstComplex += Delegate < BasicEventTest, const Foundation::EventArgs* > (this, &BasicEventTest::onConstComplex); + ConstComplex += Delegate < BasicEventTest, const Poco::EventArgs* > (this, &BasicEventTest::onConstComplex); ConstComplex.notify ( this, pCArgs ); poco_assert ( _count == 5 ); - Const2Complex += Delegate < BasicEventTest, const Foundation::EventArgs* const > (this, &BasicEventTest::onConst2Complex); + Const2Complex += Delegate < BasicEventTest, const Poco::EventArgs* const > (this, &BasicEventTest::onConst2Complex); Const2Complex.notify ( this, pArgs ); poco_assert ( _count == 6 ); // check if 2nd notify also works @@ -206,7 +206,7 @@ void BasicEventTest::testExpire () Simple += Expire < int > (Delegate < BasicEventTest, int > (this, &BasicEventTest::onSimple), 500 ); Simple.notify ( this, tmp ); poco_assert ( _count == 1 ); - Foundation::Thread::sleep ( 700 ); + Poco::Thread::sleep ( 700 ); Simple.notify ( this, tmp ); poco_assert ( _count == 1 ); } @@ -220,15 +220,15 @@ void BasicEventTest::testExpireReRegister() Simple += Expire < int > (Delegate < BasicEventTest, int > (this, &BasicEventTest::onSimple), 500 ); Simple.notify ( this, tmp ); poco_assert ( _count == 1 ); - Foundation::Thread::sleep ( 200 ); + Poco::Thread::sleep ( 200 ); Simple.notify ( this, tmp ); poco_assert ( _count == 2 ); // renew registration Simple += Expire < int > (Delegate < BasicEventTest, int > (this, &BasicEventTest::onSimple), 600 ); - Foundation::Thread::sleep( 400 ); + Poco::Thread::sleep( 400 ); Simple.notify ( this, tmp ); poco_assert ( _count == 3 ); - Foundation::Thread::sleep( 300 ); + Poco::Thread::sleep( 300 ); Simple.notify ( this, tmp ); poco_assert ( _count == 3 ); } @@ -261,11 +261,11 @@ void BasicEventTest::testOverwriteDelegate () void BasicEventTest::testAsyncNotify () { - Foundation::BasicEvent < int >* pSimple= new Foundation::BasicEvent < int >(); + Poco::BasicEvent < int >* pSimple= new Poco::BasicEvent < int >(); (*pSimple) += Delegate < BasicEventTest, int > (this, &BasicEventTest::onAsync); poco_assert ( _count == 0 ); int tmp = 0; - Foundation::ActiveResult < int > retArg = pSimple->notifyAsync ( this, tmp ); + Poco::ActiveResult < int > retArg = pSimple->notifyAsync ( this, tmp ); delete pSimple; // must work even when the event got deleted! pSimple = NULL; poco_assert ( _count == 0 ); @@ -289,29 +289,29 @@ void BasicEventTest::onConstSimple ( const void* pSender, const int& i ) _count++; } -void BasicEventTest::onComplex ( const void* pSender, Foundation::EventArgs* & i ) +void BasicEventTest::onComplex ( const void* pSender, Poco::EventArgs* & i ) { _count++; } -void BasicEventTest::onComplex2 ( const void* pSender, Foundation::EventArgs & i ) +void BasicEventTest::onComplex2 ( const void* pSender, Poco::EventArgs & i ) { _count++; } -void BasicEventTest::onConstComplex ( const void* pSender, const Foundation::EventArgs*& i ) +void BasicEventTest::onConstComplex ( const void* pSender, const Poco::EventArgs*& i ) { _count++; } -void BasicEventTest::onConst2Complex ( const void* pSender, const Foundation::EventArgs * const & i ) +void BasicEventTest::onConst2Complex ( const void* pSender, const Poco::EventArgs * const & i ) { _count++; } void BasicEventTest::onAsync ( const void* pSender, int& i ) { - Foundation::Thread::sleep ( 700 ); + Poco::Thread::sleep ( 700 ); _count += LARGEINC ; } diff --git a/Foundation/testsuite/src/BasicEventTest.h b/Foundation/testsuite/src/BasicEventTest.h index 32668b313..e118715e6 100644 --- a/Foundation/testsuite/src/BasicEventTest.h +++ b/Foundation/testsuite/src/BasicEventTest.h @@ -1,7 +1,7 @@ // // BasicEventTest.h // -// $Id: $ +// $Id: //poco/1.2/Foundation/testsuite/src/BasicEventTest.h#1 $ // // Tests for BasicEvent // @@ -31,28 +31,25 @@ // DEALINGS IN THE SOFTWARE. // + #ifndef BasicEventTest_INCLUDED #define BasicEventTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif +#include "Poco/BasicEvent.h" +#include "Poco/EventArgs.h" -#include "Foundation/BasicEvent.h" -#include "Foundation/EventArgs.h" class BasicEventTest: public CppUnit::TestCase { - Foundation::BasicEvent Simple; - Foundation::BasicEvent ConstSimple; - Foundation::BasicEvent Complex; - Foundation::BasicEvent Complex2; - Foundation::BasicEvent ConstComplex; - Foundation::BasicEvent Const2Complex; + Poco::BasicEvent Simple; + Poco::BasicEvent ConstSimple; + Poco::BasicEvent Complex; + Poco::BasicEvent Complex2; + Poco::BasicEvent ConstComplex; + Poco::BasicEvent Const2Complex; public: BasicEventTest(const std::string& name); ~BasicEventTest(); @@ -77,10 +74,10 @@ protected: void onSimple ( const void* pSender, int& i ); void onSimpleOther ( const void* pSender, int& i ); void onConstSimple ( const void* pSender, const int& i ); - void onComplex ( const void* pSender, Foundation::EventArgs* & i ); - void onComplex2 ( const void* pSender, Foundation::EventArgs & i ); - void onConstComplex ( const void* pSender, const Foundation::EventArgs*& i ); - void onConst2Complex ( const void* pSender, const Foundation::EventArgs * const & i ); + void onComplex ( const void* pSender, Poco::EventArgs* & i ); + void onComplex2 ( const void* pSender, Poco::EventArgs & i ); + void onConstComplex ( const void* pSender, const Poco::EventArgs*& i ); + void onConst2Complex ( const void* pSender, const Poco::EventArgs * const & i ); void onAsync ( const void* pSender, int& i ); int getCount () const; diff --git a/Foundation/testsuite/src/BinaryReaderWriterTest.cpp b/Foundation/testsuite/src/BinaryReaderWriterTest.cpp index d52641419..8233faedb 100644 --- a/Foundation/testsuite/src/BinaryReaderWriterTest.cpp +++ b/Foundation/testsuite/src/BinaryReaderWriterTest.cpp @@ -1,7 +1,7 @@ // // BinaryReaderWriterTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/BinaryReaderWriterTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/BinaryReaderWriterTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,17 +33,17 @@ #include "BinaryReaderWriterTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/BinaryWriter.h" -#include "Foundation/BinaryReader.h" +#include "Poco/BinaryWriter.h" +#include "Poco/BinaryReader.h" #include -using Foundation::BinaryWriter; -using Foundation::BinaryReader; -using Foundation::Int32; -using Foundation::UInt32; -using Foundation::Int64; -using Foundation::UInt64; +using Poco::BinaryWriter; +using Poco::BinaryReader; +using Poco::Int32; +using Poco::UInt32; +using Poco::Int64; +using Poco::UInt64; BinaryReaderWriterTest::BinaryReaderWriterTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/BinaryReaderWriterTest.h b/Foundation/testsuite/src/BinaryReaderWriterTest.h index 5cfd6006a..d738da99d 100644 --- a/Foundation/testsuite/src/BinaryReaderWriterTest.h +++ b/Foundation/testsuite/src/BinaryReaderWriterTest.h @@ -1,7 +1,7 @@ // // BinaryReaderWriterTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/BinaryReaderWriterTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/BinaryReaderWriterTest.h#1 $ // // Definition of the BinaryReaderWriterTest class. // @@ -36,18 +36,10 @@ #define BinaryReaderWriterTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif -#ifndef Foundation_BinaryReader_INCLUDED -#include "Foundation/BinaryReader.h" -#endif -#ifndef Foundation_BinaryWriter_INCLUDED -#include "Foundation/BinaryWriter.h" -#endif +#include "Poco/BinaryReader.h" +#include "Poco/BinaryWriter.h" class BinaryReaderWriterTest: public CppUnit::TestCase @@ -59,8 +51,8 @@ public: void testNative(); void testBigEndian(); void testLittleEndian(); - void write(Foundation::BinaryWriter& writer); - void read(Foundation::BinaryReader& reader); + void write(Poco::BinaryWriter& writer); + void read(Poco::BinaryReader& reader); void setUp(); void tearDown(); diff --git a/Foundation/testsuite/src/ByteOrderTest.cpp b/Foundation/testsuite/src/ByteOrderTest.cpp index 585680b1d..a10d8474b 100644 --- a/Foundation/testsuite/src/ByteOrderTest.cpp +++ b/Foundation/testsuite/src/ByteOrderTest.cpp @@ -1,7 +1,7 @@ // // ByteOrderTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/ByteOrderTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/ByteOrderTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,17 +33,17 @@ #include "ByteOrderTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/ByteOrder.h" +#include "Poco/ByteOrder.h" -using Foundation::ByteOrder; -using Foundation::Int16; -using Foundation::UInt16; -using Foundation::Int32; -using Foundation::UInt32; +using Poco::ByteOrder; +using Poco::Int16; +using Poco::UInt16; +using Poco::Int32; +using Poco::UInt32; #if defined(POCO_HAVE_INT64) -using Foundation::Int64; -using Foundation::UInt64; +using Poco::Int64; +using Poco::UInt64; #endif diff --git a/Foundation/testsuite/src/ByteOrderTest.h b/Foundation/testsuite/src/ByteOrderTest.h index 2ac6fa036..5df138c61 100644 --- a/Foundation/testsuite/src/ByteOrderTest.h +++ b/Foundation/testsuite/src/ByteOrderTest.h @@ -1,7 +1,7 @@ // // ByteOrderTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/ByteOrderTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/ByteOrderTest.h#1 $ // // Definition of the ByteOrderTest class. // @@ -36,12 +36,8 @@ #define ByteOrderTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class ByteOrderTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/CacheTestSuite.cpp b/Foundation/testsuite/src/CacheTestSuite.cpp index c8bd24097..65f9b824f 100644 --- a/Foundation/testsuite/src/CacheTestSuite.cpp +++ b/Foundation/testsuite/src/CacheTestSuite.cpp @@ -1,7 +1,7 @@ // // CacheTestSuite.cpp // -// $Id: $ +// $Id: //poco/1.2/Foundation/testsuite/src/CacheTestSuite.cpp#1 $ // // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. // and Contributors. diff --git a/Foundation/testsuite/src/CacheTestSuite.h b/Foundation/testsuite/src/CacheTestSuite.h index 6e3aa6c04..11f85f76c 100644 --- a/Foundation/testsuite/src/CacheTestSuite.h +++ b/Foundation/testsuite/src/CacheTestSuite.h @@ -1,7 +1,7 @@ // // CacheTestSuite.h // -// $Id: $ +// $Id: //poco/1.2/Foundation/testsuite/src/CacheTestSuite.h#1 $ // // Definition of the CacheTestSuite class. // @@ -36,9 +36,7 @@ #define CacheTestSuite_INCLUDED -#ifndef CppUnit_TestSuite_INCLUDED #include "CppUnit/TestSuite.h" -#endif class CacheTestSuite diff --git a/Foundation/testsuite/src/ChannelTest.cpp b/Foundation/testsuite/src/ChannelTest.cpp index 327013503..cd5cd2dcf 100644 --- a/Foundation/testsuite/src/ChannelTest.cpp +++ b/Foundation/testsuite/src/ChannelTest.cpp @@ -1,7 +1,7 @@ // // ChannelTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/ChannelTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/ChannelTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,26 +33,26 @@ #include "ChannelTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/SplitterChannel.h" -#include "Foundation/AsyncChannel.h" -#include "Foundation/AutoPtr.h" -#include "Foundation/Message.h" -#include "Foundation/Formatter.h" -#include "Foundation/FormattingChannel.h" -#include "Foundation/ConsoleChannel.h" -#include "Foundation/StreamChannel.h" +#include "Poco/SplitterChannel.h" +#include "Poco/AsyncChannel.h" +#include "Poco/AutoPtr.h" +#include "Poco/Message.h" +#include "Poco/Formatter.h" +#include "Poco/FormattingChannel.h" +#include "Poco/ConsoleChannel.h" +#include "Poco/StreamChannel.h" #include "TestChannel.h" #include -using Foundation::SplitterChannel; -using Foundation::AsyncChannel; -using Foundation::FormattingChannel; -using Foundation::ConsoleChannel; -using Foundation::StreamChannel; -using Foundation::Formatter; -using Foundation::Message; -using Foundation::AutoPtr; +using Poco::SplitterChannel; +using Poco::AsyncChannel; +using Poco::FormattingChannel; +using Poco::ConsoleChannel; +using Poco::StreamChannel; +using Poco::Formatter; +using Poco::Message; +using Poco::AutoPtr; class SimpleFormatter: public Formatter diff --git a/Foundation/testsuite/src/ChannelTest.h b/Foundation/testsuite/src/ChannelTest.h index 07372749a..e1b35b9d1 100644 --- a/Foundation/testsuite/src/ChannelTest.h +++ b/Foundation/testsuite/src/ChannelTest.h @@ -1,7 +1,7 @@ // // ChannelTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/ChannelTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/ChannelTest.h#1 $ // // Definition of the ChannelTest class. // @@ -36,12 +36,8 @@ #define ChannelTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class ChannelTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/ClassLoaderTest.cpp b/Foundation/testsuite/src/ClassLoaderTest.cpp index de9f5b508..b11a84dd2 100644 --- a/Foundation/testsuite/src/ClassLoaderTest.cpp +++ b/Foundation/testsuite/src/ClassLoaderTest.cpp @@ -1,7 +1,7 @@ // // ClassLoaderTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/ClassLoaderTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/ClassLoaderTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,18 +33,18 @@ #include "ClassLoaderTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/ClassLoader.h" -#include "Foundation/Manifest.h" -#include "Foundation/Exception.h" +#include "Poco/ClassLoader.h" +#include "Poco/Manifest.h" +#include "Poco/Exception.h" #include "TestPlugin.h" -using Foundation::ClassLoader; -using Foundation::Manifest; -using Foundation::SharedLibrary; -using Foundation::AbstractMetaObject; -using Foundation::NotFoundException; -using Foundation::InvalidAccessException; +using Poco::ClassLoader; +using Poco::Manifest; +using Poco::SharedLibrary; +using Poco::AbstractMetaObject; +using Poco::NotFoundException; +using Poco::InvalidAccessException; ClassLoaderTest::ClassLoaderTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/ClassLoaderTest.h b/Foundation/testsuite/src/ClassLoaderTest.h index 8dd2fb888..fa8eec904 100644 --- a/Foundation/testsuite/src/ClassLoaderTest.h +++ b/Foundation/testsuite/src/ClassLoaderTest.h @@ -1,7 +1,7 @@ // // ClassLoaderTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/ClassLoaderTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/ClassLoaderTest.h#1 $ // // Definition of the ClassLoaderTest class. // @@ -36,12 +36,8 @@ #define ClassLoaderTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class ClassLoaderTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/CoreTest.cpp b/Foundation/testsuite/src/CoreTest.cpp index 35c6f2b23..074705fd8 100644 --- a/Foundation/testsuite/src/CoreTest.cpp +++ b/Foundation/testsuite/src/CoreTest.cpp @@ -1,7 +1,7 @@ // // CoreTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/CoreTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/CoreTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,17 +33,17 @@ #include "CoreTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/Bugcheck.h" -#include "Foundation/Exception.h" -#include "Foundation/Environment.h" -#include "Foundation/Thread.h" +#include "Poco/Bugcheck.h" +#include "Poco/Exception.h" +#include "Poco/Environment.h" +#include "Poco/Thread.h" #include -using Foundation::Bugcheck; -using Foundation::Exception; -using Foundation::Environment; -using Foundation::Thread; +using Poco::Bugcheck; +using Poco::Exception; +using Poco::Environment; +using Poco::Thread; // @@ -72,18 +72,18 @@ void CoreTest::testPlatform() void CoreTest::testFixedLength() { - assert (sizeof(Foundation::Int8) == 1); - assert (sizeof(Foundation::UInt8) == 1); - assert (sizeof(Foundation::Int16) == 2); - assert (sizeof(Foundation::UInt16) == 2); - assert (sizeof(Foundation::Int32) == 4); - assert (sizeof(Foundation::UInt32) == 4); + assert (sizeof(Poco::Int8) == 1); + assert (sizeof(Poco::UInt8) == 1); + assert (sizeof(Poco::Int16) == 2); + assert (sizeof(Poco::UInt16) == 2); + assert (sizeof(Poco::Int32) == 4); + assert (sizeof(Poco::UInt32) == 4); #if defined(POCO_HAVE_INT64) - assert (sizeof(Foundation::Int64) == 8); - assert (sizeof(Foundation::UInt64) == 8); + assert (sizeof(Poco::Int64) == 8); + assert (sizeof(Poco::UInt64) == 8); #endif - assert (sizeof(Foundation::IntPtr) == sizeof(void*)); - assert (sizeof(Foundation::UIntPtr) == sizeof(void*)); + assert (sizeof(Poco::IntPtr) == sizeof(void*)); + assert (sizeof(Poco::UIntPtr) == sizeof(void*)); } diff --git a/Foundation/testsuite/src/CoreTest.h b/Foundation/testsuite/src/CoreTest.h index fd910144c..81e2e4250 100644 --- a/Foundation/testsuite/src/CoreTest.h +++ b/Foundation/testsuite/src/CoreTest.h @@ -1,7 +1,7 @@ // // CoreTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/CoreTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/CoreTest.h#1 $ // // Definition of the CoreTest class. // @@ -36,12 +36,8 @@ #define CoreTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class CoreTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/CoreTestSuite.cpp b/Foundation/testsuite/src/CoreTestSuite.cpp index 445cb0be8..136fa9652 100644 --- a/Foundation/testsuite/src/CoreTestSuite.cpp +++ b/Foundation/testsuite/src/CoreTestSuite.cpp @@ -1,7 +1,7 @@ // // CoreTestSuite.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/CoreTestSuite.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/CoreTestSuite.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -46,6 +46,8 @@ #include "DynamicFactoryTest.h" #include "MemoryPoolTest.h" #include "AnyTest.h" +#include "HashTest.h" +#include "FormatTest.h" CppUnit::Test* CoreTestSuite::suite() @@ -67,6 +69,8 @@ CppUnit::Test* CoreTestSuite::suite() pSuite->addTest(DynamicFactoryTest::suite()); pSuite->addTest(MemoryPoolTest::suite()); pSuite->addTest(AnyTest::suite()); + pSuite->addTest(HashTest::suite()); + pSuite->addTest(FormatTest::suite()); return pSuite; } diff --git a/Foundation/testsuite/src/CoreTestSuite.h b/Foundation/testsuite/src/CoreTestSuite.h index 55bde8e18..773596c3e 100644 --- a/Foundation/testsuite/src/CoreTestSuite.h +++ b/Foundation/testsuite/src/CoreTestSuite.h @@ -1,7 +1,7 @@ // // CoreTestSuite.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/CoreTestSuite.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/CoreTestSuite.h#1 $ // // Definition of the CoreTestSuite class. // @@ -36,9 +36,7 @@ #define CoreTestSuite_INCLUDED -#ifndef CppUnit_TestSuite_INCLUDED #include "CppUnit/TestSuite.h" -#endif class CoreTestSuite diff --git a/Foundation/testsuite/src/CountingStreamTest.cpp b/Foundation/testsuite/src/CountingStreamTest.cpp index 7c5eac6ff..950551e04 100644 --- a/Foundation/testsuite/src/CountingStreamTest.cpp +++ b/Foundation/testsuite/src/CountingStreamTest.cpp @@ -1,7 +1,7 @@ // // CountingStreamTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/CountingStreamTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/CountingStreamTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,12 +33,12 @@ #include "CountingStreamTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/CountingStream.h" +#include "Poco/CountingStream.h" #include -using Foundation::CountingInputStream; -using Foundation::CountingOutputStream; +using Poco::CountingInputStream; +using Poco::CountingOutputStream; CountingStreamTest::CountingStreamTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/CountingStreamTest.h b/Foundation/testsuite/src/CountingStreamTest.h index 55d4d30cd..1c0484443 100644 --- a/Foundation/testsuite/src/CountingStreamTest.h +++ b/Foundation/testsuite/src/CountingStreamTest.h @@ -1,7 +1,7 @@ // // CountingStreamTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/CountingStreamTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/CountingStreamTest.h#1 $ // // Definition of the CountingStreamTest class. // @@ -36,12 +36,8 @@ #define CountingStreamTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class CountingStreamTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/CryptTestSuite.cpp b/Foundation/testsuite/src/CryptTestSuite.cpp index bc07c574e..be5f4c105 100644 --- a/Foundation/testsuite/src/CryptTestSuite.cpp +++ b/Foundation/testsuite/src/CryptTestSuite.cpp @@ -1,7 +1,7 @@ // // CryptTestSuite.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/CryptTestSuite.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/CryptTestSuite.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. diff --git a/Foundation/testsuite/src/CryptTestSuite.h b/Foundation/testsuite/src/CryptTestSuite.h index bbc6d728f..b8b4739bc 100644 --- a/Foundation/testsuite/src/CryptTestSuite.h +++ b/Foundation/testsuite/src/CryptTestSuite.h @@ -1,7 +1,7 @@ // // CryptTestSuite.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/CryptTestSuite.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/CryptTestSuite.h#1 $ // // Definition of the CryptTestSuite class. // @@ -36,9 +36,7 @@ #define CryptTestSuite_INCLUDED -#ifndef CppUnit_TestSuite_INCLUDED #include "CppUnit/TestSuite.h" -#endif class CryptTestSuite diff --git a/Foundation/testsuite/src/DateTimeFormatterTest.cpp b/Foundation/testsuite/src/DateTimeFormatterTest.cpp index 768ac7d2e..59fe6aa9e 100644 --- a/Foundation/testsuite/src/DateTimeFormatterTest.cpp +++ b/Foundation/testsuite/src/DateTimeFormatterTest.cpp @@ -1,7 +1,7 @@ // // DateTimeFormatterTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/DateTimeFormatterTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/DateTimeFormatterTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,16 +33,16 @@ #include "DateTimeFormatterTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/DateTimeFormatter.h" -#include "Foundation/DateTimeFormat.h" -#include "Foundation/DateTime.h" -#include "Foundation/Timespan.h" +#include "Poco/DateTimeFormatter.h" +#include "Poco/DateTimeFormat.h" +#include "Poco/DateTime.h" +#include "Poco/Timespan.h" -using Foundation::DateTime; -using Foundation::Timespan; -using Foundation::DateTimeFormat; -using Foundation::DateTimeFormatter; +using Poco::DateTime; +using Poco::Timespan; +using Poco::DateTimeFormat; +using Poco::DateTimeFormatter; DateTimeFormatterTest::DateTimeFormatterTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/DateTimeFormatterTest.h b/Foundation/testsuite/src/DateTimeFormatterTest.h index 1206dbcd3..35f6680cc 100644 --- a/Foundation/testsuite/src/DateTimeFormatterTest.h +++ b/Foundation/testsuite/src/DateTimeFormatterTest.h @@ -1,7 +1,7 @@ // // DateTimeFormatterTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/DateTimeFormatterTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/DateTimeFormatterTest.h#1 $ // // Definition of the DateTimeFormatterTest class. // @@ -36,12 +36,8 @@ #define DateTimeFormatterTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class DateTimeFormatterTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/DateTimeParserTest.cpp b/Foundation/testsuite/src/DateTimeParserTest.cpp index 953f741a0..580986b45 100644 --- a/Foundation/testsuite/src/DateTimeParserTest.cpp +++ b/Foundation/testsuite/src/DateTimeParserTest.cpp @@ -1,7 +1,7 @@ // // DateTimeParserTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/DateTimeParserTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/DateTimeParserTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,18 +33,18 @@ #include "DateTimeParserTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/DateTimeParser.h" -#include "Foundation/DateTimeFormat.h" -#include "Foundation/DateTime.h" -#include "Foundation/Timestamp.h" -#include "Foundation/Exception.h" +#include "Poco/DateTimeParser.h" +#include "Poco/DateTimeFormat.h" +#include "Poco/DateTime.h" +#include "Poco/Timestamp.h" +#include "Poco/Exception.h" -using Foundation::DateTime; -using Foundation::DateTimeFormat; -using Foundation::DateTimeParser; -using Foundation::Timestamp; -using Foundation::SyntaxException; +using Poco::DateTime; +using Poco::DateTimeFormat; +using Poco::DateTimeParser; +using Poco::Timestamp; +using Poco::SyntaxException; DateTimeParserTest::DateTimeParserTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/DateTimeParserTest.h b/Foundation/testsuite/src/DateTimeParserTest.h index b567e6fca..c7a1ad731 100644 --- a/Foundation/testsuite/src/DateTimeParserTest.h +++ b/Foundation/testsuite/src/DateTimeParserTest.h @@ -1,7 +1,7 @@ // // DateTimeParserTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/DateTimeParserTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/DateTimeParserTest.h#1 $ // // Definition of the DateTimeParserTest class. // @@ -36,12 +36,8 @@ #define DateTimeParserTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class DateTimeParserTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/DateTimeTest.cpp b/Foundation/testsuite/src/DateTimeTest.cpp index 3f9a9f414..e02538020 100644 --- a/Foundation/testsuite/src/DateTimeTest.cpp +++ b/Foundation/testsuite/src/DateTimeTest.cpp @@ -1,7 +1,7 @@ // // DateTimeTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/DateTimeTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/DateTimeTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,14 +33,16 @@ #include "DateTimeTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/DateTime.h" -#include "Foundation/Timestamp.h" -#include "Foundation/Timespan.h" +#include "Poco/DateTime.h" +#include "Poco/Timestamp.h" +#include "Poco/Timespan.h" +#include "Poco/Exception.h" -using Foundation::Timestamp; -using Foundation::DateTime; -using Foundation::Timespan; +using Poco::Timestamp; +using Poco::DateTime; +using Poco::Timespan; +using Poco::AssertionViolationException; DateTimeTest::DateTimeTest(const std::string& name): CppUnit::TestCase(name) @@ -118,6 +120,18 @@ void DateTimeTest::testJulian() assert (dt.millisecond() == 0); assert (dt.dayOfWeek() == 1); assert (dt.julianDay() == 0); + + // Test that we can represent down to the microsecond. + dt = DateTime(2010, 1, 31, 17, 30, 15, 800, 3); + + assert (dt.year() == 2010); + assert (dt.month() == 1); + assert (dt.day() == 31); + assert (dt.hour() == 17); + assert (dt.minute() == 30); + assert (dt.second() == 15); + assert (dt.millisecond() == 800); + assert (dt.microsecond() == 3); } @@ -327,41 +341,245 @@ void DateTimeTest::testAMPM() void DateTimeTest::testRelational() { - DateTime dt1(2005, 1, 1, 0, 15, 30); - DateTime dt2(2005, 1, 2, 0, 15, 30); - DateTime dt3(dt1); + DateTime dt1(2005, 1, 1, 0, 15, 30); + DateTime dt2(2005, 1, 2, 0, 15, 30); + DateTime dt3(dt1); - assert (dt1 < dt2); - assert (dt1 <= dt2); - assert (dt2 > dt1); - assert (dt2 >= dt1); - assert (dt1 != dt2); - assert (!(dt1 == dt2)); + assert (dt1 < dt2); + assert (dt1 <= dt2); + assert (dt2 > dt1); + assert (dt2 >= dt1); + assert (dt1 != dt2); + assert (!(dt1 == dt2)); - assert (dt1 == dt3); - assert (!(dt1 != dt3)); - assert (dt1 >= dt3); - assert (dt1 <= dt3); - assert (!(dt1 > dt3)); - assert (!(dt1 < dt3)); + assert (dt1 == dt3); + assert (!(dt1 != dt3)); + assert (dt1 >= dt3); + assert (dt1 <= dt3); + assert (!(dt1 > dt3)); + assert (!(dt1 < dt3)); + + static const struct + { + int year; + int month; + int day; + } values[] = + { + { 1, 1, 1 }, + { 10, 4, 5 }, + { 100, 6, 7 }, + { 1000, 8, 9 }, + { 2000, 1, 31 }, + { 2002, 7, 4 }, + { 2002, 12, 31 }, + { 2003, 1, 1 }, + { 2003, 1, 2 }, + { 2003, 8, 5 }, + { 2003, 8, 6 }, + { 2003, 8, 7 }, + { 2004, 9, 3 }, + { 2004, 9, 4 }, + }; + + const int num_values = sizeof values / sizeof *values; + for (int i = 0; i < num_values; ++i) + { + DateTime v; + const DateTime& V = v; + v.assign(values[i].year, values[i].month, values[i].day); + for (int j = 0; j < num_values; ++j) + { + DateTime u; + const DateTime& U = u; + u.assign(values[j].year, values[j].month, values[j].day); + + loop_2_assert(i, j, j < i == U < V); + loop_2_assert(i, j, j <= i == U <= V); + loop_2_assert(i, j, j >= i == U >= V); + loop_2_assert(i, j, j > i == U > V); + } + } } void DateTimeTest::testArithmetics() { - DateTime dt1(2005, 1, 1, 0, 15, 30); - DateTime dt2(2005, 1, 2, 0, 15, 30); + DateTime dt1(2005, 1, 1, 0, 15, 30); + DateTime dt2(2005, 1, 2, 0, 15, 30); - Timespan s = dt2 - dt1; - assert (s.days() == 1); + Timespan s = dt2 - dt1; + assert (s.days() == 1); - DateTime dt3 = dt1 + s; - assert (dt3 == dt2); + DateTime dt3 = dt1 + s; + assert (dt3 == dt2); - dt3 -= s; - assert (dt3 == dt1); - dt1 += s; - assert (dt1 == dt2); + dt3 -= s; + assert (dt3 == dt1); + dt1 += s; + assert (dt1 == dt2); + + static const struct + { + int lineNum; // source line number + int year1; // operand/result date1 year + int month1; // operand/result date1 month + unsigned int day1; // operand/result date1 day + int numDays; // operand/result 'int' number of days + int year2; // operand/result date2 year + int month2; // operand/result date2 month + unsigned int day2; // operand/result date2 day + } data[] = + { + // - - - -first- - - - - - - second - - - + //line no. year month day numDays year month day + //------- ----- ----- ----- ------- ----- ----- ----- + { __LINE__, 1, 1, 1, 1, 1, 1, 2 }, + { __LINE__, 10, 2, 28, 1, 10, 3, 1 }, + { __LINE__, 100, 3, 31, 2, 100, 4, 2 }, + { __LINE__, 1000, 4, 30, 4, 1000, 5, 4 }, + { __LINE__, 1000, 6, 1, -31, 1000, 5, 1 }, + { __LINE__, 1001, 1, 1, -365, 1000, 1, 1 }, + { __LINE__, 1100, 5, 31, 30, 1100, 6, 30 }, + { __LINE__, 1200, 6, 30, 32, 1200, 8, 1 }, + { __LINE__, 1996, 2, 28, 367, 1997, 3, 1 }, + { __LINE__, 1997, 2, 28, 366, 1998, 3, 1 }, + { __LINE__, 1998, 2, 28, 365, 1999, 2, 28 }, + { __LINE__, 1999, 2, 28, 364, 2000, 2, 27 }, + { __LINE__, 1999, 2, 28, 1096, 2002, 2, 28 }, + { __LINE__, 2002, 2, 28, -1096, 1999, 2, 28 }, + }; + + const int num_data = sizeof data / sizeof *data; + for (int di = 0; di < num_data; ++di) + { + const int line = data[di].lineNum; + const int num_days = data[di].numDays; + DateTime x = DateTime(data[di].year1, data[di].month1, data[di].day1); + const DateTime& X = x; + x += Timespan(num_days, 0, 0, 0, 0); + loop_1_assert(line, data[di].year2 == X.year()); + loop_1_assert(line, data[di].month2 == X.month()); + loop_1_assert(line, data[di].day2 == X.day()); + } +} + +void DateTimeTest::testIncrementDecrement() +{ + static const struct + { + int lineNum; // source line number + int year1; // (first) date year + int month1; // (first) date month + unsigned int day1; // (first) date day + int year2; // (second) date year + int month2; // (second) date month + unsigned int day2; // (second) date day + } data[] = + { + // - - - -first- - - - - - - second - - - + //line no. year month day year month day + //------- ----- ----- ----- ----- ----- ----- + { __LINE__, 1, 1, 1, 1, 1, 2 }, + { __LINE__, 10, 2, 28, 10, 3, 1 }, + { __LINE__, 100, 3, 31, 100, 4, 1 }, + { __LINE__, 1000, 4, 30, 1000, 5, 1 }, + { __LINE__, 1100, 5, 31, 1100, 6, 1 }, + { __LINE__, 1200, 6, 30, 1200, 7, 1 }, + { __LINE__, 1300, 7, 31, 1300, 8, 1 }, + { __LINE__, 1400, 8, 31, 1400, 9, 1 }, + { __LINE__, 1500, 9, 30, 1500, 10, 1 }, + { __LINE__, 1600, 10, 31, 1600, 11, 1 }, + { __LINE__, 1700, 11, 30, 1700, 12, 1 }, + { __LINE__, 1800, 12, 31, 1801, 1, 1 }, + { __LINE__, 1996, 2, 28, 1996, 2, 29 }, + { __LINE__, 1997, 2, 28, 1997, 3, 1 }, + { __LINE__, 1998, 2, 28, 1998, 3, 1 }, + { __LINE__, 1999, 2, 28, 1999, 3, 1 }, + { __LINE__, 2000, 2, 28, 2000, 2, 29 }, + { __LINE__, 2001, 2, 28, 2001, 3, 1 }, + { __LINE__, 2004, 2, 28, 2004, 2, 29 }, + { __LINE__, 2100, 2, 28, 2100, 3, 1 }, + { __LINE__, 2400, 2, 28, 2400, 2, 29 }, + }; + + const int num_data = sizeof data / sizeof *data; + int di; + + for (di = 0; di < num_data; ++di) + { + const int line = data[di].lineNum; + DateTime x = DateTime(data[di].year1, data[di].month1, + data[di].day1); + // Would do pre-increment of x here. + const DateTime& X = x; + x = x + Timespan(1,0,0,0,0); + DateTime y = x; const DateTime& Y = y; + + loop_1_assert(line, data[di].year2 == X.year()); + loop_1_assert(line, data[di].month2 == X.month()); + loop_1_assert(line, data[di].day2 == X.day()); + + loop_1_assert(line, data[di].year2 == Y.year()); + loop_1_assert(line, data[di].month2 == Y.month()); + loop_1_assert(line, data[di].day2 == Y.day()); + } + + for (di = 0; di < num_data; ++di) + { + const int line = data[di].lineNum; + DateTime x = DateTime(data[di].year1, data[di].month1, data[di].day1); + DateTime x1 = DateTime(data[di].year1, data[di].month1, data[di].day1); + DateTime x2 = DateTime(data[di].year2, data[di].month2, data[di].day2); + DateTime y = x; const DateTime& Y = y; + + // Would do post increment of x here. + const DateTime& X = x; + x = x + Timespan(1,0,0,0,0); + + loop_1_assert(line, data[di].year2 == X.year()); + loop_1_assert(line, data[di].month2 == X.month()); + loop_1_assert(line, data[di].day2 == X.day()); + loop_1_assert(line, data[di].year1 == Y.year()); + loop_1_assert(line, data[di].month1 == Y.month()); + loop_1_assert(line, data[di].day1 == Y.day()); + } + + for (di = 0; di < num_data; ++di) + { + const int line = data[di].lineNum; + DateTime x = DateTime(data[di].year2, data[di].month2, data[di].day2); + const DateTime& X = x; + x = x - Timespan(1,0,0,0,0); + DateTime y = x; DateTime Y = y; + + loop_1_assert(line, data[di].year1 == X.year()); + loop_1_assert(line, data[di].month1 == X.month()); + loop_1_assert(line, data[di].day1 == X.day()); + + loop_1_assert(line, data[di].year1 == Y.year()); + loop_1_assert(line, data[di].month1 == Y.month()); + loop_1_assert(line, data[di].day1 == Y.day()); + } + + for (di = 0; di < num_data; ++di) + { + const int line = data[di].lineNum; + DateTime x1 = DateTime(data[di].year1, data[di].month1, data[di].day1); + DateTime x = DateTime(data[di].year2, data[di].month2, data[di].day2); + DateTime y = x; DateTime Y = y; + const DateTime& X = x; + // would post-decrement x here. + x = x - Timespan(1,0,0,0,0); + + loop_1_assert(line, data[di].year1 == X.year()); + loop_1_assert(line, data[di].month1 == X.month()); + loop_1_assert(line, data[di].day1 == X.day()); + + loop_1_assert(line, data[di].year2 == Y.year()); + loop_1_assert(line, data[di].month2 == Y.month()); + loop_1_assert(line, data[di].day2 == Y.day()); + } } @@ -378,6 +596,243 @@ void DateTimeTest::testSwap() } +void DateTimeTest::testUsage() +{ + DateTime dt1(1776, 7, 4); + assert(dt1.year() == 1776); + assert(dt1.month() == 7); + assert(dt1.day() == 4); + + DateTime dt2(dt1); + dt2 += Timespan(6, 0, 0, 0, 0); + assert(dt2.year() == 1776); + assert(dt2.month() == 7); + assert(dt2.day() == 10); + + Timespan span = dt2 - dt1; + assert(span.days() == 6); + + // TODO - When adding months and years we need to be + // able to specify the end-end convention. + // We cannot do this in POCO at the moment. +} + + +void DateTimeTest::testSetYearDay() +{ + static const struct + { + int d_lineNum; // source line number + int d_year; // year under test + unsigned int d_day; // day-of-year under test + int d_expMonth; // expected month + unsigned int d_expDay; // expected day + } data[] = + { + //line no. year dayOfYr exp. month exp. day + //------- ----- ------- ---------- -------- + { __LINE__, 1, 1, 1, 1 }, + { __LINE__, 1, 2, 1, 2 }, + { __LINE__, 1, 365, 12, 31 }, + { __LINE__, 1996, 1, 1, 1 }, + { __LINE__, 1996, 2, 1, 2 }, + { __LINE__, 1996, 365, 12, 30 }, + { __LINE__, 1996, 366, 12, 31 } + }; + + const int num_data = sizeof data / sizeof *data; + for (int di = 0; di < num_data; ++di) + { + const int line = data[di].d_lineNum; + const int year = data[di].d_year; + const unsigned int day = data[di].d_day; + + const int exp_month = data[di].d_expMonth; + const unsigned int exp_day = data[di].d_expDay; + const DateTime r(year, exp_month, exp_day); + DateTime x; + const DateTime& X = x; + +#if 0 + // TODO - need to be able to assign a day number in the year + // but POCO is not able to do this. + + x.assign(year, day); + + // TODO - need to be able to assert with the loop counter + // but cppUnit is not able to do this. + + assert(r == x); + assert(day == X.dayOfYear()); +#endif + } + + static const struct + { + int d_lineNum; // source line number + int d_year; // year under test + int d_day; // day-of-year under test + int d_exp; // expected status + } data2[] = + { + //line no. year dayOfYr expected value + //------- ----- ------- -------------- + { __LINE__, 1, 1, 1 }, + { __LINE__, 1, -1, 0 }, + { __LINE__, 1, 0, 0 }, + { __LINE__, 1, 365, 1 }, + { __LINE__, 1, 366, 0 }, + { __LINE__, 1, 367, 0 }, + { __LINE__, 0, 0, 0 }, + { __LINE__, -1, -1, 0 }, + { __LINE__, 1996, 1, 1 }, + { __LINE__, 1996, 2, 1 }, + { __LINE__, 1996, 32, 1 }, + { __LINE__, 1996, 365, 1 }, + { __LINE__, 1996, 366, 1 }, + { __LINE__, 1996, 367, 0 }, + }; + + const int num_data2 = sizeof data2 / sizeof *data2; + for (int di = 0; di < num_data2; ++di) + { + const int line = data2[di].d_lineNum; + const int year = data2[di].d_year; + const int day = data2[di].d_day; + const int exp = data2[di].d_exp; + DateTime x; + const DateTime& X = x; + if (1 == exp) + { + DateTime r; + const DateTime& r2 = r; +#if 0 + r.set(year, day); +#endif + } + } +} + + +void DateTimeTest::testIsValid() +{ + static const struct + { + int d_lineNum; // source line number + int d_year; // year under test + int d_month; // month under test + int d_day; // day under test + bool d_exp; // expected value + } data[] = + { + //line no. year month day expected value + //------- ----- ----- ----- -------------- + { __LINE__, 0, 0, 0, false }, + { __LINE__, 1, 1, 0, false }, + { __LINE__, 1, 0, 1, false }, + { __LINE__, 0, 1, 1, true }, + { __LINE__, 1, 1, -1, false }, + { __LINE__, 1, -1, 1, false }, + { __LINE__, 2004, 1, 32, false }, + { __LINE__, 2004, 2, 30, false }, + { __LINE__, 2004, 3, 32, false }, + { __LINE__, 2004, 4, 31, false }, + { __LINE__, 2004, 5, 32, false }, + { __LINE__, 2004, 6, 31, false }, + { __LINE__, 2004, 7, 32, false }, + { __LINE__, 2004, 8, 32, false }, + { __LINE__, 2004, 9, 31, false }, + { __LINE__, 2004, 10, 32, false }, + { __LINE__, 2004, 11, 31, false }, + { __LINE__, 2004, 12, 32, false }, + { __LINE__, 0, 12, 31, true }, + { __LINE__, 0, 2, 29, true }, + { __LINE__, 1, 1, 1, true }, + { __LINE__, 2010, 1, 2, true }, + { __LINE__, 2011, 2, 5, true }, + { __LINE__, 2012, 3, 10, true }, + { __LINE__, 2013, 4, 17, true }, + { __LINE__, 2014, 5, 23, true }, + { __LINE__, 1600, 2, 29, true }, + { __LINE__, 1700, 2, 29, false }, + { __LINE__, 1800, 2, 29, false }, + { __LINE__, 1900, 2, 29, false }, + { __LINE__, 2000, 2, 29, true }, + { __LINE__, 2100, 2, 29, false }, + }; + + const int num_data = sizeof data / sizeof *data; + for (int di = 0; di < num_data; ++di) + { + const int line = data[di].d_lineNum; + const int year = data[di].d_year; + const int month = data[di].d_month; + const int day = data[di].d_day; + const bool exp = data[di].d_exp; + + bool isValid = DateTime::isValid(year, month, day); + loop_1_assert(line, exp == isValid); + } +} + + +void DateTimeTest::testDayOfWeek() +{ + typedef DateTime::DaysOfWeek DOW; + + static const struct + { + int d_lineNum; // source line number + int d_year; // year under test + int d_month; // month under test + int d_day; // day under test + DOW d_expDay; // number of days to be added + } data[] = + { + //Line no. year month day expDay + //------- ----- ----- ----- ------- + { __LINE__, 1600, 1, 1, DateTime::SATURDAY }, + { __LINE__, 1600, 1, 2, DateTime::SUNDAY }, + { __LINE__, 1600, 1, 3, DateTime::MONDAY }, + { __LINE__, 1600, 1, 4, DateTime::TUESDAY }, + { __LINE__, 1600, 1, 5, DateTime::WEDNESDAY }, + { __LINE__, 1600, 1, 6, DateTime::THURSDAY }, + { __LINE__, 1600, 1, 7, DateTime::FRIDAY }, + { __LINE__, 1600, 1, 8, DateTime::SATURDAY }, + { __LINE__, 1752, 8, 27, DateTime::SUNDAY }, + { __LINE__, 1752, 8, 28, DateTime::MONDAY }, + { __LINE__, 1752, 8, 29, DateTime::TUESDAY }, + { __LINE__, 1752, 8, 30, DateTime::WEDNESDAY }, + { __LINE__, 1752, 8, 31, DateTime::THURSDAY }, + { __LINE__, 1752, 9, 1, DateTime::FRIDAY }, + { __LINE__, 1752, 9, 2, DateTime::SATURDAY }, + { __LINE__, 1752, 9, 14, DateTime::THURSDAY }, + { __LINE__, 1752, 9, 15, DateTime::FRIDAY }, + { __LINE__, 1752, 9, 16, DateTime::SATURDAY }, + { __LINE__, 1752, 9, 17, DateTime::SUNDAY }, + { __LINE__, 1752, 9, 18, DateTime::MONDAY }, + { __LINE__, 1752, 9, 19, DateTime::TUESDAY }, + { __LINE__, 1999, 12, 28, DateTime::TUESDAY }, + { __LINE__, 1999, 12, 29, DateTime::WEDNESDAY }, + { __LINE__, 1999, 12, 30, DateTime::THURSDAY }, + { __LINE__, 1999, 12, 31, DateTime::FRIDAY }, + { __LINE__, 2000, 1, 1, DateTime::SATURDAY }, + { __LINE__, 2000, 1, 2, DateTime::SUNDAY }, + { __LINE__, 2000, 1, 3, DateTime::MONDAY }, + { __LINE__, 2000, 1, 4, DateTime::TUESDAY }, + }; + + const int num_data = sizeof data / sizeof *data; + for (int di = 0; di < num_data ; ++di) + { + const int line = data[di].d_lineNum; + DateTime x = DateTime(data[di].d_year, data[di].d_month, data[di].d_day); + const DateTime& X = x; + loop_1_assert(line, data[di].d_expDay == X.dayOfWeek()); + } +} + + void DateTimeTest::setUp() { } @@ -403,5 +858,11 @@ CppUnit::Test* DateTimeTest::suite() CppUnit_addTest(pSuite, DateTimeTest, testArithmetics); CppUnit_addTest(pSuite, DateTimeTest, testSwap); + CppUnit_addTest(pSuite, DateTimeTest, testUsage); + CppUnit_addTest(pSuite, DateTimeTest, testSetYearDay); + CppUnit_addTest(pSuite, DateTimeTest, testIsValid); + CppUnit_addTest(pSuite, DateTimeTest, testDayOfWeek); + CppUnit_addTest(pSuite, DateTimeTest, testIncrementDecrement); + return pSuite; } diff --git a/Foundation/testsuite/src/DateTimeTest.h b/Foundation/testsuite/src/DateTimeTest.h index a64047d7e..f10103554 100644 --- a/Foundation/testsuite/src/DateTimeTest.h +++ b/Foundation/testsuite/src/DateTimeTest.h @@ -1,7 +1,7 @@ // // DateTimeTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/DateTimeTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/DateTimeTest.h#1 $ // // Definition of the DateTimeTest class. // @@ -36,12 +36,8 @@ #define DateTimeTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class DateTimeTest: public CppUnit::TestCase @@ -60,6 +56,11 @@ public: void testRelational(); void testArithmetics(); void testSwap(); + void testUsage(); + void testSetYearDay(); + void testIsValid(); + void testDayOfWeek(); + void testIncrementDecrement(); void setUp(); void tearDown(); diff --git a/Foundation/testsuite/src/DateTimeTestSuite.cpp b/Foundation/testsuite/src/DateTimeTestSuite.cpp index 3f0dfc0f9..22c30db52 100644 --- a/Foundation/testsuite/src/DateTimeTestSuite.cpp +++ b/Foundation/testsuite/src/DateTimeTestSuite.cpp @@ -1,7 +1,7 @@ // // DateTimeTestSuite.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/DateTimeTestSuite.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/DateTimeTestSuite.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. diff --git a/Foundation/testsuite/src/DateTimeTestSuite.h b/Foundation/testsuite/src/DateTimeTestSuite.h index 71b62238c..fe3a5176a 100644 --- a/Foundation/testsuite/src/DateTimeTestSuite.h +++ b/Foundation/testsuite/src/DateTimeTestSuite.h @@ -1,7 +1,7 @@ // // DateTimeTestSuite.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/DateTimeTestSuite.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/DateTimeTestSuite.h#1 $ // // Definition of the DateTimeTestSuite class. // @@ -36,9 +36,7 @@ #define DateTimeTestSuite_INCLUDED -#ifndef CppUnit_TestSuite_INCLUDED #include "CppUnit/TestSuite.h" -#endif class DateTimeTestSuite diff --git a/Foundation/testsuite/src/DigestStreamTest.cpp b/Foundation/testsuite/src/DigestStreamTest.cpp index 49ca5feb2..ecbecd30b 100644 --- a/Foundation/testsuite/src/DigestStreamTest.cpp +++ b/Foundation/testsuite/src/DigestStreamTest.cpp @@ -1,7 +1,7 @@ // // DigestStreamTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/DigestStreamTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/DigestStreamTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,15 +33,15 @@ #include "DigestStreamTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/DigestStream.h" -#include "Foundation/MD5Engine.h" +#include "Poco/DigestStream.h" +#include "Poco/MD5Engine.h" #include -using Foundation::DigestInputStream; -using Foundation::DigestOutputStream; -using Foundation::DigestEngine; -using Foundation::MD5Engine; +using Poco::DigestInputStream; +using Poco::DigestOutputStream; +using Poco::DigestEngine; +using Poco::MD5Engine; DigestStreamTest::DigestStreamTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/DigestStreamTest.h b/Foundation/testsuite/src/DigestStreamTest.h index de8d98141..eabcf2cb1 100644 --- a/Foundation/testsuite/src/DigestStreamTest.h +++ b/Foundation/testsuite/src/DigestStreamTest.h @@ -1,7 +1,7 @@ // // DigestStreamTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/DigestStreamTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/DigestStreamTest.h#1 $ // // Definition of the DigestStreamTest class. // @@ -36,12 +36,8 @@ #define DigestStreamTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class DigestStreamTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/Driver.cpp b/Foundation/testsuite/src/Driver.cpp index 2772cfa93..5575cece5 100644 --- a/Foundation/testsuite/src/Driver.cpp +++ b/Foundation/testsuite/src/Driver.cpp @@ -1,7 +1,7 @@ // // Driver.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/Driver.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/Driver.cpp#1 $ // // Console-based test driver. // diff --git a/Foundation/testsuite/src/DummyDelegate.cpp b/Foundation/testsuite/src/DummyDelegate.cpp index b906a420d..9c1e8b068 100644 --- a/Foundation/testsuite/src/DummyDelegate.cpp +++ b/Foundation/testsuite/src/DummyDelegate.cpp @@ -1,7 +1,7 @@ // // DummyDelegate.cpp // -// $Id: $ +// $Id: //poco/1.2/Foundation/testsuite/src/DummyDelegate.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -31,7 +31,7 @@ #include "DummyDelegate.h" -#include "Foundation/Exception.h" +#include "Poco/Exception.h" DummyDelegate::DummyDelegate () {} DummyDelegate::~DummyDelegate () {} @@ -40,7 +40,7 @@ void DummyDelegate::onSimple ( const void* pSender, int& i ) { if ( i != 0) { - throw Foundation::InvalidArgumentException(); + throw Poco::InvalidArgumentException(); } i++; } @@ -48,7 +48,7 @@ void DummyDelegate::onSimple2 ( const void* pSender, int& i ) { if ( i != 1) { - throw Foundation::InvalidArgumentException(); + throw Poco::InvalidArgumentException(); } i++; } diff --git a/Foundation/testsuite/src/DummyDelegate.h b/Foundation/testsuite/src/DummyDelegate.h index d7bd7a002..d2f1f05c3 100644 --- a/Foundation/testsuite/src/DummyDelegate.h +++ b/Foundation/testsuite/src/DummyDelegate.h @@ -1,18 +1,50 @@ // // DummyDelegate.h // +// $Id: //poco/1.2/Foundation/testsuite/src/DummyDelegate.h#1 $ +// +// Definition of DummyDelegate class. +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + #ifndef DummyDelegate_INCLUDED #define DummyDelegate_INCLUDED + class DummyDelegate { public: - DummyDelegate (); - virtual ~DummyDelegate (); + DummyDelegate(); + virtual ~DummyDelegate(); - void onSimple ( const void* pSender, int& i ); - void onSimple2 ( const void* pSender, int& i ); + void onSimple(const void* pSender, int& i); + void onSimple2(const void* pSender, int& i); }; + #endif // DummyDelegate_INCLUDED diff --git a/Foundation/testsuite/src/DynamicFactoryTest.cpp b/Foundation/testsuite/src/DynamicFactoryTest.cpp index c3e5dc202..aa6b0365b 100644 --- a/Foundation/testsuite/src/DynamicFactoryTest.cpp +++ b/Foundation/testsuite/src/DynamicFactoryTest.cpp @@ -1,7 +1,7 @@ // // DynamicFactoryTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/DynamicFactoryTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/DynamicFactoryTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,13 +33,13 @@ #include "DynamicFactoryTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/DynamicFactory.h" -#include "Foundation/Exception.h" +#include "Poco/DynamicFactory.h" +#include "Poco/Exception.h" #include -using Foundation::DynamicFactory; -using Foundation::Instantiator; +using Poco::DynamicFactory; +using Poco::Instantiator; namespace @@ -99,7 +99,7 @@ void DynamicFactoryTest::testDynamicFactory() dynFactory.registerClass("A"); fail("already registered - must throw"); } - catch (Foundation::ExistsException&) + catch (Poco::ExistsException&) { } @@ -112,7 +112,7 @@ void DynamicFactoryTest::testDynamicFactory() std::auto_ptr b(dynamic_cast(dynFactory.createInstance("B"))); fail("unregistered - must throw"); } - catch (Foundation::NotFoundException&) + catch (Poco::NotFoundException&) { } } diff --git a/Foundation/testsuite/src/DynamicFactoryTest.h b/Foundation/testsuite/src/DynamicFactoryTest.h index aa440e0bf..12c5e3338 100644 --- a/Foundation/testsuite/src/DynamicFactoryTest.h +++ b/Foundation/testsuite/src/DynamicFactoryTest.h @@ -1,7 +1,7 @@ // // DynamicFactoryTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/DynamicFactoryTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/DynamicFactoryTest.h#1 $ // // Definition of the DynamicFactoryTest class. // @@ -36,12 +36,8 @@ #define DynamicFactoryTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class DynamicFactoryTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/EventTestSuite.cpp b/Foundation/testsuite/src/EventTestSuite.cpp index 1648bbb00..fd7a2f43d 100644 --- a/Foundation/testsuite/src/EventTestSuite.cpp +++ b/Foundation/testsuite/src/EventTestSuite.cpp @@ -1,7 +1,7 @@ // // EventTestSuite.cpp // -// $Id: $ +// $Id: //poco/1.2/Foundation/testsuite/src/EventTestSuite.cpp#1 $ // // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. // and Contributors. diff --git a/Foundation/testsuite/src/EventTestSuite.h b/Foundation/testsuite/src/EventTestSuite.h index d8f41ed5e..1cd4f4643 100644 --- a/Foundation/testsuite/src/EventTestSuite.h +++ b/Foundation/testsuite/src/EventTestSuite.h @@ -1,7 +1,7 @@ // // EventTestSuite.h // -// $Id: $ +// $Id: //poco/1.2/Foundation/testsuite/src/EventTestSuite.h#1 $ // // Definition of the EventTestSuite class. // @@ -36,9 +36,7 @@ #define EventTestSuite_INCLUDED -#ifndef CppUnit_TestSuite_INCLUDED #include "CppUnit/TestSuite.h" -#endif class EventTestSuite diff --git a/Foundation/testsuite/src/ExpireCacheTest.cpp b/Foundation/testsuite/src/ExpireCacheTest.cpp index 634fcddaf..d0684e235 100644 --- a/Foundation/testsuite/src/ExpireCacheTest.cpp +++ b/Foundation/testsuite/src/ExpireCacheTest.cpp @@ -1,7 +1,7 @@ // // ExpireCacheTest.cpp // -// $Id: //poco/Main/Foundation/testsuite/src/ExpireCacheTest.cpp#5 $ +// $Id: //poco/1.2/Foundation/testsuite/src/ExpireCacheTest.cpp#1 $ // // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -31,20 +31,22 @@ #include "ExpireCacheTest.h" - #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" +#include "Poco/Exception.h" +#include "Poco/ExpireCache.h" +#include "Poco/Bugcheck.h" +#include "Poco/Thread.h" + + +using namespace Poco; -#include "Foundation/Exception.h" -#include "Foundation/ExpireCache.h" -#include "Foundation/Bugcheck.h" -#include "Foundation/Thread.h" -using namespace Foundation; #define DURSLEEP 250 #define DURHALFSLEEP DURSLEEP / 2 #define DURWAIT 300 + ExpireCacheTest::ExpireCacheTest(const std::string& name ): CppUnit::TestCase(name) { } @@ -71,20 +73,17 @@ void ExpireCacheTest::testClear() poco_assert ( !aCache.has( 1 ) ); poco_assert ( !aCache.has( 3 ) ); poco_assert ( !aCache.has( 5 ) ); - - } void ExpireCacheTest::testExpire0() { - try { ExpireCache < int, int > aCache( 24 ); failmsg ( "cache expire lower than 25 is illegal, test should fail"); } - catch ( Foundation::InvalidArgumentException& ) + catch ( Poco::InvalidArgumentException& ) { } } @@ -142,6 +141,18 @@ void ExpireCacheTest::testExpireN() } +void ExpireCacheTest::testDuplicateAdd() +{ + ExpireCache < int, int > aCache( DURSLEEP ); + aCache.add(1, 2); // 1 + poco_assert (aCache.has(1)); + poco_assert (*aCache.get(1) == 2); + aCache.add(1, 3); + poco_assert (aCache.has(1)); + poco_assert (*aCache.get(1) == 3); +} + + void ExpireCacheTest::setUp() { } @@ -159,6 +170,7 @@ CppUnit::Test* ExpireCacheTest::suite() CppUnit_addTest(pSuite, ExpireCacheTest, testClear); CppUnit_addTest(pSuite, ExpireCacheTest, testExpire0); CppUnit_addTest(pSuite, ExpireCacheTest, testExpireN); + CppUnit_addTest(pSuite, ExpireCacheTest, testDuplicateAdd); return pSuite; } diff --git a/Foundation/testsuite/src/ExpireCacheTest.h b/Foundation/testsuite/src/ExpireCacheTest.h index 3b49523ed..22a70546d 100644 --- a/Foundation/testsuite/src/ExpireCacheTest.h +++ b/Foundation/testsuite/src/ExpireCacheTest.h @@ -1,7 +1,7 @@ // // ExpireCacheTest.h // -// $Id: $ +// $Id: //poco/1.2/Foundation/testsuite/src/ExpireCacheTest.h#1 $ // // Tests for ExpireCache // @@ -35,12 +35,9 @@ #define ExpireCacheTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif + class ExpireCacheTest: public CppUnit::TestCase { @@ -49,6 +46,7 @@ public: ~ExpireCacheTest(); void testClear(); + void testDuplicateAdd(); void testExpire0(); void testExpireN(); diff --git a/Foundation/testsuite/src/ExpireLRUCacheTest.cpp b/Foundation/testsuite/src/ExpireLRUCacheTest.cpp index 34686d50c..2fd32c992 100644 --- a/Foundation/testsuite/src/ExpireLRUCacheTest.cpp +++ b/Foundation/testsuite/src/ExpireLRUCacheTest.cpp @@ -1,7 +1,7 @@ // // ExpireLRUCacheTest.cpp // -// $Id: //poco/Main/Foundation/testsuite/src/ExpireLRUCacheTest.cpp#5 $ +// $Id: //poco/1.2/Foundation/testsuite/src/ExpireLRUCacheTest.cpp#1 $ // // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -31,20 +31,22 @@ #include "ExpireLRUCacheTest.h" - #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" +#include "Poco/Exception.h" +#include "Poco/ExpireLRUCache.h" +#include "Poco/Bugcheck.h" +#include "Poco/Thread.h" + + +using namespace Poco; -#include "Foundation/Exception.h" -#include "Foundation/ExpireLRUCache.h" -#include "Foundation/Bugcheck.h" -#include "Foundation/Thread.h" -using namespace Foundation; #define DURSLEEP 250 #define DURHALFSLEEP DURSLEEP / 2 #define DURWAIT 300 + ExpireLRUCacheTest::ExpireLRUCacheTest(const std::string& name ): CppUnit::TestCase(name) { } @@ -71,20 +73,17 @@ void ExpireLRUCacheTest::testClear() poco_assert ( !aCache.has( 1 ) ); poco_assert ( !aCache.has( 3 ) ); poco_assert ( !aCache.has( 5 ) ); - - } void ExpireLRUCacheTest::testExpire0() { - try { ExpireLRUCache < int, int > aCache( 1024, 24 ); failmsg ( "cache expire lower than 25 is illegal, test should fail"); } - catch (Foundation::InvalidArgumentException&) + catch (Poco::InvalidArgumentException&) { } } @@ -150,7 +149,7 @@ void ExpireLRUCacheTest::testCacheSize0() ExpireLRUCache < int, int > aCache( 0 ); failmsg ("cache size of 0 is illegal, test should fail"); } - catch (Foundation::InvalidArgumentException&) + catch (Poco::InvalidArgumentException&) { } } @@ -179,8 +178,6 @@ void ExpireLRUCacheTest::testCacheSize1() // removing illegal entries should work too aCache.remove(666); - - } @@ -274,6 +271,19 @@ void ExpireLRUCacheTest::testCacheSizeN() poco_assert ( !aCache.has( 3 ) ); } + +void ExpireLRUCacheTest::testDuplicateAdd() +{ + ExpireLRUCache < int, int > aCache( 3 ); + aCache.add(1, 2); // 1 + poco_assert (aCache.has(1)); + poco_assert (*aCache.get(1) == 2); + aCache.add(1, 3); + poco_assert (aCache.has(1)); + poco_assert (*aCache.get(1) == 3); +} + + void ExpireLRUCacheTest::setUp() { } @@ -295,6 +305,7 @@ CppUnit::Test* ExpireLRUCacheTest::suite() CppUnit_addTest(pSuite, ExpireLRUCacheTest, testCacheSize1); CppUnit_addTest(pSuite, ExpireLRUCacheTest, testCacheSize2); CppUnit_addTest(pSuite, ExpireLRUCacheTest, testCacheSizeN); + CppUnit_addTest(pSuite, ExpireLRUCacheTest, testDuplicateAdd); return pSuite; } diff --git a/Foundation/testsuite/src/ExpireLRUCacheTest.h b/Foundation/testsuite/src/ExpireLRUCacheTest.h index 1c6c099fa..279874815 100644 --- a/Foundation/testsuite/src/ExpireLRUCacheTest.h +++ b/Foundation/testsuite/src/ExpireLRUCacheTest.h @@ -1,7 +1,7 @@ // // ExpireLRUCacheTest.h // -// $Id: $ +// $Id: //poco/1.2/Foundation/testsuite/src/ExpireLRUCacheTest.h#1 $ // // Tests for ExpireLRUCache // @@ -35,12 +35,9 @@ #define ExpireLRUCacheTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif + class ExpireLRUCacheTest: public CppUnit::TestCase { @@ -55,6 +52,7 @@ public: void testCacheSize1(); void testCacheSize2(); void testCacheSizeN(); + void testDuplicateAdd(); void setUp(); void tearDown(); diff --git a/Foundation/testsuite/src/FIFOEventTest.cpp b/Foundation/testsuite/src/FIFOEventTest.cpp index 4d60d9c95..7734e434b 100644 --- a/Foundation/testsuite/src/FIFOEventTest.cpp +++ b/Foundation/testsuite/src/FIFOEventTest.cpp @@ -1,7 +1,7 @@ // // FIFOEventTest.cpp // -// $Id: //poco/Main/Foundation/testsuite/src/FIFOEventTest.cpp#5 $ +// $Id: //poco/1.2/Foundation/testsuite/src/FIFOEventTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -34,16 +34,18 @@ #include "DummyDelegate.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" +#include "Poco/Delegate.h" +#include "Poco/Expire.h" +#include "Poco/Thread.h" +#include "Poco/Exception.h" -#include "Foundation/Delegate.h" -#include "Foundation/Expire.h" -#include "Foundation/Thread.h" -#include "Foundation/Exception.h" -using namespace Foundation; +using namespace Poco; + #define LARGEINC 100 + FIFOEventTest::FIFOEventTest(const std::string& name ): CppUnit::TestCase(name) { } @@ -74,24 +76,24 @@ void FIFOEventTest::testNoDelegate() //Note: passing &args will not work due to & EventArgs* pArgs = &args; - Complex += Delegate < FIFOEventTest, Foundation::EventArgs* > (this, &FIFOEventTest::onComplex); - Complex -= Delegate < FIFOEventTest, Foundation::EventArgs* > (this, &FIFOEventTest::onComplex); + Complex += Delegate < FIFOEventTest, Poco::EventArgs* > (this, &FIFOEventTest::onComplex); + Complex -= Delegate < FIFOEventTest, Poco::EventArgs* > (this, &FIFOEventTest::onComplex); Complex.notify ( this, pArgs ); poco_assert ( _count == 0 ); - Complex2 += Delegate < FIFOEventTest, Foundation::EventArgs > (this, &FIFOEventTest::onComplex2); - Complex2 -= Delegate < FIFOEventTest, Foundation::EventArgs > (this, &FIFOEventTest::onComplex2); + Complex2 += Delegate < FIFOEventTest, Poco::EventArgs > (this, &FIFOEventTest::onComplex2); + Complex2 -= Delegate < FIFOEventTest, Poco::EventArgs > (this, &FIFOEventTest::onComplex2); Complex2.notify ( this, args ); poco_assert ( _count == 0 ); const EventArgs* pCArgs = &args; - ConstComplex += Delegate < FIFOEventTest, const Foundation::EventArgs* > (this, &FIFOEventTest::onConstComplex); - ConstComplex -= Delegate < FIFOEventTest, const Foundation::EventArgs* > (this, &FIFOEventTest::onConstComplex); + ConstComplex += Delegate < FIFOEventTest, const Poco::EventArgs* > (this, &FIFOEventTest::onConstComplex); + ConstComplex -= Delegate < FIFOEventTest, const Poco::EventArgs* > (this, &FIFOEventTest::onConstComplex); ConstComplex.notify ( this, pCArgs ); poco_assert ( _count == 0 ); - Const2Complex += Delegate < FIFOEventTest, const Foundation::EventArgs* const > (this, &FIFOEventTest::onConst2Complex); - Const2Complex -= Delegate < FIFOEventTest, const Foundation::EventArgs* const > (this, &FIFOEventTest::onConst2Complex); + Const2Complex += Delegate < FIFOEventTest, const Poco::EventArgs* const > (this, &FIFOEventTest::onConst2Complex); + Const2Complex -= Delegate < FIFOEventTest, const Poco::EventArgs* const > (this, &FIFOEventTest::onConst2Complex); Const2Complex.notify ( this, pArgs ); poco_assert ( _count == 0 ); } @@ -112,20 +114,20 @@ void FIFOEventTest::testSingleDelegate() poco_assert ( _count == 2 ); EventArgs* pArgs = &args; - Complex += Delegate < FIFOEventTest, Foundation::EventArgs* > (this, &FIFOEventTest::onComplex); + Complex += Delegate < FIFOEventTest, Poco::EventArgs* > (this, &FIFOEventTest::onComplex); Complex.notify ( this, pArgs ); poco_assert ( _count == 3 ); - Complex2 += Delegate < FIFOEventTest, Foundation::EventArgs > (this, &FIFOEventTest::onComplex2); + Complex2 += Delegate < FIFOEventTest, Poco::EventArgs > (this, &FIFOEventTest::onComplex2); Complex2.notify ( this, args ); poco_assert ( _count == 4 ); const EventArgs* pCArgs = &args; - ConstComplex += Delegate < FIFOEventTest, const Foundation::EventArgs* > (this, &FIFOEventTest::onConstComplex); + ConstComplex += Delegate < FIFOEventTest, const Poco::EventArgs* > (this, &FIFOEventTest::onConstComplex); ConstComplex.notify ( this, pCArgs ); poco_assert ( _count == 5 ); - Const2Complex += Delegate < FIFOEventTest, const Foundation::EventArgs* const > (this, &FIFOEventTest::onConst2Complex); + Const2Complex += Delegate < FIFOEventTest, const Poco::EventArgs* const > (this, &FIFOEventTest::onConst2Complex); Const2Complex.notify ( this, pArgs ); poco_assert ( _count == 6 ); // check if 2nd notify also works @@ -222,7 +224,7 @@ void FIFOEventTest::testFIFOOrder () Simple.notify ( this, tmp ); failmsg ("Notify should not work"); } - catch ( Foundation::InvalidArgumentException& ) + catch ( Poco::InvalidArgumentException& ) { } } @@ -270,7 +272,7 @@ void FIFOEventTest::testFIFOOrderExpire () Simple.notify ( this, tmp ); failmsg ("Notify should not work"); } - catch ( Foundation::InvalidArgumentException& ) + catch ( Poco::InvalidArgumentException& ) { } @@ -286,7 +288,7 @@ void FIFOEventTest::testExpire () Simple += Expire < int > (Delegate < FIFOEventTest, int > (this, &FIFOEventTest::onSimple), 500 ); Simple.notify ( this, tmp ); poco_assert ( _count == 1 ); - Foundation::Thread::sleep ( 700 ); + Poco::Thread::sleep ( 700 ); Simple.notify ( this, tmp ); poco_assert ( _count == 1 ); } @@ -301,15 +303,15 @@ void FIFOEventTest::testExpireReRegister() Simple += Expire < int > (Delegate < FIFOEventTest, int > (this, &FIFOEventTest::onSimple), 500 ); Simple.notify ( this, tmp ); poco_assert ( _count == 1 ); - Foundation::Thread::sleep ( 200 ); + Poco::Thread::sleep ( 200 ); Simple.notify ( this, tmp ); poco_assert ( _count == 2 ); // renew registration Simple += Expire < int > (Delegate < FIFOEventTest, int > (this, &FIFOEventTest::onSimple), 600 ); - Foundation::Thread::sleep( 400 ); + Poco::Thread::sleep( 400 ); Simple.notify ( this, tmp ); poco_assert ( _count == 3 ); - Foundation::Thread::sleep( 300 ); + Poco::Thread::sleep( 300 ); Simple.notify ( this, tmp ); poco_assert ( _count == 3 ); } @@ -343,11 +345,11 @@ void FIFOEventTest::testOverwriteDelegate () void FIFOEventTest::testAsyncNotify () { - Foundation::FIFOEvent < int >* pSimple= new Foundation::FIFOEvent < int >(); + Poco::FIFOEvent < int >* pSimple= new Poco::FIFOEvent < int >(); (*pSimple) += Delegate < FIFOEventTest, int > (this, &FIFOEventTest::onAsync); poco_assert ( _count == 0 ); int tmp = 0; - Foundation::ActiveResult < int > retArg = pSimple->notifyAsync ( this, tmp ); + Poco::ActiveResult < int > retArg = pSimple->notifyAsync ( this, tmp ); delete pSimple; // must work even when the event got deleted! pSimple = NULL; poco_assert ( _count == 0 ); @@ -371,29 +373,29 @@ void FIFOEventTest::onConstSimple ( const void* pSender, const int& i ) _count++; } -void FIFOEventTest::onComplex ( const void* pSender, Foundation::EventArgs* & i ) +void FIFOEventTest::onComplex ( const void* pSender, Poco::EventArgs* & i ) { _count++; } -void FIFOEventTest::onComplex2 ( const void* pSender, Foundation::EventArgs & i ) +void FIFOEventTest::onComplex2 ( const void* pSender, Poco::EventArgs & i ) { _count++; } -void FIFOEventTest::onConstComplex ( const void* pSender, const Foundation::EventArgs*& i ) +void FIFOEventTest::onConstComplex ( const void* pSender, const Poco::EventArgs*& i ) { _count++; } -void FIFOEventTest::onConst2Complex ( const void* pSender, const Foundation::EventArgs * const & i ) +void FIFOEventTest::onConst2Complex ( const void* pSender, const Poco::EventArgs * const & i ) { _count++; } void FIFOEventTest::onAsync ( const void* pSender, int& i ) { - Foundation::Thread::sleep ( 700 ); + Poco::Thread::sleep ( 700 ); _count += LARGEINC ; } diff --git a/Foundation/testsuite/src/FIFOEventTest.h b/Foundation/testsuite/src/FIFOEventTest.h index 6607d037d..d0ef07ba8 100644 --- a/Foundation/testsuite/src/FIFOEventTest.h +++ b/Foundation/testsuite/src/FIFOEventTest.h @@ -1,7 +1,7 @@ // // FIFOEventTest.h // -// $Id: $ +// $Id: //poco/1.2/Foundation/testsuite/src/FIFOEventTest.h#1 $ // // Definition of the FIFOEventTest class. // @@ -31,28 +31,25 @@ // DEALINGS IN THE SOFTWARE. // + #ifndef FIFOEventTest_INCLUDED #define FIFOEventTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif +#include "Poco/FIFOEvent.h" +#include "Poco/EventArgs.h" -#include "Foundation/FIFOEvent.h" -#include "Foundation/EventArgs.h" class FIFOEventTest: public CppUnit::TestCase { - Foundation::FIFOEvent Simple; - Foundation::FIFOEvent ConstSimple; - Foundation::FIFOEvent Complex; - Foundation::FIFOEvent Complex2; - Foundation::FIFOEvent ConstComplex; - Foundation::FIFOEvent Const2Complex; + Poco::FIFOEvent Simple; + Poco::FIFOEvent ConstSimple; + Poco::FIFOEvent Complex; + Poco::FIFOEvent Complex2; + Poco::FIFOEvent ConstComplex; + Poco::FIFOEvent Const2Complex; public: FIFOEventTest(const std::string& name); ~FIFOEventTest(); @@ -79,10 +76,10 @@ protected: void onSimple ( const void* pSender, int& i ); void onSimpleOther ( const void* pSender, int& i ); void onConstSimple ( const void* pSender, const int& i ); - void onComplex ( const void* pSender, Foundation::EventArgs* & i ); - void onComplex2 ( const void* pSender, Foundation::EventArgs & i ); - void onConstComplex ( const void* pSender, const Foundation::EventArgs*& i ); - void onConst2Complex ( const void* pSender, const Foundation::EventArgs * const & i ); + void onComplex ( const void* pSender, Poco::EventArgs* & i ); + void onComplex2 ( const void* pSender, Poco::EventArgs & i ); + void onConstComplex ( const void* pSender, const Poco::EventArgs*& i ); + void onConst2Complex ( const void* pSender, const Poco::EventArgs * const & i ); void onAsync ( const void* pSender, int& i ); int getCount () const; diff --git a/Foundation/testsuite/src/FPETest.cpp b/Foundation/testsuite/src/FPETest.cpp index 632b6b462..d27b5a681 100644 --- a/Foundation/testsuite/src/FPETest.cpp +++ b/Foundation/testsuite/src/FPETest.cpp @@ -1,7 +1,7 @@ // // FPETest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/FPETest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/FPETest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,10 +33,10 @@ #include "FPETest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/FPEnvironment.h" +#include "Poco/FPEnvironment.h" -using Foundation::FPE; +using Poco::FPE; FPETest::FPETest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/FPETest.h b/Foundation/testsuite/src/FPETest.h index c6284ea25..9ddd4e891 100644 --- a/Foundation/testsuite/src/FPETest.h +++ b/Foundation/testsuite/src/FPETest.h @@ -1,7 +1,7 @@ // // FPETest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/FPETest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/FPETest.h#1 $ // // Definition of the FPETest class. // @@ -36,12 +36,8 @@ #define FPETest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class FPETest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/FileChannelTest.cpp b/Foundation/testsuite/src/FileChannelTest.cpp index 468e34682..2fe5435c1 100644 --- a/Foundation/testsuite/src/FileChannelTest.cpp +++ b/Foundation/testsuite/src/FileChannelTest.cpp @@ -1,7 +1,7 @@ // // FileChannelTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/FileChannelTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/FileChannelTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,37 +33,37 @@ #include "FileChannelTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/FileChannel.h" -#include "Foundation/Message.h" -#include "Foundation/AutoPtr.h" -#include "Foundation/TemporaryFile.h" -#include "Foundation/Thread.h" -#include "Foundation/File.h" -#include "Foundation/Path.h" -#include "Foundation/Timestamp.h" -#include "Foundation/DateTime.h" -#include "Foundation/LocalDateTime.h" -#include "Foundation/DateTimeFormatter.h" -#include "Foundation/DateTimeFormat.h" -#include "Foundation/NumberFormatter.h" -#include "Foundation/DirectoryIterator.h" +#include "Poco/FileChannel.h" +#include "Poco/Message.h" +#include "Poco/AutoPtr.h" +#include "Poco/TemporaryFile.h" +#include "Poco/Thread.h" +#include "Poco/File.h" +#include "Poco/Path.h" +#include "Poco/Timestamp.h" +#include "Poco/DateTime.h" +#include "Poco/LocalDateTime.h" +#include "Poco/DateTimeFormatter.h" +#include "Poco/DateTimeFormat.h" +#include "Poco/NumberFormatter.h" +#include "Poco/DirectoryIterator.h" #include -using Foundation::FileChannel; -using Foundation::Message; -using Foundation::AutoPtr; -using Foundation::TemporaryFile; -using Foundation::Thread; -using Foundation::File; -using Foundation::Path; -using Foundation::Timestamp; -using Foundation::NumberFormatter; -using Foundation::DateTime; -using Foundation::LocalDateTime; -using Foundation::DateTimeFormatter; -using Foundation::DateTimeFormat; -using Foundation::DirectoryIterator; +using Poco::FileChannel; +using Poco::Message; +using Poco::AutoPtr; +using Poco::TemporaryFile; +using Poco::Thread; +using Poco::File; +using Poco::Path; +using Poco::Timestamp; +using Poco::NumberFormatter; +using Poco::DateTime; +using Poco::LocalDateTime; +using Poco::DateTimeFormatter; +using Poco::DateTimeFormat; +using Poco::DirectoryIterator; FileChannelTest::FileChannelTest(const std::string& name): CppUnit::TestCase(name) @@ -348,6 +348,7 @@ void FileChannelTest::testCompress() { pChannel->log(msg); } + Thread::sleep(3000); // allow time for background compression File f0(name + ".0.gz"); assert (f0.exists()); File f1(name + ".1.gz"); diff --git a/Foundation/testsuite/src/FileChannelTest.h b/Foundation/testsuite/src/FileChannelTest.h index 14cafb31d..bff4bad41 100644 --- a/Foundation/testsuite/src/FileChannelTest.h +++ b/Foundation/testsuite/src/FileChannelTest.h @@ -1,7 +1,7 @@ // // FileChannelTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/FileChannelTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/FileChannelTest.h#1 $ // // Definition of the FileChannelTest class. // @@ -36,12 +36,8 @@ #define FileChannelTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class FileChannelTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/FileTest.cpp b/Foundation/testsuite/src/FileTest.cpp index e454e9e7c..f07cc9799 100644 --- a/Foundation/testsuite/src/FileTest.cpp +++ b/Foundation/testsuite/src/FileTest.cpp @@ -1,7 +1,7 @@ // // FileTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/FileTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/FileTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,21 +33,21 @@ #include "FileTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/File.h" -#include "Foundation/TemporaryFile.h" -#include "Foundation/Path.h" -#include "Foundation/Exception.h" -#include "Foundation/Thread.h" +#include "Poco/File.h" +#include "Poco/TemporaryFile.h" +#include "Poco/Path.h" +#include "Poco/Exception.h" +#include "Poco/Thread.h" #include #include -using Foundation::File; -using Foundation::TemporaryFile; -using Foundation::Path; -using Foundation::Exception; -using Foundation::Timestamp; -using Foundation::Thread; +using Poco::File; +using Poco::TemporaryFile; +using Poco::Path; +using Poco::Exception; +using Poco::Timestamp; +using Poco::Thread; FileTest::FileTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/FileTest.h b/Foundation/testsuite/src/FileTest.h index 6e6094751..ef732220e 100644 --- a/Foundation/testsuite/src/FileTest.h +++ b/Foundation/testsuite/src/FileTest.h @@ -1,7 +1,7 @@ // // FileTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/FileTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/FileTest.h#1 $ // // Definition of the FileTest class. // @@ -36,12 +36,8 @@ #define FileTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class FileTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/FilesystemTestSuite.cpp b/Foundation/testsuite/src/FilesystemTestSuite.cpp index 8048f9e03..fe1ab1d00 100644 --- a/Foundation/testsuite/src/FilesystemTestSuite.cpp +++ b/Foundation/testsuite/src/FilesystemTestSuite.cpp @@ -1,7 +1,7 @@ // // FilesystemTestSuite.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/FilesystemTestSuite.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/FilesystemTestSuite.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. diff --git a/Foundation/testsuite/src/FilesystemTestSuite.h b/Foundation/testsuite/src/FilesystemTestSuite.h index cbaea02af..a6fa98ed3 100644 --- a/Foundation/testsuite/src/FilesystemTestSuite.h +++ b/Foundation/testsuite/src/FilesystemTestSuite.h @@ -1,7 +1,7 @@ // // FilesystemTestSuite.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/FilesystemTestSuite.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/FilesystemTestSuite.h#1 $ // // Definition of the FilesystemTestSuite class. // @@ -36,9 +36,7 @@ #define FilesystemTestSuite_INCLUDED -#ifndef CppUnit_TestSuite_INCLUDED #include "CppUnit/TestSuite.h" -#endif class FilesystemTestSuite diff --git a/Foundation/testsuite/src/FormatTest.cpp b/Foundation/testsuite/src/FormatTest.cpp new file mode 100644 index 000000000..c30d78e4a --- /dev/null +++ b/Foundation/testsuite/src/FormatTest.cpp @@ -0,0 +1,310 @@ +// +// FormatTest.cpp +// +// $Id: //poco/1.2/Foundation/testsuite/src/FormatTest.cpp#1 $ +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Redistributions in any form must be accompanied by information on +// how to obtain complete source code for this software and any +// accompanying software that uses this software. The source code +// must either be included in the distribution or be available for no +// more than the cost of distribution plus a nominal fee, and must be +// freely redistributable under reasonable conditions. For an +// executable file, complete source code means the source code for all +// modules it contains. It does not include source code for modules or +// files that typically accompany the major components of the operating +// system on which the executable file runs. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + + +#include "FormatTest.h" +#include "CppUnit/TestCaller.h" +#include "CppUnit/TestSuite.h" +#include "Poco/Format.h" +#include "Poco/Exception.h" + + +using Poco::format; +using Poco::BadCastException; +using Poco::Int64; +using Poco::UInt64; + + +FormatTest::FormatTest(const std::string& name): CppUnit::TestCase(name) +{ +} + + +FormatTest::~FormatTest() +{ +} + + +void FormatTest::testChar() +{ + char c = 'a'; + std::string s(format("%c", c)); + assert (s == "a"); + s = format("%2c", c); + assert (s == " a"); + s = format("%-2c", c); + assert (s == "a "); + + try + { + s = format("%c", std::string("foo")); + fail("bad argument - must throw"); + } + catch (BadCastException&) + { + } +} + + +void FormatTest::testInt() +{ + int i = 42; + std::string s(format("%d", i)); + assert (s == "42"); + s = format("%4d", i); + assert (s == " 42"); + s = format("%04d", i); + assert (s == "0042"); + + short h = 42; + s = format("%hd", h); + assert (s == "42"); + s = format("%4hd", h); + assert (s == " 42"); + s = format("%04hd", h); + assert (s == "0042"); + + unsigned short hu = 42; + s = format("%hu", hu); + assert (s == "42"); + s = format("%4hu", hu); + assert (s == " 42"); + s = format("%04hu", hu); + assert (s == "0042"); + + unsigned x = 0x42; + s = format("%x", x); + assert (s == "42"); + s = format("%4x", x); + assert (s == " 42"); + s = format("%04x", x); + assert (s == "0042"); + + unsigned o = 042; + s = format("%o", o); + assert (s == "42"); + s = format("%4o", o); + assert (s == " 42"); + s = format("%04o", o); + assert (s == "0042"); + + unsigned u = 42; + s = format("%u", u); + assert (s == "42"); + s = format("%4u", u); + assert (s == " 42"); + s = format("%04u", u); + assert (s == "0042"); + + long l = 42; + s = format("%ld", l); + assert (s == "42"); + s = format("%4ld", l); + assert (s == " 42"); + s = format("%04ld", l); + assert (s == "0042"); + + unsigned long ul = 42; + s = format("%lu", ul); + assert (s == "42"); + s = format("%4lu", ul); + assert (s == " 42"); + s = format("%04lu", ul); + assert (s == "0042"); + + unsigned long xl = 0x42; + s = format("%lx", xl); + assert (s == "42"); + s = format("%4lx", xl); + assert (s == " 42"); + s = format("%04lx", xl); + assert (s == "0042"); + + Int64 i64 = 42; + s = format("%Ld", i64); + assert (s == "42"); + s = format("%4Ld", i64); + assert (s == " 42"); + s = format("%04Ld", i64); + assert (s == "0042"); + + UInt64 ui64 = 42; + s = format("%Lu", ui64); + assert (s == "42"); + s = format("%4Lu", ui64); + assert (s == " 42"); + s = format("%04Lu", ui64); + assert (s == "0042"); + + x = 0xaa; + s = format("%x", x); + assert (s == "aa"); + s = format("%X", x); + assert (s == "AA"); + + i = 42; + s = format("%+d", i); + assert (s == "+42"); + + i = -42; + s = format("%+d", i); + assert (s == "-42"); + s = format("%d", i); + assert (s == "-42"); + + s = format("%d", i); + assert (s == "-42"); + + x = 0x42; + s = format("%#x", x); + assert (s == "0x42"); + + try + { + s = format("%d", l); + fail("bad argument - must throw"); + } + catch (BadCastException&) + { + } + +} + + +void FormatTest::testFloatFix() +{ + double d = 1.5; + std::string s(format("%f", d)); + assert (s.find("1.50") == 0); + + s = format("%10f", d); + assert (s.find(" 1.50") != std::string::npos); + + s = format("%6.2f", d); + assert (s == " 1.50"); + s = format("%-6.2f", d); + assert (s == "1.50 "); + + float f = 1.5; + s = format("%hf", f); + assert (s.find("1.50") == 0); +} + + +void FormatTest::testFloatSci() +{ + double d = 1.5; + std::string s(format("%e", d)); + assert (s.find("1.50") == 0); + assert (s.find("0e+0") != std::string::npos); + + s = format("%20e", d); + assert (s.find(" 1.50") != std::string::npos); + assert (s.find("0e+0") != std::string::npos); + + s = format("%10.2e", d); + assert (s == " 1.50e+000" || s == " 1.50e+00"); + s = format("%-10.2e", d); + assert (s == "1.50e+000 " || s == "1.50e+00 "); + s = format("%-10.2E", d); + assert (s == "1.50E+000 " || s == "1.50E+00 "); +} + + +void FormatTest::testString() +{ + std::string foo("foo"); + std::string s(format("%s", foo)); + assert (s == "foo"); + + s = format("%5s", foo); + assert (s == " foo"); + + s = format("%-5s", foo); + assert (s == "foo "); +} + + +void FormatTest::testMultiple() +{ + std::string s(format("aaa%dbbb%4dccc", 1, 2)); + assert (s == "aaa1bbb 2ccc"); + + s = format("%%%d%%%d%%%d", 1, 2, 3); + assert (s == "%1%2%3"); + + s = format("%d%d%d%d", 1, 2, 3, 4); + assert (s == "1234"); + + s = format("%d%d%d%d%d", 1, 2, 3, 4, 5); + assert (s == "12345"); + + s = format("%d%d%d%d%d%d", 1, 2, 3, 4, 5, 6); + assert (s == "123456"); +} + + +void FormatTest::setUp() +{ +} + + +void FormatTest::tearDown() +{ +} + + +CppUnit::Test* FormatTest::suite() +{ + CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("FormatTest"); + + CppUnit_addTest(pSuite, FormatTest, testChar); + CppUnit_addTest(pSuite, FormatTest, testInt); + CppUnit_addTest(pSuite, FormatTest, testFloatFix); + CppUnit_addTest(pSuite, FormatTest, testFloatSci); + CppUnit_addTest(pSuite, FormatTest, testString); + CppUnit_addTest(pSuite, FormatTest, testMultiple); + + return pSuite; +} diff --git a/Foundation/testsuite/src/FormatTest.h b/Foundation/testsuite/src/FormatTest.h new file mode 100644 index 000000000..b1e9c99de --- /dev/null +++ b/Foundation/testsuite/src/FormatTest.h @@ -0,0 +1,78 @@ +// +// FormatTest.h +// +// $Id: //poco/1.2/Foundation/testsuite/src/FormatTest.h#1 $ +// +// Definition of the FormatTest class. +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Redistributions in any form must be accompanied by information on +// how to obtain complete source code for this software and any +// accompanying software that uses this software. The source code +// must either be included in the distribution or be available for no +// more than the cost of distribution plus a nominal fee, and must be +// freely redistributable under reasonable conditions. For an +// executable file, complete source code means the source code for all +// modules it contains. It does not include source code for modules or +// files that typically accompany the major components of the operating +// system on which the executable file runs. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + + +#ifndef FormatTest_INCLUDED +#define FormatTest_INCLUDED + + +#include "Poco/Foundation.h" +#include "CppUnit/TestCase.h" + + +class FormatTest: public CppUnit::TestCase +{ +public: + FormatTest(const std::string& name); + ~FormatTest(); + + void testChar(); + void testInt(); + void testFloatFix(); + void testFloatSci(); + void testString(); + void testMultiple(); + + void setUp(); + void tearDown(); + + static CppUnit::Test* suite(); + +private: +}; + + +#endif // FormatTest_INCLUDED diff --git a/Foundation/testsuite/src/FoundationTestSuite.cpp b/Foundation/testsuite/src/FoundationTestSuite.cpp index a8617d885..18bf0e1d8 100644 --- a/Foundation/testsuite/src/FoundationTestSuite.cpp +++ b/Foundation/testsuite/src/FoundationTestSuite.cpp @@ -1,7 +1,7 @@ // // FoundationTestSuite.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/FoundationTestSuite.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/FoundationTestSuite.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. diff --git a/Foundation/testsuite/src/FoundationTestSuite.h b/Foundation/testsuite/src/FoundationTestSuite.h index 3ed535c21..4b4359877 100644 --- a/Foundation/testsuite/src/FoundationTestSuite.h +++ b/Foundation/testsuite/src/FoundationTestSuite.h @@ -1,7 +1,7 @@ // // FoundationTestSuite.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/FoundationTestSuite.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/FoundationTestSuite.h#1 $ // // Definition of the FoundationTestSuite class. // @@ -36,9 +36,7 @@ #define FoundationTestSuite_INCLUDED -#ifndef CppUnit_TestSuite_INCLUDED #include "CppUnit/TestSuite.h" -#endif class FoundationTestSuite diff --git a/Foundation/testsuite/src/GlobTest.cpp b/Foundation/testsuite/src/GlobTest.cpp index 340327b36..667ceb061 100644 --- a/Foundation/testsuite/src/GlobTest.cpp +++ b/Foundation/testsuite/src/GlobTest.cpp @@ -1,7 +1,7 @@ // // GlobTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/GlobTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/GlobTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,15 +33,15 @@ #include "GlobTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/Glob.h" -#include "Foundation/File.h" -#include "Foundation/Path.h" +#include "Poco/Glob.h" +#include "Poco/File.h" +#include "Poco/Path.h" #include -using Foundation::Glob; -using Foundation::File; -using Foundation::Path; +using Poco::Glob; +using Poco::File; +using Poco::Path; GlobTest::GlobTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/GlobTest.h b/Foundation/testsuite/src/GlobTest.h index 2722f000d..bd79f0d40 100644 --- a/Foundation/testsuite/src/GlobTest.h +++ b/Foundation/testsuite/src/GlobTest.h @@ -1,7 +1,7 @@ // // GlobTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/GlobTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/GlobTest.h#1 $ // // Definition of the GlobTest class. // @@ -36,16 +36,9 @@ #define GlobTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif -#ifndef STD_SET_INCLUDED #include -#define STD_SET_INCLUDED -#endif class GlobTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/HMACEngineTest.cpp b/Foundation/testsuite/src/HMACEngineTest.cpp index 4d8098439..29c0ad4cb 100644 --- a/Foundation/testsuite/src/HMACEngineTest.cpp +++ b/Foundation/testsuite/src/HMACEngineTest.cpp @@ -1,7 +1,7 @@ // // HMACEngineTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/HMACEngineTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/HMACEngineTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,13 +33,13 @@ #include "HMACEngineTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/HMACEngine.h" -#include "Foundation/MD5Engine.h" +#include "Poco/HMACEngine.h" +#include "Poco/MD5Engine.h" -using Foundation::HMACEngine; -using Foundation::MD5Engine; -using Foundation::DigestEngine; +using Poco::HMACEngine; +using Poco::MD5Engine; +using Poco::DigestEngine; HMACEngineTest::HMACEngineTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/HMACEngineTest.h b/Foundation/testsuite/src/HMACEngineTest.h index 3f3f53c34..a0989c494 100644 --- a/Foundation/testsuite/src/HMACEngineTest.h +++ b/Foundation/testsuite/src/HMACEngineTest.h @@ -1,7 +1,7 @@ // // HMACEngineTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/HMACEngineTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/HMACEngineTest.h#1 $ // // Definition of the HMACEngineTest class. // @@ -36,12 +36,8 @@ #define HMACEngineTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class HMACEngineTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/HashTest.cpp b/Foundation/testsuite/src/HashTest.cpp new file mode 100644 index 000000000..05bc70df9 --- /dev/null +++ b/Foundation/testsuite/src/HashTest.cpp @@ -0,0 +1,226 @@ +// +// HashTest.cpp +// +// $Id: //poco/1.2/Foundation/testsuite/src/HashTest.cpp#1 $ +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#include "HashTest.h" +#include "CppUnit/TestCaller.h" +#include "CppUnit/TestSuite.h" +#include "Poco/HashTable.h" +#include "Poco/NumberFormatter.h" + + +using namespace Poco; + + +HashTest::HashTest(const std::string& name): CppUnit::TestCase(name) +{ +} + + +HashTest::~HashTest() +{ +} + + +void HashTest::testInsert() +{ + std::string s1("str1"); + std::string s2("str2"); + HashTable < std::string, int > hashTable; + poco_assert (!hashTable.exists(s1)); + hashTable.insert(s1, 13); + poco_assert (hashTable.exists(s1)); + poco_assert (hashTable.get(s1) == 13); + int retVal = 0; + + poco_assert (hashTable.get(s1, retVal)); + poco_assert (retVal == 13); + try + { + hashTable.insert(s1, 22); + failmsg ("duplicate insert must fail"); + } + catch(Exception&){} + try + { + hashTable.get(s2); + failmsg ("getting a non inserted item must fail"); + } + catch(Exception&){} + + poco_assert (!hashTable.exists(s2)); + hashTable.insert(s2, 13); + poco_assert (hashTable.exists(s2)); +} + + +void HashTest::testUpdate() +{ + // add code for second test here + std::string s1("str1"); + std::string s2("str2"); + HashTable < std::string, int > hashTable; + hashTable.insert(s1, 13); + hashTable.update(s1, 14); + poco_assert (hashTable.exists(s1)); + poco_assert (hashTable.get(s1) == 14); + int retVal = 0; + + poco_assert (hashTable.get(s1, retVal)); + poco_assert (retVal == 14); + + // updating a non existing item must work too + hashTable.update(s2, 15); + poco_assert (hashTable.get(s2) == 15); +} + + +void HashTest::testOverflow() +{ + HashTable < std::string, int > hashTable(13); + for (int i = 0; i < 1024; ++i) + { + hashTable.insert(Poco::NumberFormatter::format(i), i*i); + } + + for (int i = 0; i < 1024; ++i) + { + std::string tmp = Poco::NumberFormatter::format(i); + poco_assert (hashTable.exists(tmp)); + poco_assert (hashTable.get(tmp) == i*i); + } +} + + +void HashTest::testSize() +{ + HashTable < std::string, int > hashTable(13); + poco_assert (hashTable.size() == 0); + Poco::UInt32 h1 = hashTable.insert("1", 1); + poco_assert (hashTable.size() == 1); + Poco::UInt32 h2 = hashTable.update("2", 2); + poco_assert (hashTable.size() == 2); + hashTable.remove("1"); + poco_assert (hashTable.size() == 1); + hashTable.remove("3"); + poco_assert (hashTable.size() == 1); + hashTable.removeRaw("2", h2); + poco_assert (hashTable.size() == 0); + hashTable.insert("1", 1); + hashTable.insert("2", 2); + poco_assert (hashTable.size() == 2); + hashTable.clear(); + poco_assert (hashTable.size() == 0); +} + + +void HashTest::testResize() +{ + HashTable < std::string, int > hashTable(13); + poco_assert (hashTable.size() == 0); + hashTable.resize(19); + for (int i = 0; i < 1024; ++i) + { + hashTable.insert(Poco::NumberFormatter::format(i), i*i); + } + hashTable.resize(1009); + + for (int i = 0; i < 1024; ++i) + { + std::string tmp = Poco::NumberFormatter::format(i); + poco_assert (hashTable.exists(tmp)); + poco_assert (hashTable.get(tmp) == i*i); + } +} + + +void HashTest::testStatistic() +{ + double relax = 0.001; + HashTable < std::string, int > hashTable(13); + poco_assert (hashTable.size() == 0); + HashStatistic stat1(hashTable.currentState()); + poco_assert (stat1.avgEntriesPerHash() < relax && stat1.avgEntriesPerHash() > -relax); + poco_assert (stat1.maxPositionsOfTable() == 13); + poco_assert (stat1.maxEntriesPerHash() == 0); + + hashTable.resize(19); + stat1 = hashTable.currentState(true); + poco_assert (stat1.avgEntriesPerHash() < relax && stat1.avgEntriesPerHash() > -relax); + poco_assert (stat1.maxPositionsOfTable() == 19); + poco_assert (stat1.maxEntriesPerHash() == 0); + poco_assert (stat1.detailedEntriesPerHash().size() == 19); + + for (int i = 0; i < 1024; ++i) + { + hashTable.insert(Poco::NumberFormatter::format(i), i*i); + } + stat1 = hashTable.currentState(true); + double expAvg = 1024.0/ 19; + poco_assert (stat1.avgEntriesPerHash() < (expAvg + relax) && stat1.avgEntriesPerHash() > (expAvg - relax)); + poco_assert (stat1.maxPositionsOfTable() == 19); + poco_assert (stat1.maxEntriesPerHash() > expAvg); + hashTable.resize(1009); + stat1 = hashTable.currentState(true); + + expAvg = 1024.0/ 1009; + + poco_assert (stat1.avgEntriesPerHash() < (expAvg + relax) && stat1.avgEntriesPerHash() > (expAvg - relax)); + poco_assert (stat1.maxPositionsOfTable() == 1009); + poco_assert (stat1.maxEntriesPerHash() > expAvg); +} + + + + +void HashTest::setUp() +{ +} + + +void HashTest::tearDown() +{ +} + + +CppUnit::Test* HashTest::suite() +{ + CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("HashTest"); + + CppUnit_addTest(pSuite, HashTest, testInsert); + CppUnit_addTest(pSuite, HashTest, testUpdate); + CppUnit_addTest(pSuite, HashTest, testOverflow); + CppUnit_addTest(pSuite, HashTest, testSize); + CppUnit_addTest(pSuite, HashTest, testResize); + CppUnit_addTest(pSuite, HashTest, testStatistic); + + return pSuite; +} diff --git a/Foundation/testsuite/src/HashTest.h b/Foundation/testsuite/src/HashTest.h new file mode 100644 index 000000000..33d3bc67d --- /dev/null +++ b/Foundation/testsuite/src/HashTest.h @@ -0,0 +1,65 @@ +// +// HashTest.h +// +// $Id: //poco/1.2/Foundation/testsuite/src/HashTest.h#1 $ +// +// Definition of the HashTest class. +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef HashTest_INCLUDED +#define HashTest_INCLUDED + + +#include "Poco/Foundation.h" +#include "CppUnit/TestCase.h" + + +class HashTest: public CppUnit::TestCase +{ +public: + HashTest(const std::string& name); + ~HashTest(); + + void testInsert(); + void testOverflow(); + void testUpdate(); + void testSize(); + void testResize(); + void testStatistic(); + + void setUp(); + void tearDown(); + + static CppUnit::Test* suite(); + +private: +}; + + +#endif // HashTest_INCLUDED diff --git a/Foundation/testsuite/src/HexBinaryTest.cpp b/Foundation/testsuite/src/HexBinaryTest.cpp index dbfe25f2c..acf4b14fe 100644 --- a/Foundation/testsuite/src/HexBinaryTest.cpp +++ b/Foundation/testsuite/src/HexBinaryTest.cpp @@ -1,7 +1,7 @@ // // HexBinaryTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/HexBinaryTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/HexBinaryTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,15 +33,15 @@ #include "HexBinaryTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/HexBinaryEncoder.h" -#include "Foundation/HexBinaryDecoder.h" -#include "Foundation/Exception.h" +#include "Poco/HexBinaryEncoder.h" +#include "Poco/HexBinaryDecoder.h" +#include "Poco/Exception.h" #include -using Foundation::HexBinaryEncoder; -using Foundation::HexBinaryDecoder; -using Foundation::DataFormatException; +using Poco::HexBinaryEncoder; +using Poco::HexBinaryDecoder; +using Poco::DataFormatException; HexBinaryTest::HexBinaryTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/HexBinaryTest.h b/Foundation/testsuite/src/HexBinaryTest.h index 8e98986d3..c3a031c24 100644 --- a/Foundation/testsuite/src/HexBinaryTest.h +++ b/Foundation/testsuite/src/HexBinaryTest.h @@ -1,7 +1,7 @@ // // HexBinaryTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/HexBinaryTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/HexBinaryTest.h#1 $ // // Definition of the HexBinaryTest class. // @@ -36,12 +36,8 @@ #define HexBinaryTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class HexBinaryTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/LRUCacheTest.cpp b/Foundation/testsuite/src/LRUCacheTest.cpp index 438f4ae7c..4a1457dd8 100644 --- a/Foundation/testsuite/src/LRUCacheTest.cpp +++ b/Foundation/testsuite/src/LRUCacheTest.cpp @@ -1,7 +1,7 @@ // // LRUCacheTest.cpp // -// $Id: //poco/Main/Foundation/testsuite/src/LRUCacheTest.cpp#5 $ +// $Id: //poco/1.2/Foundation/testsuite/src/LRUCacheTest.cpp#1 $ // // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -31,16 +31,14 @@ #include "LRUCacheTest.h" - #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" +#include "Poco/Exception.h" +#include "Poco/LRUCache.h" +#include "Poco/Bugcheck.h" -#include "Foundation/Exception.h" -#include "Foundation/LRUCache.h" -#include "Foundation/Bugcheck.h" - -using namespace Foundation; +using namespace Poco; LRUCacheTest::LRUCacheTest(const std::string& name ): CppUnit::TestCase(name) @@ -69,8 +67,6 @@ void LRUCacheTest::testClear() poco_assert ( !aCache.has( 1 ) ); poco_assert ( !aCache.has( 3 ) ); poco_assert ( !aCache.has( 5 ) ); - - } @@ -82,7 +78,7 @@ void LRUCacheTest::testCacheSize0() LRUCache < int, int > aCache( 0 ); failmsg ("cache size of 0 is illegal, test should fail"); } - catch (Foundation::InvalidArgumentException&) + catch (Poco::InvalidArgumentException&) { } } @@ -111,8 +107,6 @@ void LRUCacheTest::testCacheSize1() // removing illegal entries should work too aCache.remove(666); - - } @@ -207,6 +201,18 @@ void LRUCacheTest::testCacheSizeN() } +void LRUCacheTest::testDuplicateAdd() +{ + LRUCache < int, int > aCache( 3 ); + aCache.add(1, 2); // 1 + poco_assert (aCache.has(1)); + poco_assert (*aCache.get(1) == 2); + aCache.add(1, 3); + poco_assert (aCache.has(1)); + poco_assert (*aCache.get(1) == 3); +} + + void LRUCacheTest::setUp() { } @@ -226,6 +232,7 @@ CppUnit::Test* LRUCacheTest::suite() CppUnit_addTest(pSuite, LRUCacheTest, testCacheSize1); CppUnit_addTest(pSuite, LRUCacheTest, testCacheSize2); CppUnit_addTest(pSuite, LRUCacheTest, testCacheSizeN); + CppUnit_addTest(pSuite, LRUCacheTest, testDuplicateAdd); return pSuite; } diff --git a/Foundation/testsuite/src/LRUCacheTest.h b/Foundation/testsuite/src/LRUCacheTest.h index 15431acaa..6b9b0881a 100644 --- a/Foundation/testsuite/src/LRUCacheTest.h +++ b/Foundation/testsuite/src/LRUCacheTest.h @@ -1,7 +1,7 @@ // // LRUCacheTest.h // -// $Id: $ +// $Id: //poco/1.2/Foundation/testsuite/src/LRUCacheTest.h#1 $ // // Tests for LRUCache // @@ -35,12 +35,9 @@ #define LRUCacheTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif + class LRUCacheTest: public CppUnit::TestCase { @@ -53,7 +50,7 @@ public: void testCacheSize1(); void testCacheSize2(); void testCacheSizeN(); - + void testDuplicateAdd(); void setUp(); void tearDown(); diff --git a/Foundation/testsuite/src/LineEndingConverterTest.cpp b/Foundation/testsuite/src/LineEndingConverterTest.cpp index 71b381d39..15efe4d3d 100644 --- a/Foundation/testsuite/src/LineEndingConverterTest.cpp +++ b/Foundation/testsuite/src/LineEndingConverterTest.cpp @@ -1,7 +1,7 @@ // // LineEndingConverterTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/LineEndingConverterTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/LineEndingConverterTest.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,15 +33,15 @@ #include "LineEndingConverterTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/LineEndingConverter.h" -#include "Foundation/StreamCopier.h" +#include "Poco/LineEndingConverter.h" +#include "Poco/StreamCopier.h" #include -using Foundation::LineEnding; -using Foundation::InputLineEndingConverter; -using Foundation::OutputLineEndingConverter; -using Foundation::StreamCopier; +using Poco::LineEnding; +using Poco::InputLineEndingConverter; +using Poco::OutputLineEndingConverter; +using Poco::StreamCopier; LineEndingConverterTest::LineEndingConverterTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/LineEndingConverterTest.h b/Foundation/testsuite/src/LineEndingConverterTest.h index 9ae1c0176..4e61295c5 100644 --- a/Foundation/testsuite/src/LineEndingConverterTest.h +++ b/Foundation/testsuite/src/LineEndingConverterTest.h @@ -1,7 +1,7 @@ // // LineEndingConverterTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/LineEndingConverterTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/LineEndingConverterTest.h#1 $ // // Definition of the LineEndingConverterTest class. // @@ -36,12 +36,8 @@ #define LineEndingConverterTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class LineEndingConverterTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/LocalDateTimeTest.cpp b/Foundation/testsuite/src/LocalDateTimeTest.cpp index 64ad3add3..816808250 100644 --- a/Foundation/testsuite/src/LocalDateTimeTest.cpp +++ b/Foundation/testsuite/src/LocalDateTimeTest.cpp @@ -1,7 +1,7 @@ // // LocalDateTimeTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/LocalDateTimeTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/LocalDateTimeTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,18 +33,18 @@ #include "LocalDateTimeTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/LocalDateTime.h" -#include "Foundation/DateTime.h" -#include "Foundation/Timestamp.h" -#include "Foundation/Timespan.h" -#include "Foundation/Timezone.h" +#include "Poco/LocalDateTime.h" +#include "Poco/DateTime.h" +#include "Poco/Timestamp.h" +#include "Poco/Timespan.h" +#include "Poco/Timezone.h" -using Foundation::LocalDateTime; -using Foundation::DateTime; -using Foundation::Timestamp; -using Foundation::Timespan; -using Foundation::Timezone; +using Poco::LocalDateTime; +using Poco::DateTime; +using Poco::Timestamp; +using Poco::Timespan; +using Poco::Timezone; LocalDateTimeTest::LocalDateTimeTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/LocalDateTimeTest.h b/Foundation/testsuite/src/LocalDateTimeTest.h index 0f8458ec6..e3bcb0d1d 100644 --- a/Foundation/testsuite/src/LocalDateTimeTest.h +++ b/Foundation/testsuite/src/LocalDateTimeTest.h @@ -1,7 +1,7 @@ // // LocalDateTimeTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/LocalDateTimeTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/LocalDateTimeTest.h#1 $ // // Definition of the LocalDateTimeTest class. // @@ -36,12 +36,8 @@ #define LocalDateTimeTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class LocalDateTimeTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/LogStreamTest.cpp b/Foundation/testsuite/src/LogStreamTest.cpp new file mode 100644 index 000000000..0ef4e451f --- /dev/null +++ b/Foundation/testsuite/src/LogStreamTest.cpp @@ -0,0 +1,109 @@ +// +// LogStreamTest.cpp +// +// $Id: //poco/1.2/Foundation/testsuite/src/LogStreamTest.cpp#1 $ +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Redistributions in any form must be accompanied by information on +// how to obtain complete source code for this software and any +// accompanying software that uses this software. The source code +// must either be included in the distribution or be available for no +// more than the cost of distribution plus a nominal fee, and must be +// freely redistributable under reasonable conditions. For an +// executable file, complete source code means the source code for all +// modules it contains. It does not include source code for modules or +// files that typically accompany the major components of the operating +// system on which the executable file runs. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + + +#include "LogStreamTest.h" +#include "CppUnit/TestCaller.h" +#include "CppUnit/TestSuite.h" +#include "Poco/Logger.h" +#include "Poco/LogStream.h" +#include "Poco/AutoPtr.h" +#include "TestChannel.h" + + +using Poco::Logger; +using Poco::LogStream; +using Poco::Channel; +using Poco::Message; +using Poco::AutoPtr; + + +LogStreamTest::LogStreamTest(const std::string& name): CppUnit::TestCase(name) +{ +} + + +LogStreamTest::~LogStreamTest() +{ +} + + +void LogStreamTest::testLogStream() +{ + AutoPtr pChannel = new TestChannel; + Logger& root = Logger::root(); + root.setChannel(pChannel.get()); + + LogStream ls(root); + + ls << "information" << ' ' << 1 << std::endl; + assert (pChannel->list().begin()->getPriority() == Message::PRIO_INFORMATION); + assert (pChannel->list().begin()->getText() == "information 1"); + pChannel->list().clear(); + + ls.error() << "error" << std::endl; + assert (pChannel->list().begin()->getPriority() == Message::PRIO_ERROR); + assert (pChannel->list().begin()->getText() == "error"); + pChannel->list().clear(); +} + + +void LogStreamTest::setUp() +{ +} + + +void LogStreamTest::tearDown() +{ +} + + +CppUnit::Test* LogStreamTest::suite() +{ + CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("LogStreamTest"); + + CppUnit_addTest(pSuite, LogStreamTest, testLogStream); + + return pSuite; +} diff --git a/Foundation/testsuite/src/LogStreamTest.h b/Foundation/testsuite/src/LogStreamTest.h new file mode 100644 index 000000000..a0c8cb6f0 --- /dev/null +++ b/Foundation/testsuite/src/LogStreamTest.h @@ -0,0 +1,73 @@ +// +// LogStreamTest.h +// +// $Id: //poco/1.2/Foundation/testsuite/src/LogStreamTest.h#1 $ +// +// Definition of the LogStreamTest class. +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Redistributions in any form must be accompanied by information on +// how to obtain complete source code for this software and any +// accompanying software that uses this software. The source code +// must either be included in the distribution or be available for no +// more than the cost of distribution plus a nominal fee, and must be +// freely redistributable under reasonable conditions. For an +// executable file, complete source code means the source code for all +// modules it contains. It does not include source code for modules or +// files that typically accompany the major components of the operating +// system on which the executable file runs. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + + +#ifndef LogStreamTest_INCLUDED +#define LogStreamTest_INCLUDED + + +#include "Poco/Foundation.h" +#include "CppUnit/TestCase.h" + + +class LogStreamTest: public CppUnit::TestCase +{ +public: + LogStreamTest(const std::string& name); + ~LogStreamTest(); + + void testLogStream(); + + void setUp(); + void tearDown(); + + static CppUnit::Test* suite(); + +private: +}; + + +#endif // LogStreamTest_INCLUDED diff --git a/Foundation/testsuite/src/LoggerTest.cpp b/Foundation/testsuite/src/LoggerTest.cpp index 8197116ff..1ae9cc77a 100644 --- a/Foundation/testsuite/src/LoggerTest.cpp +++ b/Foundation/testsuite/src/LoggerTest.cpp @@ -1,7 +1,7 @@ // // LoggerTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/LoggerTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/LoggerTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,15 +33,15 @@ #include "LoggerTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/Logger.h" -#include "Foundation/AutoPtr.h" +#include "Poco/Logger.h" +#include "Poco/AutoPtr.h" #include "TestChannel.h" -using Foundation::Logger; -using Foundation::Channel; -using Foundation::Message; -using Foundation::AutoPtr; +using Poco::Logger; +using Poco::Channel; +using Poco::Message; +using Poco::AutoPtr; LoggerTest::LoggerTest(const std::string& name): CppUnit::TestCase(name) @@ -84,6 +84,17 @@ void LoggerTest::testLogger() Logger& logger21 = Logger::get("Logger2.Logger1"); Logger& logger22 = Logger::get("Logger2.Logger2"); + std::vector loggers; + Logger::names(loggers); + assert (loggers.size() == 7); + assert (loggers[0] == ""); + assert (loggers[1] == "Logger1"); + assert (loggers[2] == "Logger1.Logger1"); + assert (loggers[3] == "Logger1.Logger2"); + assert (loggers[4] == "Logger2"); + assert (loggers[5] == "Logger2.Logger1"); + assert (loggers[6] == "Logger2.Logger2"); + Logger::setLevel("Logger1", Message::PRIO_DEBUG); assert (logger1.is(Message::PRIO_DEBUG)); assert (logger11.is(Message::PRIO_DEBUG)); diff --git a/Foundation/testsuite/src/LoggerTest.h b/Foundation/testsuite/src/LoggerTest.h index daca07d3e..62c61ce55 100644 --- a/Foundation/testsuite/src/LoggerTest.h +++ b/Foundation/testsuite/src/LoggerTest.h @@ -1,7 +1,7 @@ // // LoggerTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/LoggerTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/LoggerTest.h#1 $ // // Definition of the LoggerTest class. // @@ -36,12 +36,8 @@ #define LoggerTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class LoggerTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/LoggingFactoryTest.cpp b/Foundation/testsuite/src/LoggingFactoryTest.cpp index 0a1801d16..2402acfc0 100644 --- a/Foundation/testsuite/src/LoggingFactoryTest.cpp +++ b/Foundation/testsuite/src/LoggingFactoryTest.cpp @@ -1,7 +1,7 @@ // // LoggingFactoryTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/LoggingFactoryTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/LoggingFactoryTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,30 +33,30 @@ #include "LoggingFactoryTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/LoggingFactory.h" -#include "Foundation/Instantiator.h" -#include "Foundation/Channel.h" -#include "Foundation/ConsoleChannel.h" -#include "Foundation/FileChannel.h" -#include "Foundation/SplitterChannel.h" -#include "Foundation/Formatter.h" -#include "Foundation/PatternFormatter.h" -#include "Foundation/Message.h" -#include "Foundation/AutoPtr.h" -#include "Foundation/Exception.h" +#include "Poco/LoggingFactory.h" +#include "Poco/Instantiator.h" +#include "Poco/Channel.h" +#include "Poco/ConsoleChannel.h" +#include "Poco/FileChannel.h" +#include "Poco/SplitterChannel.h" +#include "Poco/Formatter.h" +#include "Poco/PatternFormatter.h" +#include "Poco/Message.h" +#include "Poco/AutoPtr.h" +#include "Poco/Exception.h" #include -using Foundation::LoggingFactory; -using Foundation::Channel; -using Foundation::ConsoleChannel; -using Foundation::FileChannel; -using Foundation::SplitterChannel; -using Foundation::Formatter; -using Foundation::PatternFormatter; -using Foundation::Message; -using Foundation::AutoPtr; -using Foundation::Instantiator; +using Poco::LoggingFactory; +using Poco::Channel; +using Poco::ConsoleChannel; +using Poco::FileChannel; +using Poco::SplitterChannel; +using Poco::Formatter; +using Poco::PatternFormatter; +using Poco::Message; +using Poco::AutoPtr; +using Poco::Instantiator; namespace @@ -106,7 +106,7 @@ void LoggingFactoryTest::testBuiltins() AutoPtr pUnknownChannel = fact.createChannel("UnknownChannel"); fail("unknown class - must throw"); } - catch (Foundation::NotFoundException&) + catch (Poco::NotFoundException&) { } @@ -118,7 +118,7 @@ void LoggingFactoryTest::testBuiltins() AutoPtr pUnknownFormatter = fact.createFormatter("UnknownFormatter"); fail("unknown class - must throw"); } - catch (Foundation::NotFoundException&) + catch (Poco::NotFoundException&) { } } diff --git a/Foundation/testsuite/src/LoggingFactoryTest.h b/Foundation/testsuite/src/LoggingFactoryTest.h index 2d71f1b94..0a67f60c1 100644 --- a/Foundation/testsuite/src/LoggingFactoryTest.h +++ b/Foundation/testsuite/src/LoggingFactoryTest.h @@ -1,7 +1,7 @@ // // LoggingFactoryTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/LoggingFactoryTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/LoggingFactoryTest.h#1 $ // // Definition of the LoggingFactoryTest class. // @@ -36,12 +36,8 @@ #define LoggingFactoryTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class LoggingFactoryTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/LoggingRegistryTest.cpp b/Foundation/testsuite/src/LoggingRegistryTest.cpp index de9320de2..c0dd154b1 100644 --- a/Foundation/testsuite/src/LoggingRegistryTest.cpp +++ b/Foundation/testsuite/src/LoggingRegistryTest.cpp @@ -1,7 +1,7 @@ // // LoggingRegistryTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/LoggingRegistryTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/LoggingRegistryTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,18 +33,18 @@ #include "LoggingRegistryTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/LoggingRegistry.h" -#include "Foundation/ConsoleChannel.h" -#include "Foundation/PatternFormatter.h" -#include "Foundation/AutoPtr.h" +#include "Poco/LoggingRegistry.h" +#include "Poco/ConsoleChannel.h" +#include "Poco/PatternFormatter.h" +#include "Poco/AutoPtr.h" -using Foundation::LoggingRegistry; -using Foundation::Channel; -using Foundation::ConsoleChannel; -using Foundation::Formatter; -using Foundation::PatternFormatter; -using Foundation::AutoPtr; +using Poco::LoggingRegistry; +using Poco::Channel; +using Poco::ConsoleChannel; +using Poco::Formatter; +using Poco::PatternFormatter; +using Poco::AutoPtr; LoggingRegistryTest::LoggingRegistryTest(const std::string& name): CppUnit::TestCase(name) @@ -88,7 +88,7 @@ void LoggingRegistryTest::testRegister() pC = reg.channelForName("c3"); fail("not found - must throw"); } - catch (Foundation::NotFoundException&) + catch (Poco::NotFoundException&) { } } @@ -151,7 +151,7 @@ void LoggingRegistryTest::testUnregister() Channel* pC = reg.channelForName("c1"); fail("unregistered - must throw"); } - catch (Foundation::NotFoundException&) + catch (Poco::NotFoundException&) { } @@ -160,7 +160,7 @@ void LoggingRegistryTest::testUnregister() Formatter* pF = reg.formatterForName("f2"); fail("unregistered - must throw"); } - catch (Foundation::NotFoundException&) + catch (Poco::NotFoundException&) { } } diff --git a/Foundation/testsuite/src/LoggingRegistryTest.h b/Foundation/testsuite/src/LoggingRegistryTest.h index a3b1fe674..b91e6403f 100644 --- a/Foundation/testsuite/src/LoggingRegistryTest.h +++ b/Foundation/testsuite/src/LoggingRegistryTest.h @@ -1,7 +1,7 @@ // // LoggingRegistryTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/LoggingRegistryTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/LoggingRegistryTest.h#1 $ // // Definition of the LoggingRegistryTest class. // @@ -36,12 +36,8 @@ #define LoggingRegistryTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class LoggingRegistryTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/LoggingTestSuite.cpp b/Foundation/testsuite/src/LoggingTestSuite.cpp index 6735b316f..0ca07457a 100644 --- a/Foundation/testsuite/src/LoggingTestSuite.cpp +++ b/Foundation/testsuite/src/LoggingTestSuite.cpp @@ -1,7 +1,7 @@ // // LoggingTestSuite.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/LoggingTestSuite.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/LoggingTestSuite.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -38,6 +38,7 @@ #include "SimpleFileChannelTest.h" #include "LoggingFactoryTest.h" #include "LoggingRegistryTest.h" +#include "LogStreamTest.h" CppUnit::Test* LoggingTestSuite::suite() @@ -51,6 +52,7 @@ CppUnit::Test* LoggingTestSuite::suite() pSuite->addTest(SimpleFileChannelTest::suite()); pSuite->addTest(LoggingFactoryTest::suite()); pSuite->addTest(LoggingRegistryTest::suite()); + pSuite->addTest(LogStreamTest::suite()); return pSuite; } diff --git a/Foundation/testsuite/src/LoggingTestSuite.h b/Foundation/testsuite/src/LoggingTestSuite.h index 0c92083e3..285831422 100644 --- a/Foundation/testsuite/src/LoggingTestSuite.h +++ b/Foundation/testsuite/src/LoggingTestSuite.h @@ -1,7 +1,7 @@ // // LoggingTestSuite.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/LoggingTestSuite.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/LoggingTestSuite.h#1 $ // // Definition of the LoggingTestSuite class. // @@ -36,9 +36,7 @@ #define LoggingTestSuite_INCLUDED -#ifndef CppUnit_TestSuite_INCLUDED #include "CppUnit/TestSuite.h" -#endif class LoggingTestSuite diff --git a/Foundation/testsuite/src/MD2EngineTest.cpp b/Foundation/testsuite/src/MD2EngineTest.cpp index 8a763ee7c..060301edf 100644 --- a/Foundation/testsuite/src/MD2EngineTest.cpp +++ b/Foundation/testsuite/src/MD2EngineTest.cpp @@ -1,7 +1,7 @@ // // MD2EngineTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/MD2EngineTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/MD2EngineTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,11 +33,11 @@ #include "MD2EngineTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/MD2Engine.h" +#include "Poco/MD2Engine.h" -using Foundation::MD2Engine; -using Foundation::DigestEngine; +using Poco::MD2Engine; +using Poco::DigestEngine; MD2EngineTest::MD2EngineTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/MD2EngineTest.h b/Foundation/testsuite/src/MD2EngineTest.h index feed1cb20..7a164594c 100644 --- a/Foundation/testsuite/src/MD2EngineTest.h +++ b/Foundation/testsuite/src/MD2EngineTest.h @@ -1,7 +1,7 @@ // // MD2EngineTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/MD2EngineTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/MD2EngineTest.h#1 $ // // Definition of the MD2EngineTest class. // @@ -36,12 +36,8 @@ #define MD2EngineTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class MD2EngineTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/MD4EngineTest.cpp b/Foundation/testsuite/src/MD4EngineTest.cpp index e752d7335..eea6064e9 100644 --- a/Foundation/testsuite/src/MD4EngineTest.cpp +++ b/Foundation/testsuite/src/MD4EngineTest.cpp @@ -1,7 +1,7 @@ // // MD4EngineTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/MD4EngineTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/MD4EngineTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,11 +33,11 @@ #include "MD4EngineTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/MD4Engine.h" +#include "Poco/MD4Engine.h" -using Foundation::MD4Engine; -using Foundation::DigestEngine; +using Poco::MD4Engine; +using Poco::DigestEngine; MD4EngineTest::MD4EngineTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/MD4EngineTest.h b/Foundation/testsuite/src/MD4EngineTest.h index 36683adbb..4941725ea 100644 --- a/Foundation/testsuite/src/MD4EngineTest.h +++ b/Foundation/testsuite/src/MD4EngineTest.h @@ -1,7 +1,7 @@ // // MD4EngineTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/MD4EngineTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/MD4EngineTest.h#1 $ // // Definition of the MD4EngineTest class. // @@ -36,12 +36,8 @@ #define MD4EngineTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class MD4EngineTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/MD5EngineTest.cpp b/Foundation/testsuite/src/MD5EngineTest.cpp index 00884601e..5d3f74b67 100644 --- a/Foundation/testsuite/src/MD5EngineTest.cpp +++ b/Foundation/testsuite/src/MD5EngineTest.cpp @@ -1,7 +1,7 @@ // // MD5EngineTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/MD5EngineTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/MD5EngineTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,11 +33,11 @@ #include "MD5EngineTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/MD5Engine.h" +#include "Poco/MD5Engine.h" -using Foundation::MD5Engine; -using Foundation::DigestEngine; +using Poco::MD5Engine; +using Poco::DigestEngine; MD5EngineTest::MD5EngineTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/MD5EngineTest.h b/Foundation/testsuite/src/MD5EngineTest.h index 3f07cb779..c07db526c 100644 --- a/Foundation/testsuite/src/MD5EngineTest.h +++ b/Foundation/testsuite/src/MD5EngineTest.h @@ -1,7 +1,7 @@ // // MD5EngineTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/MD5EngineTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/MD5EngineTest.h#1 $ // // Definition of the MD5EngineTest class. // @@ -36,12 +36,8 @@ #define MD5EngineTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class MD5EngineTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/ManifestTest.cpp b/Foundation/testsuite/src/ManifestTest.cpp index 010cae6c2..3c57174c0 100644 --- a/Foundation/testsuite/src/ManifestTest.cpp +++ b/Foundation/testsuite/src/ManifestTest.cpp @@ -1,7 +1,7 @@ // // ManifestTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/ManifestTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/ManifestTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,13 +33,13 @@ #include "ManifestTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/Manifest.h" -#include "Foundation/MetaObject.h" +#include "Poco/Manifest.h" +#include "Poco/MetaObject.h" #include -using Foundation::Manifest; -using Foundation::MetaObject; +using Poco::Manifest; +using Poco::MetaObject; class MfTestBase diff --git a/Foundation/testsuite/src/ManifestTest.h b/Foundation/testsuite/src/ManifestTest.h index 73116c12b..e5aa2005e 100644 --- a/Foundation/testsuite/src/ManifestTest.h +++ b/Foundation/testsuite/src/ManifestTest.h @@ -1,7 +1,7 @@ // // ManifestTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/ManifestTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/ManifestTest.h#1 $ // // Definition of the ManifestTest class. // @@ -36,12 +36,8 @@ #define ManifestTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class ManifestTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/MemoryPoolTest.cpp b/Foundation/testsuite/src/MemoryPoolTest.cpp index f549b550e..3a3d1a899 100644 --- a/Foundation/testsuite/src/MemoryPoolTest.cpp +++ b/Foundation/testsuite/src/MemoryPoolTest.cpp @@ -1,7 +1,7 @@ // // MemoryPoolTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/MemoryPoolTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/MemoryPoolTest.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,11 +33,11 @@ #include "MemoryPoolTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/MemoryPool.h" +#include "Poco/MemoryPool.h" #include -using Foundation::MemoryPool; +using Poco::MemoryPool; MemoryPoolTest::MemoryPoolTest(const std::string& name): CppUnit::TestCase(name) @@ -71,7 +71,7 @@ void MemoryPoolTest::testMemoryPool() pool1.get(); fail("pool exhausted - must throw exception"); } - catch (Foundation::OutOfMemoryException&) + catch (Poco::OutOfMemoryException&) { } diff --git a/Foundation/testsuite/src/MemoryPoolTest.h b/Foundation/testsuite/src/MemoryPoolTest.h index 911fd1916..30b1dfc3e 100644 --- a/Foundation/testsuite/src/MemoryPoolTest.h +++ b/Foundation/testsuite/src/MemoryPoolTest.h @@ -1,7 +1,7 @@ // // MemoryPoolTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/MemoryPoolTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/MemoryPoolTest.h#1 $ // // Definition of the MemoryPoolTest class. // @@ -36,12 +36,8 @@ #define MemoryPoolTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class MemoryPoolTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/NDCTest.cpp b/Foundation/testsuite/src/NDCTest.cpp index 2be0c50c9..eb0a8c5bd 100644 --- a/Foundation/testsuite/src/NDCTest.cpp +++ b/Foundation/testsuite/src/NDCTest.cpp @@ -1,7 +1,7 @@ // // NDCTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/NDCTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/NDCTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,11 +33,11 @@ #include "NDCTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/NestedDiagnosticContext.h" +#include "Poco/NestedDiagnosticContext.h" #include -using Foundation::NDC; +using Poco::NDC; NDCTest::NDCTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/NDCTest.h b/Foundation/testsuite/src/NDCTest.h index 4faff4404..c95e2de2c 100644 --- a/Foundation/testsuite/src/NDCTest.h +++ b/Foundation/testsuite/src/NDCTest.h @@ -1,7 +1,7 @@ // // NDCTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/NDCTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/NDCTest.h#1 $ // // Definition of the NDCTest class. // @@ -36,12 +36,8 @@ #define NDCTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class NDCTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/NamedEventTest.cpp b/Foundation/testsuite/src/NamedEventTest.cpp index 9207baa79..9fd8eb9bc 100644 --- a/Foundation/testsuite/src/NamedEventTest.cpp +++ b/Foundation/testsuite/src/NamedEventTest.cpp @@ -1,7 +1,7 @@ // // NamedEventTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/NamedEventTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/NamedEventTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,16 +33,16 @@ #include "NamedEventTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/NamedEvent.h" -#include "Foundation/Thread.h" -#include "Foundation/Runnable.h" -#include "Foundation/Timestamp.h" +#include "Poco/NamedEvent.h" +#include "Poco/Thread.h" +#include "Poco/Runnable.h" +#include "Poco/Timestamp.h" -using Foundation::NamedEvent; -using Foundation::Thread; -using Foundation::Runnable; -using Foundation::Timestamp; +using Poco::NamedEvent; +using Poco::Thread; +using Poco::Runnable; +using Poco::Timestamp; static NamedEvent testEvent("TestEvent"); diff --git a/Foundation/testsuite/src/NamedEventTest.h b/Foundation/testsuite/src/NamedEventTest.h index 82c5e6bec..85468426a 100644 --- a/Foundation/testsuite/src/NamedEventTest.h +++ b/Foundation/testsuite/src/NamedEventTest.h @@ -1,7 +1,7 @@ // // NamedEventTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/NamedEventTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/NamedEventTest.h#1 $ // // Definition of the NamedEventTest class. // @@ -36,12 +36,8 @@ #define NamedEventTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class NamedEventTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/NamedMutexTest.cpp b/Foundation/testsuite/src/NamedMutexTest.cpp index c0d6725a3..950c3b34a 100644 --- a/Foundation/testsuite/src/NamedMutexTest.cpp +++ b/Foundation/testsuite/src/NamedMutexTest.cpp @@ -1,7 +1,7 @@ // // NamedMutexTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/NamedMutexTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/NamedMutexTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,16 +33,16 @@ #include "NamedMutexTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/NamedMutex.h" -#include "Foundation/Thread.h" -#include "Foundation/Runnable.h" -#include "Foundation/Timestamp.h" +#include "Poco/NamedMutex.h" +#include "Poco/Thread.h" +#include "Poco/Runnable.h" +#include "Poco/Timestamp.h" -using Foundation::NamedMutex; -using Foundation::Thread; -using Foundation::Runnable; -using Foundation::Timestamp; +using Poco::NamedMutex; +using Poco::Thread; +using Poco::Runnable; +using Poco::Timestamp; static NamedMutex testMutex("TestMutex"); diff --git a/Foundation/testsuite/src/NamedMutexTest.h b/Foundation/testsuite/src/NamedMutexTest.h index 4e24c34c7..e9c9638c2 100644 --- a/Foundation/testsuite/src/NamedMutexTest.h +++ b/Foundation/testsuite/src/NamedMutexTest.h @@ -1,7 +1,7 @@ // // NamedMutexTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/NamedMutexTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/NamedMutexTest.h#1 $ // // Definition of the NamedMutexTest class. // @@ -36,12 +36,8 @@ #define NamedMutexTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class NamedMutexTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/NotificationCenterTest.cpp b/Foundation/testsuite/src/NotificationCenterTest.cpp index 0f47b7e7e..2ca4f033c 100644 --- a/Foundation/testsuite/src/NotificationCenterTest.cpp +++ b/Foundation/testsuite/src/NotificationCenterTest.cpp @@ -1,7 +1,7 @@ // // NotificationCenterTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/NotificationCenterTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/NotificationCenterTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,15 +33,15 @@ #include "NotificationCenterTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/NotificationCenter.h" -#include "Foundation/Observer.h" -#include "Foundation/AutoPtr.h" +#include "Poco/NotificationCenter.h" +#include "Poco/Observer.h" +#include "Poco/AutoPtr.h" -using Foundation::NotificationCenter; -using Foundation::Observer; -using Foundation::Notification; -using Foundation::AutoPtr; +using Poco::NotificationCenter; +using Poco::Observer; +using Poco::Notification; +using Poco::AutoPtr; class TestNotification: public Notification @@ -142,7 +142,7 @@ void NotificationCenterTest::testDefaultCenter() } -void NotificationCenterTest::handle1(Foundation::Notification* pNf) +void NotificationCenterTest::handle1(Poco::Notification* pNf) { poco_check_ptr (pNf); AutoPtr nf = pNf; @@ -150,7 +150,7 @@ void NotificationCenterTest::handle1(Foundation::Notification* pNf) } -void NotificationCenterTest::handle2(Foundation::Notification* pNf) +void NotificationCenterTest::handle2(Poco::Notification* pNf) { poco_check_ptr (pNf); AutoPtr nf = pNf; @@ -158,7 +158,7 @@ void NotificationCenterTest::handle2(Foundation::Notification* pNf) } -void NotificationCenterTest::handle3(Foundation::Notification* pNf) +void NotificationCenterTest::handle3(Poco::Notification* pNf) { poco_check_ptr (pNf); AutoPtr nf = pNf; diff --git a/Foundation/testsuite/src/NotificationCenterTest.h b/Foundation/testsuite/src/NotificationCenterTest.h index 11d6850de..f59c7e9ef 100644 --- a/Foundation/testsuite/src/NotificationCenterTest.h +++ b/Foundation/testsuite/src/NotificationCenterTest.h @@ -1,7 +1,7 @@ // // NotificationCenterTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/NotificationCenterTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/NotificationCenterTest.h#1 $ // // Definition of the NotificationCenterTest class. // @@ -36,19 +36,10 @@ #define NotificationCenterTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif -#ifndef Foundation_Notification_INCLUDED -#include "Foundation/Notification.h" -#endif -#ifndef STD_SET_INCLUDED +#include "Poco/Notification.h" #include -#define STD_SET_INCLUDED -#endif class TestNotification; @@ -73,9 +64,9 @@ public: static CppUnit::Test* suite(); protected: - void handle1(Foundation::Notification* pNf); - void handle2(Foundation::Notification* pNf); - void handle3(Foundation::Notification* pNf); + void handle1(Poco::Notification* pNf); + void handle2(Poco::Notification* pNf); + void handle3(Poco::Notification* pNf); void handleTest(TestNotification* pNf); private: diff --git a/Foundation/testsuite/src/NotificationQueueTest.cpp b/Foundation/testsuite/src/NotificationQueueTest.cpp index 8f8d7184c..5515ab9bc 100644 --- a/Foundation/testsuite/src/NotificationQueueTest.cpp +++ b/Foundation/testsuite/src/NotificationQueueTest.cpp @@ -1,7 +1,7 @@ // // NotificationQueueTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/NotificationQueueTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/NotificationQueueTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,17 +33,17 @@ #include "NotificationQueueTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/NotificationQueue.h" -#include "Foundation/Notification.h" -#include "Foundation/Thread.h" -#include "Foundation/Runnable.h" -#include "Foundation/RunnableAdapter.h" +#include "Poco/NotificationQueue.h" +#include "Poco/Notification.h" +#include "Poco/Thread.h" +#include "Poco/Runnable.h" +#include "Poco/RunnableAdapter.h" -using Foundation::NotificationQueue; -using Foundation::Notification; -using Foundation::Thread; -using Foundation::RunnableAdapter; +using Poco::NotificationQueue; +using Poco::Notification; +using Poco::Thread; +using Poco::RunnableAdapter; class QTestNotification: public Notification diff --git a/Foundation/testsuite/src/NotificationQueueTest.h b/Foundation/testsuite/src/NotificationQueueTest.h index 877972262..6950f2a37 100644 --- a/Foundation/testsuite/src/NotificationQueueTest.h +++ b/Foundation/testsuite/src/NotificationQueueTest.h @@ -1,7 +1,7 @@ // // NotificationQueueTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/NotificationQueueTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/NotificationQueueTest.h#1 $ // // Definition of the NotificationQueueTest class. // @@ -36,22 +36,11 @@ #define NotificationQueueTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif -#ifndef Foundation_NotificationQueue_INCLUDED -#include "Foundation/NotificationQueue.h" -#endif -#ifndef Foundation_Mutex_INCLUDED -#include "Foundation/Mutex.h" -#endif -#ifndef STD_SET_INCLUDED +#include "Poco/NotificationQueue.h" +#include "Poco/Mutex.h" #include -#define STD_SET_INCLUDED -#endif class NotificationQueueTest: public CppUnit::TestCase @@ -75,9 +64,9 @@ protected: void work(); private: - Foundation::NotificationQueue _queue; + Poco::NotificationQueue _queue; std::multiset _handled; - Foundation::FastMutex _mutex; + Poco::FastMutex _mutex; }; diff --git a/Foundation/testsuite/src/NotificationsTestSuite.cpp b/Foundation/testsuite/src/NotificationsTestSuite.cpp index fd331f284..9e43fd945 100644 --- a/Foundation/testsuite/src/NotificationsTestSuite.cpp +++ b/Foundation/testsuite/src/NotificationsTestSuite.cpp @@ -1,7 +1,7 @@ // // NotificationsTestSuite.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/NotificationsTestSuite.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/NotificationsTestSuite.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. diff --git a/Foundation/testsuite/src/NotificationsTestSuite.h b/Foundation/testsuite/src/NotificationsTestSuite.h index 8be3c0d7c..3307ca6ea 100644 --- a/Foundation/testsuite/src/NotificationsTestSuite.h +++ b/Foundation/testsuite/src/NotificationsTestSuite.h @@ -1,7 +1,7 @@ // // NotificationsTestSuite.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/NotificationsTestSuite.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/NotificationsTestSuite.h#1 $ // // Definition of the NotificationsTestSuite class. // @@ -36,9 +36,7 @@ #define NotificationsTestSuite_INCLUDED -#ifndef CppUnit_TestSuite_INCLUDED #include "CppUnit/TestSuite.h" -#endif class NotificationsTestSuite diff --git a/Foundation/testsuite/src/NullStreamTest.cpp b/Foundation/testsuite/src/NullStreamTest.cpp index 437706a97..6636017a5 100644 --- a/Foundation/testsuite/src/NullStreamTest.cpp +++ b/Foundation/testsuite/src/NullStreamTest.cpp @@ -1,7 +1,7 @@ // // NullStreamTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/NullStreamTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/NullStreamTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,11 +33,11 @@ #include "NullStreamTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/NullStream.h" +#include "Poco/NullStream.h" -using Foundation::NullInputStream; -using Foundation::NullOutputStream; +using Poco::NullInputStream; +using Poco::NullOutputStream; NullStreamTest::NullStreamTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/NullStreamTest.h b/Foundation/testsuite/src/NullStreamTest.h index 6ab1ca3bf..2e3857c68 100644 --- a/Foundation/testsuite/src/NullStreamTest.h +++ b/Foundation/testsuite/src/NullStreamTest.h @@ -1,7 +1,7 @@ // // NullStreamTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/NullStreamTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/NullStreamTest.h#1 $ // // Definition of the NullStreamTest class. // @@ -36,12 +36,8 @@ #define NullStreamTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class NullStreamTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/NumberFormatterTest.cpp b/Foundation/testsuite/src/NumberFormatterTest.cpp index ee6690109..6947e7ec9 100644 --- a/Foundation/testsuite/src/NumberFormatterTest.cpp +++ b/Foundation/testsuite/src/NumberFormatterTest.cpp @@ -1,7 +1,7 @@ // // NumberFormatterTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/NumberFormatterTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/NumberFormatterTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,12 +33,12 @@ #include "NumberFormatterTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/NumberFormatter.h" +#include "Poco/NumberFormatter.h" -using Foundation::NumberFormatter; -using Foundation::Int64; -using Foundation::UInt64; +using Poco::NumberFormatter; +using Poco::Int64; +using Poco::UInt64; NumberFormatterTest::NumberFormatterTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/NumberFormatterTest.h b/Foundation/testsuite/src/NumberFormatterTest.h index a5ffaa668..1249bf068 100644 --- a/Foundation/testsuite/src/NumberFormatterTest.h +++ b/Foundation/testsuite/src/NumberFormatterTest.h @@ -1,7 +1,7 @@ // // NumberFormatterTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/NumberFormatterTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/NumberFormatterTest.h#1 $ // // Definition of the NumberFormatterTest class. // @@ -36,12 +36,8 @@ #define NumberFormatterTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class NumberFormatterTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/NumberParserTest.cpp b/Foundation/testsuite/src/NumberParserTest.cpp index 9b3080f07..0febabb6c 100644 --- a/Foundation/testsuite/src/NumberParserTest.cpp +++ b/Foundation/testsuite/src/NumberParserTest.cpp @@ -1,7 +1,7 @@ // // NumberParserTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/NumberParserTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/NumberParserTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,12 +33,12 @@ #include "NumberParserTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/NumberParser.h" -#include "Foundation/Exception.h" +#include "Poco/NumberParser.h" +#include "Poco/Exception.h" -using Foundation::NumberParser; -using Foundation::SyntaxException; +using Poco::NumberParser; +using Poco::SyntaxException; NumberParserTest::NumberParserTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/NumberParserTest.h b/Foundation/testsuite/src/NumberParserTest.h index 0ae946478..6f9ea348a 100644 --- a/Foundation/testsuite/src/NumberParserTest.h +++ b/Foundation/testsuite/src/NumberParserTest.h @@ -1,7 +1,7 @@ // // NumberParserTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/NumberParserTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/NumberParserTest.h#1 $ // // Definition of the NumberParserTest class. // @@ -36,12 +36,8 @@ #define NumberParserTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class NumberParserTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/PathTest.cpp b/Foundation/testsuite/src/PathTest.cpp index 1ef003c17..c611496bc 100644 --- a/Foundation/testsuite/src/PathTest.cpp +++ b/Foundation/testsuite/src/PathTest.cpp @@ -1,7 +1,7 @@ // // PathTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/PathTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/PathTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,17 +33,17 @@ #include "PathTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/Path.h" -#include "Foundation/Exception.h" -#include "Foundation/Random.h" -#include "Foundation/Environment.h" +#include "Poco/Path.h" +#include "Poco/Exception.h" +#include "Poco/Random.h" +#include "Poco/Environment.h" #include -using Foundation::Path; -using Foundation::PathSyntaxException; -using Foundation::Random; -using Foundation::Environment; +using Poco::Path; +using Poco::PathSyntaxException; +using Poco::Random; +using Poco::Environment; PathTest::PathTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/PathTest.h b/Foundation/testsuite/src/PathTest.h index d13b56f25..644f81161 100644 --- a/Foundation/testsuite/src/PathTest.h +++ b/Foundation/testsuite/src/PathTest.h @@ -1,7 +1,7 @@ // // PathTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/PathTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/PathTest.h#1 $ // // Definition of the PathTest class. // @@ -36,12 +36,8 @@ #define PathTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class PathTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/PatternFormatterTest.cpp b/Foundation/testsuite/src/PatternFormatterTest.cpp index ab1dff377..a984d45c2 100644 --- a/Foundation/testsuite/src/PatternFormatterTest.cpp +++ b/Foundation/testsuite/src/PatternFormatterTest.cpp @@ -1,7 +1,7 @@ // // PatternFormatterTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/PatternFormatterTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/PatternFormatterTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,14 +33,14 @@ #include "PatternFormatterTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/PatternFormatter.h" -#include "Foundation/Message.h" -#include "Foundation/DateTime.h" +#include "Poco/PatternFormatter.h" +#include "Poco/Message.h" +#include "Poco/DateTime.h" -using Foundation::PatternFormatter; -using Foundation::Message; -using Foundation::DateTime; +using Poco::PatternFormatter; +using Poco::Message; +using Poco::DateTime; PatternFormatterTest::PatternFormatterTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/PatternFormatterTest.h b/Foundation/testsuite/src/PatternFormatterTest.h index 8900ffebe..7d57cc292 100644 --- a/Foundation/testsuite/src/PatternFormatterTest.h +++ b/Foundation/testsuite/src/PatternFormatterTest.h @@ -1,7 +1,7 @@ // // PatternFormatterTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/PatternFormatterTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/PatternFormatterTest.h#1 $ // // Definition of the PatternFormatterTest class. // @@ -36,12 +36,8 @@ #define PatternFormatterTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class PatternFormatterTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/PriorityEventTest.cpp b/Foundation/testsuite/src/PriorityEventTest.cpp index d6d13eb94..1b4cb3dec 100644 --- a/Foundation/testsuite/src/PriorityEventTest.cpp +++ b/Foundation/testsuite/src/PriorityEventTest.cpp @@ -1,7 +1,7 @@ // // PriorityEventTest.cpp // -// $Id: //poco/Main/Foundation/testsuite/src/PriorityEventTest.cpp#5 $ +// $Id: //poco/1.2/Foundation/testsuite/src/PriorityEventTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -34,13 +34,14 @@ #include "DummyDelegate.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" +#include "Poco/PriorityDelegate.h" +#include "Poco/PriorityExpire.h" +#include "Poco/Thread.h" +#include "Poco/Exception.h" -#include "Foundation/PriorityDelegate.h" -#include "Foundation/PriorityExpire.h" -#include "Foundation/Thread.h" -#include "Foundation/Exception.h" -using namespace Foundation; +using namespace Poco; + #define LARGEINC 100 @@ -75,24 +76,24 @@ void PriorityEventTest::testNoDelegate() //Note: passing &args will not work due to & EventArgs* pArgs = &args; - Complex += PriorityDelegate < PriorityEventTest, Foundation::EventArgs* > (this, &PriorityEventTest::onComplex, 0); - Complex -= PriorityDelegate < PriorityEventTest, Foundation::EventArgs* > (this, &PriorityEventTest::onComplex, 0); + Complex += PriorityDelegate < PriorityEventTest, Poco::EventArgs* > (this, &PriorityEventTest::onComplex, 0); + Complex -= PriorityDelegate < PriorityEventTest, Poco::EventArgs* > (this, &PriorityEventTest::onComplex, 0); Complex.notify ( this, pArgs ); poco_assert ( _count == 0 ); - Complex2 += PriorityDelegate < PriorityEventTest, Foundation::EventArgs > (this, &PriorityEventTest::onComplex2, 0); - Complex2 -= PriorityDelegate < PriorityEventTest, Foundation::EventArgs > (this, &PriorityEventTest::onComplex2, 0); + Complex2 += PriorityDelegate < PriorityEventTest, Poco::EventArgs > (this, &PriorityEventTest::onComplex2, 0); + Complex2 -= PriorityDelegate < PriorityEventTest, Poco::EventArgs > (this, &PriorityEventTest::onComplex2, 0); Complex2.notify ( this, args ); poco_assert ( _count == 0 ); const EventArgs* pCArgs = &args; - ConstComplex += PriorityDelegate < PriorityEventTest, const Foundation::EventArgs* > (this, &PriorityEventTest::onConstComplex, 0); - ConstComplex -= PriorityDelegate < PriorityEventTest, const Foundation::EventArgs* > (this, &PriorityEventTest::onConstComplex, 0); + ConstComplex += PriorityDelegate < PriorityEventTest, const Poco::EventArgs* > (this, &PriorityEventTest::onConstComplex, 0); + ConstComplex -= PriorityDelegate < PriorityEventTest, const Poco::EventArgs* > (this, &PriorityEventTest::onConstComplex, 0); ConstComplex.notify ( this, pCArgs ); poco_assert ( _count == 0 ); - Const2Complex += PriorityDelegate < PriorityEventTest, const Foundation::EventArgs* const > (this, &PriorityEventTest::onConst2Complex, 0); - Const2Complex -= PriorityDelegate < PriorityEventTest, const Foundation::EventArgs* const > (this, &PriorityEventTest::onConst2Complex, 0); + Const2Complex += PriorityDelegate < PriorityEventTest, const Poco::EventArgs* const > (this, &PriorityEventTest::onConst2Complex, 0); + Const2Complex -= PriorityDelegate < PriorityEventTest, const Poco::EventArgs* const > (this, &PriorityEventTest::onConst2Complex, 0); Const2Complex.notify ( this, pArgs ); poco_assert ( _count == 0 ); } @@ -116,24 +117,24 @@ void PriorityEventTest::testSingleDelegate() poco_assert ( _count == 2 ); EventArgs* pArgs = &args; - Complex += PriorityDelegate < PriorityEventTest, Foundation::EventArgs* > (this, &PriorityEventTest::onComplex, 0); - Complex -= PriorityDelegate < PriorityEventTest, Foundation::EventArgs* > (this, &PriorityEventTest::onComplex, 3); + Complex += PriorityDelegate < PriorityEventTest, Poco::EventArgs* > (this, &PriorityEventTest::onComplex, 0); + Complex -= PriorityDelegate < PriorityEventTest, Poco::EventArgs* > (this, &PriorityEventTest::onComplex, 3); Complex.notify ( this, pArgs ); poco_assert ( _count == 3 ); - Complex2 += PriorityDelegate < PriorityEventTest, Foundation::EventArgs > (this, &PriorityEventTest::onComplex2, 0); - Complex2 -= PriorityDelegate < PriorityEventTest, Foundation::EventArgs > (this, &PriorityEventTest::onComplex2, 3); + Complex2 += PriorityDelegate < PriorityEventTest, Poco::EventArgs > (this, &PriorityEventTest::onComplex2, 0); + Complex2 -= PriorityDelegate < PriorityEventTest, Poco::EventArgs > (this, &PriorityEventTest::onComplex2, 3); Complex2.notify ( this, args ); poco_assert ( _count == 4 ); const EventArgs* pCArgs = &args; - ConstComplex += PriorityDelegate < PriorityEventTest, const Foundation::EventArgs* > (this, &PriorityEventTest::onConstComplex, 0); - ConstComplex -= PriorityDelegate < PriorityEventTest, const Foundation::EventArgs* > (this, &PriorityEventTest::onConstComplex, 3); + ConstComplex += PriorityDelegate < PriorityEventTest, const Poco::EventArgs* > (this, &PriorityEventTest::onConstComplex, 0); + ConstComplex -= PriorityDelegate < PriorityEventTest, const Poco::EventArgs* > (this, &PriorityEventTest::onConstComplex, 3); ConstComplex.notify ( this, pCArgs ); poco_assert ( _count == 5 ); - Const2Complex += PriorityDelegate < PriorityEventTest, const Foundation::EventArgs* const > (this, &PriorityEventTest::onConst2Complex, 0); - Const2Complex -= PriorityDelegate < PriorityEventTest, const Foundation::EventArgs* const > (this, &PriorityEventTest::onConst2Complex, 3); + Const2Complex += PriorityDelegate < PriorityEventTest, const Poco::EventArgs* const > (this, &PriorityEventTest::onConst2Complex, 0); + Const2Complex -= PriorityDelegate < PriorityEventTest, const Poco::EventArgs* const > (this, &PriorityEventTest::onConst2Complex, 3); Const2Complex.notify ( this, pArgs ); poco_assert ( _count == 6 ); // check if 2nd notify also works @@ -239,7 +240,7 @@ void PriorityEventTest::testPriorityOrder () Simple.notify ( this, tmp ); failmsg ("Notify should not work"); } - catch ( Foundation::InvalidArgumentException& ) + catch ( Poco::InvalidArgumentException& ) { } @@ -291,7 +292,7 @@ void PriorityEventTest::testPriorityOrderExpire () Simple.notify ( this, tmp ); failmsg ("Notify should not work"); } - catch ( Foundation::InvalidArgumentException& ) + catch ( Poco::InvalidArgumentException& ) { } @@ -309,7 +310,7 @@ void PriorityEventTest::testExpire () Simple += PriorityExpire < int > (PriorityDelegate < PriorityEventTest, int > (this, &PriorityEventTest::onSimple, 1), 500 ); Simple.notify ( this, tmp ); poco_assert ( _count == 1 ); - Foundation::Thread::sleep ( 700 ); + Poco::Thread::sleep ( 700 ); Simple.notify ( this, tmp ); poco_assert ( _count == 1 ); Simple -= PriorityExpire < int > (PriorityDelegate < PriorityEventTest, int > (this, &PriorityEventTest::onSimple, 1), 500 ); @@ -325,15 +326,15 @@ void PriorityEventTest::testExpireReRegister() Simple += PriorityExpire < int > (PriorityDelegate < PriorityEventTest, int > (this, &PriorityEventTest::onSimple, 1), 500 ); Simple.notify ( this, tmp ); poco_assert ( _count == 1 ); - Foundation::Thread::sleep ( 200 ); + Poco::Thread::sleep ( 200 ); Simple.notify ( this, tmp ); poco_assert ( _count == 2 ); // renew registration Simple += PriorityExpire < int > (PriorityDelegate < PriorityEventTest, int > (this, &PriorityEventTest::onSimple, 1), 600 ); - Foundation::Thread::sleep( 400 ); + Poco::Thread::sleep( 400 ); Simple.notify ( this, tmp ); poco_assert ( _count == 3 ); - Foundation::Thread::sleep( 300 ); + Poco::Thread::sleep( 300 ); Simple.notify ( this, tmp ); poco_assert ( _count == 3 ); } @@ -368,11 +369,11 @@ void PriorityEventTest::testOverwriteDelegate () void PriorityEventTest::testAsyncNotify () { - Foundation::PriorityEvent < int >* pSimple= new Foundation::PriorityEvent < int >(); + Poco::PriorityEvent < int >* pSimple= new Poco::PriorityEvent < int >(); (*pSimple) += PriorityDelegate < PriorityEventTest, int > (this, &PriorityEventTest::onAsync, 0); poco_assert ( _count == 0 ); int tmp = 0; - Foundation::ActiveResult < int > retArg = pSimple->notifyAsync ( this, tmp ); + Poco::ActiveResult < int > retArg = pSimple->notifyAsync ( this, tmp ); delete pSimple; // must work even when the event got deleted! pSimple = NULL; poco_assert ( _count == 0 ); @@ -397,29 +398,29 @@ void PriorityEventTest::onConstSimple ( const void* pSender, const int& i ) _count++; } -void PriorityEventTest::onComplex ( const void* pSender, Foundation::EventArgs* & i ) +void PriorityEventTest::onComplex ( const void* pSender, Poco::EventArgs* & i ) { _count++; } -void PriorityEventTest::onComplex2 ( const void* pSender, Foundation::EventArgs & i ) +void PriorityEventTest::onComplex2 ( const void* pSender, Poco::EventArgs & i ) { _count++; } -void PriorityEventTest::onConstComplex ( const void* pSender, const Foundation::EventArgs*& i ) +void PriorityEventTest::onConstComplex ( const void* pSender, const Poco::EventArgs*& i ) { _count++; } -void PriorityEventTest::onConst2Complex ( const void* pSender, const Foundation::EventArgs * const & i ) +void PriorityEventTest::onConst2Complex ( const void* pSender, const Poco::EventArgs * const & i ) { _count++; } void PriorityEventTest::onAsync ( const void* pSender, int& i ) { - Foundation::Thread::sleep ( 700 ); + Poco::Thread::sleep ( 700 ); _count += LARGEINC ; } diff --git a/Foundation/testsuite/src/PriorityEventTest.h b/Foundation/testsuite/src/PriorityEventTest.h index 4d805f970..28f615c3f 100644 --- a/Foundation/testsuite/src/PriorityEventTest.h +++ b/Foundation/testsuite/src/PriorityEventTest.h @@ -1,7 +1,7 @@ // // PriorityEventTest.h // -// $Id: $ +// $Id: //poco/1.2/Foundation/testsuite/src/PriorityEventTest.h#1 $ // // Definition of the PriorityEventTest class. // @@ -31,28 +31,25 @@ // DEALINGS IN THE SOFTWARE. // + #ifndef PriorityEventTest_INCLUDED #define PriorityEventTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif +#include "Poco/PriorityEvent.h" +#include "Poco/EventArgs.h" -#include "Foundation/PriorityEvent.h" -#include "Foundation/EventArgs.h" class PriorityEventTest: public CppUnit::TestCase { - Foundation::PriorityEvent Simple; - Foundation::PriorityEvent ConstSimple; - Foundation::PriorityEvent Complex; - Foundation::PriorityEvent Complex2; - Foundation::PriorityEvent ConstComplex; - Foundation::PriorityEvent Const2Complex; + Poco::PriorityEvent Simple; + Poco::PriorityEvent ConstSimple; + Poco::PriorityEvent Complex; + Poco::PriorityEvent Complex2; + Poco::PriorityEvent ConstComplex; + Poco::PriorityEvent Const2Complex; public: PriorityEventTest(const std::string& name); ~PriorityEventTest(); @@ -79,10 +76,10 @@ protected: void onSimple ( const void* pSender, int& i ); void onSimpleOther ( const void* pSender, int& i ); void onConstSimple ( const void* pSender, const int& i ); - void onComplex ( const void* pSender, Foundation::EventArgs* & i ); - void onComplex2 ( const void* pSender, Foundation::EventArgs & i ); - void onConstComplex ( const void* pSender, const Foundation::EventArgs*& i ); - void onConst2Complex ( const void* pSender, const Foundation::EventArgs * const & i ); + void onComplex ( const void* pSender, Poco::EventArgs* & i ); + void onComplex2 ( const void* pSender, Poco::EventArgs & i ); + void onConstComplex ( const void* pSender, const Poco::EventArgs*& i ); + void onConst2Complex ( const void* pSender, const Poco::EventArgs * const & i ); void onAsync ( const void* pSender, int& i ); int getCount () const; diff --git a/Foundation/testsuite/src/ProcessTest.cpp b/Foundation/testsuite/src/ProcessTest.cpp index 3d5d10456..51dfdfa62 100644 --- a/Foundation/testsuite/src/ProcessTest.cpp +++ b/Foundation/testsuite/src/ProcessTest.cpp @@ -1,7 +1,7 @@ // // ProcessTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/ProcessTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/ProcessTest.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,11 +33,16 @@ #include "ProcessTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/Process.h" +#include "Poco/Process.h" +#include "Poco/Pipe.h" +#include "Poco/PipeStream.h" -using Foundation::Process; -using Foundation::ProcessHandle; +using Poco::Process; +using Poco::ProcessHandle; +using Poco::Pipe; +using Poco::PipeInputStream; +using Poco::PipeOutputStream; ProcessTest::ProcessTest(const std::string& name): CppUnit::TestCase(name) @@ -75,6 +80,62 @@ void ProcessTest::testLaunch() } +void ProcessTest::testLaunchRedirectIn() +{ + std::string name("TestApp"); + std::string cmd; +#if defined(_DEBUG) + name += "d"; +#endif + +#if defined(POCO_OS_FAMILY_UNIX) + cmd = "./"; + cmd += name; +#else + cmd = name; +#endif + + std::vector args; + args.push_back("-count"); + Pipe inPipe; + ProcessHandle ph = Process::launch(cmd, args, &inPipe, 0, 0); + PipeOutputStream ostr(inPipe); + ostr << std::string(100, 'x'); + ostr.close(); + int rc = ph.wait(); + assert (rc == 100); +} + + +void ProcessTest::testLaunchRedirectOut() +{ + std::string name("TestApp"); + std::string cmd; +#if defined(_DEBUG) + name += "d"; +#endif + +#if defined(POCO_OS_FAMILY_UNIX) + cmd = "./"; + cmd += name; +#else + cmd = name; +#endif + + std::vector args; + args.push_back("-hello"); + Pipe outPipe; + ProcessHandle ph = Process::launch(cmd, args, 0, &outPipe, 0); + PipeInputStream istr(outPipe); + std::string s; + int c = istr.get(); + while (c != -1) { s += (char) c; c = istr.get(); } + assert (s == "Hello, world!"); + int rc = ph.wait(); + assert (rc == 1); +} + + void ProcessTest::setUp() { } @@ -90,6 +151,8 @@ CppUnit::Test* ProcessTest::suite() CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("ProcessTest"); CppUnit_addTest(pSuite, ProcessTest, testLaunch); + CppUnit_addTest(pSuite, ProcessTest, testLaunchRedirectIn); + CppUnit_addTest(pSuite, ProcessTest, testLaunchRedirectOut); return pSuite; } diff --git a/Foundation/testsuite/src/ProcessTest.h b/Foundation/testsuite/src/ProcessTest.h index c3912583f..b144d2620 100644 --- a/Foundation/testsuite/src/ProcessTest.h +++ b/Foundation/testsuite/src/ProcessTest.h @@ -1,7 +1,7 @@ // // ProcessTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/ProcessTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/ProcessTest.h#1 $ // // Definition of the ProcessTest class. // @@ -36,12 +36,8 @@ #define ProcessTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class ProcessTest: public CppUnit::TestCase @@ -51,6 +47,8 @@ public: ~ProcessTest(); void testLaunch(); + void testLaunchRedirectIn(); + void testLaunchRedirectOut(); void setUp(); void tearDown(); diff --git a/Foundation/testsuite/src/ProcessesTestSuite.cpp b/Foundation/testsuite/src/ProcessesTestSuite.cpp index 539f6d593..ab601a5d5 100644 --- a/Foundation/testsuite/src/ProcessesTestSuite.cpp +++ b/Foundation/testsuite/src/ProcessesTestSuite.cpp @@ -1,7 +1,7 @@ // // ProcessesTestSuite.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/ProcessesTestSuite.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/ProcessesTestSuite.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. diff --git a/Foundation/testsuite/src/ProcessesTestSuite.h b/Foundation/testsuite/src/ProcessesTestSuite.h index 831833e6c..e308949fb 100644 --- a/Foundation/testsuite/src/ProcessesTestSuite.h +++ b/Foundation/testsuite/src/ProcessesTestSuite.h @@ -1,7 +1,7 @@ // // ProcessesTestSuite.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/ProcessesTestSuite.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/ProcessesTestSuite.h#1 $ // // Definition of the ProcessesTestSuite class. // @@ -36,9 +36,7 @@ #define ProcessesTestSuite_INCLUDED -#ifndef CppUnit_TestSuite_INCLUDED #include "CppUnit/TestSuite.h" -#endif class ProcessesTestSuite diff --git a/Foundation/testsuite/src/RWLockTest.cpp b/Foundation/testsuite/src/RWLockTest.cpp index ebfbe7385..7238072e8 100644 --- a/Foundation/testsuite/src/RWLockTest.cpp +++ b/Foundation/testsuite/src/RWLockTest.cpp @@ -1,7 +1,7 @@ // // RWLockTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/RWLockTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/RWLockTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,14 +33,14 @@ #include "RWLockTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/RWLock.h" -#include "Foundation/Thread.h" -#include "Foundation/Runnable.h" +#include "Poco/RWLock.h" +#include "Poco/Thread.h" +#include "Poco/Runnable.h" -using Foundation::RWLock; -using Foundation::Thread; -using Foundation::Runnable; +using Poco::RWLock; +using Poco::Thread; +using Poco::Runnable; class RWLockRunnable: public Runnable diff --git a/Foundation/testsuite/src/RWLockTest.h b/Foundation/testsuite/src/RWLockTest.h index f968aa166..409351667 100644 --- a/Foundation/testsuite/src/RWLockTest.h +++ b/Foundation/testsuite/src/RWLockTest.h @@ -1,7 +1,7 @@ // // RWLockTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/RWLockTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/RWLockTest.h#1 $ // // Definition of the RWLockTest class. // @@ -36,12 +36,8 @@ #define RWLockTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class RWLockTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/RandomStreamTest.cpp b/Foundation/testsuite/src/RandomStreamTest.cpp index bbf5a7c37..8fbc82539 100644 --- a/Foundation/testsuite/src/RandomStreamTest.cpp +++ b/Foundation/testsuite/src/RandomStreamTest.cpp @@ -1,7 +1,7 @@ // // RandomStreamTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/RandomStreamTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/RandomStreamTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,12 +33,12 @@ #include "RandomStreamTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/RandomStream.h" +#include "Poco/RandomStream.h" #include #include -using Foundation::RandomInputStream; +using Poco::RandomInputStream; RandomStreamTest::RandomStreamTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/RandomStreamTest.h b/Foundation/testsuite/src/RandomStreamTest.h index f3f7f93d3..9650382db 100644 --- a/Foundation/testsuite/src/RandomStreamTest.h +++ b/Foundation/testsuite/src/RandomStreamTest.h @@ -1,7 +1,7 @@ // // RandomStreamTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/RandomStreamTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/RandomStreamTest.h#1 $ // // Definition of the RandomStreamTest class. // @@ -36,12 +36,8 @@ #define RandomStreamTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class RandomStreamTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/RandomTest.cpp b/Foundation/testsuite/src/RandomTest.cpp index df1a40ce2..dd7b2f2d3 100644 --- a/Foundation/testsuite/src/RandomTest.cpp +++ b/Foundation/testsuite/src/RandomTest.cpp @@ -1,7 +1,7 @@ // // RandomTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/RandomTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/RandomTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,13 +33,13 @@ #include "RandomTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/Random.h" +#include "Poco/Random.h" #include #include -using Foundation::Random; -using Foundation::UInt32; +using Poco::Random; +using Poco::UInt32; RandomTest::RandomTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/RandomTest.h b/Foundation/testsuite/src/RandomTest.h index 40878f2a8..cdad10e6d 100644 --- a/Foundation/testsuite/src/RandomTest.h +++ b/Foundation/testsuite/src/RandomTest.h @@ -1,7 +1,7 @@ // // RandomTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/RandomTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/RandomTest.h#1 $ // // Definition of the RandomTest class. // @@ -36,12 +36,8 @@ #define RandomTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class RandomTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/RegularExpressionTest.cpp b/Foundation/testsuite/src/RegularExpressionTest.cpp index fe6242e4c..0b262477c 100644 --- a/Foundation/testsuite/src/RegularExpressionTest.cpp +++ b/Foundation/testsuite/src/RegularExpressionTest.cpp @@ -1,7 +1,7 @@ // // RegularExpressionTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/RegularExpressionTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/RegularExpressionTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,12 +33,12 @@ #include "RegularExpressionTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/RegularExpression.h" -#include "Foundation/Exception.h" +#include "Poco/RegularExpression.h" +#include "Poco/Exception.h" -using Foundation::RegularExpression; -using Foundation::RegularExpressionException; +using Poco::RegularExpression; +using Poco::RegularExpressionException; RegularExpressionTest::RegularExpressionTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/RegularExpressionTest.h b/Foundation/testsuite/src/RegularExpressionTest.h index 30f7735e3..dd9a5c902 100644 --- a/Foundation/testsuite/src/RegularExpressionTest.h +++ b/Foundation/testsuite/src/RegularExpressionTest.h @@ -1,7 +1,7 @@ // // RegularExpressionTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/RegularExpressionTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/RegularExpressionTest.h#1 $ // // Definition of the RegularExpressionTest class. // @@ -36,12 +36,8 @@ #define RegularExpressionTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class RegularExpressionTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/SHA1EngineTest.cpp b/Foundation/testsuite/src/SHA1EngineTest.cpp index d4e85a786..aaeea311c 100644 --- a/Foundation/testsuite/src/SHA1EngineTest.cpp +++ b/Foundation/testsuite/src/SHA1EngineTest.cpp @@ -1,7 +1,7 @@ // // SHA1EngineTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/SHA1EngineTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/SHA1EngineTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,11 +33,11 @@ #include "SHA1EngineTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/SHA1Engine.h" +#include "Poco/SHA1Engine.h" -using Foundation::SHA1Engine; -using Foundation::DigestEngine; +using Poco::SHA1Engine; +using Poco::DigestEngine; SHA1EngineTest::SHA1EngineTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/SHA1EngineTest.h b/Foundation/testsuite/src/SHA1EngineTest.h index d59e294a0..e74219a39 100644 --- a/Foundation/testsuite/src/SHA1EngineTest.h +++ b/Foundation/testsuite/src/SHA1EngineTest.h @@ -1,7 +1,7 @@ // // SHA1EngineTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/SHA1EngineTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/SHA1EngineTest.h#1 $ // // Definition of the SHA1EngineTest class. // @@ -36,12 +36,8 @@ #define SHA1EngineTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class SHA1EngineTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/SemaphoreTest.cpp b/Foundation/testsuite/src/SemaphoreTest.cpp index e76ba5bbb..da7472faf 100644 --- a/Foundation/testsuite/src/SemaphoreTest.cpp +++ b/Foundation/testsuite/src/SemaphoreTest.cpp @@ -1,7 +1,7 @@ // // SemaphoreTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/SemaphoreTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/SemaphoreTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,16 +33,16 @@ #include "SemaphoreTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/Thread.h" -#include "Foundation/Runnable.h" -#include "Foundation/Semaphore.h" -#include "Foundation/Exception.h" +#include "Poco/Thread.h" +#include "Poco/Runnable.h" +#include "Poco/Semaphore.h" +#include "Poco/Exception.h" -using Foundation::Thread; -using Foundation::Runnable; -using Foundation::Semaphore; -using Foundation::TimeoutException; +using Poco::Thread; +using Poco::Runnable; +using Poco::Semaphore; +using Poco::TimeoutException; class SemaRunnable: public Runnable diff --git a/Foundation/testsuite/src/SemaphoreTest.h b/Foundation/testsuite/src/SemaphoreTest.h index 1d3e79223..df4b0dd00 100644 --- a/Foundation/testsuite/src/SemaphoreTest.h +++ b/Foundation/testsuite/src/SemaphoreTest.h @@ -1,7 +1,7 @@ // // SemaphoreTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/SemaphoreTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/SemaphoreTest.h#1 $ // // Definition of the SemaphoreTest class. // @@ -36,12 +36,8 @@ #define SemaphoreTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class SemaphoreTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/SharedLibraryTest.cpp b/Foundation/testsuite/src/SharedLibraryTest.cpp index 5cdbeaccf..187804f26 100644 --- a/Foundation/testsuite/src/SharedLibraryTest.cpp +++ b/Foundation/testsuite/src/SharedLibraryTest.cpp @@ -1,7 +1,7 @@ // // SharedLibraryTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/SharedLibraryTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/SharedLibraryTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,14 +33,14 @@ #include "SharedLibraryTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/SharedLibrary.h" -#include "Foundation/Exception.h" +#include "Poco/SharedLibrary.h" +#include "Poco/Exception.h" -using Foundation::SharedLibrary; -using Foundation::NotFoundException; -using Foundation::LibraryLoadException; -using Foundation::LibraryAlreadyLoadedException; +using Poco::SharedLibrary; +using Poco::NotFoundException; +using Poco::LibraryLoadException; +using Poco::LibraryAlreadyLoadedException; typedef int (*GimmeFiveFunc)(); diff --git a/Foundation/testsuite/src/SharedLibraryTest.h b/Foundation/testsuite/src/SharedLibraryTest.h index a42aa96c7..ea0f6073c 100644 --- a/Foundation/testsuite/src/SharedLibraryTest.h +++ b/Foundation/testsuite/src/SharedLibraryTest.h @@ -1,7 +1,7 @@ // // SharedLibraryTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/SharedLibraryTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/SharedLibraryTest.h#1 $ // // Definition of the SharedLibraryTest class. // @@ -36,12 +36,8 @@ #define SharedLibraryTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class SharedLibraryTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/SharedLibraryTestSuite.cpp b/Foundation/testsuite/src/SharedLibraryTestSuite.cpp index 5ccd843b1..b2430659a 100644 --- a/Foundation/testsuite/src/SharedLibraryTestSuite.cpp +++ b/Foundation/testsuite/src/SharedLibraryTestSuite.cpp @@ -1,7 +1,7 @@ // // SharedLibraryTestSuite.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/SharedLibraryTestSuite.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/SharedLibraryTestSuite.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. diff --git a/Foundation/testsuite/src/SharedLibraryTestSuite.h b/Foundation/testsuite/src/SharedLibraryTestSuite.h index 6195c1908..9b080bfff 100644 --- a/Foundation/testsuite/src/SharedLibraryTestSuite.h +++ b/Foundation/testsuite/src/SharedLibraryTestSuite.h @@ -1,7 +1,7 @@ // // SharedLibraryTestSuite.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/SharedLibraryTestSuite.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/SharedLibraryTestSuite.h#1 $ // // Definition of the SharedLibraryTestSuite class. // @@ -36,9 +36,7 @@ #define SharedLibraryTestSuite_INCLUDED -#ifndef CppUnit_TestSuite_INCLUDED #include "CppUnit/TestSuite.h" -#endif class SharedLibraryTestSuite diff --git a/Foundation/testsuite/src/SharedPtrTest.cpp b/Foundation/testsuite/src/SharedPtrTest.cpp index 94550fb62..524215db2 100644 --- a/Foundation/testsuite/src/SharedPtrTest.cpp +++ b/Foundation/testsuite/src/SharedPtrTest.cpp @@ -1,7 +1,7 @@ // // SharedPtrTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/SharedPtrTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/SharedPtrTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,12 +33,12 @@ #include "SharedPtrTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/SharedPtr.h" -#include "Foundation/Exception.h" +#include "Poco/SharedPtr.h" +#include "Poco/Exception.h" -using Foundation::SharedPtr; -using Foundation::NullPointerException; +using Poco::SharedPtr; +using Poco::NullPointerException; namespace @@ -51,7 +51,7 @@ namespace ++_count; } - ~TestObject() + virtual ~TestObject() { --_count; } @@ -72,6 +72,21 @@ namespace }; int TestObject::_count = 0; + + class DerivedObject: public TestObject + { + public: + DerivedObject(const std::string& s, int i): TestObject(s), _number(i) + { + } + + int number() const + { + return _number; + } + private: + int _number; + }; } @@ -162,6 +177,41 @@ void SharedPtrTest::testSharedPtr() } +void SharedPtrTest::testImplicitCast() +{ + { + // null assign test + SharedPtr < DerivedObject > ptr2; + assertNull(ptr2.get()); + SharedPtr ptr1 = ptr2; + } + { + SharedPtr < DerivedObject > ptr2(new DerivedObject("test", 666)); + assert (TestObject::count() == 1); + SharedPtr ptr1 = ptr2; + assert (TestObject::count() == 1); + } + assert (TestObject::count() == 0); + SharedPtr ptr1 = new DerivedObject("test", 666); + assert (TestObject::count() == 1); + ptr1 = 0; + assert (TestObject::count() == 0); +} + +void SharedPtrTest::testExplicitCast() +{ + SharedPtr ptr1 = new DerivedObject("test", 666); + SharedPtr < DerivedObject > ptr2 = ptr1.cast(); + assert (ptr2.get() != 0); + + // cast the other way round must fail + ptr1 = new TestObject("test"); + assert (TestObject::count() == 2); + ptr2 = ptr1.cast(); + assert (TestObject::count() == 1); + assert (ptr2.get() == 0); +} + void SharedPtrTest::setUp() { } @@ -177,6 +227,8 @@ CppUnit::Test* SharedPtrTest::suite() CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("SharedPtrTest"); CppUnit_addTest(pSuite, SharedPtrTest, testSharedPtr); + CppUnit_addTest(pSuite, SharedPtrTest, testImplicitCast); + CppUnit_addTest(pSuite, SharedPtrTest, testExplicitCast); return pSuite; } diff --git a/Foundation/testsuite/src/SharedPtrTest.h b/Foundation/testsuite/src/SharedPtrTest.h index 26c7a2c4b..8f0affea4 100644 --- a/Foundation/testsuite/src/SharedPtrTest.h +++ b/Foundation/testsuite/src/SharedPtrTest.h @@ -1,7 +1,7 @@ // // SharedPtrTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/SharedPtrTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/SharedPtrTest.h#1 $ // // Definition of the SharedPtrTest class. // @@ -36,12 +36,8 @@ #define SharedPtrTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class SharedPtrTest: public CppUnit::TestCase @@ -52,6 +48,9 @@ public: void testSharedPtr(); + void testImplicitCast(); + void testExplicitCast(); + void setUp(); void tearDown(); diff --git a/Foundation/testsuite/src/SimpleFileChannelTest.cpp b/Foundation/testsuite/src/SimpleFileChannelTest.cpp index a693efd1a..c470172b8 100644 --- a/Foundation/testsuite/src/SimpleFileChannelTest.cpp +++ b/Foundation/testsuite/src/SimpleFileChannelTest.cpp @@ -1,7 +1,7 @@ // // SimpleFileChannelTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/SimpleFileChannelTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/SimpleFileChannelTest.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -30,27 +30,27 @@ // -#include "Foundation/SimpleFileChannel.h" -#include "Foundation/Message.h" -#include "Foundation/Path.h" -#include "Foundation/File.h" -#include "Foundation/DirectoryIterator.h" -#include "Foundation/Timestamp.h" -#include "Foundation/DateTimeFormatter.h" -#include "Foundation/AutoPtr.h" +#include "Poco/SimpleFileChannel.h" +#include "Poco/Message.h" +#include "Poco/Path.h" +#include "Poco/File.h" +#include "Poco/DirectoryIterator.h" +#include "Poco/Timestamp.h" +#include "Poco/DateTimeFormatter.h" +#include "Poco/AutoPtr.h" #include "SimpleFileChannelTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -using Foundation::SimpleFileChannel; -using Foundation::Message; -using Foundation::Path; -using Foundation::File; -using Foundation::DirectoryIterator; -using Foundation::Timestamp; -using Foundation::DateTimeFormatter; -using Foundation::AutoPtr; +using Poco::SimpleFileChannel; +using Poco::Message; +using Poco::Path; +using Poco::File; +using Poco::DirectoryIterator; +using Poco::Timestamp; +using Poco::DateTimeFormatter; +using Poco::AutoPtr; SimpleFileChannelTest::SimpleFileChannelTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/SimpleFileChannelTest.h b/Foundation/testsuite/src/SimpleFileChannelTest.h index 4991964b5..4204fe583 100644 --- a/Foundation/testsuite/src/SimpleFileChannelTest.h +++ b/Foundation/testsuite/src/SimpleFileChannelTest.h @@ -1,7 +1,7 @@ // // SimpleFileChannelTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/SimpleFileChannelTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/SimpleFileChannelTest.h#1 $ // // Definition of the SimpleFileChannelTest class. // @@ -36,12 +36,8 @@ #define SimpleFileChannelTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class SimpleFileChannelTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/StopwatchTest.cpp b/Foundation/testsuite/src/StopwatchTest.cpp index 310ba6546..b619f4c40 100644 --- a/Foundation/testsuite/src/StopwatchTest.cpp +++ b/Foundation/testsuite/src/StopwatchTest.cpp @@ -1,7 +1,7 @@ // // StopwatchTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/StopwatchTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/StopwatchTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,14 +33,14 @@ #include "StopwatchTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/Stopwatch.h" -#include "Foundation/Timestamp.h" -#include "Foundation/Thread.h" +#include "Poco/Stopwatch.h" +#include "Poco/Timestamp.h" +#include "Poco/Thread.h" -using Foundation::Stopwatch; -using Foundation::Timestamp; -using Foundation::Thread; +using Poco::Stopwatch; +using Poco::Timestamp; +using Poco::Thread; StopwatchTest::StopwatchTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/StopwatchTest.h b/Foundation/testsuite/src/StopwatchTest.h index de6f19189..526df1d2e 100644 --- a/Foundation/testsuite/src/StopwatchTest.h +++ b/Foundation/testsuite/src/StopwatchTest.h @@ -1,7 +1,7 @@ // // StopwatchTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/StopwatchTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/StopwatchTest.h#1 $ // // Definition of the StopwatchTest class. // @@ -36,12 +36,8 @@ #define StopwatchTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class StopwatchTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/StreamConverterTest.cpp b/Foundation/testsuite/src/StreamConverterTest.cpp index 357920d59..db1a116f8 100644 --- a/Foundation/testsuite/src/StreamConverterTest.cpp +++ b/Foundation/testsuite/src/StreamConverterTest.cpp @@ -1,7 +1,7 @@ // // StreamConverterTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/StreamConverterTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/StreamConverterTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,20 +33,20 @@ #include "StreamConverterTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/StreamConverter.h" -#include "Foundation/ASCIIEncoding.h" -#include "Foundation/Latin1Encoding.h" -#include "Foundation/UTF8Encoding.h" -#include "Foundation/StreamCopier.h" +#include "Poco/StreamConverter.h" +#include "Poco/ASCIIEncoding.h" +#include "Poco/Latin1Encoding.h" +#include "Poco/UTF8Encoding.h" +#include "Poco/StreamCopier.h" #include -using Foundation::InputStreamConverter; -using Foundation::OutputStreamConverter; -using Foundation::Latin1Encoding; -using Foundation::UTF8Encoding; -using Foundation::ASCIIEncoding; -using Foundation::StreamCopier; +using Poco::InputStreamConverter; +using Poco::OutputStreamConverter; +using Poco::Latin1Encoding; +using Poco::UTF8Encoding; +using Poco::ASCIIEncoding; +using Poco::StreamCopier; StreamConverterTest::StreamConverterTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/StreamConverterTest.h b/Foundation/testsuite/src/StreamConverterTest.h index 304f2141f..67a4a7f1b 100644 --- a/Foundation/testsuite/src/StreamConverterTest.h +++ b/Foundation/testsuite/src/StreamConverterTest.h @@ -1,7 +1,7 @@ // // StreamConverterTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/StreamConverterTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/StreamConverterTest.h#1 $ // // Definition of the StreamConverterTest class. // @@ -36,12 +36,8 @@ #define StreamConverterTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class StreamConverterTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/StreamCopierTest.cpp b/Foundation/testsuite/src/StreamCopierTest.cpp index da4618905..9cd546787 100644 --- a/Foundation/testsuite/src/StreamCopierTest.cpp +++ b/Foundation/testsuite/src/StreamCopierTest.cpp @@ -1,7 +1,7 @@ // // StreamCopierTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/StreamCopierTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/StreamCopierTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,11 +33,11 @@ #include "StreamCopierTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/StreamCopier.h" +#include "Poco/StreamCopier.h" #include -using Foundation::StreamCopier; +using Poco::StreamCopier; StreamCopierTest::StreamCopierTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/StreamCopierTest.h b/Foundation/testsuite/src/StreamCopierTest.h index 240562e59..69ac4ca07 100644 --- a/Foundation/testsuite/src/StreamCopierTest.h +++ b/Foundation/testsuite/src/StreamCopierTest.h @@ -1,7 +1,7 @@ // // StreamCopierTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/StreamCopierTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/StreamCopierTest.h#1 $ // // Definition of the StreamCopierTest class. // @@ -36,12 +36,8 @@ #define StreamCopierTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class StreamCopierTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/StreamTokenizerTest.cpp b/Foundation/testsuite/src/StreamTokenizerTest.cpp index e24276596..a79b5cdd2 100644 --- a/Foundation/testsuite/src/StreamTokenizerTest.cpp +++ b/Foundation/testsuite/src/StreamTokenizerTest.cpp @@ -1,7 +1,7 @@ // // StreamTokenizerTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/StreamTokenizerTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/StreamTokenizerTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,17 +33,17 @@ #include "StreamTokenizerTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/StreamTokenizer.h" -#include "Foundation/Token.h" +#include "Poco/StreamTokenizer.h" +#include "Poco/Token.h" #include #include -using Foundation::StreamTokenizer; -using Foundation::Token; -using Foundation::InvalidToken; -using Foundation::EOFToken; -using Foundation::WhitespaceToken; +using Poco::StreamTokenizer; +using Poco::Token; +using Poco::InvalidToken; +using Poco::EOFToken; +using Poco::WhitespaceToken; class IdentifierToken: public Token diff --git a/Foundation/testsuite/src/StreamTokenizerTest.h b/Foundation/testsuite/src/StreamTokenizerTest.h index da54177a5..37aafe9a4 100644 --- a/Foundation/testsuite/src/StreamTokenizerTest.h +++ b/Foundation/testsuite/src/StreamTokenizerTest.h @@ -1,7 +1,7 @@ // // StreamTokenizerTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/StreamTokenizerTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/StreamTokenizerTest.h#1 $ // // Definition of the StreamTokenizerTest class. // @@ -36,12 +36,8 @@ #define StreamTokenizerTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class StreamTokenizerTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/StreamsTestSuite.cpp b/Foundation/testsuite/src/StreamsTestSuite.cpp index b1e82c1cd..4e321f245 100644 --- a/Foundation/testsuite/src/StreamsTestSuite.cpp +++ b/Foundation/testsuite/src/StreamsTestSuite.cpp @@ -1,7 +1,7 @@ // // StreamsTestSuite.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/StreamsTestSuite.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/StreamsTestSuite.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. diff --git a/Foundation/testsuite/src/StreamsTestSuite.h b/Foundation/testsuite/src/StreamsTestSuite.h index 368cff15d..48ed1809f 100644 --- a/Foundation/testsuite/src/StreamsTestSuite.h +++ b/Foundation/testsuite/src/StreamsTestSuite.h @@ -1,7 +1,7 @@ // // StreamsTestSuite.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/StreamsTestSuite.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/StreamsTestSuite.h#1 $ // // Definition of the StreamsTestSuite class. // @@ -36,9 +36,7 @@ #define StreamsTestSuite_INCLUDED -#ifndef CppUnit_TestSuite_INCLUDED #include "CppUnit/TestSuite.h" -#endif class StreamsTestSuite diff --git a/Foundation/testsuite/src/StringTest.cpp b/Foundation/testsuite/src/StringTest.cpp index a5196818f..d67140412 100644 --- a/Foundation/testsuite/src/StringTest.cpp +++ b/Foundation/testsuite/src/StringTest.cpp @@ -1,7 +1,7 @@ // // StringTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/StringTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/StringTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,23 +33,23 @@ #include "StringTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/String.h" +#include "Poco/String.h" -using Foundation::trimLeft; -using Foundation::trimLeftInPlace; -using Foundation::trimRight; -using Foundation::trimRightInPlace; -using Foundation::trim; -using Foundation::trimInPlace; -using Foundation::toUpper; -using Foundation::toUpperInPlace; -using Foundation::toLower; -using Foundation::toLowerInPlace; -using Foundation::icompare; -using Foundation::translate; -using Foundation::translateInPlace; -using Foundation::cat; +using Poco::trimLeft; +using Poco::trimLeftInPlace; +using Poco::trimRight; +using Poco::trimRightInPlace; +using Poco::trim; +using Poco::trimInPlace; +using Poco::toUpper; +using Poco::toUpperInPlace; +using Poco::toLower; +using Poco::toLowerInPlace; +using Poco::icompare; +using Poco::translate; +using Poco::translateInPlace; +using Poco::cat; StringTest::StringTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/StringTest.h b/Foundation/testsuite/src/StringTest.h index a8981bf4f..8c732b831 100644 --- a/Foundation/testsuite/src/StringTest.h +++ b/Foundation/testsuite/src/StringTest.h @@ -1,7 +1,7 @@ // // StringTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/StringTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/StringTest.h#1 $ // // Definition of the StringTest class. // @@ -36,12 +36,8 @@ #define StringTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class StringTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/StringTokenizerTest.cpp b/Foundation/testsuite/src/StringTokenizerTest.cpp index 407d96a34..f40e1a2ee 100644 --- a/Foundation/testsuite/src/StringTokenizerTest.cpp +++ b/Foundation/testsuite/src/StringTokenizerTest.cpp @@ -1,7 +1,7 @@ // // StringTokenizerTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/StringTokenizerTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/StringTokenizerTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,10 +33,10 @@ #include "StringTokenizerTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/StringTokenizer.h" +#include "Poco/StringTokenizer.h" -using Foundation::StringTokenizer; +using Poco::StringTokenizer; StringTokenizerTest::StringTokenizerTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/StringTokenizerTest.h b/Foundation/testsuite/src/StringTokenizerTest.h index aa6148f0b..e27a62173 100644 --- a/Foundation/testsuite/src/StringTokenizerTest.h +++ b/Foundation/testsuite/src/StringTokenizerTest.h @@ -1,7 +1,7 @@ // // StringTokenizerTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/StringTokenizerTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/StringTokenizerTest.h#1 $ // // Definition of the StringTokenizerTest class. // @@ -36,12 +36,8 @@ #define StringTokenizerTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class StringTokenizerTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/TaskManagerTest.cpp b/Foundation/testsuite/src/TaskManagerTest.cpp index 9ae28aefb..6dda2da32 100644 --- a/Foundation/testsuite/src/TaskManagerTest.cpp +++ b/Foundation/testsuite/src/TaskManagerTest.cpp @@ -1,7 +1,7 @@ // // TaskManagerTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/TaskManagerTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/TaskManagerTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,33 +33,33 @@ #include "TaskManagerTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/TaskManager.h" -#include "Foundation/Task.h" -#include "Foundation/TaskNotification.h" -#include "Foundation/NotificationCenter.h" -#include "Foundation/Thread.h" -#include "Foundation/Event.h" -#include "Foundation/Observer.h" -#include "Foundation/Exception.h" -#include "Foundation/AutoPtr.h" +#include "Poco/TaskManager.h" +#include "Poco/Task.h" +#include "Poco/TaskNotification.h" +#include "Poco/NotificationCenter.h" +#include "Poco/Thread.h" +#include "Poco/Event.h" +#include "Poco/Observer.h" +#include "Poco/Exception.h" +#include "Poco/AutoPtr.h" -using Foundation::TaskManager; -using Foundation::Task; -using Foundation::NotificationCenter; -using Foundation::TaskStartedNotification; -using Foundation::TaskCancelledNotification; -using Foundation::TaskFinishedNotification; -using Foundation::TaskFailedNotification; -using Foundation::TaskProgressNotification; -using Foundation::TaskCustomNotification; -using Foundation::Thread; -using Foundation::Event; -using Foundation::Observer; -using Foundation::Exception; -using Foundation::SystemException; -using Foundation::NullPointerException; -using Foundation::AutoPtr; +using Poco::TaskManager; +using Poco::Task; +using Poco::NotificationCenter; +using Poco::TaskStartedNotification; +using Poco::TaskCancelledNotification; +using Poco::TaskFinishedNotification; +using Poco::TaskFailedNotification; +using Poco::TaskProgressNotification; +using Poco::TaskCustomNotification; +using Poco::Thread; +using Poco::Event; +using Poco::Observer; +using Poco::Exception; +using Poco::SystemException; +using Poco::NullPointerException; +using Poco::AutoPtr; namespace diff --git a/Foundation/testsuite/src/TaskManagerTest.h b/Foundation/testsuite/src/TaskManagerTest.h index 97b5627fe..66740287e 100644 --- a/Foundation/testsuite/src/TaskManagerTest.h +++ b/Foundation/testsuite/src/TaskManagerTest.h @@ -1,7 +1,7 @@ // // TaskManagerTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/TaskManagerTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/TaskManagerTest.h#1 $ // // Definition of the TaskManagerTest class. // @@ -36,12 +36,8 @@ #define TaskManagerTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class TaskManagerTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/TaskTest.cpp b/Foundation/testsuite/src/TaskTest.cpp index 1b2f315e3..e1537ce4c 100644 --- a/Foundation/testsuite/src/TaskTest.cpp +++ b/Foundation/testsuite/src/TaskTest.cpp @@ -1,7 +1,7 @@ // // TaskTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/TaskTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/TaskTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,16 +33,16 @@ #include "TaskTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/Task.h" -#include "Foundation/Thread.h" -#include "Foundation/Event.h" -#include "Foundation/AutoPtr.h" +#include "Poco/Task.h" +#include "Poco/Thread.h" +#include "Poco/Event.h" +#include "Poco/AutoPtr.h" -using Foundation::Task; -using Foundation::Thread; -using Foundation::Event; -using Foundation::AutoPtr; +using Poco::Task; +using Poco::Thread; +using Poco::Event; +using Poco::AutoPtr; namespace diff --git a/Foundation/testsuite/src/TaskTest.h b/Foundation/testsuite/src/TaskTest.h index 27f3dacf2..a0179e894 100644 --- a/Foundation/testsuite/src/TaskTest.h +++ b/Foundation/testsuite/src/TaskTest.h @@ -1,7 +1,7 @@ // // TaskTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/TaskTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/TaskTest.h#1 $ // // Definition of the TaskTest class. // @@ -36,12 +36,8 @@ #define TaskTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class TaskTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/TaskTestSuite.cpp b/Foundation/testsuite/src/TaskTestSuite.cpp index e8380fafd..adaacb58b 100644 --- a/Foundation/testsuite/src/TaskTestSuite.cpp +++ b/Foundation/testsuite/src/TaskTestSuite.cpp @@ -1,7 +1,7 @@ // // TaskTestSuite.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/TaskTestSuite.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/TaskTestSuite.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. diff --git a/Foundation/testsuite/src/TaskTestSuite.h b/Foundation/testsuite/src/TaskTestSuite.h index 0348ebab6..46b29f590 100644 --- a/Foundation/testsuite/src/TaskTestSuite.h +++ b/Foundation/testsuite/src/TaskTestSuite.h @@ -1,7 +1,7 @@ // // TaskTestSuite.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/TaskTestSuite.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/TaskTestSuite.h#1 $ // // Definition of the TaskTestSuite class. // @@ -36,9 +36,7 @@ #define TaskTestSuite_INCLUDED -#ifndef CppUnit_TestSuite_INCLUDED #include "CppUnit/TestSuite.h" -#endif class TaskTestSuite diff --git a/Foundation/testsuite/src/TeeStreamTest.cpp b/Foundation/testsuite/src/TeeStreamTest.cpp index aebd8b868..997998b6f 100644 --- a/Foundation/testsuite/src/TeeStreamTest.cpp +++ b/Foundation/testsuite/src/TeeStreamTest.cpp @@ -1,7 +1,7 @@ // // TeeStreamTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/TeeStreamTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/TeeStreamTest.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,12 +33,12 @@ #include "TeeStreamTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/TeeStream.h" +#include "Poco/TeeStream.h" #include -using Foundation::TeeInputStream; -using Foundation::TeeOutputStream; +using Poco::TeeInputStream; +using Poco::TeeOutputStream; TeeStreamTest::TeeStreamTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/TeeStreamTest.h b/Foundation/testsuite/src/TeeStreamTest.h index d7ce617f6..ac7031a70 100644 --- a/Foundation/testsuite/src/TeeStreamTest.h +++ b/Foundation/testsuite/src/TeeStreamTest.h @@ -1,7 +1,7 @@ // // TeeStreamTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/TeeStreamTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/TeeStreamTest.h#1 $ // // Definition of the TeeStreamTest class. // @@ -36,12 +36,8 @@ #define TeeStreamTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class TeeStreamTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/TestApp.cpp b/Foundation/testsuite/src/TestApp.cpp index 54071ddc0..24ea1a259 100644 --- a/Foundation/testsuite/src/TestApp.cpp +++ b/Foundation/testsuite/src/TestApp.cpp @@ -1,7 +1,7 @@ // // TestApp.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/TestApp.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/TestApp.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -30,7 +30,26 @@ // +#include +#include + + int main(int argc, char** argv) { + if (argc > 1) + { + std::string arg(argv[1]); + if (arg == "-hello") + { + std::cout << "Hello, world!"; + } + else if (arg == "-count") + { + int n = 0; + int c = std::cin.get(); + while (c != -1) { ++n; c = std::cin.get(); } + return n; + } + } return argc - 1; } diff --git a/Foundation/testsuite/src/TestChannel.cpp b/Foundation/testsuite/src/TestChannel.cpp index 4f8203a63..d56aca207 100644 --- a/Foundation/testsuite/src/TestChannel.cpp +++ b/Foundation/testsuite/src/TestChannel.cpp @@ -1,7 +1,7 @@ // // TestChannel.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/TestChannel.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/TestChannel.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -43,7 +43,7 @@ TestChannel::~TestChannel() } -void TestChannel::log(const Foundation::Message& msg) +void TestChannel::log(const Poco::Message& msg) { _msgList.push_back(msg); } diff --git a/Foundation/testsuite/src/TestChannel.h b/Foundation/testsuite/src/TestChannel.h index 5b6998a85..13a5d23ef 100644 --- a/Foundation/testsuite/src/TestChannel.h +++ b/Foundation/testsuite/src/TestChannel.h @@ -1,7 +1,7 @@ // // TestChannel.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/TestChannel.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/TestChannel.h#1 $ // // Definition of the TestChannel class. // @@ -36,27 +36,20 @@ #define TestChannel_INCLUDED -#ifndef Foundation_Channel_INCLUDED -#include "Foundation/Channel.h" -#endif -#ifndef Foundation_Message_INCLUDED -#include "Foundation/Message.h" -#endif -#ifndef STD_LIST_INCLUDED +#include "Poco/Channel.h" +#include "Poco/Message.h" #include -#define STD_LIST_INCLUDED -#endif -class TestChannel: public Foundation::Channel +class TestChannel: public Poco::Channel { public: - typedef std::list MsgList; + typedef std::list MsgList; TestChannel(); ~TestChannel(); - void log(const Foundation::Message& msg); + void log(const Poco::Message& msg); MsgList& list(); void clear(); diff --git a/Foundation/testsuite/src/TestLibrary.cpp b/Foundation/testsuite/src/TestLibrary.cpp index 798d93d50..395194fad 100644 --- a/Foundation/testsuite/src/TestLibrary.cpp +++ b/Foundation/testsuite/src/TestLibrary.cpp @@ -1,7 +1,7 @@ // // TestLibrary.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/TestLibrary.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/TestLibrary.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -31,7 +31,7 @@ #include "TestPlugin.h" -#include "Foundation/ClassLibrary.h" +#include "Poco/ClassLibrary.h" #include diff --git a/Foundation/testsuite/src/TestPlugin.cpp b/Foundation/testsuite/src/TestPlugin.cpp index 088dae6a6..052c3c703 100644 --- a/Foundation/testsuite/src/TestPlugin.cpp +++ b/Foundation/testsuite/src/TestPlugin.cpp @@ -1,7 +1,7 @@ // // TestPlugin.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/TestPlugin.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/TestPlugin.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. diff --git a/Foundation/testsuite/src/TestPlugin.h b/Foundation/testsuite/src/TestPlugin.h index fe1d66faa..abc8b4307 100644 --- a/Foundation/testsuite/src/TestPlugin.h +++ b/Foundation/testsuite/src/TestPlugin.h @@ -1,7 +1,7 @@ // // TestPlugin.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/TestPlugin.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/TestPlugin.h#1 $ // // Definition of the TestPlugin class. // @@ -36,9 +36,7 @@ #define TestPlugin_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif +#include "Poco/Foundation.h" class TestPlugin diff --git a/Foundation/testsuite/src/TextConverterTest.cpp b/Foundation/testsuite/src/TextConverterTest.cpp index 7d61d69a3..ffb8b8e65 100644 --- a/Foundation/testsuite/src/TextConverterTest.cpp +++ b/Foundation/testsuite/src/TextConverterTest.cpp @@ -1,7 +1,7 @@ // // TextConverterTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/TextConverterTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/TextConverterTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,16 +33,16 @@ #include "TextConverterTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/TextConverter.h" -#include "Foundation/ASCIIEncoding.h" -#include "Foundation/Latin1Encoding.h" -#include "Foundation/UTF8Encoding.h" +#include "Poco/TextConverter.h" +#include "Poco/ASCIIEncoding.h" +#include "Poco/Latin1Encoding.h" +#include "Poco/UTF8Encoding.h" -using Foundation::TextConverter; -using Foundation::Latin1Encoding; -using Foundation::UTF8Encoding; -using Foundation::ASCIIEncoding; +using Poco::TextConverter; +using Poco::Latin1Encoding; +using Poco::UTF8Encoding; +using Poco::ASCIIEncoding; TextConverterTest::TextConverterTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/TextConverterTest.h b/Foundation/testsuite/src/TextConverterTest.h index 8f48a105b..22ffb0691 100644 --- a/Foundation/testsuite/src/TextConverterTest.h +++ b/Foundation/testsuite/src/TextConverterTest.h @@ -1,7 +1,7 @@ // // TextConverterTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/TextConverterTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/TextConverterTest.h#1 $ // // Definition of the TextConverterTest class. // @@ -36,12 +36,8 @@ #define TextConverterTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class TextConverterTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/TextIteratorTest.cpp b/Foundation/testsuite/src/TextIteratorTest.cpp index 1492ad15e..599aa1ff6 100644 --- a/Foundation/testsuite/src/TextIteratorTest.cpp +++ b/Foundation/testsuite/src/TextIteratorTest.cpp @@ -1,7 +1,7 @@ // // TextIteratorTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/TextIteratorTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/TextIteratorTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,14 +33,14 @@ #include "TextIteratorTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/TextIterator.h" -#include "Foundation/Latin1Encoding.h" -#include "Foundation/UTF8Encoding.h" +#include "Poco/TextIterator.h" +#include "Poco/Latin1Encoding.h" +#include "Poco/UTF8Encoding.h" -using Foundation::TextIterator; -using Foundation::Latin1Encoding; -using Foundation::UTF8Encoding; +using Poco::TextIterator; +using Poco::Latin1Encoding; +using Poco::UTF8Encoding; TextIteratorTest::TextIteratorTest(const std::string& name): CppUnit::TestCase(name) @@ -131,7 +131,7 @@ void TextIteratorTest::testOneUTF8() ++it; assert (it == end); - unsigned char data[Foundation::TextEncoding::MAX_SEQUENCE_LENGTH]; + unsigned char data[Poco::TextEncoding::MAX_SEQUENCE_LENGTH]; // 2 byte sequence int n = encoding.convert(0xab, data, sizeof(data)); diff --git a/Foundation/testsuite/src/TextIteratorTest.h b/Foundation/testsuite/src/TextIteratorTest.h index 0a46eca5e..066c1f2b7 100644 --- a/Foundation/testsuite/src/TextIteratorTest.h +++ b/Foundation/testsuite/src/TextIteratorTest.h @@ -1,7 +1,7 @@ // // TextIteratorTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/TextIteratorTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/TextIteratorTest.h#1 $ // // Definition of the TextIteratorTest class. // @@ -36,12 +36,8 @@ #define TextIteratorTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class TextIteratorTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/TextTestSuite.cpp b/Foundation/testsuite/src/TextTestSuite.cpp index 0b631d9c2..4dd516547 100644 --- a/Foundation/testsuite/src/TextTestSuite.cpp +++ b/Foundation/testsuite/src/TextTestSuite.cpp @@ -1,7 +1,7 @@ // // TextTestSuite.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/TextTestSuite.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/TextTestSuite.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. diff --git a/Foundation/testsuite/src/TextTestSuite.h b/Foundation/testsuite/src/TextTestSuite.h index aca5568e2..ee267df39 100644 --- a/Foundation/testsuite/src/TextTestSuite.h +++ b/Foundation/testsuite/src/TextTestSuite.h @@ -1,7 +1,7 @@ // // TextTestSuite.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/TextTestSuite.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/TextTestSuite.h#1 $ // // Definition of the TextTestSuite class. // @@ -36,9 +36,7 @@ #define TextTestSuite_INCLUDED -#ifndef CppUnit_TestSuite_INCLUDED #include "CppUnit/TestSuite.h" -#endif class TextTestSuite diff --git a/Foundation/testsuite/src/ThreadLocalTest.cpp b/Foundation/testsuite/src/ThreadLocalTest.cpp index 1ae75823f..77501a0f1 100644 --- a/Foundation/testsuite/src/ThreadLocalTest.cpp +++ b/Foundation/testsuite/src/ThreadLocalTest.cpp @@ -1,7 +1,7 @@ // // ThreadLocalTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/ThreadLocalTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/ThreadLocalTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,14 +33,14 @@ #include "ThreadLocalTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/ThreadLocal.h" -#include "Foundation/Thread.h" -#include "Foundation/Runnable.h" +#include "Poco/ThreadLocal.h" +#include "Poco/Thread.h" +#include "Poco/Runnable.h" -using Foundation::ThreadLocal; -using Foundation::Thread; -using Foundation::Runnable; +using Poco::ThreadLocal; +using Poco::Thread; +using Poco::Runnable; class TLTestRunnable: public Runnable diff --git a/Foundation/testsuite/src/ThreadLocalTest.h b/Foundation/testsuite/src/ThreadLocalTest.h index f97b5dbc3..b6c45803f 100644 --- a/Foundation/testsuite/src/ThreadLocalTest.h +++ b/Foundation/testsuite/src/ThreadLocalTest.h @@ -1,7 +1,7 @@ // // ThreadLocalTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/ThreadLocalTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/ThreadLocalTest.h#1 $ // // Definition of the ThreadLocalTest class. // @@ -36,12 +36,8 @@ #define ThreadLocalTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class ThreadLocalTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/ThreadPoolTest.cpp b/Foundation/testsuite/src/ThreadPoolTest.cpp index 024146d67..4d5c0fba9 100644 --- a/Foundation/testsuite/src/ThreadPoolTest.cpp +++ b/Foundation/testsuite/src/ThreadPoolTest.cpp @@ -1,7 +1,7 @@ // // ThreadPoolTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/ThreadPoolTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/ThreadPoolTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,15 +33,15 @@ #include "ThreadPoolTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/ThreadPool.h" -#include "Foundation/RunnableAdapter.h" -#include "Foundation/Exception.h" -#include "Foundation/Thread.h" +#include "Poco/ThreadPool.h" +#include "Poco/RunnableAdapter.h" +#include "Poco/Exception.h" +#include "Poco/Thread.h" -using Foundation::ThreadPool; -using Foundation::RunnableAdapter; -using Foundation::Thread; +using Poco::ThreadPool; +using Poco::RunnableAdapter; +using Poco::Thread; ThreadPoolTest::ThreadPoolTest(const std::string& name): CppUnit::TestCase(name), _event(false) @@ -98,7 +98,7 @@ void ThreadPoolTest::testThreadPool() pool.start(ra); failmsg("thread pool exhausted - must throw exception"); } - catch (Foundation::NoThreadAvailableException&) + catch (Poco::NoThreadAvailableException&) { } catch (...) diff --git a/Foundation/testsuite/src/ThreadPoolTest.h b/Foundation/testsuite/src/ThreadPoolTest.h index 37ad4d8d0..421a633c9 100644 --- a/Foundation/testsuite/src/ThreadPoolTest.h +++ b/Foundation/testsuite/src/ThreadPoolTest.h @@ -1,7 +1,7 @@ // // ThreadPoolTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/ThreadPoolTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/ThreadPoolTest.h#1 $ // // Definition of the ThreadPoolTest class. // @@ -36,18 +36,10 @@ #define ThreadPoolTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif -#ifndef Foundation_Event_INCLUDED -#include "Foundation/Event.h" -#endif -#ifndef Foundation_Mutex_INCLUDED -#include "Foundation/Mutex.h" -#endif +#include "Poco/Event.h" +#include "Poco/Mutex.h" class ThreadPoolTest: public CppUnit::TestCase @@ -67,8 +59,8 @@ protected: void count(); private: - Foundation::FastMutex _mutex; - Foundation::Event _event; + Poco::FastMutex _mutex; + Poco::Event _event; int _count; }; diff --git a/Foundation/testsuite/src/ThreadTest.cpp b/Foundation/testsuite/src/ThreadTest.cpp index 4a83184a7..54cdd5dfb 100644 --- a/Foundation/testsuite/src/ThreadTest.cpp +++ b/Foundation/testsuite/src/ThreadTest.cpp @@ -1,7 +1,7 @@ // // ThreadTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/ThreadTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/ThreadTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,14 +33,14 @@ #include "ThreadTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/Thread.h" -#include "Foundation/Runnable.h" -#include "Foundation/Event.h" +#include "Poco/Thread.h" +#include "Poco/Runnable.h" +#include "Poco/Event.h" -using Foundation::Thread; -using Foundation::Runnable; -using Foundation::Event; +using Poco::Thread; +using Poco::Runnable; +using Poco::Event; class MyRunnable: public Runnable diff --git a/Foundation/testsuite/src/ThreadTest.h b/Foundation/testsuite/src/ThreadTest.h index 6bfc72544..6b8dc717b 100644 --- a/Foundation/testsuite/src/ThreadTest.h +++ b/Foundation/testsuite/src/ThreadTest.h @@ -1,7 +1,7 @@ // // ThreadTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/ThreadTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/ThreadTest.h#1 $ // // Definition of the ThreadTest class. // @@ -36,12 +36,8 @@ #define ThreadTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class ThreadTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/ThreadingTestSuite.cpp b/Foundation/testsuite/src/ThreadingTestSuite.cpp index 7ca67173a..2c0530b67 100644 --- a/Foundation/testsuite/src/ThreadingTestSuite.cpp +++ b/Foundation/testsuite/src/ThreadingTestSuite.cpp @@ -1,7 +1,7 @@ // // ThreadingTestSuite.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/ThreadingTestSuite.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/ThreadingTestSuite.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -39,6 +39,7 @@ #include "ThreadLocalTest.h" #include "ActivityTest.h" #include "ActiveMethodTest.h" +#include "ActiveDispatcherTest.h" CppUnit::Test* ThreadingTestSuite::suite() @@ -53,6 +54,7 @@ CppUnit::Test* ThreadingTestSuite::suite() pSuite->addTest(ThreadLocalTest::suite()); pSuite->addTest(ActivityTest::suite()); pSuite->addTest(ActiveMethodTest::suite()); + pSuite->addTest(ActiveDispatcherTest::suite()); return pSuite; } diff --git a/Foundation/testsuite/src/ThreadingTestSuite.h b/Foundation/testsuite/src/ThreadingTestSuite.h index 4c6362669..f34427ada 100644 --- a/Foundation/testsuite/src/ThreadingTestSuite.h +++ b/Foundation/testsuite/src/ThreadingTestSuite.h @@ -1,7 +1,7 @@ // // ThreadingTestSuite.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/ThreadingTestSuite.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/ThreadingTestSuite.h#1 $ // // Definition of the ThreadingTestSuite class. // @@ -36,9 +36,7 @@ #define ThreadingTestSuite_INCLUDED -#ifndef CppUnit_TestSuite_INCLUDED #include "CppUnit/TestSuite.h" -#endif class ThreadingTestSuite diff --git a/Foundation/testsuite/src/TimerTest.cpp b/Foundation/testsuite/src/TimerTest.cpp index 226f8274f..ff08cbe0c 100644 --- a/Foundation/testsuite/src/TimerTest.cpp +++ b/Foundation/testsuite/src/TimerTest.cpp @@ -1,7 +1,7 @@ // // TimerTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/TimerTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/TimerTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,14 +33,14 @@ #include "TimerTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/Thread.h" -#include "Foundation/Stopwatch.h" +#include "Poco/Thread.h" +#include "Poco/Stopwatch.h" -using Foundation::Timer; -using Foundation::TimerCallback; -using Foundation::Thread; -using Foundation::Stopwatch; +using Poco::Timer; +using Poco::TimerCallback; +using Poco::Thread; +using Poco::Stopwatch; TimerTest::TimerTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/TimerTest.h b/Foundation/testsuite/src/TimerTest.h index f9fc2caa9..098660374 100644 --- a/Foundation/testsuite/src/TimerTest.h +++ b/Foundation/testsuite/src/TimerTest.h @@ -1,7 +1,7 @@ // // TimerTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/TimerTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/TimerTest.h#1 $ // // Definition of the TimerTest class. // @@ -36,18 +36,10 @@ #define TimerTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif -#ifndef Foundation_Timer_INCLUDED -#include "Foundation/Timer.h" -#endif -#ifndef Foundation_Event_INCLUDED -#include "Foundation/Event.h" -#endif +#include "Poco/Timer.h" +#include "Poco/Event.h" class TimerTest: public CppUnit::TestCase @@ -64,10 +56,10 @@ public: static CppUnit::Test* suite(); protected: - void onTimer(Foundation::Timer& t); + void onTimer(Poco::Timer& t); private: - Foundation::Event _event; + Poco::Event _event; }; diff --git a/Foundation/testsuite/src/TimespanTest.cpp b/Foundation/testsuite/src/TimespanTest.cpp index 08d35c198..9ba4d7713 100644 --- a/Foundation/testsuite/src/TimespanTest.cpp +++ b/Foundation/testsuite/src/TimespanTest.cpp @@ -1,7 +1,7 @@ // // TimespanTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/TimespanTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/TimespanTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,10 +33,10 @@ #include "TimespanTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/Timespan.h" +#include "Poco/Timespan.h" -using Foundation::Timespan; +using Poco::Timespan; TimespanTest::TimespanTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/TimespanTest.h b/Foundation/testsuite/src/TimespanTest.h index 5275fc7bf..df504a102 100644 --- a/Foundation/testsuite/src/TimespanTest.h +++ b/Foundation/testsuite/src/TimespanTest.h @@ -1,7 +1,7 @@ // // TimespanTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/TimespanTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/TimespanTest.h#1 $ // // Definition of the TimespanTest class. // @@ -36,12 +36,8 @@ #define TimespanTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class TimespanTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/TimestampTest.cpp b/Foundation/testsuite/src/TimestampTest.cpp index 4ce0da609..f610aa469 100644 --- a/Foundation/testsuite/src/TimestampTest.cpp +++ b/Foundation/testsuite/src/TimestampTest.cpp @@ -1,7 +1,7 @@ // // TimestampTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/TimestampTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/TimestampTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,12 +33,12 @@ #include "TimestampTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/Timestamp.h" -#include "Foundation/Thread.h" +#include "Poco/Timestamp.h" +#include "Poco/Thread.h" -using Foundation::Timestamp; -using Foundation::Thread; +using Poco::Timestamp; +using Poco::Thread; TimestampTest::TimestampTest(const std::string& name): CppUnit::TestCase(name) @@ -92,8 +92,8 @@ void TimestampTest::testTimestamp() #if defined(_WIN32) { Timestamp now; - Foundation::UInt32 low; - Foundation::UInt32 high; + Poco::UInt32 low; + Poco::UInt32 high; now.toFileTimeNP(low, high); Timestamp ts = Timestamp::fromFileTimeNP(low, high); assert (now == ts); diff --git a/Foundation/testsuite/src/TimestampTest.h b/Foundation/testsuite/src/TimestampTest.h index b68ac3562..4e4e23365 100644 --- a/Foundation/testsuite/src/TimestampTest.h +++ b/Foundation/testsuite/src/TimestampTest.h @@ -1,7 +1,7 @@ // // TimestampTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/TimestampTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/TimestampTest.h#1 $ // // Definition of the TimestampTest class. // @@ -36,12 +36,8 @@ #define TimestampTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class TimestampTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/TimezoneTest.cpp b/Foundation/testsuite/src/TimezoneTest.cpp index a36938245..471727ac7 100644 --- a/Foundation/testsuite/src/TimezoneTest.cpp +++ b/Foundation/testsuite/src/TimezoneTest.cpp @@ -1,7 +1,7 @@ // // TimezoneTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/TimezoneTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/TimezoneTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,11 +33,11 @@ #include "TimezoneTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/Timezone.h" +#include "Poco/Timezone.h" #include -using Foundation::Timezone; +using Poco::Timezone; TimezoneTest::TimezoneTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/TimezoneTest.h b/Foundation/testsuite/src/TimezoneTest.h index 83c2097ba..b9efde270 100644 --- a/Foundation/testsuite/src/TimezoneTest.h +++ b/Foundation/testsuite/src/TimezoneTest.h @@ -1,7 +1,7 @@ // // TimezoneTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/TimezoneTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/TimezoneTest.h#1 $ // // Definition of the TimezoneTest class. // @@ -36,12 +36,8 @@ #define TimezoneTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class TimezoneTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/URIStreamOpenerTest.cpp b/Foundation/testsuite/src/URIStreamOpenerTest.cpp index b1d9e1af8..801f8e270 100644 --- a/Foundation/testsuite/src/URIStreamOpenerTest.cpp +++ b/Foundation/testsuite/src/URIStreamOpenerTest.cpp @@ -1,7 +1,7 @@ // // URIStreamOpenerTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/URIStreamOpenerTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/URIStreamOpenerTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,20 +33,20 @@ #include "URIStreamOpenerTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/URIStreamOpener.h" -#include "Foundation/URIStreamFactory.h" -#include "Foundation/URI.h" -#include "Foundation/TemporaryFile.h" -#include "Foundation/Path.h" +#include "Poco/URIStreamOpener.h" +#include "Poco/URIStreamFactory.h" +#include "Poco/URI.h" +#include "Poco/TemporaryFile.h" +#include "Poco/Path.h" #include #include -using Foundation::URIStreamOpener; -using Foundation::URIStreamFactory; -using Foundation::URI; -using Foundation::TemporaryFile; -using Foundation::Path; +using Poco::URIStreamOpener; +using Poco::URIStreamFactory; +using Poco::URI; +using Poco::TemporaryFile; +using Poco::Path; namespace diff --git a/Foundation/testsuite/src/URIStreamOpenerTest.h b/Foundation/testsuite/src/URIStreamOpenerTest.h index e7713d09a..acdf1b5ef 100644 --- a/Foundation/testsuite/src/URIStreamOpenerTest.h +++ b/Foundation/testsuite/src/URIStreamOpenerTest.h @@ -1,7 +1,7 @@ // // URIStreamOpenerTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/URIStreamOpenerTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/URIStreamOpenerTest.h#1 $ // // Definition of the URIStreamOpenerTest class. // @@ -36,12 +36,8 @@ #define URIStreamOpenerTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class URIStreamOpenerTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/URITest.cpp b/Foundation/testsuite/src/URITest.cpp index fcec6eb0b..08145b80b 100644 --- a/Foundation/testsuite/src/URITest.cpp +++ b/Foundation/testsuite/src/URITest.cpp @@ -1,7 +1,7 @@ // // URITest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/URITest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/URITest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,10 +33,10 @@ #include "URITest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/URI.h" +#include "Poco/URI.h" -using Foundation::URI; +using Poco::URI; URITest::URITest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/URITest.h b/Foundation/testsuite/src/URITest.h index 7b364a086..580c959f9 100644 --- a/Foundation/testsuite/src/URITest.h +++ b/Foundation/testsuite/src/URITest.h @@ -1,7 +1,7 @@ // // URITest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/URITest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/URITest.h#1 $ // // Definition of the URITest class. // @@ -36,12 +36,8 @@ #define URITest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class URITest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/URITestSuite.cpp b/Foundation/testsuite/src/URITestSuite.cpp index f8ee5d58b..112abd2cc 100644 --- a/Foundation/testsuite/src/URITestSuite.cpp +++ b/Foundation/testsuite/src/URITestSuite.cpp @@ -1,7 +1,7 @@ // // URITestSuite.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/URITestSuite.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/URITestSuite.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. diff --git a/Foundation/testsuite/src/URITestSuite.h b/Foundation/testsuite/src/URITestSuite.h index c63242845..84e49e962 100644 --- a/Foundation/testsuite/src/URITestSuite.h +++ b/Foundation/testsuite/src/URITestSuite.h @@ -1,7 +1,7 @@ // // URITestSuite.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/URITestSuite.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/URITestSuite.h#1 $ // // Definition of the URITestSuite class. // @@ -36,9 +36,7 @@ #define URITestSuite_INCLUDED -#ifndef CppUnit_TestSuite_INCLUDED #include "CppUnit/TestSuite.h" -#endif class URITestSuite diff --git a/Foundation/testsuite/src/UUIDGeneratorTest.cpp b/Foundation/testsuite/src/UUIDGeneratorTest.cpp index eea381b30..b5d59db56 100644 --- a/Foundation/testsuite/src/UUIDGeneratorTest.cpp +++ b/Foundation/testsuite/src/UUIDGeneratorTest.cpp @@ -1,7 +1,7 @@ // // UUIDGeneratorTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/UUIDGeneratorTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/UUIDGeneratorTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,13 +33,13 @@ #include "UUIDGeneratorTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/UUIDGenerator.h" -#include "Foundation/UUID.h" +#include "Poco/UUIDGenerator.h" +#include "Poco/UUID.h" #include -using Foundation::UUIDGenerator; -using Foundation::UUID; +using Poco::UUIDGenerator; +using Poco::UUID; UUIDGeneratorTest::UUIDGeneratorTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/UUIDGeneratorTest.h b/Foundation/testsuite/src/UUIDGeneratorTest.h index 2adfeef32..965494fa6 100644 --- a/Foundation/testsuite/src/UUIDGeneratorTest.h +++ b/Foundation/testsuite/src/UUIDGeneratorTest.h @@ -1,7 +1,7 @@ // // UUIDGeneratorTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/UUIDGeneratorTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/UUIDGeneratorTest.h#1 $ // // Definition of the UUIDGeneratorTest class. // @@ -36,12 +36,8 @@ #define UUIDGeneratorTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class UUIDGeneratorTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/UUIDTest.cpp b/Foundation/testsuite/src/UUIDTest.cpp index 02530244a..464890a0b 100644 --- a/Foundation/testsuite/src/UUIDTest.cpp +++ b/Foundation/testsuite/src/UUIDTest.cpp @@ -1,7 +1,7 @@ // // UUIDTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/UUIDTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/UUIDTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,10 +33,10 @@ #include "UUIDTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/UUID.h" +#include "Poco/UUID.h" -using Foundation::UUID; +using Poco::UUID; UUIDTest::UUIDTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/UUIDTest.h b/Foundation/testsuite/src/UUIDTest.h index f2134b1d1..3186d15ef 100644 --- a/Foundation/testsuite/src/UUIDTest.h +++ b/Foundation/testsuite/src/UUIDTest.h @@ -1,7 +1,7 @@ // // UUIDTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/UUIDTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/UUIDTest.h#1 $ // // Definition of the UUIDTest class. // @@ -36,12 +36,8 @@ #define UUIDTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class UUIDTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/src/UUIDTestSuite.cpp b/Foundation/testsuite/src/UUIDTestSuite.cpp index 28b7293b2..58aed7931 100644 --- a/Foundation/testsuite/src/UUIDTestSuite.cpp +++ b/Foundation/testsuite/src/UUIDTestSuite.cpp @@ -1,7 +1,7 @@ // // UUIDTestSuite.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/UUIDTestSuite.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/UUIDTestSuite.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. diff --git a/Foundation/testsuite/src/UUIDTestSuite.h b/Foundation/testsuite/src/UUIDTestSuite.h index 4a67d94da..9f36a1b73 100644 --- a/Foundation/testsuite/src/UUIDTestSuite.h +++ b/Foundation/testsuite/src/UUIDTestSuite.h @@ -1,7 +1,7 @@ // // UUIDTestSuite.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/UUIDTestSuite.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/UUIDTestSuite.h#1 $ // // Definition of the UUIDTestSuite class. // @@ -36,9 +36,7 @@ #define UUIDTestSuite_INCLUDED -#ifndef CppUnit_TestSuite_INCLUDED #include "CppUnit/TestSuite.h" -#endif class UUIDTestSuite diff --git a/Foundation/testsuite/src/WinDriver.cpp b/Foundation/testsuite/src/WinDriver.cpp index 78bb33660..a41c3d8ac 100644 --- a/Foundation/testsuite/src/WinDriver.cpp +++ b/Foundation/testsuite/src/WinDriver.cpp @@ -1,7 +1,7 @@ // // WinDriver.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/WinDriver.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/WinDriver.cpp#1 $ // // Test driver for Windows. // diff --git a/Foundation/testsuite/src/ZLibTest.cpp b/Foundation/testsuite/src/ZLibTest.cpp index b151e0ff7..e1715d984 100644 --- a/Foundation/testsuite/src/ZLibTest.cpp +++ b/Foundation/testsuite/src/ZLibTest.cpp @@ -1,7 +1,7 @@ // // ZLibTest.cpp // -// $Id: //poco/1.1.0/Foundation/testsuite/src/ZLibTest.cpp#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/ZLibTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,19 +33,19 @@ #include "ZLibTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Foundation/InflatingStream.h" -#include "Foundation/DeflatingStream.h" -#include "Foundation/StreamCopier.h" +#include "Poco/InflatingStream.h" +#include "Poco/DeflatingStream.h" +#include "Poco/StreamCopier.h" #include -using Foundation::InflatingInputStream; -using Foundation::InflatingOutputStream; -using Foundation::DeflatingOutputStream; -using Foundation::DeflatingInputStream; -using Foundation::InflatingStreamBuf; -using Foundation::DeflatingStreamBuf; -using Foundation::StreamCopier; +using Poco::InflatingInputStream; +using Poco::InflatingOutputStream; +using Poco::DeflatingOutputStream; +using Poco::DeflatingInputStream; +using Poco::InflatingStreamBuf; +using Poco::DeflatingStreamBuf; +using Poco::StreamCopier; ZLibTest::ZLibTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Foundation/testsuite/src/ZLibTest.h b/Foundation/testsuite/src/ZLibTest.h index 4f3420d60..3b9374740 100644 --- a/Foundation/testsuite/src/ZLibTest.h +++ b/Foundation/testsuite/src/ZLibTest.h @@ -1,7 +1,7 @@ // // ZLibTest.h // -// $Id: //poco/1.1.0/Foundation/testsuite/src/ZLibTest.h#2 $ +// $Id: //poco/1.2/Foundation/testsuite/src/ZLibTest.h#1 $ // // Definition of the ZLibTest class. // @@ -36,12 +36,8 @@ #define ZLibTest_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Foundation.h" #include "CppUnit/TestCase.h" -#endif class ZLibTest: public CppUnit::TestCase diff --git a/Foundation/testsuite/testapp.vmsbuild b/Foundation/testsuite/testapp.vmsbuild index 581aef71a..1d3a8427d 100644 --- a/Foundation/testsuite/testapp.vmsbuild +++ b/Foundation/testsuite/testapp.vmsbuild @@ -1,7 +1,7 @@ # # sample.vmsbuild # -# $Id: //poco/1.1.0/Foundation/testsuite/testapp.vmsbuild#1 $ +# $Id: //poco/1.2/Foundation/testsuite/testapp.vmsbuild#1 $ # EXE=TestApp TestApp diff --git a/Foundation/testsuite/testlibrary.vmsbuild b/Foundation/testsuite/testlibrary.vmsbuild index f066f349c..71f4b9d28 100644 --- a/Foundation/testsuite/testlibrary.vmsbuild +++ b/Foundation/testsuite/testlibrary.vmsbuild @@ -1,7 +1,7 @@ # # buildfiles.vms # -# $Id: //poco/1.1.0/Foundation/testsuite/testlibrary.vmsbuild#1 $ +# $Id: //poco/1.2/Foundation/testsuite/testlibrary.vmsbuild#1 $ # SHR=TestLibrary TestPlugin diff --git a/Foundation/testsuite/testsuite.vmsbuild b/Foundation/testsuite/testsuite.vmsbuild index 12344546a..95fbba602 100644 --- a/Foundation/testsuite/testsuite.vmsbuild +++ b/Foundation/testsuite/testsuite.vmsbuild @@ -1,7 +1,7 @@ # # buildfiles.vms # -# $Id: //poco/1.1.0/Foundation/testsuite/testsuite.vmsbuild#1 $ +# $Id: //poco/1.2/Foundation/testsuite/testsuite.vmsbuild#1 $ # EXE=TestRunner ActiveMethodTest @@ -33,6 +33,7 @@ GlobTest FilesystemTestSuite FoundationTestSuite HMACEngineTest +HashTest HexBinaryTest LoggerTest LoggingFactoryTest diff --git a/MANIFEST b/MANIFEST index d673d8fe9..249eec354 100644 --- a/MANIFEST +++ b/MANIFEST @@ -4,10 +4,11 @@ build/config build/config/ARM-Linux build/config/CYGWIN build/config/Darwin -build/config/Darwin8 +build/config/Darwin7 build/config/FreeBSD build/config/HP-UX build/config/Linux +build/config/MinGW build/config/OSF1 build/config/QNX build/config/SunOS @@ -37,6 +38,10 @@ build_vs71.cmd build_vs80.cmd CHANGELOG components +configure +contrib +contrib/poco-doc.pl +CONTRIBUTORS CppUnit CppUnit/cppunit.vmsbuild CppUnit/CppUnit_vs71.sln @@ -107,227 +112,246 @@ Foundation/Foundation_vs71.vcproj Foundation/Foundation_vs80.sln Foundation/Foundation_vs80.vcproj Foundation/include -Foundation/include/Foundation -Foundation/include/Foundation/AbstractCache.h -Foundation/include/Foundation/AbstractDelegate.h -Foundation/include/Foundation/AbstractEvent.h -Foundation/include/Foundation/AbstractPriorityDelegate.h -Foundation/include/Foundation/AbstractStrategy.h -Foundation/include/Foundation/ActiveMethod.h -Foundation/include/Foundation/ActiveResult.h -Foundation/include/Foundation/Activity.h -Foundation/include/Foundation/Any.h -Foundation/include/Foundation/ArchiveStrategy.h -Foundation/include/Foundation/ASCIIEncoding.h -Foundation/include/Foundation/AsyncChannel.h -Foundation/include/Foundation/AutoPtr.h -Foundation/include/Foundation/AutoReleasePool.h -Foundation/include/Foundation/Base64Decoder.h -Foundation/include/Foundation/Base64Encoder.h -Foundation/include/Foundation/BasicEvent.h -Foundation/include/Foundation/BinaryReader.h -Foundation/include/Foundation/BinaryWriter.h -Foundation/include/Foundation/Buffer.h -Foundation/include/Foundation/BufferAllocator.h -Foundation/include/Foundation/BufferedBidirectionalStreamBuf.h -Foundation/include/Foundation/BufferedStreamBuf.h -Foundation/include/Foundation/Bugcheck.h -Foundation/include/Foundation/ByteOrder.h -Foundation/include/Foundation/Channel.h -Foundation/include/Foundation/ClassLibrary.h -Foundation/include/Foundation/ClassLoader.h -Foundation/include/Foundation/CompareFunctions.h -Foundation/include/Foundation/Configurable.h -Foundation/include/Foundation/ConsoleChannel.h -Foundation/include/Foundation/CountingStream.h -Foundation/include/Foundation/DateTime.h -Foundation/include/Foundation/DateTimeFormat.h -Foundation/include/Foundation/DateTimeFormatter.h -Foundation/include/Foundation/DateTimeParser.h -Foundation/include/Foundation/Debugger.h -Foundation/include/Foundation/DefaultStrategy.h -Foundation/include/Foundation/DeflatingStream.h -Foundation/include/Foundation/Delegate.h -Foundation/include/Foundation/DigestEngine.h -Foundation/include/Foundation/DigestStream.h -Foundation/include/Foundation/DirectoryIterator.h -Foundation/include/Foundation/DirectoryIterator_UNIX.h -Foundation/include/Foundation/DirectoryIterator_VMS.h -Foundation/include/Foundation/DirectoryIterator_WIN32.h -Foundation/include/Foundation/DirectoryIterator_WIN32U.h -Foundation/include/Foundation/DynamicFactory.h -Foundation/include/Foundation/Environment.h -Foundation/include/Foundation/Environment_UNIX.h -Foundation/include/Foundation/Environment_VMS.h -Foundation/include/Foundation/Environment_WIN32.h -Foundation/include/Foundation/Environment_WIN32U.h -Foundation/include/Foundation/ErrorHandler.h -Foundation/include/Foundation/Event.h -Foundation/include/Foundation/EventArgs.h -Foundation/include/Foundation/EventLogChannel.h -Foundation/include/Foundation/Event_POSIX.h -Foundation/include/Foundation/Event_WIN32.h -Foundation/include/Foundation/Exception.h -Foundation/include/Foundation/Expire.h -Foundation/include/Foundation/ExpireCache.h -Foundation/include/Foundation/ExpireLRUCache.h -Foundation/include/Foundation/ExpireStrategy.h -Foundation/include/Foundation/FIFOEvent.h -Foundation/include/Foundation/FIFOStrategy.h -Foundation/include/Foundation/File.h -Foundation/include/Foundation/FileChannel.h -Foundation/include/Foundation/FileStreamFactory.h -Foundation/include/Foundation/File_UNIX.h -Foundation/include/Foundation/File_VMS.h -Foundation/include/Foundation/File_WIN32.h -Foundation/include/Foundation/File_WIN32U.h -Foundation/include/Foundation/Formatter.h -Foundation/include/Foundation/FormattingChannel.h -Foundation/include/Foundation/Foundation.h -Foundation/include/Foundation/FPEnvironment.h -Foundation/include/Foundation/FPEnvironment_C99.h -Foundation/include/Foundation/FPEnvironment_DEC.h -Foundation/include/Foundation/FPEnvironment_DUMMY.h -Foundation/include/Foundation/FPEnvironment_SUN.h -Foundation/include/Foundation/FPEnvironment_WIN32.h -Foundation/include/Foundation/Glob.h -Foundation/include/Foundation/HexBinaryDecoder.h -Foundation/include/Foundation/HexBinaryEncoder.h -Foundation/include/Foundation/HMACEngine.h -Foundation/include/Foundation/InflatingStream.h -Foundation/include/Foundation/Instantiator.h -Foundation/include/Foundation/KeyValueArgs.h -Foundation/include/Foundation/Latin1Encoding.h -Foundation/include/Foundation/Latin9Encoding.h -Foundation/include/Foundation/LineEndingConverter.h -Foundation/include/Foundation/LocalDateTime.h -Foundation/include/Foundation/LogFile.h -Foundation/include/Foundation/LogFile_STD.h -Foundation/include/Foundation/LogFile_VMS.h -Foundation/include/Foundation/LogFile_WIN32.h -Foundation/include/Foundation/Logger.h -Foundation/include/Foundation/LoggingFactory.h -Foundation/include/Foundation/LoggingRegistry.h -Foundation/include/Foundation/LRUCache.h -Foundation/include/Foundation/LRUStrategy.h -Foundation/include/Foundation/Manifest.h -Foundation/include/Foundation/MD2Engine.h -Foundation/include/Foundation/MD4Engine.h -Foundation/include/Foundation/MD5Engine.h -Foundation/include/Foundation/MemoryPool.h -Foundation/include/Foundation/Message.h -Foundation/include/Foundation/MetaObject.h -Foundation/include/Foundation/Mutex.h -Foundation/include/Foundation/Mutex_POSIX.h -Foundation/include/Foundation/Mutex_WIN32.h -Foundation/include/Foundation/NamedEvent.h -Foundation/include/Foundation/NamedEvent_UNIX.h -Foundation/include/Foundation/NamedEvent_VMS.h -Foundation/include/Foundation/NamedEvent_WIN32.h -Foundation/include/Foundation/NamedEvent_WIN32U.h -Foundation/include/Foundation/NamedMutex.h -Foundation/include/Foundation/NamedMutex_UNIX.h -Foundation/include/Foundation/NamedMutex_VMS.h -Foundation/include/Foundation/NamedMutex_WIN32.h -Foundation/include/Foundation/NamedMutex_WIN32U.h -Foundation/include/Foundation/NestedDiagnosticContext.h -Foundation/include/Foundation/Notification.h -Foundation/include/Foundation/NotificationCenter.h -Foundation/include/Foundation/NotificationQueue.h -Foundation/include/Foundation/NotificationStrategy.h -Foundation/include/Foundation/NullChannel.h -Foundation/include/Foundation/NullStream.h -Foundation/include/Foundation/NumberFormatter.h -Foundation/include/Foundation/NumberParser.h -Foundation/include/Foundation/Observer.h -Foundation/include/Foundation/OpcomChannel.h -Foundation/include/Foundation/Path.h -Foundation/include/Foundation/Path_UNIX.h -Foundation/include/Foundation/Path_VMS.h -Foundation/include/Foundation/Path_WIN32.h -Foundation/include/Foundation/Path_WIN32U.h -Foundation/include/Foundation/PatternFormatter.h -Foundation/include/Foundation/Platform.h -Foundation/include/Foundation/Platform_POSIX.h -Foundation/include/Foundation/Platform_VMS.h -Foundation/include/Foundation/Platform_WIN32.h -Foundation/include/Foundation/PriorityDelegate.h -Foundation/include/Foundation/PriorityEvent.h -Foundation/include/Foundation/PriorityExpire.h -Foundation/include/Foundation/Process.h -Foundation/include/Foundation/Process_UNIX.h -Foundation/include/Foundation/Process_VMS.h -Foundation/include/Foundation/Process_WIN32.h -Foundation/include/Foundation/Process_WIN32U.h -Foundation/include/Foundation/PurgeStrategy.h -Foundation/include/Foundation/Random.h -Foundation/include/Foundation/RandomStream.h -Foundation/include/Foundation/RefCountedObject.h -Foundation/include/Foundation/RegularExpression.h -Foundation/include/Foundation/RotateStrategy.h -Foundation/include/Foundation/Runnable.h -Foundation/include/Foundation/RunnableAdapter.h -Foundation/include/Foundation/RWLock.h -Foundation/include/Foundation/RWLock_POSIX.h -Foundation/include/Foundation/RWLock_WIN32.h -Foundation/include/Foundation/ScopedLock.h -Foundation/include/Foundation/Semaphore.h -Foundation/include/Foundation/Semaphore_POSIX.h -Foundation/include/Foundation/Semaphore_WIN32.h -Foundation/include/Foundation/SHA1Engine.h -Foundation/include/Foundation/SharedLibrary.h -Foundation/include/Foundation/SharedLibrary_HPUX.h -Foundation/include/Foundation/SharedLibrary_UNIX.h -Foundation/include/Foundation/SharedLibrary_VMS.h -Foundation/include/Foundation/SharedLibrary_WIN32.h -Foundation/include/Foundation/SharedPtr.h -Foundation/include/Foundation/SignalHandler.h -Foundation/include/Foundation/SimpleFileChannel.h -Foundation/include/Foundation/SingletonHolder.h -Foundation/include/Foundation/SplitterChannel.h -Foundation/include/Foundation/Stopwatch.h -Foundation/include/Foundation/StrategyCollection.h -Foundation/include/Foundation/StreamChannel.h -Foundation/include/Foundation/StreamConverter.h -Foundation/include/Foundation/StreamCopier.h -Foundation/include/Foundation/StreamTokenizer.h -Foundation/include/Foundation/StreamUtil.h -Foundation/include/Foundation/String.h -Foundation/include/Foundation/StringTokenizer.h -Foundation/include/Foundation/SynchronizedObject.h -Foundation/include/Foundation/SyslogChannel.h -Foundation/include/Foundation/Task.h -Foundation/include/Foundation/TaskManager.h -Foundation/include/Foundation/TaskNotification.h -Foundation/include/Foundation/TeeStream.h -Foundation/include/Foundation/TemporaryFile.h -Foundation/include/Foundation/TextConverter.h -Foundation/include/Foundation/TextEncoding.h -Foundation/include/Foundation/TextIterator.h -Foundation/include/Foundation/Thread.h -Foundation/include/Foundation/ThreadLocal.h -Foundation/include/Foundation/ThreadPool.h -Foundation/include/Foundation/Thread_POSIX.h -Foundation/include/Foundation/Thread_WIN32.h -Foundation/include/Foundation/Timer.h -Foundation/include/Foundation/Timespan.h -Foundation/include/Foundation/Timestamp.h -Foundation/include/Foundation/Timezone.h -Foundation/include/Foundation/Token.h -Foundation/include/Foundation/Types.h -Foundation/include/Foundation/UnbufferedStreamBuf.h -Foundation/include/Foundation/UnicodeConverter.h -Foundation/include/Foundation/URI.h -Foundation/include/Foundation/URIStreamFactory.h -Foundation/include/Foundation/URIStreamOpener.h -Foundation/include/Foundation/UTF16Encoding.h -Foundation/include/Foundation/UTF8Encoding.h -Foundation/include/Foundation/UUID.h -Foundation/include/Foundation/UUIDGenerator.h -Foundation/include/Foundation/ValidArgs.h -Foundation/include/Foundation/Windows1252Encoding.h -Foundation/include/Foundation/zconf.h -Foundation/include/Foundation/zlib.h +Foundation/include/Poco +Foundation/include/Poco/AbstractCache.h +Foundation/include/Poco/AbstractDelegate.h +Foundation/include/Poco/AbstractEvent.h +Foundation/include/Poco/AbstractPriorityDelegate.h +Foundation/include/Poco/AbstractStrategy.h +Foundation/include/Poco/ActiveDispatcher.h +Foundation/include/Poco/ActiveMethod.h +Foundation/include/Poco/ActiveResult.h +Foundation/include/Poco/ActiveRunnable.h +Foundation/include/Poco/ActiveStarter.h +Foundation/include/Poco/Activity.h +Foundation/include/Poco/Any.h +Foundation/include/Poco/ArchiveStrategy.h +Foundation/include/Poco/ASCIIEncoding.h +Foundation/include/Poco/AsyncChannel.h +Foundation/include/Poco/AutoPtr.h +Foundation/include/Poco/AutoReleasePool.h +Foundation/include/Poco/Base64Decoder.h +Foundation/include/Poco/Base64Encoder.h +Foundation/include/Poco/BasicEvent.h +Foundation/include/Poco/BinaryReader.h +Foundation/include/Poco/BinaryWriter.h +Foundation/include/Poco/Buffer.h +Foundation/include/Poco/BufferAllocator.h +Foundation/include/Poco/BufferedBidirectionalStreamBuf.h +Foundation/include/Poco/BufferedStreamBuf.h +Foundation/include/Poco/Bugcheck.h +Foundation/include/Poco/ByteOrder.h +Foundation/include/Poco/Channel.h +Foundation/include/Poco/ClassLibrary.h +Foundation/include/Poco/ClassLoader.h +Foundation/include/Poco/CompareFunctions.h +Foundation/include/Poco/Config.h +Foundation/include/Poco/Configurable.h +Foundation/include/Poco/ConsoleChannel.h +Foundation/include/Poco/CountingStream.h +Foundation/include/Poco/DateTime.h +Foundation/include/Poco/DateTimeFormat.h +Foundation/include/Poco/DateTimeFormatter.h +Foundation/include/Poco/DateTimeParser.h +Foundation/include/Poco/Debugger.h +Foundation/include/Poco/DefaultStrategy.h +Foundation/include/Poco/DeflatingStream.h +Foundation/include/Poco/Delegate.h +Foundation/include/Poco/DigestEngine.h +Foundation/include/Poco/DigestStream.h +Foundation/include/Poco/DirectoryIterator.h +Foundation/include/Poco/DirectoryIterator_UNIX.h +Foundation/include/Poco/DirectoryIterator_VMS.h +Foundation/include/Poco/DirectoryIterator_WIN32.h +Foundation/include/Poco/DirectoryIterator_WIN32U.h +Foundation/include/Poco/DynamicFactory.h +Foundation/include/Poco/Environment.h +Foundation/include/Poco/Environment_UNIX.h +Foundation/include/Poco/Environment_VMS.h +Foundation/include/Poco/Environment_WIN32.h +Foundation/include/Poco/Environment_WIN32U.h +Foundation/include/Poco/ErrorHandler.h +Foundation/include/Poco/Event.h +Foundation/include/Poco/EventArgs.h +Foundation/include/Poco/EventLogChannel.h +Foundation/include/Poco/Event_POSIX.h +Foundation/include/Poco/Event_WIN32.h +Foundation/include/Poco/Exception.h +Foundation/include/Poco/Expire.h +Foundation/include/Poco/ExpireCache.h +Foundation/include/Poco/ExpireLRUCache.h +Foundation/include/Poco/ExpireStrategy.h +Foundation/include/Poco/FIFOEvent.h +Foundation/include/Poco/FIFOStrategy.h +Foundation/include/Poco/File.h +Foundation/include/Poco/FileChannel.h +Foundation/include/Poco/FileStreamFactory.h +Foundation/include/Poco/File_UNIX.h +Foundation/include/Poco/File_VMS.h +Foundation/include/Poco/File_WIN32.h +Foundation/include/Poco/File_WIN32U.h +Foundation/include/Poco/Format.h +Foundation/include/Poco/Formatter.h +Foundation/include/Poco/FormattingChannel.h +Foundation/include/Poco/Foundation.h +Foundation/include/Poco/FPEnvironment.h +Foundation/include/Poco/FPEnvironment_C99.h +Foundation/include/Poco/FPEnvironment_DEC.h +Foundation/include/Poco/FPEnvironment_DUMMY.h +Foundation/include/Poco/FPEnvironment_SUN.h +Foundation/include/Poco/FPEnvironment_WIN32.h +Foundation/include/Poco/Glob.h +Foundation/include/Poco/HashFunction.h +Foundation/include/Poco/HashStatistic.h +Foundation/include/Poco/HashTable.h +Foundation/include/Poco/HexBinaryDecoder.h +Foundation/include/Poco/HexBinaryEncoder.h +Foundation/include/Poco/HMACEngine.h +Foundation/include/Poco/InflatingStream.h +Foundation/include/Poco/Instantiator.h +Foundation/include/Poco/KeyValueArgs.h +Foundation/include/Poco/Latin1Encoding.h +Foundation/include/Poco/Latin9Encoding.h +Foundation/include/Poco/LineEndingConverter.h +Foundation/include/Poco/LocalDateTime.h +Foundation/include/Poco/LogFile.h +Foundation/include/Poco/LogFile_STD.h +Foundation/include/Poco/LogFile_VMS.h +Foundation/include/Poco/LogFile_WIN32.h +Foundation/include/Poco/LogFile_WIN32U.h +Foundation/include/Poco/Logger.h +Foundation/include/Poco/LoggingFactory.h +Foundation/include/Poco/LoggingRegistry.h +Foundation/include/Poco/LogStream.h +Foundation/include/Poco/LRUCache.h +Foundation/include/Poco/LRUStrategy.h +Foundation/include/Poco/Manifest.h +Foundation/include/Poco/MD2Engine.h +Foundation/include/Poco/MD4Engine.h +Foundation/include/Poco/MD5Engine.h +Foundation/include/Poco/MemoryPool.h +Foundation/include/Poco/Message.h +Foundation/include/Poco/MetaObject.h +Foundation/include/Poco/Mutex.h +Foundation/include/Poco/Mutex_POSIX.h +Foundation/include/Poco/Mutex_WIN32.h +Foundation/include/Poco/NamedEvent.h +Foundation/include/Poco/NamedEvent_UNIX.h +Foundation/include/Poco/NamedEvent_VMS.h +Foundation/include/Poco/NamedEvent_WIN32.h +Foundation/include/Poco/NamedEvent_WIN32U.h +Foundation/include/Poco/NamedMutex.h +Foundation/include/Poco/NamedMutex_UNIX.h +Foundation/include/Poco/NamedMutex_VMS.h +Foundation/include/Poco/NamedMutex_WIN32.h +Foundation/include/Poco/NamedMutex_WIN32U.h +Foundation/include/Poco/NestedDiagnosticContext.h +Foundation/include/Poco/Notification.h +Foundation/include/Poco/NotificationCenter.h +Foundation/include/Poco/NotificationQueue.h +Foundation/include/Poco/NotificationStrategy.h +Foundation/include/Poco/NullChannel.h +Foundation/include/Poco/NullStream.h +Foundation/include/Poco/NumberFormatter.h +Foundation/include/Poco/NumberParser.h +Foundation/include/Poco/Observer.h +Foundation/include/Poco/OpcomChannel.h +Foundation/include/Poco/Path.h +Foundation/include/Poco/Path_UNIX.h +Foundation/include/Poco/Path_VMS.h +Foundation/include/Poco/Path_WIN32.h +Foundation/include/Poco/Path_WIN32U.h +Foundation/include/Poco/PatternFormatter.h +Foundation/include/Poco/Pipe.h +Foundation/include/Poco/PipeImpl.h +Foundation/include/Poco/PipeImpl_DUMMY.h +Foundation/include/Poco/PipeImpl_POSIX.h +Foundation/include/Poco/PipeImpl_WIN32.h +Foundation/include/Poco/PipeStream.h +Foundation/include/Poco/Platform.h +Foundation/include/Poco/Platform_POSIX.h +Foundation/include/Poco/Platform_VMS.h +Foundation/include/Poco/Platform_WIN32.h +Foundation/include/Poco/Poco.h +Foundation/include/Poco/PriorityDelegate.h +Foundation/include/Poco/PriorityEvent.h +Foundation/include/Poco/PriorityExpire.h +Foundation/include/Poco/Process.h +Foundation/include/Poco/Process_UNIX.h +Foundation/include/Poco/Process_VMS.h +Foundation/include/Poco/Process_WIN32.h +Foundation/include/Poco/Process_WIN32U.h +Foundation/include/Poco/PurgeStrategy.h +Foundation/include/Poco/Random.h +Foundation/include/Poco/RandomStream.h +Foundation/include/Poco/RefCountedObject.h +Foundation/include/Poco/RegularExpression.h +Foundation/include/Poco/RotateStrategy.h +Foundation/include/Poco/Runnable.h +Foundation/include/Poco/RunnableAdapter.h +Foundation/include/Poco/RWLock.h +Foundation/include/Poco/RWLock_POSIX.h +Foundation/include/Poco/RWLock_WIN32.h +Foundation/include/Poco/ScopedLock.h +Foundation/include/Poco/Semaphore.h +Foundation/include/Poco/Semaphore_POSIX.h +Foundation/include/Poco/Semaphore_WIN32.h +Foundation/include/Poco/SHA1Engine.h +Foundation/include/Poco/SharedLibrary.h +Foundation/include/Poco/SharedLibrary_HPUX.h +Foundation/include/Poco/SharedLibrary_UNIX.h +Foundation/include/Poco/SharedLibrary_VMS.h +Foundation/include/Poco/SharedLibrary_WIN32.h +Foundation/include/Poco/SharedPtr.h +Foundation/include/Poco/SignalHandler.h +Foundation/include/Poco/SimpleFileChannel.h +Foundation/include/Poco/SimpleHashTable.h +Foundation/include/Poco/SingletonHolder.h +Foundation/include/Poco/SplitterChannel.h +Foundation/include/Poco/Stopwatch.h +Foundation/include/Poco/StrategyCollection.h +Foundation/include/Poco/StreamChannel.h +Foundation/include/Poco/StreamConverter.h +Foundation/include/Poco/StreamCopier.h +Foundation/include/Poco/StreamTokenizer.h +Foundation/include/Poco/StreamUtil.h +Foundation/include/Poco/String.h +Foundation/include/Poco/StringTokenizer.h +Foundation/include/Poco/SynchronizedObject.h +Foundation/include/Poco/SyslogChannel.h +Foundation/include/Poco/Task.h +Foundation/include/Poco/TaskManager.h +Foundation/include/Poco/TaskNotification.h +Foundation/include/Poco/TeeStream.h +Foundation/include/Poco/TemporaryFile.h +Foundation/include/Poco/TextConverter.h +Foundation/include/Poco/TextEncoding.h +Foundation/include/Poco/TextIterator.h +Foundation/include/Poco/Thread.h +Foundation/include/Poco/ThreadLocal.h +Foundation/include/Poco/ThreadPool.h +Foundation/include/Poco/Thread_POSIX.h +Foundation/include/Poco/Thread_WIN32.h +Foundation/include/Poco/Timer.h +Foundation/include/Poco/Timespan.h +Foundation/include/Poco/Timestamp.h +Foundation/include/Poco/Timezone.h +Foundation/include/Poco/Token.h +Foundation/include/Poco/Types.h +Foundation/include/Poco/UnbufferedStreamBuf.h +Foundation/include/Poco/UnicodeConverter.h +Foundation/include/Poco/URI.h +Foundation/include/Poco/URIStreamFactory.h +Foundation/include/Poco/URIStreamOpener.h +Foundation/include/Poco/UTF16Encoding.h +Foundation/include/Poco/UTF8Encoding.h +Foundation/include/Poco/UUID.h +Foundation/include/Poco/UUIDGenerator.h +Foundation/include/Poco/ValidArgs.h +Foundation/include/Poco/Void.h +Foundation/include/Poco/Windows1252Encoding.h +Foundation/include/Poco/zconf.h +Foundation/include/Poco/zlib.h Foundation/Makefile Foundation/samples Foundation/samples/ActiveMethod @@ -460,6 +484,7 @@ Foundation/samples/uuidgen/uuidgen.vmsbuild Foundation/samples/uuidgen/uuidgen_vs71.vcproj Foundation/samples/uuidgen/uuidgen_vs80.vcproj Foundation/src +Foundation/src/ActiveDispatcher.cpp Foundation/src/adler32.c Foundation/src/ArchiveStrategy.cpp Foundation/src/ASCIIEncoding.cpp @@ -512,6 +537,7 @@ Foundation/src/File_UNIX.cpp Foundation/src/File_VMS.cpp Foundation/src/File_WIN32.cpp Foundation/src/File_WIN32U.cpp +Foundation/src/Format.cpp Foundation/src/Formatter.cpp Foundation/src/FormattingChannel.cpp Foundation/src/FPEnvironment.cpp @@ -523,6 +549,7 @@ Foundation/src/FPEnvironment_WIN32.cpp Foundation/src/get.c Foundation/src/Glob.cpp Foundation/src/gzio.c +Foundation/src/HashStatistic.cpp Foundation/src/HexBinaryDecoder.cpp Foundation/src/HexBinaryEncoder.cpp Foundation/src/infback.c @@ -542,9 +569,11 @@ Foundation/src/LogFile.cpp Foundation/src/LogFile_STD.cpp Foundation/src/LogFile_VMS.cpp Foundation/src/LogFile_WIN32.cpp +Foundation/src/LogFile_WIN32U.cpp Foundation/src/Logger.cpp Foundation/src/LoggingFactory.cpp Foundation/src/LoggingRegistry.cpp +Foundation/src/LogStream.cpp Foundation/src/maketables.c Foundation/src/Manifest.cpp Foundation/src/MD2Engine.cpp @@ -586,6 +615,12 @@ Foundation/src/pcre.c Foundation/src/pcre.h Foundation/src/pcreconfig.h Foundation/src/pcreinternal.h +Foundation/src/Pipe.cpp +Foundation/src/PipeImpl.cpp +Foundation/src/PipeImpl_DUMMY.cpp +Foundation/src/PipeImpl_POSIX.cpp +Foundation/src/PipeImpl_WIN32.cpp +Foundation/src/PipeStream.cpp Foundation/src/pocomsg.h Foundation/src/pocomsg.mc Foundation/src/pocomsg.rc @@ -613,6 +648,7 @@ Foundation/src/SharedLibrary_HPUX.cpp Foundation/src/SharedLibrary_UNIX.cpp Foundation/src/SharedLibrary_VMS.cpp Foundation/src/SharedLibrary_WIN32.cpp +Foundation/src/SharedLibrary_WIN32U.cpp Foundation/src/SignalHandler.cpp Foundation/src/SimpleFileChannel.cpp Foundation/src/SplitterChannel.cpp @@ -656,6 +692,7 @@ Foundation/src/UTF16Encoding.cpp Foundation/src/UTF8Encoding.cpp Foundation/src/UUID.cpp Foundation/src/UUIDGenerator.cpp +Foundation/src/Void.cpp Foundation/src/Windows1252Encoding.cpp Foundation/src/zconf.h Foundation/src/zlib.h @@ -667,6 +704,8 @@ Foundation/testsuite/Makefile-Driver Foundation/testsuite/Makefile-TestApp Foundation/testsuite/Makefile-TestLibrary Foundation/testsuite/src +Foundation/testsuite/src/ActiveDispatcherTest.cpp +Foundation/testsuite/src/ActiveDispatcherTest.h Foundation/testsuite/src/ActiveMethodTest.cpp Foundation/testsuite/src/ActiveMethodTest.h Foundation/testsuite/src/ActivityTest.cpp @@ -728,12 +767,16 @@ Foundation/testsuite/src/FilesystemTestSuite.cpp Foundation/testsuite/src/FilesystemTestSuite.h Foundation/testsuite/src/FileTest.cpp Foundation/testsuite/src/FileTest.h +Foundation/testsuite/src/FormatTest.cpp +Foundation/testsuite/src/FormatTest.h Foundation/testsuite/src/FoundationTestSuite.cpp Foundation/testsuite/src/FoundationTestSuite.h Foundation/testsuite/src/FPETest.cpp Foundation/testsuite/src/FPETest.h Foundation/testsuite/src/GlobTest.cpp Foundation/testsuite/src/GlobTest.h +Foundation/testsuite/src/HashTest.cpp +Foundation/testsuite/src/HashTest.h Foundation/testsuite/src/HexBinaryTest.cpp Foundation/testsuite/src/HexBinaryTest.h Foundation/testsuite/src/HMACEngineTest.cpp @@ -750,6 +793,8 @@ Foundation/testsuite/src/LoggingRegistryTest.cpp Foundation/testsuite/src/LoggingRegistryTest.h Foundation/testsuite/src/LoggingTestSuite.cpp Foundation/testsuite/src/LoggingTestSuite.h +Foundation/testsuite/src/LogStreamTest.cpp +Foundation/testsuite/src/LogStreamTest.h Foundation/testsuite/src/LRUCacheTest.cpp Foundation/testsuite/src/LRUCacheTest.h Foundation/testsuite/src/ManifestTest.cpp @@ -885,85 +930,98 @@ Foundation/testsuite/TestLibrary_vs80.vcproj Foundation/testsuite/testsuite.vmsbuild Foundation/testsuite/TestSuite_vs71.vcproj Foundation/testsuite/TestSuite_vs80.vcproj +libversion LICENSE Makefile MANIFEST Net Net/include -Net/include/Net -Net/include/Net/DatagramSocket.h -Net/include/Net/DatagramSocketImpl.h -Net/include/Net/DialogSocket.h -Net/include/Net/DNS.h -Net/include/Net/FilePartSource.h -Net/include/Net/FTPClientSession.h -Net/include/Net/FTPStreamFactory.h -Net/include/Net/HostEntry.h -Net/include/Net/HTMLForm.h -Net/include/Net/HTTPBasicCredentials.h -Net/include/Net/HTTPBasicStreamBuf.h -Net/include/Net/HTTPBufferAllocator.h -Net/include/Net/HTTPChunkedStream.h -Net/include/Net/HTTPClientSession.h -Net/include/Net/HTTPCookie.h -Net/include/Net/HTTPFixedLengthStream.h -Net/include/Net/HTTPHeaderStream.h -Net/include/Net/HTTPIOStream.h -Net/include/Net/HTTPMessage.h -Net/include/Net/HTTPRequest.h -Net/include/Net/HTTPRequestHandler.h -Net/include/Net/HTTPRequestHandlerFactory.h -Net/include/Net/HTTPResponse.h -Net/include/Net/HTTPServer.h -Net/include/Net/HTTPServerConnection.h -Net/include/Net/HTTPServerConnectionFactory.h -Net/include/Net/HTTPServerParams.h -Net/include/Net/HTTPServerRequest.h -Net/include/Net/HTTPServerResponse.h -Net/include/Net/HTTPServerSession.h -Net/include/Net/HTTPSession.h -Net/include/Net/HTTPStream.h -Net/include/Net/HTTPStreamFactory.h -Net/include/Net/IPAddress.h -Net/include/Net/MailMessage.h -Net/include/Net/MailRecipient.h -Net/include/Net/MailStream.h -Net/include/Net/MediaType.h -Net/include/Net/MessageHeader.h -Net/include/Net/MulticastSocket.h -Net/include/Net/MultipartReader.h -Net/include/Net/MultipartWriter.h -Net/include/Net/NameValueCollection.h -Net/include/Net/Net.h -Net/include/Net/NetException.h -Net/include/Net/NetworkInterface.h -Net/include/Net/NullPartHandler.h -Net/include/Net/PartHandler.h -Net/include/Net/PartSource.h -Net/include/Net/POP3ClientSession.h -Net/include/Net/QuotedPrintableDecoder.h -Net/include/Net/QuotedPrintableEncoder.h -Net/include/Net/ServerSocket.h -Net/include/Net/ServerSocketImpl.h -Net/include/Net/SMTPClientSession.h -Net/include/Net/Socket.h -Net/include/Net/SocketAcceptor.h -Net/include/Net/SocketAddress.h -Net/include/Net/SocketConnector.h -Net/include/Net/SocketDefs.h -Net/include/Net/SocketImpl.h -Net/include/Net/SocketNotification.h -Net/include/Net/SocketNotifier.h -Net/include/Net/SocketReactor.h -Net/include/Net/SocketStream.h -Net/include/Net/StreamSocket.h -Net/include/Net/StreamSocketImpl.h -Net/include/Net/StringPartSource.h -Net/include/Net/TCPServer.h -Net/include/Net/TCPServerConnection.h -Net/include/Net/TCPServerConnectionFactory.h -Net/include/Net/TCPServerDispatcher.h -Net/include/Net/TCPServerParams.h +Net/include/Poco +Net/include/Poco/Net +Net/include/Poco/Net/DatagramSocket.h +Net/include/Poco/Net/DatagramSocketImpl.h +Net/include/Poco/Net/DialogSocket.h +Net/include/Poco/Net/DNS.h +Net/include/Poco/Net/FilePartSource.h +Net/include/Poco/Net/FTPClientSession.h +Net/include/Poco/Net/FTPStreamFactory.h +Net/include/Poco/Net/HostEntry.h +Net/include/Poco/Net/HTMLForm.h +Net/include/Poco/Net/HTTPBasicCredentials.h +Net/include/Poco/Net/HTTPBasicStreamBuf.h +Net/include/Poco/Net/HTTPBufferAllocator.h +Net/include/Poco/Net/HTTPChunkedStream.h +Net/include/Poco/Net/HTTPClientSession.h +Net/include/Poco/Net/HTTPCookie.h +Net/include/Poco/Net/HTTPFixedLengthStream.h +Net/include/Poco/Net/HTTPHeaderStream.h +Net/include/Poco/Net/HTTPIOStream.h +Net/include/Poco/Net/HTTPMessage.h +Net/include/Poco/Net/HTTPRequest.h +Net/include/Poco/Net/HTTPRequestHandler.h +Net/include/Poco/Net/HTTPRequestHandlerFactory.h +Net/include/Poco/Net/HTTPResponse.h +Net/include/Poco/Net/HTTPServer.h +Net/include/Poco/Net/HTTPServerConnection.h +Net/include/Poco/Net/HTTPServerConnectionFactory.h +Net/include/Poco/Net/HTTPServerParams.h +Net/include/Poco/Net/HTTPServerRequest.h +Net/include/Poco/Net/HTTPServerResponse.h +Net/include/Poco/Net/HTTPServerSession.h +Net/include/Poco/Net/HTTPSession.h +Net/include/Poco/Net/HTTPSessionFactory.h +Net/include/Poco/Net/HTTPSessionInstantiator.h +Net/include/Poco/Net/HTTPStream.h +Net/include/Poco/Net/HTTPStreamFactory.h +Net/include/Poco/Net/ICMPClient.h +Net/include/Poco/Net/ICMPEventArgs.h +Net/include/Poco/Net/ICMPPacket.h +Net/include/Poco/Net/ICMPPacketImpl.h +Net/include/Poco/Net/ICMPSocket.h +Net/include/Poco/Net/ICMPSocketImpl.h +Net/include/Poco/Net/ICMPv4PacketImpl.h +Net/include/Poco/Net/IPAddress.h +Net/include/Poco/Net/MailMessage.h +Net/include/Poco/Net/MailRecipient.h +Net/include/Poco/Net/MailStream.h +Net/include/Poco/Net/MediaType.h +Net/include/Poco/Net/MessageHeader.h +Net/include/Poco/Net/MulticastSocket.h +Net/include/Poco/Net/MultipartReader.h +Net/include/Poco/Net/MultipartWriter.h +Net/include/Poco/Net/NameValueCollection.h +Net/include/Poco/Net/Net.h +Net/include/Poco/Net/NetException.h +Net/include/Poco/Net/NetworkInterface.h +Net/include/Poco/Net/NullPartHandler.h +Net/include/Poco/Net/PartHandler.h +Net/include/Poco/Net/PartSource.h +Net/include/Poco/Net/POP3ClientSession.h +Net/include/Poco/Net/QuotedPrintableDecoder.h +Net/include/Poco/Net/QuotedPrintableEncoder.h +Net/include/Poco/Net/RawSocket.h +Net/include/Poco/Net/RawSocketImpl.h +Net/include/Poco/Net/ServerSocket.h +Net/include/Poco/Net/ServerSocketImpl.h +Net/include/Poco/Net/SMTPClientSession.h +Net/include/Poco/Net/Socket.h +Net/include/Poco/Net/SocketAcceptor.h +Net/include/Poco/Net/SocketAddress.h +Net/include/Poco/Net/SocketConnector.h +Net/include/Poco/Net/SocketDefs.h +Net/include/Poco/Net/SocketImpl.h +Net/include/Poco/Net/SocketNotification.h +Net/include/Poco/Net/SocketNotifier.h +Net/include/Poco/Net/SocketReactor.h +Net/include/Poco/Net/SocketStream.h +Net/include/Poco/Net/StreamSocket.h +Net/include/Poco/Net/StreamSocketImpl.h +Net/include/Poco/Net/StringPartSource.h +Net/include/Poco/Net/TCPServer.h +Net/include/Poco/Net/TCPServerConnection.h +Net/include/Poco/Net/TCPServerConnectionFactory.h +Net/include/Poco/Net/TCPServerDispatcher.h +Net/include/Poco/Net/TCPServerParams.h Net/Makefile Net/Net.vmsbuild Net/Net_vs71.sln @@ -993,6 +1051,14 @@ Net/samples/EchoServer/EchoServer_vs80.vcproj Net/samples/EchoServer/Makefile Net/samples/EchoServer/src Net/samples/EchoServer/src/EchoServer.cpp +Net/samples/HTTPFormServer +Net/samples/HTTPFormServer/HTTPFormServer.properties +Net/samples/HTTPFormServer/HTTPFormServer.vmsbuild +Net/samples/HTTPFormServer/HTTPFormServer_vs71.vcproj +Net/samples/HTTPFormServer/HTTPFormServer_vs80.vcproj +Net/samples/HTTPFormServer/Makefile +Net/samples/HTTPFormServer/src +Net/samples/HTTPFormServer/src/HTTPFormServer.cpp Net/samples/httpget Net/samples/httpget/httpget.vmsbuild Net/samples/httpget/httpget_vs71.vcproj @@ -1000,6 +1066,13 @@ Net/samples/httpget/httpget_vs80.vcproj Net/samples/httpget/Makefile Net/samples/httpget/src Net/samples/httpget/src/httpget.cpp +Net/samples/HTTPLoadTest +Net/samples/HTTPLoadTest/HTTPLoadTest.vmsbuild +Net/samples/HTTPLoadTest/HTTPLoadTest_vs71.vcproj +Net/samples/HTTPLoadTest/HTTPLoadTest_vs80.vcproj +Net/samples/HTTPLoadTest/Makefile +Net/samples/HTTPLoadTest/src +Net/samples/HTTPLoadTest/src/HTTPLoadTest.cpp Net/samples/HTTPTimeServer Net/samples/HTTPTimeServer/HTTPTimeServer.properties Net/samples/HTTPTimeServer/HTTPTimeServer.vmsbuild @@ -1017,6 +1090,14 @@ Net/samples/Mail/src Net/samples/Mail/src/Mail.cpp Net/samples/Mail/src/PocoLogo.hpp Net/samples/Makefile +Net/samples/Ping +Net/samples/Ping/Makefile +Net/samples/Ping/ping.properties +Net/samples/Ping/Ping.vmsbuild +Net/samples/Ping/Ping_vs71.vcproj +Net/samples/Ping/Ping_vs80.vcproj +Net/samples/Ping/src +Net/samples/Ping/src/Ping.cpp Net/samples/samples_vs71.sln Net/samples/samples_vs80.sln Net/samples/TimeServer @@ -1058,8 +1139,17 @@ Net/src/HTTPServerRequest.cpp Net/src/HTTPServerResponse.cpp Net/src/HTTPServerSession.cpp Net/src/HTTPSession.cpp +Net/src/HTTPSessionFactory.cpp +Net/src/HTTPSessionInstantiator.cpp Net/src/HTTPStream.cpp Net/src/HTTPStreamFactory.cpp +Net/src/ICMPClient.cpp +Net/src/ICMPEventArgs.cpp +Net/src/ICMPPacket.cpp +Net/src/ICMPPacketImpl.cpp +Net/src/ICMPSocket.cpp +Net/src/ICMPSocketImpl.cpp +Net/src/ICMPv4PacketImpl.cpp Net/src/IPAddress.cpp Net/src/MailMessage.cpp Net/src/MailRecipient.cpp @@ -1078,6 +1168,8 @@ Net/src/PartSource.cpp Net/src/POP3ClientSession.cpp Net/src/QuotedPrintableDecoder.cpp Net/src/QuotedPrintableEncoder.cpp +Net/src/RawSocket.cpp +Net/src/RawSocketImpl.cpp Net/src/ServerSocket.cpp Net/src/ServerSocketImpl.cpp Net/src/SMTPClientSession.cpp @@ -1142,6 +1234,12 @@ Net/testsuite/src/HTTPTestServer.cpp Net/testsuite/src/HTTPTestServer.h Net/testsuite/src/HTTPTestSuite.cpp Net/testsuite/src/HTTPTestSuite.h +Net/testsuite/src/ICMPClientTest.cpp +Net/testsuite/src/ICMPClientTest.h +Net/testsuite/src/ICMPClientTestSuite.cpp +Net/testsuite/src/ICMPClientTestSuite.h +Net/testsuite/src/ICMPSocketTest.cpp +Net/testsuite/src/ICMPSocketTest.h Net/testsuite/src/IPAddressTest.cpp Net/testsuite/src/IPAddressTest.h Net/testsuite/src/MailMessageTest.cpp @@ -1176,6 +1274,8 @@ Net/testsuite/src/POP3ClientSessionTest.cpp Net/testsuite/src/POP3ClientSessionTest.h Net/testsuite/src/QuotedPrintableTest.cpp Net/testsuite/src/QuotedPrintableTest.h +Net/testsuite/src/RawSocketTest.cpp +Net/testsuite/src/RawSocketTest.h Net/testsuite/src/ReactorTestSuite.cpp Net/testsuite/src/ReactorTestSuite.h Net/testsuite/src/SMTPClientSessionTest.cpp @@ -1204,30 +1304,36 @@ NEWS README Util Util/include -Util/include/Util -Util/include/Util/AbstractConfiguration.h -Util/include/Util/Application.h -Util/include/Util/ConfigurationMapper.h -Util/include/Util/ConfigurationView.h -Util/include/Util/FilesystemConfiguration.h -Util/include/Util/HelpFormatter.h -Util/include/Util/IniFileConfiguration.h -Util/include/Util/LayeredConfiguration.h -Util/include/Util/LoggingConfigurator.h -Util/include/Util/LoggingSubsystem.h -Util/include/Util/MapConfiguration.h -Util/include/Util/Option.h -Util/include/Util/OptionException.h -Util/include/Util/OptionProcessor.h -Util/include/Util/OptionSet.h -Util/include/Util/PropertyFileConfiguration.h -Util/include/Util/ServerApplication.h -Util/include/Util/Subsystem.h -Util/include/Util/SystemConfiguration.h -Util/include/Util/Util.h -Util/include/Util/WinRegistryKey.h -Util/include/Util/WinService.h -Util/include/Util/XMLConfiguration.h +Util/include/Poco +Util/include/Poco/Util +Util/include/Poco/Util/AbstractConfiguration.h +Util/include/Poco/Util/Application.h +Util/include/Poco/Util/ConfigurationMapper.h +Util/include/Poco/Util/ConfigurationView.h +Util/include/Poco/Util/FilesystemConfiguration.h +Util/include/Poco/Util/HelpFormatter.h +Util/include/Poco/Util/IniFileConfiguration.h +Util/include/Poco/Util/IntValidator.h +Util/include/Poco/Util/LayeredConfiguration.h +Util/include/Poco/Util/LoggingConfigurator.h +Util/include/Poco/Util/LoggingSubsystem.h +Util/include/Poco/Util/MapConfiguration.h +Util/include/Poco/Util/Option.h +Util/include/Poco/Util/OptionCallback.h +Util/include/Poco/Util/OptionException.h +Util/include/Poco/Util/OptionProcessor.h +Util/include/Poco/Util/OptionSet.h +Util/include/Poco/Util/PropertyFileConfiguration.h +Util/include/Poco/Util/RegExpValidator.h +Util/include/Poco/Util/ServerApplication.h +Util/include/Poco/Util/Subsystem.h +Util/include/Poco/Util/SystemConfiguration.h +Util/include/Poco/Util/Util.h +Util/include/Poco/Util/Validator.h +Util/include/Poco/Util/WinRegistryConfiguration.h +Util/include/Poco/Util/WinRegistryKey.h +Util/include/Poco/Util/WinService.h +Util/include/Poco/Util/XMLConfiguration.h Util/Makefile Util/samples Util/samples/Makefile @@ -1257,18 +1363,23 @@ Util/src/ConfigurationView.cpp Util/src/FilesystemConfiguration.cpp Util/src/HelpFormatter.cpp Util/src/IniFileConfiguration.cpp +Util/src/IntValidator.cpp Util/src/LayeredConfiguration.cpp Util/src/LoggingConfigurator.cpp Util/src/LoggingSubsystem.cpp Util/src/MapConfiguration.cpp Util/src/Option.cpp +Util/src/OptionCallback.cpp Util/src/OptionException.cpp Util/src/OptionProcessor.cpp Util/src/OptionSet.cpp Util/src/PropertyFileConfiguration.cpp +Util/src/RegExpValidator.cpp Util/src/ServerApplication.cpp Util/src/Subsystem.cpp Util/src/SystemConfiguration.cpp +Util/src/Validator.cpp +Util/src/WinRegistryConfiguration.cpp Util/src/WinRegistryKey.cpp Util/src/WinService.cpp Util/src/XMLConfiguration.cpp @@ -1310,6 +1421,10 @@ Util/testsuite/src/SystemConfigurationTest.cpp Util/testsuite/src/SystemConfigurationTest.h Util/testsuite/src/UtilTestSuite.cpp Util/testsuite/src/UtilTestSuite.h +Util/testsuite/src/ValidatorTest.cpp +Util/testsuite/src/ValidatorTest.h +Util/testsuite/src/WinConfigurationTest.cpp +Util/testsuite/src/WinConfigurationTest.h Util/testsuite/src/WindowsTestSuite.cpp Util/testsuite/src/WindowsTestSuite.h Util/testsuite/src/WinDriver.cpp @@ -1328,80 +1443,81 @@ Util/Util_vs80.vcproj VERSION XML XML/include -XML/include/DOM -XML/include/DOM/AbstractContainerNode.h -XML/include/DOM/AbstractNode.h -XML/include/DOM/Attr.h -XML/include/DOM/AttrMap.h -XML/include/DOM/AutoPtr.h -XML/include/DOM/CDATASection.h -XML/include/DOM/CharacterData.h -XML/include/DOM/ChildNodesList.h -XML/include/DOM/Comment.h -XML/include/DOM/Document.h -XML/include/DOM/DocumentEvent.h -XML/include/DOM/DocumentFragment.h -XML/include/DOM/DocumentType.h -XML/include/DOM/DOMBuilder.h -XML/include/DOM/DOMException.h -XML/include/DOM/DOMImplementation.h -XML/include/DOM/DOMObject.h -XML/include/DOM/DOMParser.h -XML/include/DOM/DOMSerializer.h -XML/include/DOM/DOMWriter.h -XML/include/DOM/DTDMap.h -XML/include/DOM/Element.h -XML/include/DOM/ElementsByTagNameList.h -XML/include/DOM/Entity.h -XML/include/DOM/EntityReference.h -XML/include/DOM/Event.h -XML/include/DOM/EventDispatcher.h -XML/include/DOM/EventException.h -XML/include/DOM/EventListener.h -XML/include/DOM/EventTarget.h -XML/include/DOM/MutationEvent.h -XML/include/DOM/NamedNodeMap.h -XML/include/DOM/Node.h -XML/include/DOM/NodeFilter.h -XML/include/DOM/NodeIterator.h -XML/include/DOM/NodeList.h -XML/include/DOM/Notation.h -XML/include/DOM/ProcessingInstruction.h -XML/include/DOM/Text.h -XML/include/DOM/TreeWalker.h -XML/include/SAX -XML/include/SAX/Attributes.h -XML/include/SAX/AttributesImpl.h -XML/include/SAX/ContentHandler.h -XML/include/SAX/DeclHandler.h -XML/include/SAX/DefaultHandler.h -XML/include/SAX/DTDHandler.h -XML/include/SAX/EntityResolver.h -XML/include/SAX/EntityResolverImpl.h -XML/include/SAX/ErrorHandler.h -XML/include/SAX/InputSource.h -XML/include/SAX/LexicalHandler.h -XML/include/SAX/Locator.h -XML/include/SAX/LocatorImpl.h -XML/include/SAX/NamespaceSupport.h -XML/include/SAX/SAXException.h -XML/include/SAX/SAXParser.h -XML/include/SAX/WhitespaceFilter.h -XML/include/SAX/XMLFilter.h -XML/include/SAX/XMLFilterImpl.h -XML/include/SAX/XMLReader.h -XML/include/XML -XML/include/XML/expat.h -XML/include/XML/expat_external.h -XML/include/XML/Name.h -XML/include/XML/NamePool.h -XML/include/XML/NamespaceStrategy.h -XML/include/XML/ParserEngine.h -XML/include/XML/XML.h -XML/include/XML/XMLException.h -XML/include/XML/XMLStream.h -XML/include/XML/XMLString.h -XML/include/XML/XMLWriter.h +XML/include/Poco +XML/include/Poco/DOM +XML/include/Poco/DOM/AbstractContainerNode.h +XML/include/Poco/DOM/AbstractNode.h +XML/include/Poco/DOM/Attr.h +XML/include/Poco/DOM/AttrMap.h +XML/include/Poco/DOM/AutoPtr.h +XML/include/Poco/DOM/CDATASection.h +XML/include/Poco/DOM/CharacterData.h +XML/include/Poco/DOM/ChildNodesList.h +XML/include/Poco/DOM/Comment.h +XML/include/Poco/DOM/Document.h +XML/include/Poco/DOM/DocumentEvent.h +XML/include/Poco/DOM/DocumentFragment.h +XML/include/Poco/DOM/DocumentType.h +XML/include/Poco/DOM/DOMBuilder.h +XML/include/Poco/DOM/DOMException.h +XML/include/Poco/DOM/DOMImplementation.h +XML/include/Poco/DOM/DOMObject.h +XML/include/Poco/DOM/DOMParser.h +XML/include/Poco/DOM/DOMSerializer.h +XML/include/Poco/DOM/DOMWriter.h +XML/include/Poco/DOM/DTDMap.h +XML/include/Poco/DOM/Element.h +XML/include/Poco/DOM/ElementsByTagNameList.h +XML/include/Poco/DOM/Entity.h +XML/include/Poco/DOM/EntityReference.h +XML/include/Poco/DOM/Event.h +XML/include/Poco/DOM/EventDispatcher.h +XML/include/Poco/DOM/EventException.h +XML/include/Poco/DOM/EventListener.h +XML/include/Poco/DOM/EventTarget.h +XML/include/Poco/DOM/MutationEvent.h +XML/include/Poco/DOM/NamedNodeMap.h +XML/include/Poco/DOM/Node.h +XML/include/Poco/DOM/NodeFilter.h +XML/include/Poco/DOM/NodeIterator.h +XML/include/Poco/DOM/NodeList.h +XML/include/Poco/DOM/Notation.h +XML/include/Poco/DOM/ProcessingInstruction.h +XML/include/Poco/DOM/Text.h +XML/include/Poco/DOM/TreeWalker.h +XML/include/Poco/SAX +XML/include/Poco/SAX/Attributes.h +XML/include/Poco/SAX/AttributesImpl.h +XML/include/Poco/SAX/ContentHandler.h +XML/include/Poco/SAX/DeclHandler.h +XML/include/Poco/SAX/DefaultHandler.h +XML/include/Poco/SAX/DTDHandler.h +XML/include/Poco/SAX/EntityResolver.h +XML/include/Poco/SAX/EntityResolverImpl.h +XML/include/Poco/SAX/ErrorHandler.h +XML/include/Poco/SAX/InputSource.h +XML/include/Poco/SAX/LexicalHandler.h +XML/include/Poco/SAX/Locator.h +XML/include/Poco/SAX/LocatorImpl.h +XML/include/Poco/SAX/NamespaceSupport.h +XML/include/Poco/SAX/SAXException.h +XML/include/Poco/SAX/SAXParser.h +XML/include/Poco/SAX/WhitespaceFilter.h +XML/include/Poco/SAX/XMLFilter.h +XML/include/Poco/SAX/XMLFilterImpl.h +XML/include/Poco/SAX/XMLReader.h +XML/include/Poco/XML +XML/include/Poco/XML/expat.h +XML/include/Poco/XML/expat_external.h +XML/include/Poco/XML/Name.h +XML/include/Poco/XML/NamePool.h +XML/include/Poco/XML/NamespaceStrategy.h +XML/include/Poco/XML/ParserEngine.h +XML/include/Poco/XML/XML.h +XML/include/Poco/XML/XMLException.h +XML/include/Poco/XML/XMLStream.h +XML/include/Poco/XML/XMLString.h +XML/include/Poco/XML/XMLWriter.h XML/Makefile XML/samples XML/samples/data diff --git a/Makefile b/Makefile index 67b6579a6..2caf2bd26 100644 --- a/Makefile +++ b/Makefile @@ -1,30 +1,54 @@ # # Makefile # -# $Id: //poco/1.1.0/dist/Makefile#2 $ +# $Id: //poco/1.2/dist/Makefile#1 $ # # Makefile for Poco # +sinclude config.make + ifndef POCO_BASE $(warning WARNING: POCO_BASE is not defined. Assuming current directory.) export POCO_BASE=$(shell pwd) endif -.DEFAULT all: - $(MAKE) -C CppUnit $(MAKECMDGOALS) - $(MAKE) -C Foundation $(MAKECMDGOALS) - $(MAKE) -C Foundation/testsuite $(MAKECMDGOALS) - $(MAKE) -C Foundation/samples $(MAKECMDGOALS) - $(MAKE) -C XML $(MAKECMDGOALS) - $(MAKE) -C XML/testsuite $(MAKECMDGOALS) - $(MAKE) -C XML/samples $(MAKECMDGOALS) - $(MAKE) -C Util $(MAKECMDGOALS) - $(MAKE) -C Util/testsuite $(MAKECMDGOALS) - $(MAKE) -C Util/samples $(MAKECMDGOALS) - $(MAKE) -C Net $(MAKECMDGOALS) - $(MAKE) -C Net/testsuite $(MAKECMDGOALS) - $(MAKE) -C Net/samples $(MAKECMDGOALS) +ifndef POCO_PREFIX +export POCO_PREFIX=/usr/local +endif -.PHONY test: - $(POCO_BASE)/build/script/testall +INSTALLDIR = $(DESTDIR)$(POCO_PREFIX) +COMPONENTS = Foundation XML Util Net + +.PHONY: all libs cppunit tests samples install + +all: libs tests samples + +libs: + $(MAKE) -C $(POCO_BASE)/Foundation + $(MAKE) -C $(POCO_BASE)/XML + $(MAKE) -C $(POCO_BASE)/Util + $(MAKE) -C $(POCO_BASE)/Net + +cppunit: + $(MAKE) -C $(POCO_BASE)/CppUnit + +tests: cppunit libs + $(MAKE) -C $(POCO_BASE)/Foundation/testsuite + $(MAKE) -C $(POCO_BASE)/XML/testsuite + $(MAKE) -C $(POCO_BASE)/Util/testsuite + $(MAKE) -C $(POCO_BASE)/Net/testsuite + +samples: libs + $(MAKE) -C $(POCO_BASE)/Foundation/samples + $(MAKE) -C $(POCO_BASE)/XML/samples + $(MAKE) -C $(POCO_BASE)/Util/samples + $(MAKE) -C $(POCO_BASE)/Net/samples + +install: libs + mkdir -p $(INSTALLDIR)/include/Poco + mkdir -p $(INSTALLDIR)/lib + for comp in $(COMPONENTS) ; do \ + cp -Rf $(POCO_BASE)/$$comp/include/* $(INSTALLDIR)/include/ ; \ + done + find $(POCO_BUILD)/lib -name "libPoco*" -exec cp -Rf {} $(INSTALLDIR)/lib \; diff --git a/NEWS b/NEWS index 3b745f446..c520ab4fc 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,23 @@ +Release 1.2.0 (2006-08-29) +========================== + +This release contains major improvements and new features. +Summary of changes (please see CHANGELOG for details): +- namespaces and header locations have changed +- improvements to command line options handling +- improvements to HTTP server and client classes +- support for raw sockets and ICMP +- improvements to DateTime, bugfixes in Timezone +- improvements to Logging (including a new LogStream class) +- HashTable classes in Foundation +- ThreadPool now supports thread priorities +- ActiveMethod now supports start policies; improved exception support +- typesafe sprintf-like formatting +- Process::launch() now supports I/O redirection to pipes +- improvements to the build system (configure; make; make install is now supported) +- various other bugfixes and enchancements + + Release 1.1.2 (2006-07-07) ========================== @@ -97,4 +117,4 @@ Please refer to the README file for more information and instructions for building the libraries. -- -$Id: //poco/1.1.0/dist/NEWS#2 $ +$Id: //poco/1.2/dist/NEWS#1 $ diff --git a/Net/Makefile b/Net/Makefile index 31f80b651..ccaba6519 100644 --- a/Net/Makefile +++ b/Net/Makefile @@ -1,13 +1,15 @@ # # Makefile # -# $Id: //poco/1.1.0/Net/Makefile#1 $ +# $Id: //poco/1.2/Net/Makefile#1 $ # # Makefile for Poco Net # include $(POCO_BASE)/build/rules/global +SHAREDOPT_CXX += -DNet_EXPORTS + objects = \ DNS HTTPResponse HostEntry Socket \ DatagramSocket HTTPServer IPAddress SocketAddress \ @@ -18,16 +20,18 @@ objects = \ HTTPFixedLengthStream HTTPServerRequest MultipartWriter StreamSocketImpl \ HTTPHeaderStream HTTPServerResponse NameValueCollection TCPServer \ HTTPMessage HTTPServerSession NetException TCPServerConnection HTTPBufferAllocator \ - HTTPRequest HTTPSession NetworkInterface TCPServerConnectionFactory \ + HTTPRequest HTTPSession HTTPSessionInstantiator HTTPSessionFactory NetworkInterface TCPServerConnectionFactory \ HTTPRequestHandler HTTPStream HTTPIOStream ServerSocket TCPServerDispatcher \ HTTPRequestHandlerFactory HTTPStreamFactory ServerSocketImpl TCPServerParams \ QuotedPrintableEncoder QuotedPrintableDecoder StringPartSource \ FTPClientSession FTPStreamFactory PartHandler PartSource NullPartHandler \ SocketReactor SocketNotifier SocketNotification \ - MailRecipient MailMessage MailStream SMTPClientSession POP3ClientSession + MailRecipient MailMessage MailStream SMTPClientSession POP3ClientSession \ + RawSocket RawSocketImpl ICMPClient ICMPEventArgs ICMPPacket ICMPPacketImpl \ + ICMPSocket ICMPSocketImpl ICMPv4PacketImpl target = PocoNet -target_version = 1 +target_version = $(LIBVERSION) target_libs = PocoFoundation include $(POCO_BASE)/build/rules/lib diff --git a/Net/Net.vmsbuild b/Net/Net.vmsbuild index 1f50b4fb8..b2270e3bf 100644 --- a/Net/Net.vmsbuild +++ b/Net/Net.vmsbuild @@ -1,7 +1,7 @@ # # Net.vmsbuild # -# $Id: //poco/1.1.0/Net/Net.vmsbuild#1 $ +# $Id: //poco/1.2/Net/Net.vmsbuild#1 $ # LIB=PocoNet diff --git a/Net/Net_vs71.vcproj b/Net/Net_vs71.vcproj index 9b2d7fcfe..7f744a7e2 100644 --- a/Net/Net_vs71.vcproj +++ b/Net/Net_vs71.vcproj @@ -149,25 +149,25 @@ Name="Header Files" Filter=""> + RelativePath=".\include\Poco\Net\DNS.h"> + RelativePath=".\include\Poco\Net\HostEntry.h"> + RelativePath=".\include\Poco\Net\IPAddress.h"> + RelativePath=".\include\Poco\Net\Net.h"> + RelativePath=".\include\Poco\Net\NetException.h"> + RelativePath=".\include\Poco\Net\SocketAddress.h"> + RelativePath=".\include\Poco\Net\SocketDefs.h"> + RelativePath=".\include\Poco\Net\DatagramSocket.h"> + RelativePath=".\include\Poco\Net\DatagramSocketImpl.h"> + RelativePath=".\include\Poco\Net\DialogSocket.h"> + RelativePath=".\include\Poco\Net\MulticastSocket.h"> + RelativePath=".\include\Poco\Net\NetworkInterface.h"> + RelativePath=".\include\Poco\Net\RawSocket.h"> + RelativePath=".\include\Poco\Net\RawSocketImpl.h"> + RelativePath=".\include\Poco\Net\ServerSocket.h"> + RelativePath=".\include\Poco\Net\ServerSocketImpl.h"> + RelativePath=".\include\Poco\Net\Socket.h"> + RelativePath=".\include\Poco\Net\SocketImpl.h"> + RelativePath=".\include\Poco\Net\SocketStream.h"> + + + + + + + + @@ -281,40 +293,40 @@ Name="Header Files" Filter=""> + RelativePath=".\include\Poco\Net\FilePartSource.h"> + RelativePath=".\include\Poco\Net\MediaType.h"> + RelativePath=".\include\Poco\Net\MessageHeader.h"> + RelativePath=".\include\Poco\Net\MultipartReader.h"> + RelativePath=".\include\Poco\Net\MultipartWriter.h"> + RelativePath=".\include\Poco\Net\NameValueCollection.h"> + RelativePath=".\include\Poco\Net\NullPartHandler.h"> + RelativePath=".\include\Poco\Net\PartHandler.h"> + RelativePath=".\include\Poco\Net\PartSource.h"> + RelativePath=".\include\Poco\Net\QuotedPrintableDecoder.h"> + RelativePath=".\include\Poco\Net\QuotedPrintableEncoder.h"> + RelativePath=".\include\Poco\Net\StringPartSource.h"> + RelativePath=".\include\Poco\Net\HTTPBasicCredentials.h"> + RelativePath=".\include\Poco\Net\HTTPBasicStreamBuf.h"> + RelativePath=".\include\Poco\Net\HTTPBufferAllocator.h"> + RelativePath=".\include\Poco\Net\HTTPChunkedStream.h"> + RelativePath=".\include\Poco\Net\HTTPCookie.h"> + RelativePath=".\include\Poco\Net\HTTPFixedLengthStream.h"> + RelativePath=".\include\Poco\Net\HTTPHeaderStream.h"> + RelativePath=".\include\Poco\Net\HTTPMessage.h"> + RelativePath=".\include\Poco\Net\HTTPRequest.h"> + RelativePath=".\include\Poco\Net\HTTPResponse.h"> + RelativePath=".\include\Poco\Net\HTTPSession.h"> + RelativePath=".\include\Poco\Net\HTTPStream.h"> + RelativePath=".\include\Poco\Net\TCPServer.h"> + RelativePath=".\include\Poco\Net\TCPServerConnection.h"> + RelativePath=".\include\Poco\Net\TCPServerConnectionFactory.h"> + RelativePath=".\include\Poco\Net\TCPServerDispatcher.h"> + RelativePath=".\include\Poco\Net\TCPServerParams.h"> + RelativePath=".\include\Poco\Net\HTTPRequestHandler.h"> + RelativePath=".\include\Poco\Net\HTTPRequestHandlerFactory.h"> + RelativePath=".\include\Poco\Net\HTTPServer.h"> + RelativePath=".\include\Poco\Net\HTTPServerConnection.h"> + RelativePath=".\include\Poco\Net\HTTPServerConnectionFactory.h"> + RelativePath=".\include\Poco\Net\HTTPServerParams.h"> + RelativePath=".\include\Poco\Net\HTTPServerRequest.h"> + RelativePath=".\include\Poco\Net\HTTPServerResponse.h"> + RelativePath=".\include\Poco\Net\HTTPServerSession.h"> + RelativePath=".\include\Poco\Net\HTTPClientSession.h"> + RelativePath=".\include\Poco\Net\HTTPIOStream.h"> + RelativePath=".\include\Poco\Net\HTTPSessionFactory.h"> + + + + + + + + @@ -584,7 +608,7 @@ Name="Header Files" Filter=""> + RelativePath=".\include\Poco\Net\HTMLForm.h"> + RelativePath=".\include\Poco\Net\FTPClientSession.h"> + RelativePath=".\include\Poco\Net\FTPStreamFactory.h"> + RelativePath=".\include\Poco\Net\SocketAcceptor.h"> + RelativePath=".\include\Poco\Net\SocketConnector.h"> + RelativePath=".\include\Poco\Net\SocketNotification.h"> + RelativePath=".\include\Poco\Net\SocketNotifier.h"> + RelativePath=".\include\Poco\Net\SocketReactor.h"> + RelativePath=".\include\Poco\Net\MailMessage.h"> + RelativePath=".\include\Poco\Net\MailRecipient.h"> + RelativePath=".\include\Poco\Net\MailStream.h"> + RelativePath=".\include\Poco\Net\POP3ClientSession.h"> + RelativePath=".\include\Poco\Net\SMTPClientSession.h"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Net/Net_vs80.vcproj b/Net/Net_vs80.vcproj index 088bbb2f7..7d0c60a56 100644 --- a/Net/Net_vs80.vcproj +++ b/Net/Net_vs80.vcproj @@ -1,7 +1,7 @@ @@ -272,51 +272,59 @@ Name="Header Files" > + + + + @@ -343,6 +351,14 @@ RelativePath=".\src\NetworkInterface.cpp" > + + + + @@ -380,51 +396,51 @@ Name="Header Files" > @@ -488,51 +504,51 @@ Name="Header Files" > @@ -592,23 +608,23 @@ Name="Header Files" > @@ -644,39 +660,39 @@ Name="Header Files" > @@ -728,15 +744,23 @@ Name="Header Files" > + + + + @@ -751,6 +775,14 @@ RelativePath=".\src\HTTPIOStream.cpp" > + + + + @@ -764,7 +796,7 @@ Name="Header Files" > @@ -784,11 +816,11 @@ Name="Header Files" > @@ -812,23 +844,23 @@ Name="Header Files" > @@ -856,23 +888,23 @@ Name="Header Files" > @@ -901,6 +933,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Net/include/Net/DNS.h b/Net/include/Poco/Net/DNS.h similarity index 86% rename from Net/include/Net/DNS.h rename to Net/include/Poco/Net/DNS.h index 1c197becb..a14248a56 100644 --- a/Net/include/Net/DNS.h +++ b/Net/include/Poco/Net/DNS.h @@ -1,7 +1,7 @@ // // DNS.h // -// $Id: //poco/1.1.0/Net/include/Net/DNS.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/DNS.h#1 $ // // Library: Net // Package: NetCore @@ -40,28 +40,16 @@ #define Net_DNS_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_SocketDefs_INCLUDED -#include "Net/SocketDefs.h" -#endif -#ifndef Net_IPAddress_INCLUDED -#include "Net/IPAddress.h" -#endif -#ifndef Net_HostEntry_INCLUDED -#include "Net/HostEntry.h" -#endif -#ifndef Foundation_Mutex_INCLUDED -#include "Foundation/Mutex.h" -#endif -#ifndef STD_MAP_INCLUDED +#include "Poco/Net/Net.h" +#include "Poco/Net/SocketDefs.h" +#include "Poco/Net/IPAddress.h" +#include "Poco/Net/HostEntry.h" +#include "Poco/Mutex.h" #include -#define STD_MAP_INCLUDED -#endif -Net_BEGIN +namespace Poco { +namespace Net { class Net_API DNS @@ -142,11 +130,11 @@ private: typedef std::map DNSCache; static DNSCache _cache; - static Foundation::FastMutex _mutex; + static Poco::FastMutex _mutex; }; -Net_END +} } // namespace Poco::Net #endif // Net_DNS_INCLUDED diff --git a/Net/include/Net/DatagramSocket.h b/Net/include/Poco/Net/DatagramSocket.h similarity index 93% rename from Net/include/Net/DatagramSocket.h rename to Net/include/Poco/Net/DatagramSocket.h index 76471b89f..74d1889df 100644 --- a/Net/include/Net/DatagramSocket.h +++ b/Net/include/Poco/Net/DatagramSocket.h @@ -1,7 +1,7 @@ // // DatagramSocket.h // -// $Id: //poco/1.1.0/Net/include/Net/DatagramSocket.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/DatagramSocket.h#1 $ // // Library: Net // Package: Sockets @@ -40,15 +40,12 @@ #define Net_DatagramSocket_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_Socket_INCLUDED -#include "Net/Socket.h" -#endif +#include "Poco/Net/Net.h" +#include "Poco/Net/Socket.h" -Net_BEGIN +namespace Poco { +namespace Net { class Net_API DatagramSocket: public Socket @@ -166,7 +163,7 @@ inline bool DatagramSocket::getBroadcast() const } -Net_END +} } // namespace Poco::Net #endif // Net_DatagramSocket_INCLUDED diff --git a/Net/include/Net/DatagramSocketImpl.h b/Net/include/Poco/Net/DatagramSocketImpl.h similarity index 89% rename from Net/include/Net/DatagramSocketImpl.h rename to Net/include/Poco/Net/DatagramSocketImpl.h index afc9a4a9d..a03e98671 100644 --- a/Net/include/Net/DatagramSocketImpl.h +++ b/Net/include/Poco/Net/DatagramSocketImpl.h @@ -1,7 +1,7 @@ // // DatagramSocketImpl.h // -// $Id: //poco/1.1.0/Net/include/Net/DatagramSocketImpl.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/DatagramSocketImpl.h#1 $ // // Library: Net // Package: Sockets @@ -40,15 +40,12 @@ #define Net_DatagramSocketImpl_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_SocketImpl_INCLUDED -#include "Net/SocketImpl.h" -#endif +#include "Poco/Net/Net.h" +#include "Poco/Net/SocketImpl.h" -Net_BEGIN +namespace Poco { +namespace Net { class Net_API DatagramSocketImpl: public SocketImpl @@ -78,7 +75,7 @@ protected: }; -Net_END +} } // namespace Poco::Net #endif // Net_DatagramSocketImpl_INCLUDED diff --git a/Net/include/Net/DialogSocket.h b/Net/include/Poco/Net/DialogSocket.h similarity index 94% rename from Net/include/Net/DialogSocket.h rename to Net/include/Poco/Net/DialogSocket.h index 1eb0775a7..a81452eaa 100644 --- a/Net/include/Net/DialogSocket.h +++ b/Net/include/Poco/Net/DialogSocket.h @@ -1,7 +1,7 @@ // // DialogSocket.h // -// $Id: //poco/1.1.0/Net/include/Net/DialogSocket.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/DialogSocket.h#1 $ // // Library: Net // Package: Sockets @@ -40,15 +40,12 @@ #define Net_DialogSocket_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_StreamSocket_INCLUDED -#include "Net/StreamSocket.h" -#endif +#include "Poco/Net/Net.h" +#include "Poco/Net/StreamSocket.h" -Net_BEGIN +namespace Poco { +namespace Net { class Net_API DialogSocket: public StreamSocket @@ -207,7 +204,7 @@ private: }; -Net_END +} } // namespace Poco::Net #endif // Net_DialogSocket_INCLUDED diff --git a/Net/include/Net/FTPClientSession.h b/Net/include/Poco/Net/FTPClientSession.h similarity index 90% rename from Net/include/Net/FTPClientSession.h rename to Net/include/Poco/Net/FTPClientSession.h index 6ca55a284..97a916aa9 100644 --- a/Net/include/Net/FTPClientSession.h +++ b/Net/include/Poco/Net/FTPClientSession.h @@ -1,7 +1,7 @@ // // FTPClientSession.h // -// $Id: //poco/1.1.0/Net/include/Net/FTPClientSession.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/FTPClientSession.h#1 $ // // Library: Net // Package: FTP @@ -40,26 +40,15 @@ #define Net_FTPClientSession_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_DialogSocket_INCLUDED -#include "Net/DialogSocket.h" -#endif -#ifndef Foundation_Timespan_INCLUDED -#include "Foundation/Timespan.h" -#endif -#ifndef STD_ISTREAM_INCLUDED +#include "Poco/Net/Net.h" +#include "Poco/Net/DialogSocket.h" +#include "Poco/Timespan.h" #include -#define STD_ISTREAM_INCLUDED -#endif -#ifndef STD_OSTREAM_INCLUDED #include -#define STD_OSTREAM_INCLUDED -#endif -Net_BEGIN +namespace Poco { +namespace Net { class SocketStream; @@ -91,13 +80,13 @@ public: TYPE_BINARY // TYPE I (Image) }; - FTPClientSession(const StreamSocket& socket); + explicit FTPClientSession(const StreamSocket& socket); /// Creates an FTPClientSession using the given /// connected socket for the control connection. /// /// Passive mode will be used for data transfers. - FTPClientSession(const std::string& host, Foundation::UInt16 port = FTP_PORT); + FTPClientSession(const std::string& host, Poco::UInt16 port = FTP_PORT); /// Creates an FTPClientSession using a socket connected /// to the given host and port. /// @@ -106,10 +95,10 @@ public: virtual ~FTPClientSession(); /// Destroys the FTPClientSession. - void setTimeout(const Foundation::Timespan& timeout); + void setTimeout(const Poco::Timespan& timeout); /// Sets the timeout for socket operations. - Foundation::Timespan getTimeout() const; + Poco::Timespan getTimeout() const; /// Returns the timeout for socket operations. void setPassive(bool flag); @@ -344,13 +333,13 @@ private: FTPClientSession(const FTPClientSession&); FTPClientSession& operator = (const FTPClientSession&); - DialogSocket _controlSocket; - SocketStream* _pDataStream; - bool _passiveMode; - FileType _fileType; - bool _supports1738; - bool _isOpen; - Foundation::Timespan _timeout; + DialogSocket _controlSocket; + SocketStream* _pDataStream; + bool _passiveMode; + FileType _fileType; + bool _supports1738; + bool _isOpen; + Poco::Timespan _timeout; }; @@ -387,7 +376,7 @@ inline bool FTPClientSession::isPermanentNegative(int status) } -Net_END +} } // namespace Poco::Net #endif // Net_FTPClientSession_INCLUDED diff --git a/Net/include/Net/FTPStreamFactory.h b/Net/include/Poco/Net/FTPStreamFactory.h similarity index 85% rename from Net/include/Net/FTPStreamFactory.h rename to Net/include/Poco/Net/FTPStreamFactory.h index 0797c31eb..a871d6733 100644 --- a/Net/include/Net/FTPStreamFactory.h +++ b/Net/include/Poco/Net/FTPStreamFactory.h @@ -1,7 +1,7 @@ // // FTPStreamFactory.h // -// $Id: //poco/1.1.0/Net/include/Net/FTPStreamFactory.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/FTPStreamFactory.h#1 $ // // Library: Net // Package: FTP @@ -40,18 +40,13 @@ #define Net_FTPStreamFactory_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_HTTPSession_INCLUDED -#include "Net/HTTPSession.h" -#endif -#ifndef Foundation_URIStreamFactory_INCLUDED -#include "Foundation/URIStreamFactory.h" -#endif +#include "Poco/Net/Net.h" +#include "Poco/Net/HTTPSession.h" +#include "Poco/URIStreamFactory.h" -Net_BEGIN +namespace Poco { +namespace Net { class Net_API FTPPasswordProvider @@ -70,7 +65,7 @@ protected: }; -class Net_API FTPStreamFactory: public Foundation::URIStreamFactory +class Net_API FTPStreamFactory: public Poco::URIStreamFactory /// An implementation of the URIStreamFactory interface /// that handles File Transfer Protocol (ftp) URIs. /// @@ -92,7 +87,7 @@ public: ~FTPStreamFactory(); /// Destroys the FTPStreamFactory. - std::istream* open(const Foundation::URI& uri); + std::istream* open(const Poco::URI& uri); /// Creates and opens a HTTP stream for the given URI. /// The URI must be a ftp://... URI. /// @@ -128,8 +123,8 @@ public: protected: static void splitUserInfo(const std::string& userInfo, std::string& username, std::string& password); - static void getUserInfo(const Foundation::URI& uri, std::string& username, std::string& password); - static void getPathAndType(const Foundation::URI& uri, std::string& path, char& type); + static void getUserInfo(const Poco::URI& uri, std::string& username, std::string& password); + static void getPathAndType(const Poco::URI& uri, std::string& path, char& type); private: static std::string _anonymousPassword; @@ -137,7 +132,7 @@ private: }; -Net_END +} } // namespace Poco::Net #endif // Net_FTPStreamFactory_INCLUDED diff --git a/Net/include/Net/FilePartSource.h b/Net/include/Poco/Net/FilePartSource.h similarity index 87% rename from Net/include/Net/FilePartSource.h rename to Net/include/Poco/Net/FilePartSource.h index 117bfc217..833f1ba4a 100644 --- a/Net/include/Net/FilePartSource.h +++ b/Net/include/Poco/Net/FilePartSource.h @@ -1,7 +1,7 @@ // // FilePartSource.h // -// $Id: //poco/1.1.0/Net/include/Net/FilePartSource.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/FilePartSource.h#1 $ // // Library: Net // Package: Messages @@ -40,19 +40,13 @@ #define Net_FilePartSource_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_PartSource_INCLUDED -#include "Net/PartSource.h" -#endif -#ifndef STD_FSTREAM_INCLUDED +#include "Poco/Net/Net.h" +#include "Poco/Net/PartSource.h" #include -#define STD_FSTREAM_INCLUDED -#endif -Net_BEGIN +namespace Poco { +namespace Net { class Net_API FilePartSource: public PartSource @@ -88,7 +82,7 @@ private: }; -Net_END +} } // namespace Poco::Net #endif // Net_FilePartSource_INCLUDED diff --git a/Net/include/Net/HTMLForm.h b/Net/include/Poco/Net/HTMLForm.h similarity index 87% rename from Net/include/Net/HTMLForm.h rename to Net/include/Poco/Net/HTMLForm.h index 42f3a59aa..09228dfb3 100644 --- a/Net/include/Net/HTMLForm.h +++ b/Net/include/Poco/Net/HTMLForm.h @@ -1,7 +1,7 @@ // // HTMLForm.h // -// $Id: //poco/1.1.0/Net/include/Net/HTMLForm.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/HTMLForm.h#1 $ // // Library: Net // Package: HTML @@ -40,27 +40,15 @@ #define Net_HTMLForm_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_NameValueCollection_INCLUDED -#include "Net/NameValueCollection.h" -#endif -#ifndef STD_OSTREAM_INCLUDED +#include "Poco/Net/Net.h" +#include "Poco/Net/NameValueCollection.h" #include -#define STD_OSTREAM_INCLUDED -#endif -#ifndef STD_ISTREAM_INCLUDED #include -#define STD_ISTREAM_INCLUDED -#endif -#ifndef STD_VECTOR_INCLUDED #include -#define STD_VECTOR_INCLUDED -#endif -Net_BEGIN +namespace Poco { +namespace Net { class HTTPRequest; @@ -84,21 +72,24 @@ public: /// Encoding must be either "application/x-www-form-urlencoded" /// (which is the default) or "multipart/form-data". - HTMLForm(const HTTPRequest& request, std::istream& istr, PartHandler& handler); + HTMLForm(const HTTPRequest& request, std::istream& requestBody, PartHandler& handler); /// Creates a HTMLForm from the given HTTP request. /// /// Uploaded files are passed to the given PartHandler. - HTMLForm(const HTTPRequest& request, std::istream& istr); + HTMLForm(const HTTPRequest& request, std::istream& requestBody); /// Creates a HTMLForm from the given HTTP request. /// /// Uploaded files are silently discarded. - HTMLForm(const HTTPRequest& request); + explicit HTMLForm(const HTTPRequest& request); /// Creates a HTMLForm from the given HTTP request. /// /// The request must be a GET request and the form data /// must be in the query string (URL encoded). + /// + /// For POST requests, you must use one of the constructors + /// taking an additional input stream for the request body. ~HTMLForm(); /// Destroys the HTMLForm. @@ -136,6 +127,9 @@ public: /// /// The request must be a GET request and the form data /// must be in the query string (URL encoded). + /// + /// For POST requests, you must use one of the overloads + /// taking an additional input stream for the request body. void read(std::istream& istr, PartHandler& handler); /// Reads the form data from the given input stream. @@ -212,7 +206,7 @@ inline const std::string& HTMLForm::boundary() const } -Net_END +} } // namespace Poco::Net #endif // Net_HTMLForm_INCLUDED diff --git a/Net/include/Net/HTTPBasicCredentials.h b/Net/include/Poco/Net/HTTPBasicCredentials.h similarity index 92% rename from Net/include/Net/HTTPBasicCredentials.h rename to Net/include/Poco/Net/HTTPBasicCredentials.h index 32a6960eb..e4b8e49d3 100644 --- a/Net/include/Net/HTTPBasicCredentials.h +++ b/Net/include/Poco/Net/HTTPBasicCredentials.h @@ -1,7 +1,7 @@ // // HTTPBasicCredentials.h // -// $Id: //poco/1.1.0/Net/include/Net/HTTPBasicCredentials.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/HTTPBasicCredentials.h#1 $ // // Library: Net // Package: HTTP @@ -40,12 +40,11 @@ #define Net_HTTPBasicCredentials_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif +#include "Poco/Net/Net.h" -Net_BEGIN +namespace Poco { +namespace Net { class HTTPRequest; @@ -114,7 +113,7 @@ inline const std::string& HTTPBasicCredentials::getPassword() const } -Net_END +} } // namespace Poco::Net #endif // Net_HTTPBasicCredentials_INCLUDED diff --git a/Net/include/Net/HTTPBasicStreamBuf.h b/Net/include/Poco/Net/HTTPBasicStreamBuf.h similarity index 80% rename from Net/include/Net/HTTPBasicStreamBuf.h rename to Net/include/Poco/Net/HTTPBasicStreamBuf.h index 5d0648cb4..e045c3eea 100644 --- a/Net/include/Net/HTTPBasicStreamBuf.h +++ b/Net/include/Poco/Net/HTTPBasicStreamBuf.h @@ -40,24 +40,19 @@ #define Net_HTTPBasicStreamBuf_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Foundation_BufferedStreamBuf_INCLUDED -#include "Foundation/BufferedStreamBuf.h" -#endif -#ifndef Net_HTTPBufferAllocator_INCLUDED -#include "Net/HTTPBufferAllocator.h" -#endif +#include "Poco/Net/Net.h" +#include "Poco/BufferedStreamBuf.h" +#include "Poco/Net/HTTPBufferAllocator.h" -Net_BEGIN +namespace Poco { +namespace Net { -typedef Foundation::BasicBufferedStreamBuf, HTTPBufferAllocator> HTTPBasicStreamBuf; +typedef Poco::BasicBufferedStreamBuf, HTTPBufferAllocator> HTTPBasicStreamBuf; -Net_END +} } // namespace Poco::Net #endif // Net_HTTPBasicStreamBuf_INCLUDED diff --git a/Net/include/Net/HTTPBufferAllocator.h b/Net/include/Poco/Net/HTTPBufferAllocator.h similarity index 86% rename from Net/include/Net/HTTPBufferAllocator.h rename to Net/include/Poco/Net/HTTPBufferAllocator.h index d531a5578..63d2fd75a 100644 --- a/Net/include/Net/HTTPBufferAllocator.h +++ b/Net/include/Poco/Net/HTTPBufferAllocator.h @@ -40,19 +40,13 @@ #define Net_HTTPBufferAllocator_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Foundation_MemoryPool_INCLUDED -#include "Foundation/MemoryPool.h" -#endif -#ifndef STD_IOS_INCLUDED +#include "Poco/Net/Net.h" +#include "Poco/MemoryPool.h" #include -#define STD_IOS_INCLUDED -#endif -Net_BEGIN +namespace Poco { +namespace Net { class Net_API HTTPBufferAllocator @@ -68,11 +62,11 @@ public: }; private: - static Foundation::MemoryPool _pool; + static Poco::MemoryPool _pool; }; -Net_END +} } // namespace Poco::Net #endif // Net_HTTPBufferAllocator_INCLUDED diff --git a/Net/include/Net/HTTPChunkedStream.h b/Net/include/Poco/Net/HTTPChunkedStream.h similarity index 83% rename from Net/include/Net/HTTPChunkedStream.h rename to Net/include/Poco/Net/HTTPChunkedStream.h index bc95b3a9c..1697f4488 100644 --- a/Net/include/Net/HTTPChunkedStream.h +++ b/Net/include/Poco/Net/HTTPChunkedStream.h @@ -1,7 +1,7 @@ // // HTTPChunkedStream.h // -// $Id: //poco/1.1.0/Net/include/Net/HTTPChunkedStream.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/HTTPChunkedStream.h#1 $ // // Library: Net // Package: HTTP @@ -40,26 +40,15 @@ #define Net_HTTPChunkedStream_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_HTTPBasicStreamBuf_INCLUDED -#include "Net/HTTPBasicStreamBuf.h" -#endif -#ifndef Foundation_MemoryPool_INCLUDED -#include "Foundation/MemoryPool.h" -#endif -#ifndef STD_ISTREAM_INCLUDED +#include "Poco/Net/Net.h" +#include "Poco/Net/HTTPBasicStreamBuf.h" +#include "Poco/MemoryPool.h" #include -#define STD_ISTREAM_INCLUDED -#endif -#ifndef STD_OSTREAM_INCLUDED #include -#define STD_OSTREAM_INCLUDED -#endif -Net_BEGIN +namespace Poco { +namespace Net { class HTTPSession; @@ -111,7 +100,7 @@ public: void operator delete(void* ptr); private: - static Foundation::MemoryPool _pool; + static Poco::MemoryPool _pool; }; @@ -126,11 +115,11 @@ public: void operator delete(void* ptr); private: - static Foundation::MemoryPool _pool; + static Poco::MemoryPool _pool; }; -Net_END +} } // namespace Poco::Net #endif // Net_HTTPChunkedStream_INCLUDED diff --git a/Net/include/Net/HTTPClientSession.h b/Net/include/Poco/Net/HTTPClientSession.h similarity index 81% rename from Net/include/Net/HTTPClientSession.h rename to Net/include/Poco/Net/HTTPClientSession.h index b8cdf495b..3af8a7c30 100644 --- a/Net/include/Net/HTTPClientSession.h +++ b/Net/include/Poco/Net/HTTPClientSession.h @@ -1,7 +1,7 @@ // // HTTPClientSession.h // -// $Id: //poco/1.1.0/Net/include/Net/HTTPClientSession.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/HTTPClientSession.h#1 $ // // Library: Net // Package: HTTPClient @@ -40,26 +40,15 @@ #define Net_HTTPClientSession_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_HTTPSession_INCLUDED -#include "Net/HTTPSession.h" -#endif -#ifndef Net_SocketAddress_INCLUDED -#include "Net/SocketAddress.h" -#endif -#ifndef STD_ISTREAM_INCLUDED +#include "Poco/Net/Net.h" +#include "Poco/Net/HTTPSession.h" +#include "Poco/Net/SocketAddress.h" #include -#define STD_ISTREAM_INCLUDED -#endif -#ifndef STD_OSTREAM_INCLUDED #include -#define STD_OSTREAM_INCLUDED -#endif -Net_BEGIN +namespace Poco { +namespace Net { class HTTPRequest; @@ -93,12 +82,15 @@ public: HTTPClientSession(); /// Creates an unconnected HTTPClientSession. - HTTPClientSession(const StreamSocket& socket); + explicit HTTPClientSession(const StreamSocket& socket); /// Creates a HTTPClientSession using the given socket. /// The socket must not be connected. The session /// takes ownership of the socket. - HTTPClientSession(const std::string& host, Foundation::UInt16 port = HTTPSession::HTTP_PORT); + explicit HTTPClientSession(const SocketAddress& address); + /// Creates a HTTPClientSession using the given address. + + HTTPClientSession(const std::string& host, Poco::UInt16 port = HTTPSession::HTTP_PORT); /// Creates a HTTPClientSession using the given host and port. virtual ~HTTPClientSession(); @@ -114,28 +106,28 @@ public: const std::string& getHost() const; /// Returns the host name of the target HTTP server. - void setPort(Foundation::UInt16 port); + void setPort(Poco::UInt16 port); /// Sets the port number of the target HTTP server. /// /// The port number must not be changed once there is an /// open connection to the server. - Foundation::UInt16 getPort() const; + Poco::UInt16 getPort() const; /// Returns the port number of the target HTTP server. - void setProxy(const std::string& host, Foundation::UInt16 port = HTTPSession::HTTP_PORT); + void setProxy(const std::string& host, Poco::UInt16 port = HTTPSession::HTTP_PORT); /// Sets the proxy host name and port number. void setProxyHost(const std::string& host); /// Sets the host name of the proxy server. - void setProxyPort(Foundation::UInt16 port); + void setProxyPort(Poco::UInt16 port); /// Sets the port number of the proxy server. const std::string& getProxyHost() const; /// Returns the proxy host name. - Foundation::UInt16 getProxyPort() const; + Poco::UInt16 getProxyPort() const; /// Returns the proxy port number. virtual std::ostream& sendRequest(HTTPRequest& request); @@ -197,14 +189,14 @@ protected: /// Returns _expectResponseBody. private: - std::string _host; - Foundation::UInt16 _port; - std::string _proxyHost; - Foundation::UInt16 _proxyPort; - bool _reconnect; - bool _expectResponseBody; - std::ostream* _pRequestStream; - std::istream* _pResponseStream; + std::string _host; + Poco::UInt16 _port; + std::string _proxyHost; + Poco::UInt16 _proxyPort; + bool _reconnect; + bool _expectResponseBody; + std::ostream* _pRequestStream; + std::istream* _pResponseStream; }; @@ -217,7 +209,7 @@ inline const std::string& HTTPClientSession::getHost() const } -inline Foundation::UInt16 HTTPClientSession::getPort() const +inline Poco::UInt16 HTTPClientSession::getPort() const { return _port; } @@ -229,7 +221,7 @@ inline const std::string& HTTPClientSession::getProxyHost() const } -inline Foundation::UInt16 HTTPClientSession::getProxyPort() const +inline Poco::UInt16 HTTPClientSession::getProxyPort() const { return _proxyPort; } @@ -265,7 +257,7 @@ inline bool HTTPClientSession::getExpectResponseBody() const } -Net_END +} } // namespace Poco::Net #endif // Net_HTTPClientSession_INCLUDED diff --git a/Net/include/Net/HTTPCookie.h b/Net/include/Poco/Net/HTTPCookie.h similarity index 93% rename from Net/include/Net/HTTPCookie.h rename to Net/include/Poco/Net/HTTPCookie.h index e335ad9e5..40076d292 100644 --- a/Net/include/Net/HTTPCookie.h +++ b/Net/include/Poco/Net/HTTPCookie.h @@ -1,7 +1,7 @@ // // HTTPCookie.h // -// $Id: //poco/1.1.0/Net/include/Net/HTTPCookie.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/HTTPCookie.h#1 $ // // Library: Net // Package: HTTP @@ -40,12 +40,11 @@ #define Net_HTTPCookie_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif +#include "Poco/Net/Net.h" -Net_BEGIN +namespace Poco { +namespace Net { class NameValueCollection; @@ -225,7 +224,7 @@ inline int HTTPCookie::getMaxAge() const } -Net_END +} } // namespace Poco::Net #endif // Net_HTTPCookie_INCLUDED diff --git a/Net/include/Net/HTTPFixedLengthStream.h b/Net/include/Poco/Net/HTTPFixedLengthStream.h similarity index 86% rename from Net/include/Net/HTTPFixedLengthStream.h rename to Net/include/Poco/Net/HTTPFixedLengthStream.h index 23e2e5b59..2dca05c7c 100644 --- a/Net/include/Net/HTTPFixedLengthStream.h +++ b/Net/include/Poco/Net/HTTPFixedLengthStream.h @@ -1,7 +1,7 @@ // // HTTPFixedLengthStream.h // -// $Id: //poco/1.1.0/Net/include/Net/HTTPFixedLengthStream.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/HTTPFixedLengthStream.h#1 $ // // Library: Net // Package: HTTP @@ -40,23 +40,14 @@ #define Net_HTTPFixedLengthStream_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_HTTPBasicStreamBuf_INCLUDED -#include "Net/HTTPBasicStreamBuf.h" -#endif -#ifndef STD_ISTREAM_INCLUDED +#include "Poco/Net/Net.h" +#include "Poco/Net/HTTPBasicStreamBuf.h" #include -#define STD_ISTREAM_INCLUDED -#endif -#ifndef STD_OSTREAM_INCLUDED #include -#define STD_OSTREAM_INCLUDED -#endif -Net_BEGIN +namespace Poco { +namespace Net { class HTTPSession; @@ -109,7 +100,7 @@ public: void operator delete(void* ptr); private: - static Foundation::MemoryPool _pool; + static Poco::MemoryPool _pool; }; @@ -124,11 +115,11 @@ public: void operator delete(void* ptr); private: - static Foundation::MemoryPool _pool; + static Poco::MemoryPool _pool; }; -Net_END +} } // namespace Poco::Net #endif // Net_HTTPFixedLengthStream_INCLUDED diff --git a/Net/include/Net/HTTPHeaderStream.h b/Net/include/Poco/Net/HTTPHeaderStream.h similarity index 83% rename from Net/include/Net/HTTPHeaderStream.h rename to Net/include/Poco/Net/HTTPHeaderStream.h index 60894a145..72de14ede 100644 --- a/Net/include/Net/HTTPHeaderStream.h +++ b/Net/include/Poco/Net/HTTPHeaderStream.h @@ -1,7 +1,7 @@ // // HTTPHeaderStream.h // -// $Id: //poco/1.1.0/Net/include/Net/HTTPHeaderStream.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/HTTPHeaderStream.h#1 $ // // Library: Net // Package: HTTP @@ -40,26 +40,15 @@ #define Net_HTTPHeaderStream_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_HTTPBasicStreamBuf_INCLUDED -#include "Net/HTTPBasicStreamBuf.h" -#endif -#ifndef Foundation_MemoryPool_INCLUDED -#include "Foundation/MemoryPool.h" -#endif -#ifndef STD_ISTREAM_INCLUDED +#include "Poco/Net/Net.h" +#include "Poco/Net/HTTPBasicStreamBuf.h" +#include "Poco/MemoryPool.h" #include -#define STD_ISTREAM_INCLUDED -#endif -#ifndef STD_OSTREAM_INCLUDED #include -#define STD_OSTREAM_INCLUDED -#endif -Net_BEGIN +namespace Poco { +namespace Net { class HTTPSession; @@ -109,7 +98,7 @@ public: void operator delete(void* ptr); private: - static Foundation::MemoryPool _pool; + static Poco::MemoryPool _pool; }; @@ -124,11 +113,11 @@ public: void operator delete(void* ptr); private: - static Foundation::MemoryPool _pool; + static Poco::MemoryPool _pool; }; -Net_END +} } // namespace Poco::Net #endif // Net_HTTPHeaderStream_INCLUDED diff --git a/Net/include/Net/HTTPIOStream.h b/Net/include/Poco/Net/HTTPIOStream.h similarity index 88% rename from Net/include/Net/HTTPIOStream.h rename to Net/include/Poco/Net/HTTPIOStream.h index 7ca2dccee..bfa5236a1 100644 --- a/Net/include/Net/HTTPIOStream.h +++ b/Net/include/Poco/Net/HTTPIOStream.h @@ -40,18 +40,19 @@ #define Net_HTTPIOStream_INCLUDED -#include "Net/Net.h" -#include "Net/HTTPResponse.h" -#include "Foundation/UnbufferedStreamBuf.h" +#include "Poco/Net/Net.h" +#include "Poco/Net/HTTPResponse.h" +#include "Poco/UnbufferedStreamBuf.h" -Net_BEGIN +namespace Poco { +namespace Net { class HTTPClientSession; -class Net_API HTTPResponseStreamBuf: public Foundation::UnbufferedStreamBuf +class Net_API HTTPResponseStreamBuf: public Poco::UnbufferedStreamBuf { public: HTTPResponseStreamBuf(std::istream& istr); @@ -103,7 +104,7 @@ private: }; -Net_END +} } // namespace Poco::Net #endif // Net_HTTPIOStream_INCLUDED diff --git a/Net/include/Net/HTTPMessage.h b/Net/include/Poco/Net/HTTPMessage.h similarity index 93% rename from Net/include/Net/HTTPMessage.h rename to Net/include/Poco/Net/HTTPMessage.h index ab307411a..1f2e924ef 100644 --- a/Net/include/Net/HTTPMessage.h +++ b/Net/include/Poco/Net/HTTPMessage.h @@ -1,7 +1,7 @@ // // HTTPMessage.h // -// $Id: //poco/1.1.0/Net/include/Net/HTTPMessage.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/HTTPMessage.h#1 $ // // Library: Net // Package: HTTP @@ -40,15 +40,12 @@ #define Net_HTTPMessage_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_MessageHeader_INCLUDED -#include "Net/MessageHeader.h" -#endif +#include "Poco/Net/Net.h" +#include "Poco/Net/MessageHeader.h" -Net_BEGIN +namespace Poco { +namespace Net { class MediaType; @@ -174,7 +171,7 @@ inline const std::string& HTTPMessage::getVersion() const } -Net_END +} } // namespace Poco::Net #endif // Net_HTTPMessage_INCLUDED diff --git a/Net/include/Net/HTTPRequest.h b/Net/include/Poco/Net/HTTPRequest.h similarity index 91% rename from Net/include/Net/HTTPRequest.h rename to Net/include/Poco/Net/HTTPRequest.h index ded9c0bcb..1c85c6ef2 100644 --- a/Net/include/Net/HTTPRequest.h +++ b/Net/include/Poco/Net/HTTPRequest.h @@ -1,7 +1,7 @@ // // HTTPRequest.h // -// $Id: //poco/1.1.0/Net/include/Net/HTTPRequest.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/HTTPRequest.h#1 $ // // Library: Net // Package: HTTP @@ -40,15 +40,12 @@ #define Net_HTTPRequest_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_HTTPMessage_INCLUDED -#include "Net/HTTPMessage.h" -#endif +#include "Poco/Net/Net.h" +#include "Poco/Net/HTTPMessage.h" -Net_BEGIN +namespace Poco { +namespace Net { class Net_API HTTPRequest: public HTTPMessage @@ -92,7 +89,7 @@ public: void setHost(const std::string& host); /// Sets the value of the Host header field. - void setHost(const std::string& host, Foundation::UInt16 port); + void setHost(const std::string& host, Poco::UInt16 port); /// Sets the value of the Host header field. const std::string& getHost() const; @@ -173,7 +170,7 @@ inline const std::string& HTTPRequest::getURI() const } -Net_END +} } // namespace Poco::Net #endif // Net_HTTPRequest_INCLUDED diff --git a/Net/include/Net/HTTPRequestHandler.h b/Net/include/Poco/Net/HTTPRequestHandler.h similarity index 92% rename from Net/include/Net/HTTPRequestHandler.h rename to Net/include/Poco/Net/HTTPRequestHandler.h index 4481feb96..bbbdf6783 100644 --- a/Net/include/Net/HTTPRequestHandler.h +++ b/Net/include/Poco/Net/HTTPRequestHandler.h @@ -1,7 +1,7 @@ // // HTTPRequestHandler.h // -// $Id: //poco/1.1.0/Net/include/Net/HTTPRequestHandler.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/HTTPRequestHandler.h#1 $ // // Library: Net // Package: HTTPServer @@ -40,12 +40,11 @@ #define Net_HTTPRequestHandler_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif +#include "Poco/Net/Net.h" -Net_BEGIN +namespace Poco { +namespace Net { class HTTPServerRequest; @@ -84,7 +83,7 @@ private: }; -Net_END +} } // namespace Poco::Net #endif // Net_HTTPRequestHandler_INCLUDED diff --git a/Net/include/Net/HTTPRequestHandlerFactory.h b/Net/include/Poco/Net/HTTPRequestHandlerFactory.h similarity index 91% rename from Net/include/Net/HTTPRequestHandlerFactory.h rename to Net/include/Poco/Net/HTTPRequestHandlerFactory.h index 4ae368a25..8ee666098 100644 --- a/Net/include/Net/HTTPRequestHandlerFactory.h +++ b/Net/include/Poco/Net/HTTPRequestHandlerFactory.h @@ -1,7 +1,7 @@ // // HTTPRequestHandlerFactory.h // -// $Id: //poco/1.1.0/Net/include/Net/HTTPRequestHandlerFactory.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/HTTPRequestHandlerFactory.h#1 $ // // Library: Net // Package: HTTPServer @@ -40,12 +40,11 @@ #define Net_HTTPRequestHandlerFactory_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif +#include "Poco/Net/Net.h" -Net_BEGIN +namespace Poco { +namespace Net { class HTTPServerRequest; @@ -75,7 +74,7 @@ private: }; -Net_END +} } // namespace Poco::Net #endif // Net_HTTPRequestHandlerFactory_INCLUDED diff --git a/Net/include/Net/HTTPResponse.h b/Net/include/Poco/Net/HTTPResponse.h similarity index 91% rename from Net/include/Net/HTTPResponse.h rename to Net/include/Poco/Net/HTTPResponse.h index a1ede877d..742dfa6e6 100644 --- a/Net/include/Net/HTTPResponse.h +++ b/Net/include/Poco/Net/HTTPResponse.h @@ -1,7 +1,7 @@ // // HTTPResponse.h // -// $Id: //poco/1.1.0/Net/include/Net/HTTPResponse.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/HTTPResponse.h#1 $ // // Library: Net // Package: HTTP @@ -40,25 +40,15 @@ #define Net_HTTPResponse_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_HTTPMessage_INCLUDED -#include "Net/HTTPMessage.h" -#endif -#ifndef Net_HTTPCookie_INCLUDED -#include "Net/HTTPCookie.h" -#endif -#ifndef Foundation_Timestamp_INCLUDED -#include "Foundation/Timestamp.h" -#endif -#ifndef STD_VECTOR_INCLUDED +#include "Poco/Net/Net.h" +#include "Poco/Net/HTTPMessage.h" +#include "Poco/Net/HTTPCookie.h" +#include "Poco/Timestamp.h" #include -#define STD_VECTOR_INCLUDED -#endif -Net_BEGIN +namespace Poco { +namespace Net { class HTTPCookie; @@ -168,10 +158,10 @@ public: /// /// The reason phrase is set according to the status code. - void setDate(const Foundation::Timestamp& dateTime); + void setDate(const Poco::Timestamp& dateTime); /// Sets the Date header to the given date/time value. - Foundation::Timestamp getDate() const; + Poco::Timestamp getDate() const; /// Returns the value of the Date header. void addCookie(const HTTPCookie& cookie); @@ -272,7 +262,7 @@ inline const std::string& HTTPResponse::getReason() const } -Net_END +} } // namespace Poco::Net #endif // Net_HTTPResponse_INCLUDED diff --git a/Net/include/Net/HTTPServer.h b/Net/include/Poco/Net/HTTPServer.h similarity index 88% rename from Net/include/Net/HTTPServer.h rename to Net/include/Poco/Net/HTTPServer.h index 9fab34211..375990858 100644 --- a/Net/include/Net/HTTPServer.h +++ b/Net/include/Poco/Net/HTTPServer.h @@ -1,7 +1,7 @@ // // HTTPServer.h // -// $Id: //poco/1.1.0/Net/include/Net/HTTPServer.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/HTTPServer.h#1 $ // // Library: Net // Package: HTTPServer @@ -40,15 +40,12 @@ #define Net_HTTPServer_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_TCPServer_INCLUDED -#include "Net/TCPServer.h" -#endif +#include "Poco/Net/Net.h" +#include "Poco/Net/TCPServer.h" -Net_BEGIN +namespace Poco { +namespace Net { class HTTPRequestHandlerFactory; @@ -88,7 +85,7 @@ public: /// /// News threads are taken from the default thread pool. - HTTPServer(HTTPRequestHandlerFactory* pFactory, Foundation::ThreadPool& threadPool, const ServerSocket& socket, HTTPServerParams* pParams); + HTTPServer(HTTPRequestHandlerFactory* pFactory, Poco::ThreadPool& threadPool, const ServerSocket& socket, HTTPServerParams* pParams); /// Creates the HTTPServer, using the given ServerSocket. /// /// The server takes ownership of the HTTPRequstHandlerFactory @@ -103,7 +100,7 @@ public: }; -Net_END +} } // namespace Poco::Net #endif // Net_HTTPServer_INCLUDED diff --git a/Net/include/Net/HTTPServerConnection.h b/Net/include/Poco/Net/HTTPServerConnection.h similarity index 88% rename from Net/include/Net/HTTPServerConnection.h rename to Net/include/Poco/Net/HTTPServerConnection.h index 40d56caa9..f323fe157 100644 --- a/Net/include/Net/HTTPServerConnection.h +++ b/Net/include/Poco/Net/HTTPServerConnection.h @@ -1,7 +1,7 @@ // // HTTPServerConnection.h // -// $Id: //poco/1.1.0/Net/include/Net/HTTPServerConnection.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/HTTPServerConnection.h#1 $ // // Library: Net // Package: HTTPServer @@ -40,15 +40,12 @@ #define Net_HTTPServerConnection_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_TCPServerConnection_INCLUDED -#include "Net/TCPServerConnection.h" -#endif +#include "Poco/Net/Net.h" +#include "Poco/Net/TCPServerConnection.h" -Net_BEGIN +namespace Poco { +namespace Net { class HTTPServerParams; @@ -75,7 +72,7 @@ private: }; -Net_END +} } // namespace Poco::Net #endif // Net_HTTPServerConnection_INCLUDED diff --git a/Net/include/Net/HTTPServerConnectionFactory.h b/Net/include/Poco/Net/HTTPServerConnectionFactory.h similarity index 88% rename from Net/include/Net/HTTPServerConnectionFactory.h rename to Net/include/Poco/Net/HTTPServerConnectionFactory.h index 186c16bbd..b3d93d93d 100644 --- a/Net/include/Net/HTTPServerConnectionFactory.h +++ b/Net/include/Poco/Net/HTTPServerConnectionFactory.h @@ -1,7 +1,7 @@ // // HTTPServerConnectionFactory.h // -// $Id: //poco/1.1.0/Net/include/Net/HTTPServerConnectionFactory.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/HTTPServerConnectionFactory.h#1 $ // // Library: Net // Package: HTTPServer @@ -40,15 +40,12 @@ #define Net_HTTPServerConnectionFactory_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_TCPServerConnectionFactory_INCLUDED -#include "Net/TCPServerConnectionFactory.h" -#endif +#include "Poco/Net/Net.h" +#include "Poco/Net/TCPServerConnectionFactory.h" -Net_BEGIN +namespace Poco { +namespace Net { class HTTPServerParams; @@ -76,7 +73,7 @@ private: }; -Net_END +} } // namespace Poco::Net #endif // Net_HTTPServerConnectionFactory_INCLUDED diff --git a/Net/include/Net/HTTPServerParams.h b/Net/include/Poco/Net/HTTPServerParams.h similarity index 82% rename from Net/include/Net/HTTPServerParams.h rename to Net/include/Poco/Net/HTTPServerParams.h index f4dac5ce2..61f1057c0 100644 --- a/Net/include/Net/HTTPServerParams.h +++ b/Net/include/Poco/Net/HTTPServerParams.h @@ -1,7 +1,7 @@ // // HTTPServerParams.h // -// $Id: //poco/1.1.0/Net/include/Net/HTTPServerParams.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/HTTPServerParams.h#1 $ // // Library: Net // Package: HTTPServer @@ -40,15 +40,12 @@ #define Net_HTTPServerParams_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_TCPServerParams_INCLUDED -#include "Net/TCPServerParams.h" -#endif +#include "Poco/Net/Net.h" +#include "Poco/Net/TCPServerParams.h" -Net_BEGIN +namespace Poco { +namespace Net { class Net_API HTTPServerParams: public TCPServerParams @@ -89,10 +86,10 @@ public: /// Returns the server software name and version that the server uses to /// identify itself. - void setTimeout(const Foundation::Timespan& timeout); + void setTimeout(const Poco::Timespan& timeout); /// Sets the connection timeout for HTTP connections. - const Foundation::Timespan& getTimeout() const; + const Poco::Timespan& getTimeout() const; /// Returns the connection timeout for HTTP connections. void setKeepAlive(bool keepAlive); @@ -102,10 +99,10 @@ public: bool getKeepAlive() const; /// Returns true iff persistent connections are enabled. - void setKeepAliveTimeout(const Foundation::Timespan& timeout); + void setKeepAliveTimeout(const Poco::Timespan& timeout); /// Sets the connection timeout for HTTP connections. - const Foundation::Timespan& getKeepAliveTimeout() const; + const Poco::Timespan& getKeepAliveTimeout() const; /// Returns the connection timeout for HTTP connections. void setMaxKeepAliveRequests(int maxKeepAliveRequests); @@ -123,12 +120,12 @@ protected: /// Destroys the HTTPServerParams. private: - std::string _serverName; - std::string _softwareVersion; - Foundation::Timespan _timeout; - bool _keepAlive; - int _maxKeepAliveRequests; - Foundation::Timespan _keepAliveTimeout; + std::string _serverName; + std::string _softwareVersion; + Poco::Timespan _timeout; + bool _keepAlive; + int _maxKeepAliveRequests; + Poco::Timespan _keepAliveTimeout; }; @@ -147,7 +144,7 @@ inline const std::string& HTTPServerParams::getSoftwareVersion() const } -inline const Foundation::Timespan& HTTPServerParams::getTimeout() const +inline const Poco::Timespan& HTTPServerParams::getTimeout() const { return _timeout; } @@ -165,13 +162,13 @@ inline int HTTPServerParams::getMaxKeepAliveRequests() const } -inline const Foundation::Timespan& HTTPServerParams::getKeepAliveTimeout() const +inline const Poco::Timespan& HTTPServerParams::getKeepAliveTimeout() const { return _keepAliveTimeout; } -Net_END +} } // namespace Poco::Net #endif // Net_HTTPServerParams_INCLUDED diff --git a/Net/include/Net/HTTPServerRequest.h b/Net/include/Poco/Net/HTTPServerRequest.h similarity index 87% rename from Net/include/Net/HTTPServerRequest.h rename to Net/include/Poco/Net/HTTPServerRequest.h index 7c76fea36..0c6b5bd2a 100644 --- a/Net/include/Net/HTTPServerRequest.h +++ b/Net/include/Poco/Net/HTTPServerRequest.h @@ -1,7 +1,7 @@ // // HTTPServerRequest.h // -// $Id: //poco/1.1.0/Net/include/Net/HTTPServerRequest.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/HTTPServerRequest.h#1 $ // // Library: Net // Package: HTTPServer @@ -40,22 +40,14 @@ #define Net_HTTPServerRequest_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_HTTPRequest_INCLUDED -#include "Net/HTTPRequest.h" -#endif -#ifndef Net_SocketAddress_INCLUDED -#include "Net/SocketAddress.h" -#endif -#ifndef STD_ISTREAM_INCLUDED +#include "Poco/Net/Net.h" +#include "Poco/Net/HTTPRequest.h" +#include "Poco/Net/SocketAddress.h" #include -#define STD_ISTREAM_INCLUDED -#endif -Net_BEGIN +namespace Poco { +namespace Net { class HTTPServerSession; @@ -134,7 +126,7 @@ inline const HTTPServerParams& HTTPServerRequest::serverParams() const } -Net_END +} } // namespace Poco::Net #endif // Net_HTTPServerRequest_INCLUDED diff --git a/Net/include/Net/HTTPServerResponse.h b/Net/include/Poco/Net/HTTPServerResponse.h similarity index 90% rename from Net/include/Net/HTTPServerResponse.h rename to Net/include/Poco/Net/HTTPServerResponse.h index fe48ae614..8c2a8c500 100644 --- a/Net/include/Net/HTTPServerResponse.h +++ b/Net/include/Poco/Net/HTTPServerResponse.h @@ -1,7 +1,7 @@ // // HTTPServerResponse.h // -// $Id: //poco/1.1.0/Net/include/Net/HTTPServerResponse.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/HTTPServerResponse.h#1 $ // // Library: Net // Package: HTTPServer @@ -40,19 +40,13 @@ #define Net_HTTPServerResponse_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_HTTPResponse_INCLUDED -#include "Net/HTTPResponse.h" -#endif -#ifndef STD_OSTREAM_INCLUDED +#include "Poco/Net/Net.h" +#include "Poco/Net/HTTPResponse.h" #include -#define STD_OSTREAM_INCLUDED -#endif -Net_BEGIN +namespace Poco { +namespace Net { class HTTPServerSession; @@ -122,7 +116,7 @@ private: }; -Net_END +} } // namespace Poco::Net #endif // Net_HTTPServerResponse_INCLUDED diff --git a/Net/include/Net/HTTPServerSession.h b/Net/include/Poco/Net/HTTPServerSession.h similarity index 80% rename from Net/include/Net/HTTPServerSession.h rename to Net/include/Poco/Net/HTTPServerSession.h index 9031f9c91..652e91548 100644 --- a/Net/include/Net/HTTPServerSession.h +++ b/Net/include/Poco/Net/HTTPServerSession.h @@ -1,7 +1,7 @@ // // HTTPServerSession.h // -// $Id: //poco/1.1.0/Net/include/Net/HTTPServerSession.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/HTTPServerSession.h#1 $ // // Library: Net // Package: HTTPServer @@ -40,21 +40,14 @@ #define Net_HTTPServerSession_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_HTTPSession_INCLUDED -#include "Net/HTTPSession.h" -#endif -#ifndef Net_SocketAddress_INCLUDED -#include "Net/SocketAddress.h" -#endif -#ifndef Foundation_Timespan_INCLUDED -#include "Foundation/Timespan.h" -#endif +#include "Poco/Net/Net.h" +#include "Poco/Net/HTTPSession.h" +#include "Poco/Net/SocketAddress.h" +#include "Poco/Timespan.h" -Net_BEGIN +namespace Poco { +namespace Net { class HTTPServerParams; @@ -82,13 +75,13 @@ public: /// Returns the server's address. private: - bool _firstRequest; - Foundation::Timespan _keepAliveTimeout; - int _maxKeepAliveRequests; + bool _firstRequest; + Poco::Timespan _keepAliveTimeout; + int _maxKeepAliveRequests; }; -Net_END +} } // namespace Poco::Net #endif // Net_HTTPServerSession_INCLUDED diff --git a/Net/include/Net/HTTPSession.h b/Net/include/Poco/Net/HTTPSession.h similarity index 79% rename from Net/include/Net/HTTPSession.h rename to Net/include/Poco/Net/HTTPSession.h index 6713db0c3..17340c016 100644 --- a/Net/include/Net/HTTPSession.h +++ b/Net/include/Poco/Net/HTTPSession.h @@ -1,7 +1,7 @@ // // HTTPSession.h // -// $Id: //poco/1.1.0/Net/include/Net/HTTPSession.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/HTTPSession.h#1 $ // // Library: Net // Package: HTTP @@ -40,22 +40,15 @@ #define Net_HTTPSession_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_StreamSocket_INCLUDED -#include "Net/StreamSocket.h" -#endif -#ifndef Foundation_Timespan_INCLUDED -#include "Foundation/Timespan.h" -#endif -#ifndef STD_IOS_INCLUDED +#include "Poco/Net/Net.h" +#include "Poco/Net/StreamSocket.h" +#include "Poco/Timespan.h" +#include "Poco/Exception.h" #include -#define STD_IOS_INCLUDED -#endif -Net_BEGIN +namespace Poco { +namespace Net { class Net_API HTTPSession @@ -79,10 +72,10 @@ public: /// Returns the value of the keep-alive flag for /// this session. - void setTimeout(const Foundation::Timespan& timeout); + void setTimeout(const Poco::Timespan& timeout); /// Sets the timeout for the HTTP session. - Foundation::Timespan getTimeout() const; + Poco::Timespan getTimeout() const; /// Returns the timeout for the HTTP session. bool connected() const; @@ -91,6 +84,13 @@ public: void abort(); /// Aborts a session in progress by shutting down /// and closing the underlying socket. + + const Poco::Exception* networkException() const; + /// If sending or receiving data over the underlying + /// socket connection resulted in an exception, a + /// pointer to this exception is returned. + /// + /// Otherwise, NULL is returned. enum { @@ -154,6 +154,9 @@ protected: void close(); /// Closes the underlying socket. + void setException(const Poco::Exception& exc); + /// Stores a clone of the exception. + private: enum { @@ -163,12 +166,13 @@ private: HTTPSession(const HTTPSession&); HTTPSession& operator = (const HTTPSession&); - StreamSocket _socket; - char* _pBuffer; - char* _pCurrent; - char* _pEnd; - bool _keepAlive; - Foundation::Timespan _timeout; + StreamSocket _socket; + char* _pBuffer; + char* _pCurrent; + char* _pEnd; + bool _keepAlive; + Poco::Timespan _timeout; + Poco::Exception* _pException; friend class HTTPStreamBuf; friend class HTTPHeaderStreamBuf; @@ -186,7 +190,7 @@ inline bool HTTPSession::getKeepAlive() const } -inline Foundation::Timespan HTTPSession::getTimeout() const +inline Poco::Timespan HTTPSession::getTimeout() const { return _timeout; } @@ -198,7 +202,13 @@ inline StreamSocket& HTTPSession::socket() } -Net_END +inline const Poco::Exception* HTTPSession::networkException() const +{ + return _pException; +} + + +} } // namespace Poco::Net #endif // Net_HTTPSession_INCLUDED diff --git a/Net/include/Poco/Net/HTTPSessionFactory.h b/Net/include/Poco/Net/HTTPSessionFactory.h new file mode 100644 index 000000000..a6aad1f8a --- /dev/null +++ b/Net/include/Poco/Net/HTTPSessionFactory.h @@ -0,0 +1,154 @@ +// +// HTTPSessionFactory.h +// +// $Id: //poco/1.2/Net/include/Poco/Net/HTTPSessionFactory.h#1 $ +// +// Library: Net +// Package: HTTPClient +// Module: HTTPSessionFactory +// +// Definition of the HTTPSessionFactory class. +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef Net_HTTPSessionFactoryMgr_INCLUDED +#define Net_HTTPSessionFactoryMgr_INCLUDED + + +#include "Poco/Net/Net.h" +#include "Poco/Mutex.h" +#include "Poco/URI.h" +#include "Poco/SingletonHolder.h" +#include "Poco/SharedPtr.h" +#include + + +namespace Poco { +namespace Net { + + +class HTTPSessionInstantiator; +class HTTPClientSession; + + +class Net_API HTTPSessionFactory + /// A factory for HTTPClientSession objects. + /// + /// Given a URI, this class creates a HTTPClientSession + /// (for http) or a HTTPSClientSession (for https) for + /// accessing the URI. + /// + /// The actual work of creating the session is done by + /// HTTPSessionInstantiator objects that must be registered + /// with a HTTPSessionFactory. +{ +public: + HTTPSessionFactory(); + /// Creates the HTTPSessionFactory. + + HTTPSessionFactory(const std::string& proxyHost, Poco::UInt16 proxyPort); + /// Creates the HTTPSessionFactory and sets the proxy host and port. + + ~HTTPSessionFactory(); + /// Destroys the HTTPSessionFactory. + + void registerProtocol(const std::string& protocol, HTTPSessionInstantiator* pSessionInstantiator); + /// Registers the session instantiator for the given protocol. + /// The factory takes ownership of the SessionInstantiator. + /// + /// A protocol can be registered more than once. However, only the instantiator + /// that has been registered first is used. Also, for each call to + /// registerProtocol(), a corresponding call to unregisterProtocol() must + /// be made. + + void unregisterProtocol(const std::string& protocol); + /// Removes the registration of a protocol. + /// + /// Throws a NotFoundException if no instantiator has been registered + /// for the given protocol. + + bool supportsProtocol(const std::string& protocol); + /// Returns true if a session instantiator for the given protocol has been registered. + + HTTPClientSession* createClientSession(const Poco::URI& uri); + /// Creates a client session for the given uri scheme. Throws exception if no factory is registered for the given scheme + + const std::string& proxyHost() const; + /// Returns the proxy host, if one has been set, or an empty string otherwise. + + Poco::UInt16 proxyPort() const; + /// Returns the proxy port number, if one has been set, or zero otherwise. + + void setProxy(const std::string& proxyHost, Poco::UInt16 proxyPort); + /// Sets the proxy host and port number. + + static HTTPSessionFactory& defaultFactory(); + /// Returns the default HTTPSessionFactory. + +private: + struct InstantiatorInfo + { + HTTPSessionInstantiator* pIn; + int cnt; + InstantiatorInfo(HTTPSessionInstantiator* pInst); + // no destructor!!! this is by purpose, don't add one! + }; + + + HTTPSessionFactory(const HTTPSessionFactory&); + HTTPSessionFactory& operator = (const HTTPSessionFactory&); + + typedef std::map Instantiators; + + Instantiators _instantiators; + std::string _proxyHost; + Poco::UInt16 _proxyPort; + + mutable Poco::FastMutex _mutex; +}; + + +// +// inlines +// +inline const std::string& HTTPSessionFactory::proxyHost() const +{ + return _proxyHost; +} + + +inline Poco::UInt16 HTTPSessionFactory::proxyPort() const +{ + return _proxyPort; +} + + +} } // namespace Poco::Net + + +#endif // Net_HTTPSessionFactoryMgr_INCLUDED diff --git a/Net/include/Poco/Net/HTTPSessionInstantiator.h b/Net/include/Poco/Net/HTTPSessionInstantiator.h new file mode 100644 index 000000000..03c0cbfb6 --- /dev/null +++ b/Net/include/Poco/Net/HTTPSessionInstantiator.h @@ -0,0 +1,116 @@ +// +// HTTPSessionInstantiator.h +// +// $Id: //poco/1.2/Net/include/Poco/Net/HTTPSessionInstantiator.h#1 $ +// +// Library: Net +// Package: HTTPClient +// Module: HTTPSessionInstantiator +// +// Definition of the HTTPSessionInstantiator class. +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef Net_HTTPSessionInstantiator_INCLUDED +#define Net_HTTPSessionInstantiator_INCLUDED + + +#include "Poco/Net/Net.h" +#include "Poco/Net/HTTPSession.h" +#include "Poco/URI.h" + + +namespace Poco { +namespace Net { + + +class HTTPClientSession; + + +class Net_API HTTPSessionInstantiator + /// A factory for HTTPClientSession objects. + /// + /// Creates a HTTP session for a given URI. + /// A HTTPSessionInstantiator is not used directly. + /// Instances are registered with a HTTPSessionFactory, + /// and used through it. +{ +public: + HTTPSessionInstantiator(); + /// Creates the HTTPSessionInstantiator. + + virtual ~HTTPSessionInstantiator(); + /// Destroys the HTTPSessionInstantiator. + + virtual HTTPClientSession* createClientSession(const Poco::URI& uri); + /// Creates a HTTPClientSession for the given URI. + + static void registerInstantiator(); + /// Registers the instantiator with the global HTTPSessionFactory. + + static void unregisterInstantiator(); + /// Unregisters the factory with the global HTTPSessionFactory. + +protected: + void setProxy(const std::string& host, Poco::UInt16 port); + /// Sets the proxy host and port. + /// Called by HTTPSessionFactory. + + const std::string& proxyHost() const; + /// Returns the proxy post. + + Poco::UInt16 proxyPort() const; + /// Returns the proxy port. + +private: + std::string _proxyHost; + Poco::UInt16 _proxyPort; + + friend class HTTPSessionFactory; +}; + + +// +// inlines +// +inline const std::string& HTTPSessionInstantiator::proxyHost() const +{ + return _proxyHost; +} + + +inline Poco::UInt16 HTTPSessionInstantiator::proxyPort() const +{ + return _proxyPort; +} + + +} } // namespace Poco::Net + + +#endif // Net_HTTPSessionInstantiator_INCLUDED diff --git a/Net/include/Net/HTTPStream.h b/Net/include/Poco/Net/HTTPStream.h similarity index 82% rename from Net/include/Net/HTTPStream.h rename to Net/include/Poco/Net/HTTPStream.h index bd36b7ecb..76230ac6d 100644 --- a/Net/include/Net/HTTPStream.h +++ b/Net/include/Poco/Net/HTTPStream.h @@ -1,7 +1,7 @@ // // HTTPStream.h // -// $Id: //poco/1.1.0/Net/include/Net/HTTPStream.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/HTTPStream.h#1 $ // // Library: Net // Package: HTTP @@ -40,26 +40,15 @@ #define Net_HTTPStream_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_HTTPBasicStreamBuf_INCLUDED -#include "Net/HTTPBasicStreamBuf.h" -#endif -#ifndef Foundation_MemoryPool_INCLUDED -#include "Foundation/MemoryPool.h" -#endif -#ifndef STD_ISTREAM_INCLUDED +#include "Poco/Net/Net.h" +#include "Poco/Net/HTTPBasicStreamBuf.h" +#include "Poco/MemoryPool.h" #include -#define STD_ISTREAM_INCLUDED -#endif -#ifndef STD_OSTREAM_INCLUDED #include -#define STD_OSTREAM_INCLUDED -#endif -Net_BEGIN +namespace Poco { +namespace Net { class HTTPSession; @@ -110,7 +99,7 @@ public: void operator delete(void* ptr); private: - static Foundation::MemoryPool _pool; + static Poco::MemoryPool _pool; }; @@ -125,11 +114,11 @@ public: void operator delete(void* ptr); private: - static Foundation::MemoryPool _pool; + static Poco::MemoryPool _pool; }; -Net_END +} } // namespace Poco::Net #endif // Net_HTTPStream_INCLUDED diff --git a/Net/include/Net/HTTPStreamFactory.h b/Net/include/Poco/Net/HTTPStreamFactory.h similarity index 70% rename from Net/include/Net/HTTPStreamFactory.h rename to Net/include/Poco/Net/HTTPStreamFactory.h index 652bfc63f..342acbd88 100644 --- a/Net/include/Net/HTTPStreamFactory.h +++ b/Net/include/Poco/Net/HTTPStreamFactory.h @@ -1,7 +1,7 @@ // // HTTPStreamFactory.h // -// $Id: //poco/1.1.0/Net/include/Net/HTTPStreamFactory.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/HTTPStreamFactory.h#1 $ // // Library: Net // Package: HTTP @@ -40,21 +40,16 @@ #define Net_HTTPStreamFactory_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_HTTPSession_INCLUDED -#include "Net/HTTPSession.h" -#endif -#ifndef Foundation_URIStreamFactory_INCLUDED -#include "Foundation/URIStreamFactory.h" -#endif +#include "Poco/Net/Net.h" +#include "Poco/Net/HTTPSession.h" +#include "Poco/URIStreamFactory.h" -Net_BEGIN +namespace Poco { +namespace Net { -class Net_API HTTPStreamFactory: public Foundation::URIStreamFactory +class Net_API HTTPStreamFactory: public Poco::URIStreamFactory /// An implementation of the URIStreamFactory interface /// that handles Hyper-Text Transfer Protocol (http) URIs. { @@ -62,7 +57,7 @@ public: HTTPStreamFactory(); /// Creates the HTTPStreamFactory. - HTTPStreamFactory(const std::string& proxyHost, Foundation::UInt16 proxyPort = HTTPSession::HTTP_PORT); + HTTPStreamFactory(const std::string& proxyHost, Poco::UInt16 proxyPort = HTTPSession::HTTP_PORT); /// Creates the HTTPStreamFactory. /// /// HTTP connections will use the given proxy. @@ -70,11 +65,20 @@ public: virtual ~HTTPStreamFactory(); /// Destroys the HTTPStreamFactory. - virtual std::istream* open(const Foundation::URI& uri); + virtual std::istream* open(const Poco::URI& uri); /// Creates and opens a HTTP stream for the given URI. /// The URI must be a http://... URI. /// /// Throws a NetException if anything goes wrong. + /// + /// Redirect responses are handled and the redirect + /// location is automatically resolved, as long + /// as the redirect location is still accessible + /// via the HTTP protocol. If a redirection to + /// a non http://... URI is received, a + /// UnsupportedRedirectException exception is thrown. + /// The offending URI can then be obtained via the message() + /// method of UnsupportedRedirectException. static void registerFactory(); /// Registers the HTTPStreamFactory with the @@ -86,12 +90,12 @@ private: MAX_REDIRECTS = 10 }; - std::string _proxyHost; - Foundation::UInt16 _proxyPort; + std::string _proxyHost; + Poco::UInt16 _proxyPort; }; -Net_END +} } // namespace Poco::Net #endif // Net_HTTPStreamFactory_INCLUDED diff --git a/Net/include/Net/HostEntry.h b/Net/include/Poco/Net/HostEntry.h similarity index 87% rename from Net/include/Net/HostEntry.h rename to Net/include/Poco/Net/HostEntry.h index 9c6c96697..c086160d6 100644 --- a/Net/include/Net/HostEntry.h +++ b/Net/include/Poco/Net/HostEntry.h @@ -1,7 +1,7 @@ // // HostEntry.h // -// $Id: //poco/1.1.0/Net/include/Net/HostEntry.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/HostEntry.h#1 $ // // Library: Net // Package: NetCore @@ -40,22 +40,14 @@ #define Net_HostEntry_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_SocketDefs_INCLUDED -#include "Net/SocketDefs.h" -#endif -#ifndef Net_IPAddress_INLCUDED -#include "Net/IPAddress.h" -#endif -#ifndef STD_VECTOR_INCLUDED +#include "Poco/Net/Net.h" +#include "Poco/Net/SocketDefs.h" +#include "Poco/Net/IPAddress.h" #include -#define STD_VECTOR_INCLUDED -#endif -Net_BEGIN +namespace Poco { +namespace Net { class Net_API HostEntry @@ -135,7 +127,7 @@ inline void swap(HostEntry& h1, HostEntry& h2) } -Net_END +} } // namespace Poco::Net #endif // Net_HostEntry_INCLUDED diff --git a/Net/include/Poco/Net/ICMPClient.h b/Net/include/Poco/Net/ICMPClient.h new file mode 100644 index 000000000..cdb45ac3e --- /dev/null +++ b/Net/include/Poco/Net/ICMPClient.h @@ -0,0 +1,107 @@ +// +// ICMPClient.h +// +// $Id: //poco/1.2/Net/include/Poco/Net/ICMPClient.h#1 $ +// +// Library: Net +// Package: ICMP +// Module: ICMPClient +// +// Definition of the ICMPClient class. +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef Net_ICMPClient_INCLUDED +#define Net_ICMPClient_INCLUDED + + +#include "Poco/Net/Net.h" +#include "Poco/Net/ICMPSocket.h" +#include "Poco/Net/ICMPEventArgs.h" +#include "Poco/Net/SocketAddress.h" +#include "Poco/BasicEvent.h" + + +namespace Poco { +namespace Net { + + +class Net_API ICMPClient + /// This class provides ICMP Ping functionality. + /// + /// The events are available when class is instantiated + /// and non-static member functions are called. + /// + /// A "lightweight" alternative is direct (without instantiation) + /// use of static member functions. +{ +public: + mutable Poco::BasicEvent pingBegin; + mutable Poco::BasicEvent pingReply; + mutable Poco::BasicEvent pingError; + mutable Poco::BasicEvent pingEnd; + + explicit ICMPClient(IPAddress::Family family); + /// Creates an ICMP client. + + ~ICMPClient(); + /// Destroys the ICMP client. + + int ping(SocketAddress& address, int repeat = 1) const; + /// Pings the specified address [repeat] times. + /// Notifications are posted for events. + /// + /// Returns the number of valid replies. + + int ping(const std::string& address, int repeat = 1) const; + /// Calls ICMPClient::ping(SocketAddress&, int) and + /// returns the result. + /// + /// Returns the number of valid replies. + + static int ping(SocketAddress& address, IPAddress::Family family, int repeat = 1); + /// Pings the specified address [repeat] times. + /// Notifications are not posted for events. + /// + /// Returns the number of valid replies. + + static int pingIPv4(const std::string& address, int repeat = 1); + /// Calls ICMPClient::ping(SocketAddress&, int) and + /// returns the result. + /// + /// Returns the number of valid replies. + +private: + mutable IPAddress::Family _family; +}; + + +} } // namespace Poco::Net + + +#endif // Net_ICMPClient_INCLUDED diff --git a/Net/include/Poco/Net/ICMPEventArgs.h b/Net/include/Poco/Net/ICMPEventArgs.h new file mode 100644 index 000000000..abb9bd286 --- /dev/null +++ b/Net/include/Poco/Net/ICMPEventArgs.h @@ -0,0 +1,188 @@ +// +// ICMPEventArgs.h +// +// $Id: //poco/1.2/Net/include/Poco/Net/ICMPEventArgs.h#1 $ +// +// Library: Net +// Package: ICMP +// Module: ICMPEventArgs +// +// Definition of ICMPEventArgs. +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef Net_ICMPEventArgs_INCLUDED +#define Net_ICMPEventArgs_INCLUDED + + +#include "Poco/Net/Net.h" +#include "Poco/Net/SocketAddress.h" +#include +#undef min // macros collide with valarray::min() and valarray::max() +#undef max +#include + + +namespace Poco { +namespace Net { + + +class Net_API ICMPEventArgs + /// The purpose of the ICMPEventArgs class is to be used as template parameter + /// to instantiate event members in ICMPClient class. + /// When clients register for an event notification, the reference to the class is + /// passed to the handler function to provide information about the event. +{ +public: + ICMPEventArgs(const SocketAddress& address, int repetitions, int dataSize, int ttl); + /// Creates ICMPEventArgs. + + virtual ~ICMPEventArgs(); + /// Destroys ICMPEventArgs. + + std::string hostName() const; + /// Tries to resolve the target IP address into host name. + /// If unsuccessful, all exceptions are silently ignored and + /// the IP address is returned. + + std::string hostAddress() const; + /// Returns the target IP address. + + int repetitions() const; + /// Returns the number of repetitions for the ping operation. + + int dataSize() const; + /// Returns the packet data size in bytes. + + int ttl() const; + /// Returns time to live. + + int sent() const; + /// Returns the number of packets sent. + + int received() const; + /// Returns the number of packets received. + + int replyTime(int index = -1) const; + /// Returns the reply time for the request specified with index. + /// If index == -1 (default), returns the most recent reply time. + + const std::string& error(int index = -1) const; + /// Returns the error string for the request specified with index. + /// If index == -1 (default), returns the most recent error string. + + int minRTT() const; + /// Returns the minimum round trip time for a sequence of requests. + + int maxRTT() const; + /// Returns the maximum round trip time for a sequence of requests. + + int avgRTT() const; + /// Returns the average round trip time for a sequence of requests. + + float percent() const; + /// Returns the success percentage for a sequence of requests. + +private: + ICMPEventArgs(); + + void setRepetitions(int repetitions); + void setDataSize(int dataSize); + void setTTL(int ttl); + void setReplyTime(int index, int time); + void setError(int index, const std::string& text); + ICMPEventArgs& operator ++ (); + ICMPEventArgs operator ++ (int); + static int zeroVal(int n); + + SocketAddress _address; + int _sent; + int _dataSize; + int _ttl; + std::valarray _rtt; + std::vector _errors; + + friend class ICMPClient; +}; + + +// +// inlines +// +inline int ICMPEventArgs::repetitions() const +{ + return (int) _rtt.size(); +} + + +inline void ICMPEventArgs::setDataSize(int dataSize) +{ + _dataSize = dataSize; +} + + +inline int ICMPEventArgs::dataSize() const +{ + return _dataSize; +} + + +inline void ICMPEventArgs::setTTL(int ttl) +{ + _ttl = ttl; +} + + +inline int ICMPEventArgs::ttl() const +{ + return _ttl; +} + + +inline int ICMPEventArgs::sent() const +{ + return _sent; +} + + +inline int ICMPEventArgs::minRTT() const +{ + return _rtt.min(); +} + + +inline int ICMPEventArgs::maxRTT() const +{ + return _rtt.max(); +} + + +} } // namespace Poco::Net + + +#endif diff --git a/Net/include/Poco/Net/ICMPPacket.h b/Net/include/Poco/Net/ICMPPacket.h new file mode 100644 index 000000000..91a101630 --- /dev/null +++ b/Net/include/Poco/Net/ICMPPacket.h @@ -0,0 +1,111 @@ +// +// ICMPPacket.h +// +// $Id: //poco/1.2/Net/include/Poco/Net/ICMPPacket.h#1 $ +// +// Library: Net +// Package: ICMP +// Module: ICMPPacket +// +// Definition of the ICMPPacket class. +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef Net_ICMPPacket_INCLUDED +#define Net_ICMPPacket_INCLUDED + + +#include "Poco/Foundation.h" +#include "Poco/Net/Socket.h" +#include "Poco/Net/ICMPPacketImpl.h" + + +namespace Poco { +namespace Net { + + +class Net_API ICMPPacket + /// This class is the ICMP packet abstraction. +{ +public: + ICMPPacket(IPAddress::Family family, int dataSize = 48); + /// Creates an ICMPPacket of specified family. + + ~ICMPPacket(); + /// Destroys the ICMPPacket. + + const Poco::UInt8* packet(); + /// Returns raw ICMP packet. ICMP header and data are included in the returned packet. + + int packetSize() const; + /// Returns the total length of packet (header + data); + + Poco::UInt16 sequence() const; + /// Returns the most recent sequence number generated. + + void setDataSize(int dataSize); + /// Sets data size. + + int getDataSize() const; + /// Returns data size. + + int maxPacketSize() const; + /// Returns the total length of packet (header + data); + + struct timeval time(Poco::UInt8* buffer = 0, int length = 0) const; + /// Returns current epoch time if either buffer or length are equal to zero. + /// Otherwise, it extracts the time value from the supplied buffer and + /// returns the extracted value. + /// + /// Supplied buffer includes IP header, ICMP header and data. + + bool validReplyID(Poco::UInt8* buffer, int length) const; + /// Returns true if the extracted id is recognized + /// (equals the process id). + /// + /// Supplied buffer includes IP header, ICMP header and data. + + std::string errorDescription(Poco::UInt8* buffer, int length); + /// Returns error description string. + /// If supplied buffer contains an ICMP echo reply packet, an + /// empty string is returned indicating the absence of error. + /// + /// Supplied buffer includes IP header, ICMP header and data. + + std::string typeDescription(int typeId); + /// Returns the description of the packet type. + +private: + ICMPPacketImpl* _pImpl; +}; + + +} } // namespace Poco::Net + + +#endif // Net_ICMPPacket_INCLUDED diff --git a/Net/include/Poco/Net/ICMPPacketImpl.h b/Net/include/Poco/Net/ICMPPacketImpl.h new file mode 100644 index 000000000..11c65d50e --- /dev/null +++ b/Net/include/Poco/Net/ICMPPacketImpl.h @@ -0,0 +1,163 @@ +// +// ICMPPacketImpl.h +// +// $Id: //poco/1.2/Net/include/Poco/Net/ICMPPacketImpl.h#1 $ +// +// Library: Net +// Package: ICMP +// Module: ICMPPacketImpl +// +// Definition of the ICMPPacketImpl class. +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef Net_ICMPPacketImpl_INCLUDED +#define Net_ICMPPacketImpl_INCLUDED + + +#include "Poco/Foundation.h" +#include "Poco/Net/Socket.h" + + +namespace Poco { +namespace Net { + + +class Net_API ICMPPacketImpl + /// This is the abstract class for ICMP packet implementations. +{ +public: + ICMPPacketImpl(int dataSize = 48); + /// Constructor. Creates an ICMPPacketImpl. + + virtual ~ICMPPacketImpl(); + /// Destructor. + + const Poco::UInt8* packet(bool init = true); + /// Returns raw ICMP packet. + /// ICMP header and data are included in the packet. + /// If init is true, initPacket() is called. + + virtual int packetSize() const = 0; + /// Returns the total size of packet (ICMP header + data) in number of octets. + /// Must be overriden. + + virtual int maxPacketSize() const; + /// Returns the maximum permitted size of packet in number of octets. + + Poco::UInt16 sequence() const; + /// Returns the most recent sequence number generated. + + void setDataSize(int dataSize); + /// Sets data size. + + int getDataSize() const; + /// Returns data size. + + virtual struct timeval time(Poco::UInt8* buffer = 0, int length = 0) const = 0; + /// Returns current epoch time if either argument is equal to zero. + /// Otherwise, it extracts the time value from the supplied buffer. + /// + /// Supplied buffer includes IP header, ICMP header and data. + /// Must be overriden. + + virtual bool validReplyID(unsigned char* buffer, int length) const = 0; + /// Returns true if the extracted id is recognized + /// (i.e. equals the process id). + /// + /// Supplied buffer includes IP header, ICMP header and data. + /// Must be overriden. + + virtual std::string errorDescription(Poco::UInt8* buffer, int length) = 0; + /// Returns error description string. + /// If supplied buffer contains an ICMP echo reply packet, an + /// empty string is returned indicating the absence of error. + /// + /// Supplied buffer includes IP header, ICMP header and data. + /// Must be overriden. + + virtual std::string typeDescription(int typeId) = 0; + /// Returns the description of the packet type. + /// Must be overriden. + + static const Poco::UInt16 MAX_PACKET_SIZE; + static const Poco::UInt16 MAX_SEQ_VALUE; + +protected: + Poco::UInt16 nextSequence(); + /// Increments sequence number and returns the new value. + + void resetSequence(); + /// Resets the sequence to zero. + + virtual void initPacket() = 0; + /// (Re)assembles the packet. + /// Must be overriden. + + Poco::UInt16 checksum(Poco::UInt16 *addr, Poco::Int32 len); + /// Calculates the checksum for supplied buffer. + +private: + Poco::UInt16 _seq; + Poco::UInt8* _pPacket; + int _dataSize; + +}; + + +// +// inlines +// +inline Poco::UInt16 ICMPPacketImpl::sequence() const +{ + return _seq; +} + + +inline Poco::UInt16 ICMPPacketImpl::nextSequence() +{ + return ++_seq; +} + + +inline void ICMPPacketImpl::resetSequence() +{ + _seq = 0; +} + + +inline int ICMPPacketImpl::maxPacketSize() const +{ + return MAX_PACKET_SIZE; +} + + +} } // namespace Poco::Net + + +#endif // Net_ICMPPacketImpl_INCLUDED diff --git a/Net/include/Poco/Net/ICMPSocket.h b/Net/include/Poco/Net/ICMPSocket.h new file mode 100644 index 000000000..b1e25b93e --- /dev/null +++ b/Net/include/Poco/Net/ICMPSocket.h @@ -0,0 +1,139 @@ +// +// ICMPSocket.h +// +// $Id: //poco/1.2/Net/include/Poco/Net/ICMPSocket.h#1 $ +// +// Library: Net +// Package: ICMP +// Module: ICMPSocket +// +// Definition of the ICMPSocket class. +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef Net_ICMPSocket_INCLUDED +#define Net_ICMPSocket_INCLUDED + + +#include "Poco/Net/Net.h" +#include "Poco/Net/Socket.h" + + +namespace Poco { +namespace Net { + + +class Net_API ICMPSocket: public Socket + /// This class provides an interface to an + /// ICMP client socket. +{ +public: + ICMPSocket(IPAddress::Family family, int dataSize = 48, int ttl = 128, int timeout = 500000); + /// Creates an unconnected ICMP socket. + /// + /// The socket will be created for the + /// given address family. + + ICMPSocket(const Socket& socket); + /// Creates the ICMPSocket with the SocketImpl + /// from another socket. The SocketImpl must be + /// a DatagramSocketImpl, otherwise an InvalidArgumentException + /// will be thrown. + + ~ICMPSocket(); + /// Destroys the ICMPSocket. + + ICMPSocket& operator = (const Socket& socket); + /// Assignment operator. + /// + /// Releases the socket's SocketImpl and + /// attaches the SocketImpl from the other socket and + /// increments the reference count of the SocketImpl. + + int sendTo(const SocketAddress& address, int flags = 0); + /// Sends an ICMP request through + /// the socket to the given address. + /// + /// Returns the number of bytes sent. + + int receiveFrom(SocketAddress& address, int flags = 0); + /// Receives data from the socket. + /// Stores the address of the sender in address. + /// + /// Returns the time elapsed since the originating + /// request was sent. + + int dataSize() const; + /// Returns the data size in bytes. + + int ttl() const; + /// Returns the Time-To-Live value. + + int timeout() const; + /// Returns the socket timeout value. + +protected: + ICMPSocket(SocketImpl* pImpl); + /// Creates the Socket and attaches the given SocketImpl. + /// The socket takes owership of the SocketImpl. + /// + /// The SocketImpl must be a ICMPSocketImpl, otherwise + /// an InvalidArgumentException will be thrown. + +private: + int _dataSize; + int _ttl; + int _timeout; +}; + + +// +// inlines +// +inline int ICMPSocket::dataSize() const +{ + return _dataSize; +} + + +inline int ICMPSocket::ttl() const +{ + return _ttl; +} + + +inline int ICMPSocket::timeout() const +{ + return _timeout; +} + + +} } // namespace Poco::Net + + +#endif // Net_ICMPSocket_INCLUDED diff --git a/Net/include/Poco/Net/ICMPSocketImpl.h b/Net/include/Poco/Net/ICMPSocketImpl.h new file mode 100644 index 000000000..2d8c2da39 --- /dev/null +++ b/Net/include/Poco/Net/ICMPSocketImpl.h @@ -0,0 +1,84 @@ +// +// ICMPSocketImpl.h +// +// $Id: //poco/1.2/Net/include/Poco/Net/ICMPSocketImpl.h#1 $ +// +// Library: Net +// Package: ICMP +// Module: ICMPSocketImpl +// +// Definition of the ICMPSocketImpl class. +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef Net_ICMPSocketImpl_INCLUDED +#define Net_ICMPSocketImpl_INCLUDED + + +#include "Poco/Net/Net.h" +#include "Poco/Net/RawSocketImpl.h" +#include "Poco/Net/ICMPPacket.h" +#include "Poco/Timestamp.h" + + +namespace Poco { +namespace Net { + + +class Net_API ICMPSocketImpl: public RawSocketImpl + /// This class implements an ICMP socket. +{ +public: + ICMPSocketImpl(IPAddress::Family family, int dataSize, int ttl, int timeout); + /// Creates an unconnected ICMP socket. + /// + /// The socket will be created for the given address family. + + int sendTo(const void*, int, const SocketAddress& address, int flags = 0); + /// Sends an ICMP request through the socket to the given address. + /// + /// Returns the number of bytes sent. + + int receiveFrom(void*, int, SocketAddress& address, int flags = 0); + /// Receives data from the socket. + /// Stores the address of the sender in address. + /// + /// Returns the time elapsed since the originating request was sent. + +protected: + ~ICMPSocketImpl(); + +private: + ICMPPacket _icmpPacket; +}; + + +} } // namespace Poco::Net + + +#endif // Net_ICMPSocketImpl_INCLUDED diff --git a/Net/include/Poco/Net/ICMPv4PacketImpl.h b/Net/include/Poco/Net/ICMPv4PacketImpl.h new file mode 100644 index 000000000..99ebb0dd3 --- /dev/null +++ b/Net/include/Poco/Net/ICMPv4PacketImpl.h @@ -0,0 +1,186 @@ +// +// ICMPv4PacketImpl.h +// +// $Id: //poco/1.2/Net/include/Poco/Net/ICMPv4PacketImpl.h#1 $ +// +// Library: Net +// Package: ICMP +// Module: ICMPv4PacketImpl +// +// Definition of the ICMPv4PacketImpl class. +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef Net_ICMPv4PacketImpl_INCLUDED +#define Net_ICMPv4PacketImpl_INCLUDED + + +#include "Poco/Foundation.h" +#include "Poco/Net/Socket.h" +#include "Poco/Net/ICMPPacketImpl.h" + + +namespace Poco { +namespace Net { + + +class Net_API ICMPv4PacketImpl : public ICMPPacketImpl + /// This class implements the ICMPv4 packet. + /// Parts are based on original ICMP code by + /// Mike Muuss + /// U. S. Army Ballistic Research Laboratory + /// December, 1983 +{ +public: + // ICMPv4 header + struct Header + { + Poco::UInt8 type; // ICMP packet type + Poco::UInt8 code; // Type sub code + Poco::UInt16 checksum; + Poco::UInt16 id; + Poco::UInt16 seq; + }; + + enum MessageType + { + ECHO_REPLY, + ICMP_1, + ICMP_2, + DESTINATION_UNREACHABLE, + SOURCE_QUENCH, + REDIRECT, + ICMP_6, + ICMP_7, + ECHO, + ICMP_9, + ICMP_10, + TIME_EXCEEDED, + PARAMETER_PROBLEM, + TIMESTAMP, + TIMESTAMP_REPLY, + INFORMATION_REQUEST, + INFORMATION_REPLY, + MESSAGE_TYPE_UNKNOWN, // non-standard default, must remain last but one + MESSAGE_TYPE_LENGTH // length indicator, must remain last + }; + + enum DestinationUnreachableCode + { + NET_UNREACHABLE, + HOST_UNREACHABLE, + PROTOCOL_UNREACHABLE, + PORT_UNREACHABLE, + FRAGMENTATION_NEEDED_AND_DF_SET, + SOURCE_ROUTE_FAILED, + DESTINATION_UNREACHABLE_UNKNOWN, // non-standard default, must remain last but one + DESTINATION_UNREACHABLE_LENGTH // length indicator, must remain last + }; + + enum RedirectMessageCode + { + REDIRECT_NETWORK, + REDIRECT_HOST, + REDIRECT_SERVICE_NETWORK, + REDIRECT_SERVICE_HOST, + REDIRECT_MESSAGE_UNKNOWN, // non-standard default, must remain last but one + REDIRECT_MESSAGE_LENGTH // length indicator, must remain last + }; + + enum TimeExceededCode + { + TIME_TO_LIVE, + FRAGMENT_REASSEMBLY, + TIME_EXCEEDED_UNKNOWN, // non-standard default, must remain last but one + TIME_EXCEEDED_LENGTH // length indicator, must remain last + }; + + enum ParameterProblemCode + { + POINTER_INDICATES_THE_ERROR, + PARAMETER_PROBLEM_UNKNOWN, // non-standard default, must remain last but one + PARAMETER_PROBLEM_LENGTH // length indicator, must remain last + }; + + ICMPv4PacketImpl(int dataSize = 48); + /// Constructor. Creates an ICMPv4PacketImpl. + + ~ICMPv4PacketImpl(); + /// Destructor. + + int packetSize() const; + /// Returns the total length of packet (header + data); + + struct timeval time(Poco::UInt8* buffer = 0, int length = 0) const; + /// Returns current epoch time if either buffer or length are equal to zero. + /// Otherwise, it extracts the time value from the supplied buffer. + /// + /// Buffer includes IP header, ICMP header and data. + + bool validReplyID(Poco::UInt8* buffer, int length) const; + /// Returns true if the extracted id is recognized + /// (i.e. equals the process id). + /// + /// Buffer includes IP header, ICMP header and data. + + virtual std::string errorDescription(Poco::UInt8* buffer, int length); + /// Returns error description string. + /// If supplied buffer contains ICMPv4 echo reply packet, an + /// empty string is returned indicating the absence of error. + /// + /// Buffer includes IP header, ICMP header and data. + + virtual std::string typeDescription(int typeId); + /// Returns the description of the packet type. + + static const Poco::UInt16 MAX_PACKET_SIZE; + static const std::string MESSAGE_TYPE[MESSAGE_TYPE_LENGTH]; + static const Poco::UInt8 DESTINATION_UNREACHABLE_TYPE; // 3 + static const Poco::UInt8 SOURCE_QUENCH_TYPE; // 4 + static const Poco::UInt8 REDIRECT_MESSAGE_TYPE; // 5 + static const Poco::UInt8 TIME_EXCEEDED_TYPE; // 11 + static const Poco::UInt8 PARAMETER_PROBLEM_TYPE; // 12 + +private: + void initPacket(); + Header* header(Poco::UInt8* buffer, int length) const; + Poco::UInt8* data(Poco::UInt8* buffer, int length) const; + + static const std::string DESTINATION_UNREACHABLE_CODE[DESTINATION_UNREACHABLE_LENGTH]; + static const std::string REDIRECT_MESSAGE_CODE[REDIRECT_MESSAGE_LENGTH]; + static const std::string TIME_EXCEEDED_CODE[TIME_EXCEEDED_LENGTH]; + static const std::string PARAMETER_PROBLEM_CODE[PARAMETER_PROBLEM_LENGTH]; + + Poco::UInt16 _seq; +}; + + +} } // namespace Poco::Net + + +#endif // Net_ICMPv4PacketImpl_INCLUDED diff --git a/Net/include/Net/IPAddress.h b/Net/include/Poco/Net/IPAddress.h similarity index 95% rename from Net/include/Net/IPAddress.h rename to Net/include/Poco/Net/IPAddress.h index 7ec7f9f27..87b22cc33 100644 --- a/Net/include/Net/IPAddress.h +++ b/Net/include/Poco/Net/IPAddress.h @@ -1,7 +1,7 @@ // // IPAddress.h // -// $Id: //poco/1.1.0/Net/include/Net/IPAddress.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/IPAddress.h#1 $ // // Library: Net // Package: NetCore @@ -40,15 +40,12 @@ #define Net_IPAddress_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_SocketDefs_INCLUDED -#include "Net/SocketDefs.h" -#endif +#include "Poco/Net/Net.h" +#include "Poco/Net/SocketDefs.h" -Net_BEGIN +namespace Poco { +namespace Net { class IPAddressImpl; @@ -341,7 +338,7 @@ inline void swap(IPAddress& a1, IPAddress& a2) } -Net_END +} } // namespace Poco::Net #endif // Net_IPAddress_INCLUDED diff --git a/Net/include/Net/MailMessage.h b/Net/include/Poco/Net/MailMessage.h similarity index 91% rename from Net/include/Net/MailMessage.h rename to Net/include/Poco/Net/MailMessage.h index 880ca6052..b5760ab95 100644 --- a/Net/include/Net/MailMessage.h +++ b/Net/include/Poco/Net/MailMessage.h @@ -1,7 +1,7 @@ // // MailMessage.h // -// $Id: //poco/1.1.0/Net/include/Net/MailMessage.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/MailMessage.h#1 $ // // Library: Net // Package: Mail @@ -40,25 +40,15 @@ #define Net_MailMessage_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_MessageHeader_INCLUDED -#include "Net/MessageHeader.h" -#endif -#ifndef Net_MailRecipient_INCLUDED -#include "Net/MailRecipient.h" -#endif -#ifndef Foundation_Timestamp_INCLUDED -#include "Foundation/Timestamp.h" -#endif -#ifndef STD_VECTOR_INCLUDED +#include "Poco/Net/Net.h" +#include "Poco/Net/MessageHeader.h" +#include "Poco/Net/MailRecipient.h" +#include "Poco/Timestamp.h" #include -#define STD_VECTOR_INCLUDED -#endif -Net_BEGIN +namespace Poco { +namespace Net { class MediaType; @@ -148,10 +138,10 @@ public: const std::string& getContentType() const; /// Returns the content type for the message. - void setDate(const Foundation::Timestamp& dateTime); + void setDate(const Poco::Timestamp& dateTime); /// Sets the Date header to the given date/time value. - Foundation::Timestamp getDate() const; + Poco::Timestamp getDate() const; /// Returns the value of the Date header. bool isMultipart() const; @@ -257,7 +247,7 @@ inline const std::string& MailMessage::getContent() const } -Net_END +} } // namespace Poco::Net #endif // Net_MailMessage_INCLUDED diff --git a/Net/include/Net/MailRecipient.h b/Net/include/Poco/Net/MailRecipient.h similarity index 92% rename from Net/include/Net/MailRecipient.h rename to Net/include/Poco/Net/MailRecipient.h index 7396eff98..aaa4cb0ed 100644 --- a/Net/include/Net/MailRecipient.h +++ b/Net/include/Poco/Net/MailRecipient.h @@ -1,7 +1,7 @@ // // MailRecipient.h // -// $Id: //poco/1.1.0/Net/include/Net/MailRecipient.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/MailRecipient.h#1 $ // // Library: Net // Package: Mail @@ -40,12 +40,11 @@ #define Net_MailRecipient_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif +#include "Poco/Net/Net.h" -Net_BEGIN +namespace Poco { +namespace Net { class Net_API MailRecipient @@ -137,7 +136,7 @@ inline void swap(MailRecipient& r1, MailRecipient& r2) } -Net_END +} } // namespace Poco::Net #endif // Net_MailRecipient_INCLUDED diff --git a/Net/include/Net/MailStream.h b/Net/include/Poco/Net/MailStream.h similarity index 88% rename from Net/include/Net/MailStream.h rename to Net/include/Poco/Net/MailStream.h index b338b664b..618d26926 100644 --- a/Net/include/Net/MailStream.h +++ b/Net/include/Poco/Net/MailStream.h @@ -1,7 +1,7 @@ // // MailStream.h // -// $Id: //poco/1.1.0/Net/include/Net/MailStream.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/MailStream.h#1 $ // // Library: Net // Package: Mail @@ -40,26 +40,17 @@ #define Net_MailStream_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Foundation_UnbufferedStreamBuf_INCLUDED -#include "Foundation/UnbufferedStreamBuf.h" -#endif -#ifndef STD_ISTREAM_INCLUDED +#include "Poco/Net/Net.h" +#include "Poco/UnbufferedStreamBuf.h" #include -#define STD_ISTREAM_INCLUDED -#endif -#ifndef STD_OSTREAM_INCLUDED #include -#define STD_OSTREAM_INCLUDED -#endif -Net_BEGIN +namespace Poco { +namespace Net { -class Net_API MailStreamBuf: public Foundation::UnbufferedStreamBuf +class Net_API MailStreamBuf: public Poco::UnbufferedStreamBuf /// The sole purpose of this stream buffer is to replace /// a "\r\n.\r\n" character sequence with a "\r\n..\r\n" sequence for /// output streams and vice-versa for input streams. @@ -171,7 +162,7 @@ public: }; -Net_END +} } // namespace Poco::Net #endif // Net_MailStream_INCLUDED diff --git a/Net/include/Net/MediaType.h b/Net/include/Poco/Net/MediaType.h similarity index 92% rename from Net/include/Net/MediaType.h rename to Net/include/Poco/Net/MediaType.h index 0bd68629c..245a7f87e 100644 --- a/Net/include/Net/MediaType.h +++ b/Net/include/Poco/Net/MediaType.h @@ -1,7 +1,7 @@ // // MediaType.h // -// $Id: //poco/1.1.0/Net/include/Net/MediaType.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/MediaType.h#1 $ // // Library: Net // Package: Messages @@ -40,15 +40,12 @@ #define Net_MediaType_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_NameValueCollection_INCLUDED -#include "Net/NameValueCollection.h" -#endif +#include "Poco/Net/Net.h" +#include "Poco/Net/NameValueCollection.h" -Net_BEGIN +namespace Poco { +namespace Net { class Net_API MediaType @@ -167,7 +164,7 @@ inline void swap(MediaType& m1, MediaType& m2) } -Net_END +} } // namespace Poco::Net #endif // Net_MediaType_INCLUDED diff --git a/Net/include/Net/MessageHeader.h b/Net/include/Poco/Net/MessageHeader.h similarity index 89% rename from Net/include/Net/MessageHeader.h rename to Net/include/Poco/Net/MessageHeader.h index 08e417d9d..c0c949c79 100644 --- a/Net/include/Net/MessageHeader.h +++ b/Net/include/Poco/Net/MessageHeader.h @@ -1,7 +1,7 @@ // // MessageHeader.h // -// $Id: //poco/1.1.0/Net/include/Net/MessageHeader.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/MessageHeader.h#1 $ // // Library: Net // Package: Messages @@ -40,27 +40,15 @@ #define Net_MessageHeader_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_NameValueCollection_INCLUDED -#include "Net/NameValueCollection.h" -#endif -#ifndef STD_OSTREAM_INCLUDED +#include "Poco/Net/Net.h" +#include "Poco/Net/NameValueCollection.h" #include -#define STD_OSTREAM_INCLUDED -#endif -#ifndef STD_ISTREAM_INCLUDED #include -#define STD_ISTREAM_INCLUDED -#endif -#ifndef STD_VECTOR_INCLUDED #include -#define STD_VECTOR_INCLUDED -#endif -Net_BEGIN +namespace Poco { +namespace Net { class Net_API MessageHeader: public NameValueCollection @@ -163,7 +151,7 @@ private: }; -Net_END +} } // namespace Poco::Net #endif // Net_MessageHeader_INCLUDED diff --git a/Net/include/Net/MulticastSocket.h b/Net/include/Poco/Net/MulticastSocket.h similarity index 91% rename from Net/include/Net/MulticastSocket.h rename to Net/include/Poco/Net/MulticastSocket.h index cd5b15d6a..7f908de15 100644 --- a/Net/include/Net/MulticastSocket.h +++ b/Net/include/Poco/Net/MulticastSocket.h @@ -1,7 +1,7 @@ // // MulticastSocket.h // -// $Id: //poco/1.1.0/Net/include/Net/MulticastSocket.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/MulticastSocket.h#1 $ // // Library: Net // Package: Sockets @@ -40,18 +40,13 @@ #define Net_MulticastSocket_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_DatagramSocket_INCLUDED -#include "Net/DatagramSocket.h" -#endif -#ifndef Net_NetworkInterface_INCLUDED -#include "Net/NetworkInterface.h" -#endif +#include "Poco/Net/Net.h" +#include "Poco/Net/DatagramSocket.h" +#include "Poco/Net/NetworkInterface.h" -Net_BEGIN +namespace Poco { +namespace Net { class Net_API MulticastSocket: public DatagramSocket @@ -137,7 +132,7 @@ public: }; -Net_END +} } // namespace Poco::Net #endif // Net_MulticastSocket_INCLUDED diff --git a/Net/include/Net/MultipartReader.h b/Net/include/Poco/Net/MultipartReader.h similarity index 89% rename from Net/include/Net/MultipartReader.h rename to Net/include/Poco/Net/MultipartReader.h index c1d8c9955..f8dd7c34c 100644 --- a/Net/include/Net/MultipartReader.h +++ b/Net/include/Poco/Net/MultipartReader.h @@ -1,7 +1,7 @@ // // MultipartReader.h // -// $Id: //poco/1.1.0/Net/include/Net/MultipartReader.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/MultipartReader.h#1 $ // // Library: Net // Package: Messages @@ -40,25 +40,19 @@ #define Net_MultipartReader_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Foundation_BufferedStreamBuf_INCLUDED -#include "Foundation/BufferedStreamBuf.h" -#endif -#ifndef STD_ISTREAM_INCLUDED +#include "Poco/Net/Net.h" +#include "Poco/BufferedStreamBuf.h" #include -#define STD_ISTREAM_INCLUDED -#endif -Net_BEGIN +namespace Poco { +namespace Net { class MessageHeader; -class Net_API MultipartStreamBuf: public Foundation::BufferedStreamBuf +class Net_API MultipartStreamBuf: public Poco::BufferedStreamBuf /// This is the streambuf class used for reading from a multipart message stream. { public: @@ -115,7 +109,7 @@ class Net_API MultipartReader /// To split a multipart message into its parts, /// do the following: /// - Create a MultipartReader object, passing it - // an input stream and optionally a boundary string. + /// an input stream and optionally a boundary string. /// - while hasNextPart() returns true, call nextPart() /// and read the part from stream(). { @@ -178,7 +172,7 @@ private: }; -Net_END +} } // namespace Poco::Net #endif // Net_MultipartReader_INCLUDED diff --git a/Net/include/Net/MultipartWriter.h b/Net/include/Poco/Net/MultipartWriter.h similarity index 91% rename from Net/include/Net/MultipartWriter.h rename to Net/include/Poco/Net/MultipartWriter.h index 986b354be..8b07110c4 100644 --- a/Net/include/Net/MultipartWriter.h +++ b/Net/include/Poco/Net/MultipartWriter.h @@ -1,7 +1,7 @@ // // MultipartWriter.h // -// $Id: //poco/1.1.0/Net/include/Net/MultipartWriter.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/MultipartWriter.h#1 $ // // Library: Net // Package: Messages @@ -40,16 +40,12 @@ #define Net_MultipartWriter_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef STD_OSTREAM_INCLUDED +#include "Poco/Net/Net.h" #include -#define STD_OSTREAM_INCLUDED -#endif -Net_BEGIN +namespace Poco { +namespace Net { class MessageHeader; @@ -128,7 +124,7 @@ inline std::ostream& MultipartWriter::stream() } -Net_END +} } // namespace Poco::Net #endif // Net_MultipartWriter_INCLUDED diff --git a/Net/include/Net/NameValueCollection.h b/Net/include/Poco/Net/NameValueCollection.h similarity index 87% rename from Net/include/Net/NameValueCollection.h rename to Net/include/Poco/Net/NameValueCollection.h index c5abc1648..8b6c1cca1 100644 --- a/Net/include/Net/NameValueCollection.h +++ b/Net/include/Poco/Net/NameValueCollection.h @@ -1,7 +1,7 @@ // // NameValueCollection.h // -// $Id: //poco/1.1.0/Net/include/Net/NameValueCollection.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/NameValueCollection.h#1 $ // // Library: Net // Package: Messages @@ -40,19 +40,13 @@ #define Net_NameValueCollection_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Foundation_String_INCLUDED -#include "Foundation/String.h" -#endif -#ifndef STD_MAP_INCLUDED +#include "Poco/Net/Net.h" +#include "Poco/String.h" #include -#define STD_MAP_INCLUDED -#endif -Net_BEGIN +namespace Poco { +namespace Net { class Net_API NameValueCollection @@ -69,7 +63,7 @@ public: { bool operator() (const std::string& s1, const std::string& s2) const { - return Foundation::icompare(s1, s2) < 0; + return Poco::icompare(s1, s2) < 0; } }; @@ -108,6 +102,10 @@ public: /// /// Throws a NotFoundException if the name-value pair does not exist. + const std::string& get(const std::string& name, const std::string& defaultValue) const; + /// Returns the value of the first name-value pair with the given name. + /// If no value with the given name has been found, the defaultValue is returned. + bool has(const std::string& name) const; /// Returns true if there is at least one name-value pair /// with the given name. @@ -151,7 +149,7 @@ inline void swap(NameValueCollection& nvc1, NameValueCollection& nvc2) } -Net_END +} } // namespace Poco::Net #endif // Net_NameValueCollection_INCLUDED diff --git a/Net/include/Net/Net.h b/Net/include/Poco/Net/Net.h similarity index 86% rename from Net/include/Net/Net.h rename to Net/include/Poco/Net/Net.h index 9ced32ac8..70983b2f3 100644 --- a/Net/include/Net/Net.h +++ b/Net/include/Poco/Net/Net.h @@ -1,7 +1,7 @@ // // Net.h // -// $Id: //poco/1.1.0/Net/include/Net/Net.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/Net.h#1 $ // // Library: Net // Package: NetCore @@ -42,16 +42,7 @@ #define Net_Net_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif - - -// -// Macros to declare the Net namespace -// -#define Net_BEGIN namespace Net { -#define Net_END } +#include "Poco/Foundation.h" // @@ -62,7 +53,7 @@ // Net_API functions as being imported from a DLL, wheras this DLL sees symbols // defined with this macro as being exported. // -#if (defined(_WIN32) || defined(__CYGWIN__)) && defined(POCO_DLL) +#if defined(_WIN32) && defined(POCO_DLL) #if defined(Net_EXPORTS) #define Net_API __declspec(dllexport) #else diff --git a/Net/include/Net/NetException.h b/Net/include/Poco/Net/NetException.h similarity index 86% rename from Net/include/Net/NetException.h rename to Net/include/Poco/Net/NetException.h index 98d781cd9..ff8df3645 100644 --- a/Net/include/Net/NetException.h +++ b/Net/include/Poco/Net/NetException.h @@ -1,7 +1,7 @@ // // NetException.h // -// $Id: //poco/1.1.0/Net/include/Net/NetException.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/NetException.h#1 $ // // Library: Net // Package: NetCore @@ -40,18 +40,15 @@ #define Net_NetException_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Foundation_Exception_INCLUDED -#include "Foundation/Exception.h" -#endif +#include "Poco/Net/Net.h" +#include "Poco/Exception.h" -Net_BEGIN +namespace Poco { +namespace Net { -POCO_DECLARE_EXCEPTION(Net_API, NetException, Foundation::IOException) +POCO_DECLARE_EXCEPTION(Net_API, NetException, Poco::IOException) POCO_DECLARE_EXCEPTION(Net_API, InvalidAddressException, NetException) POCO_DECLARE_EXCEPTION(Net_API, ServiceNotFoundException, NetException) POCO_DECLARE_EXCEPTION(Net_API, ConnectionAbortedException, NetException) @@ -65,12 +62,14 @@ POCO_DECLARE_EXCEPTION(Net_API, MessageException, NetException) POCO_DECLARE_EXCEPTION(Net_API, MultipartException, MessageException) POCO_DECLARE_EXCEPTION(Net_API, HTTPException, NetException) POCO_DECLARE_EXCEPTION(Net_API, NotAuthenticatedException, HTTPException) +POCO_DECLARE_EXCEPTION(Net_API, UnsupportedRedirectException, HTTPException) POCO_DECLARE_EXCEPTION(Net_API, FTPException, NetException) POCO_DECLARE_EXCEPTION(Net_API, SMTPException, NetException) POCO_DECLARE_EXCEPTION(Net_API, POP3Exception, NetException) +POCO_DECLARE_EXCEPTION(Net_API, ICMPException, NetException) -Net_END +} } // namespace Poco::Net #endif // Net_NetException_INCLUDED diff --git a/Net/include/Net/NetworkInterface.h b/Net/include/Poco/Net/NetworkInterface.h similarity index 90% rename from Net/include/Net/NetworkInterface.h rename to Net/include/Poco/Net/NetworkInterface.h index 7606b17fd..79085e136 100644 --- a/Net/include/Net/NetworkInterface.h +++ b/Net/include/Poco/Net/NetworkInterface.h @@ -1,7 +1,7 @@ // // NetworkInterface.h // -// $Id: //poco/1.1.0/Net/include/Net/NetworkInterface.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/NetworkInterface.h#1 $ // // Library: Net // Package: Sockets @@ -40,22 +40,14 @@ #define Net_NetworkInterface_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_IPAddress_INCLUDED -#include "Net/IPAddress.h" -#endif -#ifndef Foundation_Mutex_INCLUDED -#include "Foundation/Mutex.h" -#endif -#ifndef STD_VECTOR_INCLUDED +#include "Poco/Net/Net.h" +#include "Poco/Net/IPAddress.h" +#include "Poco/Mutex.h" #include -#define STD_VECTOR_INCLUDED -#endif -Net_BEGIN +namespace Poco { +namespace Net { class Net_API NetworkInterface @@ -150,7 +142,7 @@ private: IPAddress _address; int _index; - static Foundation::FastMutex _mutex; + static Poco::FastMutex _mutex; }; @@ -187,7 +179,7 @@ inline bool NetworkInterface::supportsIPv6() const } -Net_END +} } // namespace Poco::Net #endif // Net_NetworkInterface_INCLUDED diff --git a/Net/include/Net/NullPartHandler.h b/Net/include/Poco/Net/NullPartHandler.h similarity index 88% rename from Net/include/Net/NullPartHandler.h rename to Net/include/Poco/Net/NullPartHandler.h index 38a5f8503..b5823ab45 100644 --- a/Net/include/Net/NullPartHandler.h +++ b/Net/include/Poco/Net/NullPartHandler.h @@ -1,7 +1,7 @@ // // NullPartHandler.h // -// $Id: //poco/1.1.0/Net/include/Net/NullPartHandler.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/NullPartHandler.h#1 $ // // Library: Net // Package: Messages @@ -40,15 +40,12 @@ #define Net_NullPartHandler_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_PartHandler_INCLUDED -#include "Net/PartHandler.h" -#endif +#include "Poco/Net/Net.h" +#include "Poco/Net/PartHandler.h" -Net_BEGIN +namespace Poco { +namespace Net { class Net_API NullPartHandler: public PartHandler @@ -66,7 +63,7 @@ public: }; -Net_END +} } // namespace Poco::Net #endif // Net_NullPartHandler_INCLUDED diff --git a/Net/include/Net/POP3ClientSession.h b/Net/include/Poco/Net/POP3ClientSession.h similarity index 89% rename from Net/include/Net/POP3ClientSession.h rename to Net/include/Poco/Net/POP3ClientSession.h index 24217dbc5..3750add4f 100644 --- a/Net/include/Net/POP3ClientSession.h +++ b/Net/include/Poco/Net/POP3ClientSession.h @@ -1,7 +1,7 @@ // // POP3ClientSession.h // -// $Id: //poco/1.1.0/Net/include/Net/POP3ClientSession.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/POP3ClientSession.h#1 $ // // Library: Net // Package: Mail @@ -40,25 +40,15 @@ #define Net_POP3ClientSession_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_DialogSocket_INCLUDED -#include "Net/DialogSocket.h" -#endif -#ifndef Foundation_Timespan_INCLUDED -#include "Foundation/Timespan.h" -#endif -#ifndef STD_OSTREAM_INCLUDED +#include "Poco/Net/Net.h" +#include "Poco/Net/DialogSocket.h" +#include "Poco/Timespan.h" #include -#define STD_OSTREAM_INCLUDED -#endif -#ifndef STD_VECTOR_INCLUDED #include -#endif -Net_BEGIN +namespace Poco { +namespace Net { class MessageHeader; @@ -91,17 +81,17 @@ public: /// the given socket, which must be connected /// to a POP3 server. - POP3ClientSession(const std::string& host, Foundation::UInt16 port = POP3_PORT); + POP3ClientSession(const std::string& host, Poco::UInt16 port = POP3_PORT); /// Creates the POP3ClientSession using a socket connected /// to the given host and port. virtual ~POP3ClientSession(); /// Destroys the SMTPClientSession. - void setTimeout(const Foundation::Timespan& timeout); + void setTimeout(const Poco::Timespan& timeout); /// Sets the timeout for socket read operations. - Foundation::Timespan getTimeout() const; + Poco::Timespan getTimeout() const; /// Returns the timeout for socket read operations. void login(const std::string& username, const std::string& password); @@ -211,7 +201,7 @@ private: }; -Net_END +} } // namespace Poco::Net #endif // Net_POP3ClientSession_INCLUDED diff --git a/Net/include/Net/PartHandler.h b/Net/include/Poco/Net/PartHandler.h similarity index 90% rename from Net/include/Net/PartHandler.h rename to Net/include/Poco/Net/PartHandler.h index d1922d044..518a1db79 100644 --- a/Net/include/Net/PartHandler.h +++ b/Net/include/Poco/Net/PartHandler.h @@ -1,7 +1,7 @@ // // PartHandler.h // -// $Id: //poco/1.1.0/Net/include/Net/PartHandler.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/PartHandler.h#1 $ // // Library: Net // Package: Messages @@ -40,16 +40,12 @@ #define Net_PartHandler_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef STD_ISTREAM_INCLUDED +#include "Poco/Net/Net.h" #include -#define STD_ISTREAM_INCLUDED -#endif -Net_BEGIN +namespace Poco { +namespace Net { class MessageHeader; @@ -88,7 +84,7 @@ private: }; -Net_END +} } // namespace Poco::Net #endif // Net_PartHandler_INCLUDED diff --git a/Net/include/Net/PartSource.h b/Net/include/Poco/Net/PartSource.h similarity index 90% rename from Net/include/Net/PartSource.h rename to Net/include/Poco/Net/PartSource.h index df7e594e1..367364a8f 100644 --- a/Net/include/Net/PartSource.h +++ b/Net/include/Poco/Net/PartSource.h @@ -1,7 +1,7 @@ // // PartSource.h // -// $Id: //poco/1.1.0/Net/include/Net/PartSource.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/PartSource.h#1 $ // // Library: Net // Package: Messages @@ -40,16 +40,12 @@ #define Net_PartSource_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef STD_ISTREAM_INCLUDED +#include "Poco/Net/Net.h" #include -#define STD_ISTREAM_INCLUDED -#endif -Net_BEGIN +namespace Poco { +namespace Net { class Net_API PartSource @@ -101,7 +97,7 @@ inline const std::string& PartSource::mediaType() const } -Net_END +} } // namespace Poco::Net #endif // Net_PartSource_INCLUDED diff --git a/Net/include/Net/QuotedPrintableDecoder.h b/Net/include/Poco/Net/QuotedPrintableDecoder.h similarity index 85% rename from Net/include/Net/QuotedPrintableDecoder.h rename to Net/include/Poco/Net/QuotedPrintableDecoder.h index 38a8a99a0..ab0500f7a 100644 --- a/Net/include/Net/QuotedPrintableDecoder.h +++ b/Net/include/Poco/Net/QuotedPrintableDecoder.h @@ -1,7 +1,7 @@ // // QuotedPrintableDecoder.h // -// $Id: //poco/1.1.0/Net/include/Net/QuotedPrintableDecoder.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/QuotedPrintableDecoder.h#1 $ // // Library: Net // Package: Messages @@ -40,22 +40,16 @@ #define Net_QuotedPrintableDecoder_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Foundation_UnbufferedStreamBuf_INCLUDED -#include "Foundation/UnbufferedStreamBuf.h" -#endif -#ifndef STD_ISTREAM_INCLUDED +#include "Poco/Net/Net.h" +#include "Poco/UnbufferedStreamBuf.h" #include -#define STD_ISTREAM_INCLUDED -#endif -Net_BEGIN +namespace Poco { +namespace Net { -class Net_API QuotedPrintableDecoderBuf: public Foundation::UnbufferedStreamBuf +class Net_API QuotedPrintableDecoderBuf: public Poco::UnbufferedStreamBuf /// This streambuf decodes all quoted-printable (see RFC 2045) /// encoded data read from the istream connected to it. { @@ -96,7 +90,7 @@ public: }; -Net_END +} } // namespace Poco::Net #endif // Net_QuotedPrintableDecoder_INCLUDED diff --git a/Net/include/Net/QuotedPrintableEncoder.h b/Net/include/Poco/Net/QuotedPrintableEncoder.h similarity index 86% rename from Net/include/Net/QuotedPrintableEncoder.h rename to Net/include/Poco/Net/QuotedPrintableEncoder.h index 53f9cc5a1..b471b723b 100644 --- a/Net/include/Net/QuotedPrintableEncoder.h +++ b/Net/include/Poco/Net/QuotedPrintableEncoder.h @@ -1,7 +1,7 @@ // // QuotedPrintableEncoder.h // -// $Id: //poco/1.1.0/Net/include/Net/QuotedPrintableEncoder.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/QuotedPrintableEncoder.h#1 $ // // Library: Net // Package: Messages @@ -40,22 +40,16 @@ #define Net_QuotedPrintableEncoder_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Foundation_UnbufferedStreamBuf_INCLUDED -#include "Foundation/UnbufferedStreamBuf.h" -#endif -#ifndef STD_OSTREAM_INCLUDED +#include "Poco/Net/Net.h" +#include "Poco/UnbufferedStreamBuf.h" #include -#define STD_OSTREAM_INCLUDED -#endif -Net_BEGIN +namespace Poco { +namespace Net { -class Net_API QuotedPrintableEncoderBuf: public Foundation::UnbufferedStreamBuf +class Net_API QuotedPrintableEncoderBuf: public Poco::UnbufferedStreamBuf /// This streambuf encodes all data written /// to it in quoted-printable encoding (see RFC 2045) /// and forwards it to a connected ostream. @@ -107,7 +101,7 @@ public: }; -Net_END +} } // namespace Poco::Net #endif // Net_QuotedPrintableEncoder_INCLUDED diff --git a/Net/include/Poco/Net/RawSocket.h b/Net/include/Poco/Net/RawSocket.h new file mode 100644 index 000000000..d7b7d7a91 --- /dev/null +++ b/Net/include/Poco/Net/RawSocket.h @@ -0,0 +1,169 @@ +// +// RawSocket.h +// +// $Id: //poco/1.2/Net/include/Poco/Net/RawSocket.h#1 $ +// +// Library: Net +// Package: Sockets +// Module: RawSocket +// +// Definition of the RawSocket class. +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef Net_RawSocket_INCLUDED +#define Net_RawSocket_INCLUDED + + +#include "Poco/Net/Net.h" +#include "Poco/Net/Socket.h" + + +namespace Poco { +namespace Net { + + +class Net_API RawSocket: public Socket + /// This class provides an interface to a + /// raw IP socket. +{ +public: + RawSocket(); + /// Creates an unconnected IPv4 raw socket. + + RawSocket(IPAddress::Family family, int proto = IPPROTO_RAW); + /// Creates an unconnected raw socket. + /// + /// The socket will be created for the + /// given address family. + + RawSocket(const SocketAddress& address, bool reuseAddress = false); + /// Creates a raw socket and binds it + /// to the given address. + /// + /// Depending on the address family, the socket + /// will be either an IPv4 or an IPv6 socket. + + RawSocket(const Socket& socket); + /// Creates the RawSocket with the SocketImpl + /// from another socket. The SocketImpl must be + /// a RawSocketImpl, otherwise an InvalidArgumentException + /// will be thrown. + + ~RawSocket(); + /// Destroys the RawSocket. + + RawSocket& operator = (const Socket& socket); + /// Assignment operator. + /// + /// Releases the socket's SocketImpl and + /// attaches the SocketImpl from the other socket and + /// increments the reference count of the SocketImpl. + + void connect(const SocketAddress& address); + /// Restricts incoming and outgoing + /// packets to the specified address. + /// + /// Cannot be used together with bind(). + + void bind(const SocketAddress& address, bool reuseAddress = false); + /// Bind a local address to the socket. + /// + /// This is usually only done when establishing a server + /// socket. + /// + /// If reuseAddress is true, sets the SO_REUSEADDR + /// socket option. + /// + /// Cannot be used together with connect(). + + int sendBytes(const void* buffer, int length, int flags = 0); + /// Sends the contents of the given buffer through + /// the socket. + /// + /// Returns the number of bytes sent, which may be + /// less than the number of bytes specified. + + int receiveBytes(void* buffer, int length, int flags = 0); + /// Receives data from the socket and stores it + /// in buffer. Up to length bytes are received. + /// + /// Returns the number of bytes received. + + int sendTo(const void* buffer, int length, const SocketAddress& address, int flags = 0); + /// Sends the contents of the given buffer through + /// the socket to the given address. + /// + /// Returns the number of bytes sent, which may be + /// less than the number of bytes specified. + + int receiveFrom(void* buffer, int length, SocketAddress& address, int flags = 0); + /// Receives data from the socket and stores it + /// in buffer. Up to length bytes are received. + /// Stores the address of the sender in address. + /// + /// Returns the number of bytes received. + + void setBroadcast(bool flag); + /// Sets the value of the SO_BROADCAST socket option. + /// + /// Setting this flag allows sending datagrams to + /// the broadcast address. + + bool getBroadcast() const; + /// Returns the value of the SO_BROADCAST socket option. + +protected: + RawSocket(SocketImpl* pImpl); + /// Creates the Socket and attaches the given SocketImpl. + /// The socket takes owership of the SocketImpl. + /// + /// The SocketImpl must be a StreamSocketImpl, otherwise + /// an InvalidArgumentException will be thrown. +}; + + +// +// inlines +// +inline void RawSocket::setBroadcast(bool flag) +{ + impl()->setBroadcast(flag); +} + + +inline bool RawSocket::getBroadcast() const +{ + return impl()->getBroadcast(); +} + + +} } // namespace Poco::Net + + +#endif // Net_RawSocket_INCLUDED diff --git a/Net/include/Poco/Net/RawSocketImpl.h b/Net/include/Poco/Net/RawSocketImpl.h new file mode 100644 index 000000000..3854d5dd6 --- /dev/null +++ b/Net/include/Poco/Net/RawSocketImpl.h @@ -0,0 +1,78 @@ +// +// RawSocketImpl.h +// +// $Id: //poco/1.2/Net/include/Poco/Net/RawSocketImpl.h#1 $ +// +// Library: Net +// Package: Sockets +// Module: RawSocketImpl +// +// Definition of the RawSocketImpl class. +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef Net_RawSocketImpl_INCLUDED +#define Net_RawSocketImpl_INCLUDED + + +#include "Poco/Net/Net.h" +#include "Poco/Net/SocketImpl.h" + + +namespace Poco { +namespace Net { + + +class Net_API RawSocketImpl: public SocketImpl + /// This class implements a raw socket. +{ +public: + RawSocketImpl(); + /// Creates an unconnected IPv4 raw socket with IPPROTO_RAW. + + RawSocketImpl(IPAddress::Family family, int proto = IPPROTO_RAW); + /// Creates an unconnected raw socket. + /// + /// The socket will be created for the + /// given address family. + + RawSocketImpl(poco_socket_t sockfd); + /// Creates a RawSocketImpl using the given native socket. + +protected: + void init(int af); + void init2(int af, int proto); + + ~RawSocketImpl(); +}; + + +} } // namespace Poco::Net + + +#endif // Net_RawSocketImpl_INCLUDED diff --git a/Net/include/Net/SMTPClientSession.h b/Net/include/Poco/Net/SMTPClientSession.h similarity index 88% rename from Net/include/Net/SMTPClientSession.h rename to Net/include/Poco/Net/SMTPClientSession.h index ddf795bef..04b662f14 100644 --- a/Net/include/Net/SMTPClientSession.h +++ b/Net/include/Poco/Net/SMTPClientSession.h @@ -1,7 +1,7 @@ // // SMTPClientSession.h // -// $Id: //poco/1.1.0/Net/include/Net/SMTPClientSession.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/SMTPClientSession.h#1 $ // // Library: Net // Package: Mail @@ -40,18 +40,13 @@ #define Net_SMTPClientSession_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_DialogSocket_INCLUDED -#include "Net/DialogSocket.h" -#endif -#ifndef Foundation_Timespan_INCLUDED -#include "Foundation/Timespan.h" -#endif +#include "Poco/Net/Net.h" +#include "Poco/Net/DialogSocket.h" +#include "Poco/Timespan.h" -Net_BEGIN +namespace Poco { +namespace Net { class MailMessage; @@ -73,17 +68,17 @@ public: /// the given socket, which must be connected /// to a SMTP server. - SMTPClientSession(const std::string& host, Foundation::UInt16 port = SMTP_PORT); + SMTPClientSession(const std::string& host, Poco::UInt16 port = SMTP_PORT); /// Creates the SMTPClientSession using a socket connected /// to the given host and port. virtual ~SMTPClientSession(); /// Destroys the SMTPClientSession. - void setTimeout(const Foundation::Timespan& timeout); + void setTimeout(const Poco::Timespan& timeout); /// Sets the timeout for socket read operations. - Foundation::Timespan getTimeout() const; + Poco::Timespan getTimeout() const; /// Returns the timeout for socket read operations. void login(const std::string& hostname); @@ -178,7 +173,7 @@ inline bool SMTPClientSession::isPermanentNegative(int status) } -Net_END +} } // namespace Poco::Net #endif // Net_SMTPClientSession_INCLUDED diff --git a/Net/include/Net/ServerSocket.h b/Net/include/Poco/Net/ServerSocket.h similarity index 89% rename from Net/include/Net/ServerSocket.h rename to Net/include/Poco/Net/ServerSocket.h index f7a8a1657..4aff1059f 100644 --- a/Net/include/Net/ServerSocket.h +++ b/Net/include/Poco/Net/ServerSocket.h @@ -1,7 +1,7 @@ // // ServerSocket.h // -// $Id: //poco/1.1.0/Net/include/Net/ServerSocket.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/ServerSocket.h#1 $ // // Library: Net // Package: Sockets @@ -40,18 +40,13 @@ #define Net_ServerSocket_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_Socket_INCLUDED -#include "Net/Socket.h" -#endif -#ifndef Net_StreamSocket_INCLUDED -#include "Net/StreamSocket.h" -#endif +#include "Poco/Net/Net.h" +#include "Poco/Net/Socket.h" +#include "Poco/Net/StreamSocket.h" -Net_BEGIN +namespace Poco { +namespace Net { class Net_API ServerSocket: public Socket @@ -79,7 +74,7 @@ public: /// After successful construction, the server socket /// is ready to accept connections. - ServerSocket(Foundation::UInt16 port, int backlog = 64); + ServerSocket(Poco::UInt16 port, int backlog = 64); /// Creates a server socket, binds it /// to the given port and puts it in listening /// state. @@ -107,7 +102,7 @@ public: /// If reuseAddress is true, sets the SO_REUSEADDR /// socket option. - virtual void bind(Foundation::UInt16 port, bool reuseAddress = false); + virtual void bind(Poco::UInt16 port, bool reuseAddress = false); /// Bind a local port to the socket. /// /// This is usually only done when establishing a server @@ -155,7 +150,7 @@ protected: }; -Net_END +} } // namespace Poco::Net #endif // Net_ServerSocket_INCLUDED diff --git a/Net/include/Net/ServerSocketImpl.h b/Net/include/Poco/Net/ServerSocketImpl.h similarity index 88% rename from Net/include/Net/ServerSocketImpl.h rename to Net/include/Poco/Net/ServerSocketImpl.h index af9d92e01..4b23b08d3 100644 --- a/Net/include/Net/ServerSocketImpl.h +++ b/Net/include/Poco/Net/ServerSocketImpl.h @@ -1,7 +1,7 @@ // // ServerSocketImpl.h // -// $Id: //poco/1.1.0/Net/include/Net/ServerSocketImpl.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/ServerSocketImpl.h#1 $ // // Library: Net // Package: Sockets @@ -40,15 +40,12 @@ #define Net_ServerSocketImpl_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_SocketImpl_INCLUDED -#include "Net/SocketImpl.h" -#endif +#include "Poco/Net/Net.h" +#include "Poco/Net/SocketImpl.h" -Net_BEGIN +namespace Poco { +namespace Net { class Net_API ServerSocketImpl: public SocketImpl @@ -64,7 +61,7 @@ protected: }; -Net_END +} } // namespace Poco::Net #endif // Net_ServerSocketImpl_INCLUDED diff --git a/Net/include/Net/Socket.h b/Net/include/Poco/Net/Socket.h similarity index 87% rename from Net/include/Net/Socket.h rename to Net/include/Poco/Net/Socket.h index 29dba1be4..5763276a3 100644 --- a/Net/include/Net/Socket.h +++ b/Net/include/Poco/Net/Socket.h @@ -1,7 +1,7 @@ // // Socket.h // -// $Id: //poco/1.1.0/Net/include/Net/Socket.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/Socket.h#1 $ // // Library: Net // Package: Sockets @@ -40,19 +40,13 @@ #define Net_Socket_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_SocketImpl_INCLUDED -#include "Net/SocketImpl.h" -#endif -#ifndef STD_VECTOR_INCLUDED +#include "Poco/Net/Net.h" +#include "Poco/Net/SocketImpl.h" #include -#define STD_VECTOR_INCLUDED -#endif -Net_BEGIN +namespace Poco { +namespace Net { class Net_API Socket @@ -116,7 +110,7 @@ public: void close(); /// Closes the socket. - static int select(SocketList& readList, SocketList& writeList, SocketList& exceptList, const Foundation::Timespan& timeout); + static int select(SocketList& readList, SocketList& writeList, SocketList& exceptList, const Poco::Timespan& timeout); /// Determines the status of one or more sockets, /// using a call to select(). /// @@ -136,7 +130,7 @@ public: /// * writeList contains those sockets ready for writing, /// * exceptList contains those sockets with a pending error. - bool poll(const Foundation::Timespan& timeout, int mode) const; + bool poll(const Poco::Timespan& timeout, int mode) const; /// Determines the status of the socket, using a /// call to select(). /// @@ -170,23 +164,23 @@ public: /// value previously set with setReceiveBufferSize(), /// as the system is free to adjust the value. - void setSendTimeout(const Foundation::Timespan& timeout); + void setSendTimeout(const Poco::Timespan& timeout); /// Sets the send timeout for the socket. - Foundation::Timespan getSendTimeout() const; + Poco::Timespan getSendTimeout() const; /// Returns the send timeout for the socket. /// /// The returned timeout may be different than the /// timeout previously set with setSendTimeout(), /// as the system is free to adjust the value. - void setReceiveTimeout(const Foundation::Timespan& timeout); + void setReceiveTimeout(const Poco::Timespan& timeout); /// Sets the send timeout for the socket. /// /// On systems that do not support SO_RCVTIMEO, a /// workaround using poll() is provided. - Foundation::Timespan getReceiveTimeout() const; + Poco::Timespan getReceiveTimeout() const; /// Returns the receive timeout for the socket. /// /// The returned timeout may be different than the @@ -205,7 +199,7 @@ public: /// Sets the socket option specified by level and option /// to the given integer value. - void setOption(int level, int option, const Foundation::Timespan& value); + void setOption(int level, int option, const Poco::Timespan& value); /// Sets the socket option specified by level and option /// to the given time value. @@ -225,7 +219,7 @@ public: /// Returns the value of the socket option /// specified by level and option. - void getOption(int level, int option, Foundation::Timespan& value) const; + void getOption(int level, int option, Poco::Timespan& value) const; /// Returns the value of the socket option /// specified by level and option. @@ -351,7 +345,7 @@ inline void Socket::close() } -inline bool Socket::poll(const Foundation::Timespan& timeout, int mode) const +inline bool Socket::poll(const Poco::Timespan& timeout, int mode) const { return _pImpl->poll(timeout, mode); } @@ -387,25 +381,25 @@ inline int Socket::getReceiveBufferSize() const } -inline void Socket::setSendTimeout(const Foundation::Timespan& timeout) +inline void Socket::setSendTimeout(const Poco::Timespan& timeout) { _pImpl->setSendTimeout(timeout); } -inline Foundation::Timespan Socket::getSendTimeout() const +inline Poco::Timespan Socket::getSendTimeout() const { return _pImpl->getSendTimeout(); } -inline void Socket::setReceiveTimeout(const Foundation::Timespan& timeout) +inline void Socket::setReceiveTimeout(const Poco::Timespan& timeout) { _pImpl->setReceiveTimeout(timeout); } -inline Foundation::Timespan Socket::getReceiveTimeout() const +inline Poco::Timespan Socket::getReceiveTimeout() const { return _pImpl->getReceiveTimeout(); } @@ -429,7 +423,7 @@ inline void Socket::setOption(int level, int option, unsigned char value) } -inline void Socket::setOption(int level, int option, const Foundation::Timespan& value) +inline void Socket::setOption(int level, int option, const Poco::Timespan& value) { _pImpl->setOption(level, option, value); } @@ -459,7 +453,7 @@ inline void Socket::getOption(int level, int option, unsigned char& value) const } -inline void Socket::getOption(int level, int option, Foundation::Timespan& value) const +inline void Socket::getOption(int level, int option, Poco::Timespan& value) const { _pImpl->getOption(level, option, value); } @@ -589,7 +583,7 @@ inline bool Socket::supportsIPv6() } -Net_END +} } // namespace Poco::Net #endif // Net_Socket_INCLUDED diff --git a/Net/include/Net/SocketAcceptor.h b/Net/include/Poco/Net/SocketAcceptor.h similarity index 85% rename from Net/include/Net/SocketAcceptor.h rename to Net/include/Poco/Net/SocketAcceptor.h index 72be005df..b966156cc 100644 --- a/Net/include/Net/SocketAcceptor.h +++ b/Net/include/Poco/Net/SocketAcceptor.h @@ -1,7 +1,7 @@ // // SocketAcceptor.h // -// $Id: //poco/1.1.0/Net/include/Net/SocketAcceptor.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/SocketAcceptor.h#1 $ // // Library: Net // Package: Reactor @@ -40,24 +40,15 @@ #define Net_SocketAcceptor_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_SocketNotification_INCLUDED -#include "Net/SocketNotification.h" -#endif -#ifndef Net_ServerSocket_INCLUDED -#include "Net/ServerSocket.h" -#endif -#ifndef Net_StreamSocket_INCLUDED -#include "Net/StreamSocket.h" -#endif -#ifndef Foundation_Observer_INCLUDED -#include "Foundation/Observer.h" -#endif +#include "Poco/Net/Net.h" +#include "Poco/Net/SocketNotification.h" +#include "Poco/Net/ServerSocket.h" +#include "Poco/Net/StreamSocket.h" +#include "Poco/Observer.h" -Net_BEGIN +namespace Poco { +namespace Net { template @@ -129,7 +120,7 @@ public: /// The overriding method must call the baseclass implementation first. { _pReactor = &reactor; - _pReactor->addEventHandler(_socket, Foundation::Observer(*this, &SocketAcceptor::onAccept)); + _pReactor->addEventHandler(_socket, Poco::Observer(*this, &SocketAcceptor::onAccept)); } virtual void unregisterAcceptor() @@ -142,7 +133,7 @@ public: { if (_pReactor) { - _pReactor->removeEventHandler(_socket, Foundation::Observer(*this, &SocketAcceptor::onAccept)); + _pReactor->removeEventHandler(_socket, Poco::Observer(*this, &SocketAcceptor::onAccept)); } } @@ -187,7 +178,7 @@ private: }; -Net_END +} } // namespace Poco::Net #endif // Net_SocketAcceptor_INCLUDED diff --git a/Net/include/Net/SocketAddress.h b/Net/include/Poco/Net/SocketAddress.h similarity index 78% rename from Net/include/Net/SocketAddress.h rename to Net/include/Poco/Net/SocketAddress.h index db17bb807..0acb3f443 100644 --- a/Net/include/Net/SocketAddress.h +++ b/Net/include/Poco/Net/SocketAddress.h @@ -1,7 +1,7 @@ // // SocketAddress.h // -// $Id: //poco/1.1.0/Net/include/Net/SocketAddress.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/SocketAddress.h#1 $ // // Library: Net // Package: NetCore @@ -40,18 +40,13 @@ #define Net_SocketAddress_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_SocketDefs_INCLUDED -#include "Net/SocketDefs.h" -#endif -#ifndef Net_IPAddress_INCLUDED -#include "Net/IPAddress.h" -#endif +#include "Poco/Net/Net.h" +#include "Poco/Net/SocketDefs.h" +#include "Poco/Net/IPAddress.h" -Net_BEGIN +namespace Poco { +namespace Net { class IPAddress; @@ -68,10 +63,10 @@ public: SocketAddress(); /// Creates a wildcard (all zero) IPv4 SocketAddress. - SocketAddress(const IPAddress& host, Foundation::UInt16 port); + SocketAddress(const IPAddress& host, Poco::UInt16 port); /// Creates a SocketAddress from an IP address and a port number. - SocketAddress(const std::string& host, Foundation::UInt16 port); + SocketAddress(const std::string& host, Poco::UInt16 port); /// Creates a SocketAddress from an IP address and a port number. /// /// The IP address must either be a domain name, or it must @@ -86,6 +81,17 @@ public: /// /// The given port must either be a decimal port number, or /// a service name. + + explicit SocketAddress(const std::string& hostAndPort); + /// Creates a SocketAddress from an IP address or host name and a + /// port number/service name. Host name/address and port number must + /// be separated by a colon. In case of an IPv6 address, + /// the address part must be enclosed in brackets. + /// + /// Examples: + /// 192.168.1.10:80 + /// [::FFFF:192.168.1.120]:2040 + /// www.appinf.com:8080 SocketAddress(const SocketAddress& addr); /// Creates a SocketAddress by copying another one. @@ -105,7 +111,7 @@ public: IPAddress host() const; /// Returns the host IP address. - Foundation::UInt16 port() const; + Poco::UInt16 port() const; /// Returns the port number. poco_socklen_t length() const; @@ -132,9 +138,9 @@ public: }; protected: - void init(const IPAddress& host, Foundation::UInt16 port); - void init(const std::string& host, Foundation::UInt16 port); - Foundation::UInt16 resolveService(const std::string& service); + void init(const IPAddress& host, Poco::UInt16 port); + void init(const std::string& host, Poco::UInt16 port); + Poco::UInt16 resolveService(const std::string& service); private: SocketAddressImpl* _pImpl; @@ -150,7 +156,7 @@ inline void swap(SocketAddress& a1, SocketAddress& a2) } -Net_END +} } // namespace Poco::Net #endif // Net_SocketAddress_INCLUDED diff --git a/Net/include/Net/SocketConnector.h b/Net/include/Poco/Net/SocketConnector.h similarity index 80% rename from Net/include/Net/SocketConnector.h rename to Net/include/Poco/Net/SocketConnector.h index 515e5d987..1e200ea39 100644 --- a/Net/include/Net/SocketConnector.h +++ b/Net/include/Poco/Net/SocketConnector.h @@ -1,7 +1,7 @@ // // SocketConnector.h // -// $Id: //poco/1.1.0/Net/include/Net/SocketConnector.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/SocketConnector.h#1 $ // // Library: Net // Package: Reactor @@ -40,24 +40,15 @@ #define Net_SocketConnector_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_SocketNotification_INCLUDED -#include "Net/SocketNotification.h" -#endif -#ifndef Net_SocketAddress_INCLUDED -#include "Net/SocketAddress.h" -#endif -#ifndef Net_StreamSocket_INCLUDED -#include "Net/StreamSocket.h" -#endif -#ifndef Foundation_Observer_INCLUDED -#include "Foundation/Observer.h" -#endif +#include "Poco/Net/Net.h" +#include "Poco/Net/SocketNotification.h" +#include "Poco/Net/SocketAddress.h" +#include "Poco/Net/StreamSocket.h" +#include "Poco/Observer.h" -Net_BEGIN +namespace Poco { +namespace Net { template @@ -133,9 +124,9 @@ public: /// The overriding method must call the baseclass implementation first. { _pReactor = &reactor; - _pReactor->addEventHandler(_socket, Foundation::Observer(*this, &SocketConnector::onReadable)); - _pReactor->addEventHandler(_socket, Foundation::Observer(*this, &SocketConnector::onWritable)); - _pReactor->addEventHandler(_socket, Foundation::Observer(*this, &SocketConnector::onError)); + _pReactor->addEventHandler(_socket, Poco::Observer(*this, &SocketConnector::onReadable)); + _pReactor->addEventHandler(_socket, Poco::Observer(*this, &SocketConnector::onWritable)); + _pReactor->addEventHandler(_socket, Poco::Observer(*this, &SocketConnector::onError)); } virtual void unregisterConnector() @@ -148,9 +139,9 @@ public: { if (_pReactor) { - _pReactor->removeEventHandler(_socket, Foundation::Observer(*this, &SocketConnector::onReadable)); - _pReactor->removeEventHandler(_socket, Foundation::Observer(*this, &SocketConnector::onWritable)); - _pReactor->removeEventHandler(_socket, Foundation::Observer(*this, &SocketConnector::onError)); + _pReactor->removeEventHandler(_socket, Poco::Observer(*this, &SocketConnector::onReadable)); + _pReactor->removeEventHandler(_socket, Poco::Observer(*this, &SocketConnector::onWritable)); + _pReactor->removeEventHandler(_socket, Poco::Observer(*this, &SocketConnector::onError)); } } @@ -230,7 +221,7 @@ private: }; -Net_END +} } // namespace Poco::Net #endif // Net_SocketConnector_INCLUDED diff --git a/Net/include/Net/SocketDefs.h b/Net/include/Poco/Net/SocketDefs.h similarity index 96% rename from Net/include/Net/SocketDefs.h rename to Net/include/Poco/Net/SocketDefs.h index 076becfc9..edd16a06f 100644 --- a/Net/include/Net/SocketDefs.h +++ b/Net/include/Poco/Net/SocketDefs.h @@ -1,7 +1,7 @@ // // SocketDefs.h // -// $Id: //poco/1.1.0/Net/include/Net/SocketDefs.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/SocketDefs.h#1 $ // // Library: Net // Package: NetCore diff --git a/Net/include/Net/SocketImpl.h b/Net/include/Poco/Net/SocketImpl.h similarity index 89% rename from Net/include/Net/SocketImpl.h rename to Net/include/Poco/Net/SocketImpl.h index 8fddab739..0f90ab04b 100644 --- a/Net/include/Net/SocketImpl.h +++ b/Net/include/Poco/Net/SocketImpl.h @@ -1,7 +1,7 @@ // // SocketImpl.h // -// $Id: //poco/1.1.0/Net/include/Net/SocketImpl.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/SocketImpl.h#1 $ // // Library: Net // Package: Sockets @@ -40,27 +40,18 @@ #define Net_SocketImpl_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_SocketDefs_INCLUDED -#include "Net/SocketDefs.h" -#endif -#ifndef Net_SocketAddress_INCLUDED -#include "Net/SocketAddress.h" -#endif -#ifndef Foundation_RefCountedObject_INCLUDED -#include "Foundation/RefCountedObject.h" -#endif -#ifndef Foundation_Timespan_INCLUDED -#include "Foundation/Timespan.h" -#endif +#include "Poco/Net/Net.h" +#include "Poco/Net/SocketDefs.h" +#include "Poco/Net/SocketAddress.h" +#include "Poco/RefCountedObject.h" +#include "Poco/Timespan.h" -Net_BEGIN +namespace Poco { +namespace Net { -class Net_API SocketImpl: public Foundation::RefCountedObject +class Net_API SocketImpl: public Poco::RefCountedObject /// This class encapsulates the Berkeley sockets API. /// /// Subclasses implement specific socket types like @@ -96,7 +87,7 @@ public: /// connection is established. Instead, incoming and outgoing /// packets are restricted to the specified address. - virtual void connect(const SocketAddress& address, const Foundation::Timespan& timeout); + virtual void connect(const SocketAddress& address, const Poco::Timespan& timeout); /// Initializes the socket, sets the socket timeout and /// establishes a connection to the TCP server at the given address. @@ -178,7 +169,7 @@ public: /// Returns the number of bytes available that can be read /// without causing the socket to block. - virtual bool poll(const Foundation::Timespan& timeout, int mode); + virtual bool poll(const Poco::Timespan& timeout, int mode); /// Determines the status of the socket, using a /// call to select(). /// @@ -208,23 +199,23 @@ public: /// value previously set with setReceiveBufferSize(), /// as the system is free to adjust the value. - virtual void setSendTimeout(const Foundation::Timespan& timeout); + virtual void setSendTimeout(const Poco::Timespan& timeout); /// Sets the send timeout for the socket. - virtual Foundation::Timespan getSendTimeout(); + virtual Poco::Timespan getSendTimeout(); /// Returns the send timeout for the socket. /// /// The returned timeout may be different than the /// timeout previously set with setSendTimeout(), /// as the system is free to adjust the value. - virtual void setReceiveTimeout(const Foundation::Timespan& timeout); + virtual void setReceiveTimeout(const Poco::Timespan& timeout); /// Sets the send timeout for the socket. /// /// On systems that do not support SO_RCVTIMEO, a /// workaround using poll() is provided. - virtual Foundation::Timespan getReceiveTimeout(); + virtual Poco::Timespan getReceiveTimeout(); /// Returns the receive timeout for the socket. /// /// The returned timeout may be different than the @@ -249,7 +240,7 @@ public: /// Sets the socket option specified by level and option /// to the given integer value. - void setOption(int level, int option, const Foundation::Timespan& value); + void setOption(int level, int option, const Poco::Timespan& value); /// Sets the socket option specified by level and option /// to the given time value. @@ -273,7 +264,7 @@ public: /// Returns the value of the socket option /// specified by level and option. - void getOption(int level, int option, Foundation::Timespan& value); + void getOption(int level, int option, Poco::Timespan& value); /// Returns the value of the socket option /// specified by level and option. @@ -415,7 +406,7 @@ private: poco_socket_t _sockfd; #if defined(POCO_BROKEN_TIMEOUTS) - Foundation::Timespan _recvTimeout; + Poco::Timespan _recvTimeout; #endif friend class Socket; @@ -454,7 +445,7 @@ inline void SocketImpl::invalidate() } -Net_END +} } // namespace Poco::Net #endif // Net_SocketImpl_INCLUDED diff --git a/Net/include/Net/SocketNotification.h b/Net/include/Poco/Net/SocketNotification.h similarity index 89% rename from Net/include/Net/SocketNotification.h rename to Net/include/Poco/Net/SocketNotification.h index 3efaff563..87c2487c1 100644 --- a/Net/include/Net/SocketNotification.h +++ b/Net/include/Poco/Net/SocketNotification.h @@ -1,7 +1,7 @@ // // SocketNotification.h // -// $Id: //poco/1.1.0/Net/include/Net/SocketNotification.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/SocketNotification.h#1 $ // // Library: Net // Package: Reactor @@ -40,24 +40,19 @@ #define Net_SocketNotification_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_Socket_INCLUDED -#include "Net/Socket.h" -#endif -#ifndef Foundation_Notification_INCLUDED -#include "Foundation/Notification.h" -#endif +#include "Poco/Net/Net.h" +#include "Poco/Net/Socket.h" +#include "Poco/Notification.h" -Net_BEGIN +namespace Poco { +namespace Net { class SocketReactor; -class Net_API SocketNotification: public Foundation::Notification +class Net_API SocketNotification: public Poco::Notification /// The base class for all notifications generated by /// the SocketReactor. { @@ -161,7 +156,7 @@ inline Socket& SocketNotification::socket() } -Net_END +} } // namespace Poco::Net #endif // Net_SocketNotification_INCLUDED diff --git a/Net/include/Net/SocketNotifier.h b/Net/include/Poco/Net/SocketNotifier.h similarity index 71% rename from Net/include/Net/SocketNotifier.h rename to Net/include/Poco/Net/SocketNotifier.h index 505f985d7..3b133a555 100644 --- a/Net/include/Net/SocketNotifier.h +++ b/Net/include/Poco/Net/SocketNotifier.h @@ -1,7 +1,7 @@ // // SocketNotifier.h // -// $Id: //poco/1.1.0/Net/include/Net/SocketNotifier.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/SocketNotifier.h#1 $ // // Library: Net // Package: Reactor @@ -40,28 +40,16 @@ #define Net_SocketNotifier_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_Socket_INCLUDED -#include "Net/Socket.h" -#endif -#ifndef Foundation_RefCountedObject_INCLUDED -#include "Foundation/RefCountedObject.h" -#endif -#ifndef Foundation_NotificationCenter_INCLUDED -#include "Foundation/NotificationCenter.h" -#endif -#ifndef Foundation_Observer_INCLUDED -#include "Foundation/Observer.h" -#endif -#ifndef STD_SET_INCLUDED +#include "Poco/Net/Net.h" +#include "Poco/Net/Socket.h" +#include "Poco/RefCountedObject.h" +#include "Poco/NotificationCenter.h" +#include "Poco/Observer.h" #include -#define STD_SET_INCLUDED -#endif -Net_BEGIN +namespace Poco { +namespace Net { class Socket; @@ -69,7 +57,7 @@ class SocketReactor; class SocketNotification; -class Net_API SocketNotifier: public Foundation::RefCountedObject +class Net_API SocketNotifier: public Poco::RefCountedObject /// This class is used internally by SocketReactor /// to notify registered event handlers of socket events. { @@ -77,10 +65,10 @@ public: SocketNotifier(const Socket& socket); /// Creates the SocketNotifier for the given socket. - void addObserver(SocketReactor* pReactor, const Foundation::AbstractObserver& observer); + void addObserver(SocketReactor* pReactor, const Poco::AbstractObserver& observer); /// Adds the given observer. - void removeObserver(SocketReactor* pReactor, const Foundation::AbstractObserver& observer); + void removeObserver(SocketReactor* pReactor, const Poco::AbstractObserver& observer); /// Removes the given observer. bool accepts(SocketNotification* pNotification); @@ -97,10 +85,11 @@ protected: /// Destroys the SocketNotifier. private: - typedef std::multiset EventSet; - EventSet _events; - Foundation::NotificationCenter _nc; - Socket _socket; + typedef std::multiset EventSet; + + EventSet _events; + Poco::NotificationCenter _nc; + Socket _socket; }; @@ -119,7 +108,7 @@ inline bool SocketNotifier::hasObservers() const } -Net_END +} } // namespace Poco::Net #endif // Net_SocketNotifier_INCLUDED diff --git a/Net/include/Net/SocketReactor.h b/Net/include/Poco/Net/SocketReactor.h similarity index 78% rename from Net/include/Net/SocketReactor.h rename to Net/include/Poco/Net/SocketReactor.h index 72820cc0f..cd3103713 100644 --- a/Net/include/Net/SocketReactor.h +++ b/Net/include/Poco/Net/SocketReactor.h @@ -1,7 +1,7 @@ // // SocketReactor.h // -// $Id: //poco/1.1.0/Net/include/Net/SocketReactor.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/SocketReactor.h#1 $ // // Library: Net // Package: Reactor @@ -40,31 +40,17 @@ #define Net_SocketReactor_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_Socket_INCLUDED -#include "Net/Socket.h" -#endif -#ifndef Foundation_Runnable_INCLUDED -#include "Foundation/Runnable.h" -#endif -#ifndef Foundation_Timespan_INCLUDED -#include "Foundation/Timespan.h" -#endif -#ifndef Foundation_Observer_INCLUDED -#include "Foundation/Observer.h" -#endif -#ifndef Foundation_AutoPtr_INCLUDED -#include "Foundation/AutoPtr.h" -#endif -#ifndef STD_MAP_INCLUDED +#include "Poco/Net/Net.h" +#include "Poco/Net/Socket.h" +#include "Poco/Runnable.h" +#include "Poco/Timespan.h" +#include "Poco/Observer.h" +#include "Poco/AutoPtr.h" #include -#define STD_MAP_INCLUDED -#endif -Net_BEGIN +namespace Poco { +namespace Net { class Socket; @@ -72,7 +58,7 @@ class SocketNotification; class SocketNotifier; -class Net_API SocketReactor: public Foundation::Runnable +class Net_API SocketReactor: public Poco::Runnable /// This class, which is part of the Reactor pattern, /// implements the "Initiation Dispatcher". /// @@ -137,7 +123,7 @@ public: SocketReactor(); /// Creates the SocketReactor. - SocketReactor(const Foundation::Timespan& timeout); + SocketReactor(const Poco::Timespan& timeout); /// Creates the SocketReactor, using the given timeout. virtual ~SocketReactor(); @@ -153,7 +139,7 @@ public: /// The reactor will be stopped when the next event /// (including a timeout event) occurs. - void setTimeout(const Foundation::Timespan& timeout); + void setTimeout(const Poco::Timespan& timeout); /// Sets the timeout. /// /// If no other event occurs for the given timeout @@ -164,21 +150,21 @@ public: /// The timeout is passed to the Socket::select() /// method. - const Foundation::Timespan& getTimeout() const; + const Poco::Timespan& getTimeout() const; /// Returns the timeout. - void addEventHandler(const Socket& socket, const Foundation::AbstractObserver& observer); + void addEventHandler(const Socket& socket, const Poco::AbstractObserver& observer); /// Registers an event handler with the SocketReactor. /// /// Usage: - /// Foundation::Observer obs(*this, &MyEventHandler::handleMyEvent); + /// Poco::Observer obs(*this, &MyEventHandler::handleMyEvent); /// reactor.addEventHandler(obs); - void removeEventHandler(const Socket& socket, const Foundation::AbstractObserver& observer); + void removeEventHandler(const Socket& socket, const Poco::AbstractObserver& observer); /// Unregisters an event handler with the SocketReactor. /// /// Usage: - /// Foundation::Observer obs(*this, &MyEventHandler::handleMyEvent); + /// Poco::Observer obs(*this, &MyEventHandler::handleMyEvent); /// reactor.removeEventHandler(obs); protected: @@ -204,8 +190,8 @@ protected: /// Dispatches the given notification to all observers. private: - typedef Foundation::AutoPtr NotifierPtr; - typedef Foundation::AutoPtr NotificationPtr; + typedef Poco::AutoPtr NotifierPtr; + typedef Poco::AutoPtr NotificationPtr; typedef std::map EventHandlerMap; void dispatch(NotifierPtr& pNotifier, SocketNotification* pNotification); @@ -215,21 +201,21 @@ private: DEFAULT_TIMEOUT = 250000 }; - bool _stop; - Foundation::Timespan _timeout; - EventHandlerMap _handlers; - NotificationPtr _pReadableNotification; - NotificationPtr _pWritableNotification; - NotificationPtr _pErrorNotification; - NotificationPtr _pTimeoutNotification; - NotificationPtr _pShutdownNotification; - Foundation::FastMutex _mutex; + bool _stop; + Poco::Timespan _timeout; + EventHandlerMap _handlers; + NotificationPtr _pReadableNotification; + NotificationPtr _pWritableNotification; + NotificationPtr _pErrorNotification; + NotificationPtr _pTimeoutNotification; + NotificationPtr _pShutdownNotification; + Poco::FastMutex _mutex; friend class SocketNotifier; }; -Net_END +} } // namespace Poco::Net #endif // Net_SocketReactor_INCLUDED diff --git a/Net/include/Net/SocketStream.h b/Net/include/Poco/Net/SocketStream.h similarity index 87% rename from Net/include/Net/SocketStream.h rename to Net/include/Poco/Net/SocketStream.h index 11d9f4d73..815acfc54 100644 --- a/Net/include/Net/SocketStream.h +++ b/Net/include/Poco/Net/SocketStream.h @@ -1,7 +1,7 @@ // // SocketStream.h // -// $Id: //poco/1.1.0/Net/include/Net/SocketStream.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/SocketStream.h#1 $ // // Library: Net // Package: Sockets @@ -40,32 +40,21 @@ #define Net_SocketStream_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_StreamSocket_INCLUDED -#include "Net/StreamSocket.h" -#endif -#ifndef Foundation_BufferedBidirectionalStreamBuf_INCLUDED -#include "Foundation/BufferedBidirectionalStreamBuf.h" -#endif -#ifndef STD_ISTREAM_INCLUDED +#include "Poco/Net/Net.h" +#include "Poco/Net/StreamSocket.h" +#include "Poco/BufferedBidirectionalStreamBuf.h" #include -#define STD_ISTREAM_INCLUDED -#endif -#ifndef STD_OSTREAM_INCLUDED #include -#define STD_OSTREAM_INCLUDED -#endif -Net_BEGIN +namespace Poco { +namespace Net { class StreamSocketImpl; -class Net_API SocketStreamBuf: public Foundation::BufferedBidirectionalStreamBuf +class Net_API SocketStreamBuf: public Poco::BufferedBidirectionalStreamBuf /// This is the streambuf class used for reading from and writing to a socket. { public: @@ -204,7 +193,7 @@ inline StreamSocketImpl* SocketStreamBuf::socketImpl() const } -Net_END +} } // namespace Poco::Net #endif // Net_SocketStream_INCLUDED diff --git a/Net/include/Net/StreamSocket.h b/Net/include/Poco/Net/StreamSocket.h similarity index 86% rename from Net/include/Net/StreamSocket.h rename to Net/include/Poco/Net/StreamSocket.h index b4ad1f443..eda0d2408 100644 --- a/Net/include/Net/StreamSocket.h +++ b/Net/include/Poco/Net/StreamSocket.h @@ -1,7 +1,7 @@ // // StreamSocket.h // -// $Id: //poco/1.1.0/Net/include/Net/StreamSocket.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/StreamSocket.h#1 $ // // Library: Net // Package: Sockets @@ -40,15 +40,12 @@ #define Net_StreamSocket_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_Socket_INCLUDED -#include "Net/Socket.h" -#endif +#include "Poco/Net/Net.h" +#include "Poco/Net/Socket.h" -Net_BEGIN +namespace Poco { +namespace Net { class StreamSocketImpl; @@ -93,7 +90,7 @@ public: /// connection is established. Instead, incoming and outgoing /// packets are restricted to the specified address. - void connect(const SocketAddress& address, const Foundation::Timespan& timeout); + void connect(const SocketAddress& address, const Poco::Timespan& timeout); /// Initializes the socket, sets the socket timeout and /// establishes a connection to the TCP server at the given address. @@ -123,7 +120,13 @@ public: /// Receives data from the socket and stores it /// in buffer. Up to length bytes are received. /// - /// Returns the number of bytes received. + /// Returns the number of bytes received. + /// A return value of 0 means a graceful shutdown + /// of the connection from the peer. + /// + /// Throws a TimeoutException if a receive timeout has + /// been set and nothing is received within that interval. + /// Throws a NetException (or a subclass) in case of other errors. void sendUrgent(unsigned char data); /// Sends one byte of urgent data through @@ -134,7 +137,7 @@ public: /// The preferred way for a socket to receive urgent data /// is by enabling the SO_OOBINLINE option. -protected: +public: StreamSocket(SocketImpl* pImpl); /// Creates the Socket and attaches the given SocketImpl. /// The socket takes owership of the SocketImpl. @@ -147,7 +150,7 @@ protected: }; -Net_END +} } // namespace Poco::Net #endif // Net_StreamSocket_INCLUDED diff --git a/Net/include/Net/StreamSocketImpl.h b/Net/include/Poco/Net/StreamSocketImpl.h similarity index 88% rename from Net/include/Net/StreamSocketImpl.h rename to Net/include/Poco/Net/StreamSocketImpl.h index 2ff3226c4..a0f42c783 100644 --- a/Net/include/Net/StreamSocketImpl.h +++ b/Net/include/Poco/Net/StreamSocketImpl.h @@ -1,7 +1,7 @@ // // StreamSocketImpl.h // -// $Id: //poco/1.1.0/Net/include/Net/StreamSocketImpl.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/StreamSocketImpl.h#1 $ // // Library: Net // Package: Sockets @@ -40,15 +40,12 @@ #define Net_StreamSocketImpl_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_SocketImpl_INCLUDED -#include "Net/SocketImpl.h" -#endif +#include "Poco/Net/Net.h" +#include "Poco/Net/SocketImpl.h" -Net_BEGIN +namespace Poco { +namespace Net { class Net_API StreamSocketImpl: public SocketImpl @@ -69,7 +66,7 @@ protected: }; -Net_END +} } // namespace Poco::Net #endif // Net_StreamSocketImpl_INCLUDED diff --git a/Net/include/Net/StringPartSource.h b/Net/include/Poco/Net/StringPartSource.h similarity index 88% rename from Net/include/Net/StringPartSource.h rename to Net/include/Poco/Net/StringPartSource.h index 8bac4b34f..21f49d595 100644 --- a/Net/include/Net/StringPartSource.h +++ b/Net/include/Poco/Net/StringPartSource.h @@ -1,7 +1,7 @@ // // StringPartSource.h // -// $Id: //poco/1.1.0/Net/include/Net/StringPartSource.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/StringPartSource.h#1 $ // // Library: Net // Package: Messages @@ -40,19 +40,13 @@ #define Net_StringPartSource_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_PartSource_INCLUDED -#include "Net/PartSource.h" -#endif -#ifndef STD_SSTREAM_INCLUDED +#include "Poco/Net/Net.h" +#include "Poco/Net/PartSource.h" #include -#define STD_SSTREAM_INCLUDED -#endif -Net_BEGIN +namespace Poco { +namespace Net { class Net_API StringPartSource: public PartSource @@ -87,7 +81,7 @@ private: }; -Net_END +} } // namespace Poco::Net #endif // Net_StringPartSource_INCLUDED diff --git a/Net/include/Net/TCPServer.h b/Net/include/Poco/Net/TCPServer.h similarity index 88% rename from Net/include/Net/TCPServer.h rename to Net/include/Poco/Net/TCPServer.h index 659a40bc2..f5278e140 100644 --- a/Net/include/Net/TCPServer.h +++ b/Net/include/Poco/Net/TCPServer.h @@ -1,7 +1,7 @@ // // TCPServer.h // -// $Id: //poco/1.1.0/Net/include/Net/TCPServer.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/TCPServer.h#1 $ // // Library: Net // Package: TCPServer @@ -40,24 +40,15 @@ #define Net_TCPServer_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_ServerSocket_INCLUDED -#include "Net/ServerSocket.h" -#endif -#ifndef Foundation_Runnable_INCLUDED -#include "Foundation/Runnable.h" -#endif -#ifndef Foundation_Thread_INCLUDED -#include "Foundation/Thread.h" -#endif -#ifndef Foundation_ThreadPool_INCLUDED -#include "Foundation/ThreadPool.h" -#endif +#include "Poco/Net/Net.h" +#include "Poco/Net/ServerSocket.h" +#include "Poco/Runnable.h" +#include "Poco/Thread.h" +#include "Poco/ThreadPool.h" -Net_BEGIN +namespace Poco { +namespace Net { class TCPServerParams; @@ -65,7 +56,7 @@ class TCPServerDispatcher; class TCPServerConnectionFactory; -class Net_API TCPServer: public Foundation::Runnable +class Net_API TCPServer: public Poco::Runnable /// This class implements a multithreaded TCP server. /// /// The server uses a ServerSocket to listen for incoming @@ -119,7 +110,7 @@ public: /// /// News threads are taken from the default thread pool. - TCPServer(TCPServerConnectionFactory* pFactory, Foundation::ThreadPool& threadPool, const ServerSocket& socket, TCPServerParams* pParams = 0); + TCPServer(TCPServerConnectionFactory* pFactory, Poco::ThreadPool& threadPool, const ServerSocket& socket, TCPServerParams* pParams = 0); /// Creates the TCPServer, using the given ServerSocket. /// /// The server takes ownership of the TCPServerConnectionFactory @@ -189,12 +180,12 @@ private: ServerSocket _socket; TCPServerDispatcher* _pDispatcher; - Foundation::Thread _thread; + Poco::Thread _thread; bool _stopped; }; -Net_END +} } // namespace Poco::Net #endif // Net_TCPServer_INCLUDED diff --git a/Net/include/Net/TCPServerConnection.h b/Net/include/Poco/Net/TCPServerConnection.h similarity index 86% rename from Net/include/Net/TCPServerConnection.h rename to Net/include/Poco/Net/TCPServerConnection.h index 2a250e001..ba0212e76 100644 --- a/Net/include/Net/TCPServerConnection.h +++ b/Net/include/Poco/Net/TCPServerConnection.h @@ -1,7 +1,7 @@ // // TCPServerConnection.h // -// $Id: //poco/1.1.0/Net/include/Net/TCPServerConnection.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/TCPServerConnection.h#1 $ // // Library: Net // Package: TCPServer @@ -40,21 +40,16 @@ #define Net_TCPServerConnection_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_StreamSocket_INCLUDED -#include "Net/StreamSocket.h" -#endif -#ifndef Foundation_Runnable_INCLUDED -#include "Foundation/Runnable.h" -#endif +#include "Poco/Net/Net.h" +#include "Poco/Net/StreamSocket.h" +#include "Poco/Runnable.h" -Net_BEGIN +namespace Poco { +namespace Net { -class Net_API TCPServerConnection: public Foundation::Runnable +class Net_API TCPServerConnection: public Poco::Runnable /// The abstract base class for TCP server connections /// created by TCPServer. /// @@ -107,7 +102,7 @@ inline StreamSocket& TCPServerConnection::socket() } -Net_END +} } // namespace Poco::Net #endif // Net_TCPServerConnection_INCLUDED diff --git a/Net/include/Net/TCPServerConnectionFactory.h b/Net/include/Poco/Net/TCPServerConnectionFactory.h similarity index 90% rename from Net/include/Net/TCPServerConnectionFactory.h rename to Net/include/Poco/Net/TCPServerConnectionFactory.h index 03561e4d1..b674f86df 100644 --- a/Net/include/Net/TCPServerConnectionFactory.h +++ b/Net/include/Poco/Net/TCPServerConnectionFactory.h @@ -1,7 +1,7 @@ // // TCPServerConnectionFactory.h // -// $Id: //poco/1.1.0/Net/include/Net/TCPServerConnectionFactory.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/TCPServerConnectionFactory.h#1 $ // // Library: Net // Package: TCPServer @@ -40,15 +40,12 @@ #define Net_TCPServerConnectionFactory_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_TCPServerConnection_INCLUDED -#include "Net/TCPServerConnection.h" -#endif +#include "Poco/Net/Net.h" +#include "Poco/Net/TCPServerConnection.h" -Net_BEGIN +namespace Poco { +namespace Net { class Net_API TCPServerConnectionFactory @@ -105,7 +102,7 @@ public: }; -Net_END +} } // namespace Poco::Net #endif // Net_TCPServerConnectionFactory_INCLUDED diff --git a/Net/include/Net/TCPServerDispatcher.h b/Net/include/Poco/Net/TCPServerDispatcher.h similarity index 75% rename from Net/include/Net/TCPServerDispatcher.h rename to Net/include/Poco/Net/TCPServerDispatcher.h index e0dedf19d..10be978c6 100644 --- a/Net/include/Net/TCPServerDispatcher.h +++ b/Net/include/Poco/Net/TCPServerDispatcher.h @@ -1,7 +1,7 @@ // // TCPServerDispatcher.h // -// $Id: //poco/1.1.0/Net/include/Net/TCPServerDispatcher.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/TCPServerDispatcher.h#1 $ // // Library: Net // Package: TCPServer @@ -40,39 +40,28 @@ #define Net_TCPServerDispatcher_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_StreamSocket_INCLUDED -#include "Net/StreamSocket.h" -#endif -#ifndef Foundation_Runnable_INCLUDED -#include "Foundation/Runnable.h" -#endif -#ifndef Foundation_NotificationQueue_INCLUDED -#include "Foundation/NotificationQueue.h" -#endif -#ifndef Foundation_ThreadPool_INCLUDED -#include "Foundation/ThreadPool.h" -#endif -#ifndef Foundation_Mutex_INCLUDED -#include "Foundation/Mutex.h" -#endif +#include "Poco/Net/Net.h" +#include "Poco/Net/StreamSocket.h" +#include "Poco/Runnable.h" +#include "Poco/NotificationQueue.h" +#include "Poco/ThreadPool.h" +#include "Poco/Mutex.h" -Net_BEGIN +namespace Poco { +namespace Net { class TCPServerParams; class TCPServerConnectionFactory; -class Net_API TCPServerDispatcher: public Foundation::Runnable +class Net_API TCPServerDispatcher: public Poco::Runnable /// A helper class for TCPServer that dispatches /// connections to server connection threads. { public: - TCPServerDispatcher(TCPServerConnectionFactory* pFactory, Foundation::ThreadPool& threadPool, TCPServerParams* pParams); + TCPServerDispatcher(TCPServerConnectionFactory* pFactory, Poco::ThreadPool& threadPool, TCPServerParams* pParams); /// Creates the TCPServerDispatcher. /// /// The dispatcher takes ownership of the TCPServerParams object. @@ -134,16 +123,16 @@ private: int _rc; TCPServerParams* _pParams; - int _currentThreads; - int _totalConnections; - int _currentConnections; - int _maxConcurrentConnections; - int _refusedConnections; + int _currentThreads; + int _totalConnections; + int _currentConnections; + int _maxConcurrentConnections; + int _refusedConnections; bool _stopped; - Foundation::NotificationQueue _queue; - TCPServerConnectionFactory* _pConnectionFactory; - Foundation::ThreadPool& _threadPool; - mutable Foundation::FastMutex _mutex; + Poco::NotificationQueue _queue; + TCPServerConnectionFactory* _pConnectionFactory; + Poco::ThreadPool& _threadPool; + mutable Poco::FastMutex _mutex; }; @@ -156,7 +145,7 @@ inline const TCPServerParams& TCPServerDispatcher::params() const } -Net_END +} } // namespace Poco::Net #endif // Net_TCPServerDispatcher_INCLUDED diff --git a/Net/include/Net/TCPServerParams.h b/Net/include/Poco/Net/TCPServerParams.h similarity index 82% rename from Net/include/Net/TCPServerParams.h rename to Net/include/Poco/Net/TCPServerParams.h index 891a8c308..f3905cf7a 100644 --- a/Net/include/Net/TCPServerParams.h +++ b/Net/include/Poco/Net/TCPServerParams.h @@ -1,7 +1,7 @@ // // TCPServerParams.h // -// $Id: //poco/1.1.0/Net/include/Net/TCPServerParams.h#2 $ +// $Id: //poco/1.2/Net/include/Poco/Net/TCPServerParams.h#1 $ // // Library: Net // Package: TCPServer @@ -40,21 +40,16 @@ #define Net_TCPServerParams_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Foundation_RefCountedObject_INCLUDED -#include "Foundation/RefCountedObject.h" -#endif -#ifndef Foundation_Timespan_INCLUDED -#include "Foundation/Timespan.h" -#endif +#include "Poco/Net/Net.h" +#include "Poco/RefCountedObject.h" +#include "Poco/Timespan.h" -Net_BEGIN +namespace Poco { +namespace Net { -class Net_API TCPServerParams: public Foundation::RefCountedObject +class Net_API TCPServerParams: public Poco::RefCountedObject /// This class is used to specify parameters to both the /// TCPServer, as well as to TCPServerDispatcher objects. /// @@ -69,13 +64,13 @@ public: /// - maxThreads: 0 /// - maxQueued: 64 - void setThreadIdleTime(const Foundation::Timespan& idleTime); + void setThreadIdleTime(const Poco::Timespan& idleTime); /// Sets the maximum idle time for a thread before /// it is terminated. /// /// The default idle time is 10 seconds; - const Foundation::Timespan& getThreadIdleTime() const; + const Poco::Timespan& getThreadIdleTime() const; /// Returns the maximum thread idle time. void setMaxQueued(int count); @@ -112,7 +107,7 @@ protected: /// Destroys the TCPServerParams. private: - Foundation::Timespan _threadIdleTime; + Poco::Timespan _threadIdleTime; int _maxThreads; int _maxQueued; }; @@ -121,7 +116,7 @@ private: // // inlines // -inline const Foundation::Timespan& TCPServerParams::getThreadIdleTime() const +inline const Poco::Timespan& TCPServerParams::getThreadIdleTime() const { return _threadIdleTime; } @@ -139,7 +134,7 @@ inline int TCPServerParams::getMaxQueued() const } -Net_END +} } // namespace Poco::Net #endif // Net_TCPServerParams_INCLUDED diff --git a/Net/samples/EchoServer/EchoServer.vmsbuild b/Net/samples/EchoServer/EchoServer.vmsbuild index bc5b54c2e..02df6f26d 100644 --- a/Net/samples/EchoServer/EchoServer.vmsbuild +++ b/Net/samples/EchoServer/EchoServer.vmsbuild @@ -1,7 +1,7 @@ # # sample.vmsbuild # -# $Id: //poco/1.1.0/Net/samples/EchoServer/EchoServer.vmsbuild#1 $ +# $Id: //poco/1.2/Net/samples/EchoServer/EchoServer.vmsbuild#1 $ # EXE=EchoServer EchoServer diff --git a/Net/samples/EchoServer/Makefile b/Net/samples/EchoServer/Makefile index 03a264e44..a91670703 100644 --- a/Net/samples/EchoServer/Makefile +++ b/Net/samples/EchoServer/Makefile @@ -1,7 +1,7 @@ # # Makefile # -# $Id: //poco/1.1.0/Net/samples/EchoServer/Makefile#1 $ +# $Id: //poco/1.2/Net/samples/EchoServer/Makefile#1 $ # # Makefile for Poco EchoServer # @@ -12,6 +12,6 @@ objects = EchoServer target = EchoServer target_version = 1 -target_libs = PocoFoundation PocoXML PocoNet PocoUtil +target_libs = PocoUtil PocoNet PocoXML PocoFoundation include $(POCO_BASE)/build/rules/exec diff --git a/Net/samples/EchoServer/src/EchoServer.cpp b/Net/samples/EchoServer/src/EchoServer.cpp index 429ef8a97..7aa883b6e 100644 --- a/Net/samples/EchoServer/src/EchoServer.cpp +++ b/Net/samples/EchoServer/src/EchoServer.cpp @@ -1,7 +1,7 @@ // // EchoServer.cpp // -// $Id: //poco/1.1.0/Net/samples/EchoServer/src/EchoServer.cpp#2 $ +// $Id: //poco/1.2/Net/samples/EchoServer/src/EchoServer.cpp#1 $ // // This sample demonstrates the SocketReactor and SocketAcceptor classes. // @@ -32,34 +32,34 @@ // -#include "Net/SocketReactor.h" -#include "Net/SocketAcceptor.h" -#include "Net/SocketNotification.h" -#include "Net/StreamSocket.h" -#include "Net/ServerSocket.h" -#include "Foundation/Observer.h" -#include "Foundation/Exception.h" -#include "Foundation/Thread.h" -#include "Util/ServerApplication.h" -#include "Util/Option.h" -#include "Util/OptionSet.h" -#include "Util/HelpFormatter.h" +#include "Poco/Net/SocketReactor.h" +#include "Poco/Net/SocketAcceptor.h" +#include "Poco/Net/SocketNotification.h" +#include "Poco/Net/StreamSocket.h" +#include "Poco/Net/ServerSocket.h" +#include "Poco/Observer.h" +#include "Poco/Exception.h" +#include "Poco/Thread.h" +#include "Poco/Util/ServerApplication.h" +#include "Poco/Util/Option.h" +#include "Poco/Util/OptionSet.h" +#include "Poco/Util/HelpFormatter.h" #include -using Net::SocketReactor; -using Net::SocketAcceptor; -using Net::ReadableNotification; -using Net::ShutdownNotification; -using Net::ServerSocket; -using Net::StreamSocket; -using Foundation::Observer; -using Foundation::Thread; -using Util::ServerApplication; -using Util::Application; -using Util::Option; -using Util::OptionSet; -using Util::HelpFormatter; +using Poco::Net::SocketReactor; +using Poco::Net::SocketAcceptor; +using Poco::Net::ReadableNotification; +using Poco::Net::ShutdownNotification; +using Poco::Net::ServerSocket; +using Poco::Net::StreamSocket; +using Poco::Observer; +using Poco::Thread; +using Poco::Util::ServerApplication; +using Poco::Util::Application; +using Poco::Util::Option; +using Poco::Util::OptionSet; +using Poco::Util::HelpFormatter; class EchoServiceHandler @@ -119,7 +119,7 @@ private: }; -class EchoServer: public Util::ServerApplication +class EchoServer: public Poco::Util::ServerApplication /// The main application class. /// /// This class handles command-line arguments and diff --git a/Net/samples/HTTPFormServer/HTTPFormServer.properties b/Net/samples/HTTPFormServer/HTTPFormServer.properties new file mode 100644 index 000000000..d32ffdc4f --- /dev/null +++ b/Net/samples/HTTPFormServer/HTTPFormServer.properties @@ -0,0 +1,10 @@ +# This is a sample configuration file for HTTPFormServer + +logging.loggers.root.channel.class = ConsoleChannel +logging.loggers.app.name = Application +logging.loggers.app.channel = c1 +logging.formatters.f1.class = PatternFormatter +logging.formatters.f1.pattern = [%p] %t +logging.channels.c1.class = ConsoleChannel +logging.channels.c1.formatter = f1 +HTTPFormServer.port = 9980 diff --git a/Net/samples/HTTPFormServer/HTTPFormServer.vmsbuild b/Net/samples/HTTPFormServer/HTTPFormServer.vmsbuild new file mode 100644 index 000000000..5d180e690 --- /dev/null +++ b/Net/samples/HTTPFormServer/HTTPFormServer.vmsbuild @@ -0,0 +1,8 @@ +# +# sample.vmsbuild +# +# $Id: //poco/1.2/Net/samples/HTTPFormServer/HTTPFormServer.vmsbuild#1 $ +# +EXE=HTTPFormServer +HTTPFormServer + diff --git a/Net/samples/HTTPFormServer/HTTPFormServer_vs71.vcproj b/Net/samples/HTTPFormServer/HTTPFormServer_vs71.vcproj new file mode 100644 index 000000000..9bb8e7734 --- /dev/null +++ b/Net/samples/HTTPFormServer/HTTPFormServer_vs71.vcproj @@ -0,0 +1,152 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Net/samples/HTTPFormServer/HTTPFormServer_vs80.vcproj b/Net/samples/HTTPFormServer/HTTPFormServer_vs80.vcproj new file mode 100644 index 000000000..592170c64 --- /dev/null +++ b/Net/samples/HTTPFormServer/HTTPFormServer_vs80.vcproj @@ -0,0 +1,217 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Net/samples/HTTPFormServer/Makefile b/Net/samples/HTTPFormServer/Makefile new file mode 100644 index 000000000..b554cd7b2 --- /dev/null +++ b/Net/samples/HTTPFormServer/Makefile @@ -0,0 +1,17 @@ +# +# Makefile +# +# $Id: //poco/1.2/Net/samples/HTTPFormServer/Makefile#1 $ +# +# Makefile for Poco HTTPFormServer +# + +include $(POCO_BASE)/build/rules/global + +objects = HTTPFormServer + +target = HTTPFormServer +target_version = 1 +target_libs = PocoUtil PocoNet PocoXML PocoFoundation + +include $(POCO_BASE)/build/rules/exec diff --git a/Net/samples/HTTPFormServer/src/HTTPFormServer.cpp b/Net/samples/HTTPFormServer/src/HTTPFormServer.cpp new file mode 100644 index 000000000..fbb344329 --- /dev/null +++ b/Net/samples/HTTPFormServer/src/HTTPFormServer.cpp @@ -0,0 +1,326 @@ +// +// HTTPFormServer.cpp +// +// $Id: //poco/Main/Net/samples/HTTPFormServer/src/HTTPFormServer.cpp#5 $ +// +// This sample demonstrates the HTTPServer and HTMLForm classes. +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#include "Poco/Net/HTTPServer.h" +#include "Poco/Net/HTTPRequestHandler.h" +#include "Poco/Net/HTTPRequestHandlerFactory.h" +#include "Poco/Net/HTTPServerParams.h" +#include "Poco/Net/HTTPServerRequest.h" +#include "Poco/Net/HTTPServerResponse.h" +#include "Poco/Net/HTTPServerParams.h" +#include "Poco/Net/HTMLForm.h" +#include "Poco/Net/PartHandler.h" +#include "Poco/Net/MessageHeader.h" +#include "Poco/Net/ServerSocket.h" +#include "Poco/CountingStream.h" +#include "Poco/NullStream.h" +#include "Poco/StreamCopier.h" +#include "Poco/Exception.h" +#include "Poco/Util/ServerApplication.h" +#include "Poco/Util/Option.h" +#include "Poco/Util/OptionSet.h" +#include "Poco/Util/HelpFormatter.h" +#include + + +using Poco::Net::ServerSocket; +using Poco::Net::HTTPRequestHandler; +using Poco::Net::HTTPRequestHandlerFactory; +using Poco::Net::HTTPServer; +using Poco::Net::HTTPServerRequest; +using Poco::Net::HTTPServerResponse; +using Poco::Net::HTTPServerParams; +using Poco::Net::MessageHeader; +using Poco::Net::HTMLForm; +using Poco::Net::NameValueCollection; +using Poco::Util::ServerApplication; +using Poco::Util::Application; +using Poco::Util::Option; +using Poco::Util::OptionSet; +using Poco::Util::HelpFormatter; +using Poco::CountingInputStream; +using Poco::NullOutputStream; +using Poco::StreamCopier; + + +class MyPartHandler: public Poco::Net::PartHandler +{ +public: + MyPartHandler(): + _length(0) + { + } + + void handlePart(const MessageHeader& header, std::istream& stream) + { + _type = header.get("Content-Type", "(unspecified)"); + if (header.has("Content-Disposition")) + { + std::string disp; + NameValueCollection params; + MessageHeader::splitParameters(header["Content-Disposition"], disp, params); + _name = params.get("name", "(unnamed)"); + _fileName = params.get("filename", "(unnamed)"); + } + + CountingInputStream istr(stream); + NullOutputStream ostr; + StreamCopier::copyStream(istr, ostr); + _length = istr.chars(); + } + + int length() const + { + return _length; + } + + const std::string& name() const + { + return _name; + } + + const std::string& fileName() const + { + return _fileName; + } + + const std::string& contentType() const + { + return _type; + } + +private: + int _length; + std::string _type; + std::string _name; + std::string _fileName; +}; + + +class FormRequestHandler: public HTTPRequestHandler + /// Return a HTML document with the current date and time. +{ +public: + FormRequestHandler() + { + } + + void handleRequest(HTTPServerRequest& request, HTTPServerResponse& response) + { + Application& app = Application::instance(); + app.logger().information("Request from " + request.clientAddress().toString()); + + MyPartHandler partHandler; + HTMLForm form(request, request.stream(), partHandler); + + response.setChunkedTransferEncoding(true); + response.setContentType("text/html"); + + std::ostream& ostr = response.send(); + + ostr << + "\n" + "\n" + "POCO Form Server Sample\n" + "\n" + "\n" + "

POCO Form Server Sample

\n" + "

GET Form

\n" + "
\n" + "\n" + "\n" + "
\n" + "

POST Form

\n" + "
\n" + "\n" + "\n" + "
\n" + "

File Upload

\n" + "
\n" + " \n" + "\n" + "
\n"; + + ostr << "

Request

\n"; + ostr << "Method: " << request.getMethod() << "
\n"; + ostr << "URI: " << request.getURI() << "
\n"; + NameValueCollection::ConstIterator it = request.begin(); + NameValueCollection::ConstIterator end = request.end(); + for (; it != end; ++it) + { + ostr << it->first << ": " << it->second << "
\n"; + } + ostr << "

"; + + if (!form.empty()) + { + ostr << "

Form

\n"; + it = form.begin(); + end = form.end(); + for (; it != end; ++it) + { + ostr << it->first << ": " << it->second << "
\n"; + } + ostr << "

"; + } + + if (!partHandler.name().empty()) + { + ostr << "

Upload

\n"; + ostr << "Name: " << partHandler.name() << "
\n"; + ostr << "File Name: " << partHandler.fileName() << "
\n"; + ostr << "Type: " << partHandler.contentType() << "
\n"; + ostr << "Size: " << partHandler.length() << "
\n"; + ostr << "

"; + } + ostr << "\n"; + } +}; + + +class FormRequestHandlerFactory: public HTTPRequestHandlerFactory +{ +public: + FormRequestHandlerFactory() + { + } + + HTTPRequestHandler* createRequestHandler(const HTTPServerRequest& request) + { + return new FormRequestHandler; + } +}; + + +class HTTPFormServer: public Poco::Util::ServerApplication + /// The main application class. + /// + /// This class handles command-line arguments and + /// configuration files. + /// Start the HTTPFormServer executable with the help + /// option (/help on Windows, --help on Unix) for + /// the available command line options. + /// + /// To use the sample configuration file (HTTPFormServer.properties), + /// copy the file to the directory where the HTTPFormServer executable + /// resides. If you start the debug version of the HTTPFormServer + /// (HTTPFormServerd[.exe]), you must also create a copy of the configuration + /// file named HTTPFormServerd.properties. In the configuration file, you + /// can specify the port on which the server is listening (default + /// 9980) and the format of the date/Form string sent back to the client. + /// + /// To test the FormServer you can use any web browser (http://localhost:9980/). +{ +public: + HTTPFormServer(): _helpRequested(false) + { + } + + ~HTTPFormServer() + { + } + +protected: + void initialize(Application& self) + { + loadConfiguration(); // load default configuration files, if present + ServerApplication::initialize(self); + } + + void uninitialize() + { + ServerApplication::uninitialize(); + } + + void defineOptions(OptionSet& options) + { + ServerApplication::defineOptions(options); + + options.addOption( + Option("help", "h", "display help information on command line arguments") + .required(false) + .repeatable(false)); + } + + void handleOption(const std::string& name, const std::string& value) + { + ServerApplication::handleOption(name, value); + + if (name == "help") + _helpRequested = true; + } + + void displayHelp() + { + HelpFormatter helpFormatter(options()); + helpFormatter.setCommand(commandName()); + helpFormatter.setUsage("OPTIONS"); + helpFormatter.setHeader("A web server that shows how to work with HTML forms."); + helpFormatter.format(std::cout); + } + + int main(const std::vector& args) + { + if (_helpRequested) + { + displayHelp(); + } + else + { + unsigned short port = (unsigned short) config().getInt("HTTPFormServer.port", 9980); + + // set-up a server socket + ServerSocket svs(port); + // set-up a HTTPServer instance + HTTPServer srv(new FormRequestHandlerFactory, svs, new HTTPServerParams); + // start the HTTPServer + srv.start(); + // wait for CTRL-C or kill + waitForTerminationRequest(); + // Stop the HTTPServer + srv.stop(); + } + return Application::EXIT_OK; + } + +private: + bool _helpRequested; +}; + + +int main(int argc, char** argv) +{ + HTTPFormServer app; + return app.run(argc, argv); +} diff --git a/Net/samples/HTTPLoadTest/HTTPLoadTest.vmsbuild b/Net/samples/HTTPLoadTest/HTTPLoadTest.vmsbuild new file mode 100644 index 000000000..a690def50 --- /dev/null +++ b/Net/samples/HTTPLoadTest/HTTPLoadTest.vmsbuild @@ -0,0 +1,7 @@ +# +# HTTPLoadTest.vmsbuild +# +# $Id: //poco/1.2/Net/samples/HTTPLoadTest/HTTPLoadTest.vmsbuild#1 $ +# +EXE=HTTPLoadTest +HTTPLoadTest diff --git a/Net/samples/HTTPLoadTest/HTTPLoadTest_vs71.vcproj b/Net/samples/HTTPLoadTest/HTTPLoadTest_vs71.vcproj new file mode 100644 index 000000000..8fa45a471 --- /dev/null +++ b/Net/samples/HTTPLoadTest/HTTPLoadTest_vs71.vcproj @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Net/samples/HTTPLoadTest/HTTPLoadTest_vs80.vcproj b/Net/samples/HTTPLoadTest/HTTPLoadTest_vs80.vcproj new file mode 100644 index 000000000..597370997 --- /dev/null +++ b/Net/samples/HTTPLoadTest/HTTPLoadTest_vs80.vcproj @@ -0,0 +1,209 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Net/samples/HTTPLoadTest/Makefile b/Net/samples/HTTPLoadTest/Makefile new file mode 100644 index 000000000..cb36bcbda --- /dev/null +++ b/Net/samples/HTTPLoadTest/Makefile @@ -0,0 +1,17 @@ +# +# Makefile +# +# $Id: //poco/1.2/Net/samples/HTTPLoadTest/Makefile#1 $ +# +# Makefile for Poco HTTPLoadTest +# + +include $(POCO_BASE)/build/rules/global + +objects = HTTPLoadTest + +target = HTTPLoadTest +target_version = 1 +target_libs = PocoUtil PocoNet PocoXML PocoFoundation + +include $(POCO_BASE)/build/rules/exec diff --git a/Net/samples/HTTPLoadTest/src/HTTPLoadTest.cpp b/Net/samples/HTTPLoadTest/src/HTTPLoadTest.cpp new file mode 100644 index 000000000..eeeec7e5c --- /dev/null +++ b/Net/samples/HTTPLoadTest/src/HTTPLoadTest.cpp @@ -0,0 +1,388 @@ +// +// HTTPLoadTest.cpp +// +// $Id: //poco/1.2/Net/samples/HTTPLoadTest/src/HTTPLoadTest.cpp#1 $ +// +// This sample demonstrates the HTTPClientSession class. +// +// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#include "Poco/Net/HTTPClientSession.h" +#include "Poco/Net/HTTPRequest.h" +#include "Poco/Net/HTTPResponse.h" +#include "Poco/Net/HTTPCookie.h" +#include "Poco/Net/NameValueCollection.h" +#include "Poco/Path.h" +#include "Poco/URI.h" +#include "Poco/AutoPtr.h" +#include "Poco/Thread.h" +#include "Poco/Mutex.h" +#include "Poco/Runnable.h" +#include "Poco/Stopwatch.h" +#include "Poco/NumberParser.h" +#include "Poco/Exception.h" +#include "Poco/Util/Application.h" +#include "Poco/Util/Option.h" +#include "Poco/Util/OptionSet.h" +#include "Poco/Util/HelpFormatter.h" +#include "Poco/Util/AbstractConfiguration.h" +#include + + +using Poco::Net::HTTPClientSession; +using Poco::Net::HTTPRequest; +using Poco::Net::HTTPResponse; +using Poco::Net::HTTPMessage; +using Poco::Net::HTTPCookie; +using Poco::Net::NameValueCollection; +using Poco::Util::Application; +using Poco::Util::Option; +using Poco::Util::OptionSet; +using Poco::Util::HelpFormatter; +using Poco::Util::AbstractConfiguration; +using Poco::AutoPtr; +using Poco::Thread; +using Poco::FastMutex; +using Poco::Runnable; +using Poco::Stopwatch; +using Poco::NumberParser; +using Poco::Path; +using Poco::URI; +using Poco::Exception; + +class HTTPClient : public Runnable +{ +public: + HTTPClient(const URI& uri, int repetitions, bool cookies=false, bool verbose=false): + _uri(uri), + _cookies(cookies), + _verbose(verbose), + _repetitions(repetitions), + _usec(0), + _success(0) + { + _gRepetitions += _repetitions; + } + + ~HTTPClient() + { + } + + void run() + { + Stopwatch sw; + std::vector cookies; + + for (int i = 0; i < _repetitions; ++i) + { + try + { + int usec = 0; + std::string path(_uri.getPathAndQuery()); + if (path.empty()) path = "/"; + + HTTPClientSession session(_uri.getHost(), _uri.getPort()); + HTTPRequest req(HTTPRequest::HTTP_GET, path, HTTPMessage::HTTP_1_1); + + if (_cookies) + { + NameValueCollection nvc; + std::vector::iterator it = cookies.begin(); + for(; it != cookies.end(); ++it) + nvc.add((*it).getName(), (*it).getValue()); + + req.setCookies(nvc); + } + + HTTPResponse res; + sw.restart(); + session.sendRequest(req); + std::istream& rs = session.receiveResponse(res); + sw.stop(); + _success += HTTPResponse::HTTP_OK == res.getStatus() ? 1 : 0; + if (_cookies) res.getCookies(cookies); + usec = sw.elapsed(); + + if (_verbose) + { + FastMutex::ScopedLock lock(_mutex); + std::cout + << _uri.toString() << ' ' << res.getStatus() << ' ' << res.getReason() + << ' ' << usec/1000.0 << "ms" << std::endl; + } + + _usec += usec; + } + catch (Exception& exc) + { + FastMutex::ScopedLock lock(_mutex); + std::cerr << exc.displayText() << std::endl; + } + } + + { + FastMutex::ScopedLock lock(_mutex); + _gSuccess += _success; + _gUsec += _usec; + } + if (_verbose) + printStats(_uri.toString(), _repetitions, _success, _usec); + } + + static void printStats(std::string uri, int repetitions, int success, Poco::UInt64 usec); + static int totalAttempts(); + static Poco::UInt64 totalMicroseconds(); + static int totalSuccessCount(); + +private: + HTTPClient(); + + URI _uri; + bool _verbose; + bool _cookies; + int _repetitions; + Poco::UInt64 _usec; + int _success; + static int _gRepetitions; + static Poco::UInt64 _gUsec; + static int _gSuccess; + static FastMutex _mutex; +}; + +FastMutex HTTPClient::_mutex; +int HTTPClient::_gRepetitions; +Poco::UInt64 HTTPClient::_gUsec; +int HTTPClient::_gSuccess; + +int HTTPClient::totalAttempts() +{ + return _gRepetitions; +} + +Poco::UInt64 HTTPClient::totalMicroseconds() +{ + return _gUsec; +} + +int HTTPClient::totalSuccessCount() +{ + return _gSuccess; +} + +void HTTPClient::printStats(std::string uri, int repetitions, int success, Poco::UInt64 usec) +{ + FastMutex::ScopedLock lock(_mutex); + + std::cout << std::endl << "--------------" << std::endl + << "Statistics for " << uri << std::endl << "--------------" + << std::endl + << repetitions << " attempts, " << success << " succesful (" + << ((float) success / (float) repetitions) * 100.0 << "%)" << std::endl + << "Avg response time: " << ((float) usec / (float) repetitions) / 1000.0 << "ms, " << std::endl + << "Avg requests/second handled: " << ((float) success /((float) usec / 1000000.0)) << std::endl + << "Total time: " << (float) usec / 1000000.0 << std::endl; +} + +class HTTPLoadTest: public Application + /// This sample demonstrates some of the features of the Poco::Util::Application class, + /// such as configuration file handling and command line arguments processing. + /// + /// Try HTTPLoadTest --help (on Unix platforms) or HTTPLoadTest /help (elsewhere) for + /// more information. +{ +public: + HTTPLoadTest(): + _helpRequested(false), + _repetitions(1), + _threads(1), + _verbose(false), + _cookies(false) + { + } + +protected: + void initialize(Application& self) + { + loadConfiguration(); // load default configuration files, if present + Application::initialize(self); + // add your own initialization code here + } + + void uninitialize() + { + // add your own uninitialization code here + Application::uninitialize(); + } + + void reinitialize(Application& self) + { + Application::reinitialize(self); + // add your own reinitialization code here + } + + void defineOptions(OptionSet& options) + { + Application::defineOptions(options); + + options.addOption( + Option("help", "h", "display help information on command line arguments") + .required(false) + .repeatable(false)); + + options.addOption( + Option("verbose", "v", "display messages on stdout") + .required(false) + .repeatable(false)); + + options.addOption( + Option("cookies", "c", "resend cookies") + .required(false) + .repeatable(false)); + + options.addOption( + Option("uri", "u", "HTTP URI") + .required(true) + .repeatable(false) + .argument("uri")); + + options.addOption( + Option("repetitions", "r", "fetch repetitions") + .required(false) + .repeatable(false) + .argument("repetitions")); + + options.addOption( + Option("threads", "t", "thread count") + .required(false) + .repeatable(false) + .argument("threads")); + } + + void handleOption(const std::string& name, const std::string& value) + { + Application::handleOption(name, value); + + if (name == "help") + _helpRequested = true; + else if (name == "verbose") + _verbose = true; + else if (name == "cookies") + _cookies = true; + else if (name == "uri") + _uri = value; + else if (name == "repetitions") + _repetitions = NumberParser::parse(value); + else if (name == "threads") + _threads = NumberParser::parse(value); + } + + void displayHelp() + { + HelpFormatter helpFormatter(options()); + helpFormatter.setCommand(commandName()); + helpFormatter.setUsage("OPTIONS"); + helpFormatter.setHeader("A sample application that demonstrates some of the features of the Poco::Util::Application class."); + helpFormatter.format(std::cout); + } + + void defineProperty(const std::string& def) + { + std::string name; + std::string value; + std::string::size_type pos = def.find('='); + if (pos != std::string::npos) + { + name.assign(def, 0, pos); + value.assign(def, pos + 1, def.length() - pos); + } + else name = def; + config().setString(name, value); + } + + int main(const std::vector& args) + { + if (_helpRequested) + { + displayHelp(); + } + else + { + URI uri(_uri); + std::vector threads; + + Stopwatch sw; + sw.start(); + for (int i = 0; i < _threads; ++i) + { + Thread* pt = new Thread(_uri); + poco_check_ptr(pt); + threads.push_back(pt); + HTTPClient* pHTTPClient = new HTTPClient(uri, _repetitions, _cookies, _verbose); + poco_check_ptr(pHTTPClient); + threads.back()->start(*pHTTPClient); + } + + std::vector::iterator it = threads.begin(); + for(; it != threads.end(); ++it) + { + (*it)->join(); + delete *it; + } + sw.stop(); + + HTTPClient::printStats(_uri, HTTPClient::totalAttempts(), HTTPClient::totalSuccessCount(), sw.elapsed()); + } + + return Application::EXIT_OK; + } + +private: + bool _helpRequested; + bool _verbose; + bool _cookies; + std::string _uri; + int _repetitions; + int _threads; +}; + + +int main(int argc, char** argv) +{ + AutoPtr pApp = new HTTPLoadTest; + try + { + pApp->init(argc, argv); + } + catch (Poco::Exception& exc) + { + pApp->logger().log(exc); + return Application::EXIT_CONFIG; + } + return pApp->run(); +} + diff --git a/Net/samples/HTTPTimeServer/HTTPTimeServer.properties b/Net/samples/HTTPTimeServer/HTTPTimeServer.properties index 2a1bc3912..deaa2e8b7 100644 --- a/Net/samples/HTTPTimeServer/HTTPTimeServer.properties +++ b/Net/samples/HTTPTimeServer/HTTPTimeServer.properties @@ -7,5 +7,7 @@ logging.formatters.f1.class = PatternFormatter logging.formatters.f1.pattern = [%p] %t logging.channels.c1.class = ConsoleChannel logging.channels.c1.formatter = f1 -# HTTPTimeServer.format = %W, %e %b %y %H:%M:%S %Z -# HTTPTimeServer.port = 9980 +HTTPTimeServer.format = %W, %e %b %y %H:%M:%S %Z +HTTPTimeServer.port = 9980 +HTTPTimeServer.maxQueued = 100 +HTTPTimeServer.maxThreads = 200 diff --git a/Net/samples/HTTPTimeServer/HTTPTimeServer.vmsbuild b/Net/samples/HTTPTimeServer/HTTPTimeServer.vmsbuild index db0c0736c..2a2e57dd6 100644 --- a/Net/samples/HTTPTimeServer/HTTPTimeServer.vmsbuild +++ b/Net/samples/HTTPTimeServer/HTTPTimeServer.vmsbuild @@ -1,7 +1,7 @@ # # sample.vmsbuild # -# $Id: //poco/1.1.0/Net/samples/HTTPTimeServer/HTTPTimeServer.vmsbuild#1 $ +# $Id: //poco/1.2/Net/samples/HTTPTimeServer/HTTPTimeServer.vmsbuild#1 $ # EXE=HTTPTimeServer HTTPTimeServer diff --git a/Net/samples/HTTPTimeServer/Makefile b/Net/samples/HTTPTimeServer/Makefile index f0f6392e7..a6975012a 100644 --- a/Net/samples/HTTPTimeServer/Makefile +++ b/Net/samples/HTTPTimeServer/Makefile @@ -1,7 +1,7 @@ # # Makefile # -# $Id: //poco/1.1.0/Net/samples/HTTPTimeServer/Makefile#1 $ +# $Id: //poco/1.2/Net/samples/HTTPTimeServer/Makefile#1 $ # # Makefile for Poco HTTPTimeServer # @@ -12,6 +12,6 @@ objects = HTTPTimeServer target = HTTPTimeServer target_version = 1 -target_libs = PocoFoundation PocoXML PocoNet PocoUtil +target_libs = PocoUtil PocoNet PocoXML PocoFoundation include $(POCO_BASE)/build/rules/exec diff --git a/Net/samples/HTTPTimeServer/src/HTTPTimeServer.cpp b/Net/samples/HTTPTimeServer/src/HTTPTimeServer.cpp index 2d8e7944f..12aaa6f76 100644 --- a/Net/samples/HTTPTimeServer/src/HTTPTimeServer.cpp +++ b/Net/samples/HTTPTimeServer/src/HTTPTimeServer.cpp @@ -1,7 +1,7 @@ // -// TimeServer.cpp +// HTTPTimeServer.cpp // -// $Id: //poco/1.1.0/Net/samples/HTTPTimeServer/src/HTTPTimeServer.cpp#2 $ +// $Id: //poco/1.2/Net/samples/HTTPTimeServer/src/HTTPTimeServer.cpp#1 $ // // This sample demonstrates the HTTPServer and related classes. // @@ -32,40 +32,42 @@ // -#include "Net/HTTPServer.h" -#include "Net/HTTPRequestHandler.h" -#include "Net/HTTPRequestHandlerFactory.h" -#include "Net/HTTPServerParams.h" -#include "Net/HTTPServerRequest.h" -#include "Net/HTTPServerResponse.h" -#include "Net/HTTPServerParams.h" -#include "Net/ServerSocket.h" -#include "Foundation/Timestamp.h" -#include "Foundation/DateTimeFormatter.h" -#include "Foundation/DateTimeFormat.h" -#include "Foundation/Exception.h" -#include "Util/ServerApplication.h" -#include "Util/Option.h" -#include "Util/OptionSet.h" -#include "Util/HelpFormatter.h" +#include "Poco/Net/HTTPServer.h" +#include "Poco/Net/HTTPRequestHandler.h" +#include "Poco/Net/HTTPRequestHandlerFactory.h" +#include "Poco/Net/HTTPServerParams.h" +#include "Poco/Net/HTTPServerRequest.h" +#include "Poco/Net/HTTPServerResponse.h" +#include "Poco/Net/HTTPServerParams.h" +#include "Poco/Net/ServerSocket.h" +#include "Poco/Timestamp.h" +#include "Poco/DateTimeFormatter.h" +#include "Poco/DateTimeFormat.h" +#include "Poco/Exception.h" +#include "Poco/ThreadPool.h" +#include "Poco/Util/ServerApplication.h" +#include "Poco/Util/Option.h" +#include "Poco/Util/OptionSet.h" +#include "Poco/Util/HelpFormatter.h" #include -using Net::ServerSocket; -using Net::HTTPRequestHandler; -using Net::HTTPRequestHandlerFactory; -using Net::HTTPServer; -using Net::HTTPServerRequest; -using Net::HTTPServerResponse; -using Net::HTTPServerParams; -using Foundation::Timestamp; -using Foundation::DateTimeFormatter; -using Foundation::DateTimeFormat; -using Util::ServerApplication; -using Util::Application; -using Util::Option; -using Util::OptionSet; -using Util::HelpFormatter; +using Poco::Net::ServerSocket; +using Poco::Net::HTTPRequestHandler; +using Poco::Net::HTTPRequestHandlerFactory; +using Poco::Net::HTTPServer; +using Poco::Net::HTTPServerRequest; +using Poco::Net::HTTPServerResponse; +using Poco::Net::HTTPServerParams; +using Poco::Timestamp; +using Poco::DateTimeFormatter; +using Poco::DateTimeFormat; +using Poco::ThreadPool; +using Poco::Util::ServerApplication; +using Poco::Util::Application; +using Poco::Util::Option; +using Poco::Util::OptionSet; +using Poco::Util::HelpFormatter; class TimeRequestHandler: public HTTPRequestHandler @@ -122,7 +124,7 @@ private: }; -class HTTPTimeServer: public Util::ServerApplication +class HTTPTimeServer: public Poco::Util::ServerApplication /// The main application class. /// /// This class handles command-line arguments and @@ -200,11 +202,18 @@ protected: // get parameters from configuration file unsigned short port = (unsigned short) config().getInt("HTTPTimeServer.port", 9980); std::string format(config().getString("HTTPTimeServer.format", DateTimeFormat::SORTABLE_FORMAT)); + int maxQueued = config().getInt("HTTPTimeServer.maxQueued", 100); + int maxThreads = config().getInt("HTTPTimeServer.maxThreads", 16); + ThreadPool::defaultPool().addCapacity(maxThreads); + + HTTPServerParams* pParams = new HTTPServerParams; + pParams->setMaxQueued(maxQueued); + pParams->setMaxThreads(maxThreads); // set-up a server socket ServerSocket svs(port); // set-up a HTTPServer instance - HTTPServer srv(new TimeRequestHandlerFactory(format), svs, new HTTPServerParams); + HTTPServer srv(new TimeRequestHandlerFactory(format), svs, pParams); // start the HTTPServer srv.start(); // wait for CTRL-C or kill diff --git a/Net/samples/Mail/Mail.vmsbuild b/Net/samples/Mail/Mail.vmsbuild index 70053a915..384f53df7 100644 --- a/Net/samples/Mail/Mail.vmsbuild +++ b/Net/samples/Mail/Mail.vmsbuild @@ -1,7 +1,7 @@ # # sample.vmsbuild # -# $Id: //poco/1.1.0/Net/samples/Mail/Mail.vmsbuild#1 $ +# $Id: //poco/1.2/Net/samples/Mail/Mail.vmsbuild#1 $ # EXE=Mail Mail diff --git a/Net/samples/Mail/Makefile b/Net/samples/Mail/Makefile index 4092f1f33..2bc2c2a01 100644 --- a/Net/samples/Mail/Makefile +++ b/Net/samples/Mail/Makefile @@ -1,7 +1,7 @@ # # Makefile # -# $Id: //poco/1.1.0/Net/samples/Mail/Makefile#1 $ +# $Id: //poco/1.2/Net/samples/Mail/Makefile#1 $ # # Makefile for Poco Mail # @@ -12,6 +12,6 @@ objects = Mail target = Mail target_version = 1 -target_libs = PocoFoundation PocoXML PocoNet PocoUtil +target_libs = PocoUtil PocoNet PocoXML PocoFoundation include $(POCO_BASE)/build/rules/exec diff --git a/Net/samples/Mail/src/Mail.cpp b/Net/samples/Mail/src/Mail.cpp index 2a98d786f..e4a82d1bf 100644 --- a/Net/samples/Mail/src/Mail.cpp +++ b/Net/samples/Mail/src/Mail.cpp @@ -1,7 +1,7 @@ // // Mail.cpp // -// $Id: //poco/1.1.0/Net/samples/Mail/src/Mail.cpp#2 $ +// $Id: //poco/1.2/Net/samples/Mail/src/Mail.cpp#1 $ // // This sample demonstrates the MailMessage and SMTPClientSession classes. // @@ -32,21 +32,21 @@ // -#include "Net/MailMessage.h" -#include "Net/MailRecipient.h" -#include "Net/SMTPClientSession.h" -#include "Net/StringPartSource.h" -#include "Foundation/Path.h" -#include "Foundation/Exception.h" +#include "Poco/Net/MailMessage.h" +#include "Poco/Net/MailRecipient.h" +#include "Poco/Net/SMTPClientSession.h" +#include "Poco/Net/StringPartSource.h" +#include "Poco/Path.h" +#include "Poco/Exception.h" #include -using Net::MailMessage; -using Net::MailRecipient; -using Net::SMTPClientSession; -using Net::StringPartSource; -using Foundation::Path; -using Foundation::Exception; +using Poco::Net::MailMessage; +using Poco::Net::MailRecipient; +using Poco::Net::SMTPClientSession; +using Poco::Net::StringPartSource; +using Poco::Path; +using Poco::Exception; const unsigned char PocoLogo[] = diff --git a/Net/samples/Makefile b/Net/samples/Makefile index a0ac941e7..cde8f3f6d 100644 --- a/Net/samples/Makefile +++ b/Net/samples/Makefile @@ -1,12 +1,14 @@ # # Makefile # -# $Id: //poco/1.1.0/Net/samples/Makefile#1 $ +# $Id: //poco/1.2/Net/samples/Makefile#1 $ # # Makefile for Poco Net Samples # -.DEFAULT all: +.PHONY: projects +clean all: projects +projects: $(MAKE) -C dict $(MAKECMDGOALS) $(MAKE) -C TimeServer $(MAKECMDGOALS) $(MAKE) -C httpget $(MAKECMDGOALS) diff --git a/Net/samples/Ping/Makefile b/Net/samples/Ping/Makefile new file mode 100644 index 000000000..6909b02ed --- /dev/null +++ b/Net/samples/Ping/Makefile @@ -0,0 +1,17 @@ +# +# Makefile +# +# $Id: //poco/1.2/Net/samples/Ping/Makefile#1 $ +# +# Makefile for Poco ping +# + +include $(POCO_BASE)/build/rules/global + +objects = Ping + +target = Ping +target_version = 1 +target_libs = PocoFoundation PocoXML PocoUtil PocoNet + +include $(POCO_BASE)/build/rules/exec diff --git a/Net/samples/Ping/Ping.vmsbuild b/Net/samples/Ping/Ping.vmsbuild new file mode 100644 index 000000000..ab811c0c7 --- /dev/null +++ b/Net/samples/Ping/Ping.vmsbuild @@ -0,0 +1,7 @@ +# +# sample.vmsbuild +# +# $Id: //poco/1.2/Net/samples/Ping/Ping.vmsbuild#1 $ +# +EXE=Ping +Ping diff --git a/Net/samples/Ping/Ping_vs71.vcproj b/Net/samples/Ping/Ping_vs71.vcproj new file mode 100644 index 000000000..d5811545a --- /dev/null +++ b/Net/samples/Ping/Ping_vs71.vcproj @@ -0,0 +1,152 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Net/samples/Ping/Ping_vs80.vcproj b/Net/samples/Ping/Ping_vs80.vcproj new file mode 100644 index 000000000..aad1b1f5e --- /dev/null +++ b/Net/samples/Ping/Ping_vs80.vcproj @@ -0,0 +1,217 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Net/samples/Ping/ping.properties b/Net/samples/Ping/ping.properties new file mode 100644 index 000000000..58962c60a --- /dev/null +++ b/Net/samples/Ping/ping.properties @@ -0,0 +1,8 @@ +# This is a sample configuration file. +logging.loggers.root.channel.class = ConsoleChannel +logging.loggers.app.name = Application +logging.loggers.app.channel = c1 +logging.formatters.f1.class = PatternFormatter +logging.formatters.f1.pattern = %t +logging.channels.c1.class = ConsoleChannel +logging.channels.c1.formatter = f1 diff --git a/Net/samples/Ping/src/Ping.cpp b/Net/samples/Ping/src/Ping.cpp new file mode 100644 index 000000000..f8307047a --- /dev/null +++ b/Net/samples/Ping/src/Ping.cpp @@ -0,0 +1,219 @@ +// +// Ping.cpp +// +// $Id: //poco/1.2/Net/samples/Ping/src/Ping.cpp#1 $ +// +// This sample demonstrates the Application class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#include "Poco/Util/Application.h" +#include "Poco/Util/Option.h" +#include "Poco/Util/OptionSet.h" +#include "Poco/Util/HelpFormatter.h" +#include "Poco/Util/AbstractConfiguration.h" +#include "Poco/Net/ICMPSocket.h" +#include "Poco/Net/ICMPClient.h" +#include "Poco/Net/IPAddress.h" +#include "Poco/Net/ICMPEventArgs.h" +#include "Poco/AutoPtr.h" +#include "Poco/NumberParser.h" +#include "Poco/Delegate.h" +#include +#include + + +using Poco::Util::Application; +using Poco::Util::Option; +using Poco::Util::OptionSet; +using Poco::Util::HelpFormatter; +using Poco::Util::AbstractConfiguration; +using Poco::Net::ICMPSocket; +using Poco::Net::ICMPClient; +using Poco::Net::IPAddress; +using Poco::Net::ICMPEventArgs; +using Poco::AutoPtr; +using Poco::NumberParser; +using Poco::Delegate; + + +class Ping: public Application + /// This sample demonstrates the Poco::Net::ICMPClient in conjunction with + /// Poco Foundation C#-like events functionality. + /// + /// Try Ping --help (on Unix platforms) or Ping /help (elsewhere) for + /// more information. +{ +public: + Ping(): + _helpRequested(false), + _icmpClient(IPAddress::IPv4), + _repetitions(4), + _target("localhost") + { + } + +protected: + void initialize(Application& self) + { + loadConfiguration(); // load default configuration files, if present + Application::initialize(self); + + _icmpClient.pingBegin += Delegate(this, &Ping::onBegin); + _icmpClient.pingReply += Delegate(this, &Ping::onReply); + _icmpClient.pingError += Delegate(this, &Ping::onError); + _icmpClient.pingEnd += Delegate(this, &Ping::onEnd); + } + + void uninitialize() + { + _icmpClient.pingBegin -= Delegate(this, &Ping::onBegin); + _icmpClient.pingReply -= Delegate(this, &Ping::onReply); + _icmpClient.pingError -= Delegate(this, &Ping::onError); + _icmpClient.pingEnd -= Delegate(this, &Ping::onEnd); + + Application::uninitialize(); + } + + void defineOptions(OptionSet& options) + { + Application::defineOptions(options); + + options.addOption( + Option("help", "h", "display help information on command line arguments") + .required(false) + .repeatable(false)); + + options.addOption( + Option("repetitions", "r", "define the number of repetitions") + .required(false) + .repeatable(false) + .argument("repetitions")); + + options.addOption( + Option("target", "t", "define the target address") + .required(false) + .repeatable(false) + .argument("target")); + } + + void handleOption(const std::string& name, const std::string& value) + { + Application::handleOption(name, value); + + if (name == "help") + _helpRequested = true; + else if (name == "repetitions") + _repetitions = NumberParser::parse(value); + else if (name == "target") + _target = value; + } + + void displayHelp() + { + HelpFormatter helpFormatter(options()); + helpFormatter.setCommand(commandName()); + helpFormatter.setUsage("OPTIONS"); + helpFormatter.setHeader( + "A sample application that demonstrates the functionality of the " + "Poco::Net::ICMPClient class in conjunction with Poco::Events package functionality."); + helpFormatter.format(std::cout); + } + + + int main(const std::vector& args) + { + if (_helpRequested) + displayHelp(); + else + _icmpClient.ping(_target, _repetitions); + + return Application::EXIT_OK; + } + + + void onBegin(const void* pSender, ICMPEventArgs& args) + { + std::ostringstream os; + os << "Pinging " << args.hostName() << " [" << args.hostAddress() << "] with " << args.dataSize() << " bytes of data:" + << std::endl << "---------------------------------------------" << std::endl; + logger().information(os.str()); + } + + void onReply(const void* pSender, ICMPEventArgs& args) + { + std::ostringstream os; + os << "Reply from " << args.hostAddress() + << " bytes=" << args.dataSize() + << " time=" << args.replyTime() << "ms" + << " TTL=" << args.ttl(); + logger().information(os.str()); + } + + void onError(const void* pSender, ICMPEventArgs& args) + { + std::ostringstream os; + os << args.error(); + logger().information(os.str()); + } + + void onEnd(const void* pSender, ICMPEventArgs& args) + { + std::ostringstream os; + os << std::endl << "--- Ping statistics for " << args.hostName() << " ---" + << std::endl << "Packets: Sent=" << args.sent() << ", Received=" << args.received() + << " Lost=" << args.repetitions() - args.received() << " (" << 100.0 - args.percent() << "% loss)," + << std::endl << "Approximate round trip times in milliseconds: " << std::endl + << "Minimum=" << args.minRTT() << "ms, Maximum=" << args.maxRTT() + << "ms, Average=" << args.avgRTT() << "ms" + << std::endl << "------------------------------------------"; + logger().information(os.str()); + } + +private: + bool _helpRequested; + ICMPClient _icmpClient; + int _repetitions; + std::string _target; +}; + + +int main(int argc, char** argv) +{ + AutoPtr pApp = new Ping; + try + { + pApp->init(argc, argv); + } + catch (Poco::Exception& exc) + { + pApp->logger().log(exc); + return Application::EXIT_CONFIG; + } + return pApp->run(); +} diff --git a/Net/samples/TimeServer/Makefile b/Net/samples/TimeServer/Makefile index 3c6812527..3454bba37 100644 --- a/Net/samples/TimeServer/Makefile +++ b/Net/samples/TimeServer/Makefile @@ -1,7 +1,7 @@ # # Makefile # -# $Id: //poco/1.1.0/Net/samples/TimeServer/Makefile#1 $ +# $Id: //poco/1.2/Net/samples/TimeServer/Makefile#1 $ # # Makefile for Poco TimeServer # @@ -12,6 +12,6 @@ objects = TimeServer target = TimeServer target_version = 1 -target_libs = PocoFoundation PocoXML PocoNet PocoUtil +target_libs = PocoUtil PocoNet PocoXML PocoFoundation include $(POCO_BASE)/build/rules/exec diff --git a/Net/samples/TimeServer/TimeServer.vmsbuild b/Net/samples/TimeServer/TimeServer.vmsbuild index 0cdcd6a24..6a41765f0 100644 --- a/Net/samples/TimeServer/TimeServer.vmsbuild +++ b/Net/samples/TimeServer/TimeServer.vmsbuild @@ -1,7 +1,7 @@ # # sample.vmsbuild # -# $Id: //poco/1.1.0/Net/samples/TimeServer/TimeServer.vmsbuild#1 $ +# $Id: //poco/1.2/Net/samples/TimeServer/TimeServer.vmsbuild#1 $ # EXE=TimeServer TimeServer diff --git a/Net/samples/TimeServer/src/TimeServer.cpp b/Net/samples/TimeServer/src/TimeServer.cpp index e528b5574..118148075 100644 --- a/Net/samples/TimeServer/src/TimeServer.cpp +++ b/Net/samples/TimeServer/src/TimeServer.cpp @@ -1,7 +1,7 @@ // // TimeServer.cpp // -// $Id: //poco/1.1.0/Net/samples/TimeServer/src/TimeServer.cpp#2 $ +// $Id: //poco/1.2/Net/samples/TimeServer/src/TimeServer.cpp#1 $ // // This sample demonstrates the TCPServer and ServerSocket classes. // @@ -32,36 +32,36 @@ // -#include "Net/TCPServer.h" -#include "Net/TCPServerConnection.h" -#include "Net/TCPServerConnectionFactory.h" -#include "Net/TCPServerParams.h" -#include "Net/StreamSocket.h" -#include "Net/ServerSocket.h" -#include "Foundation/Timestamp.h" -#include "Foundation/DateTimeFormatter.h" -#include "Foundation/DateTimeFormat.h" -#include "Foundation/Exception.h" -#include "Util/ServerApplication.h" -#include "Util/Option.h" -#include "Util/OptionSet.h" -#include "Util/HelpFormatter.h" +#include "Poco/Net/TCPServer.h" +#include "Poco/Net/TCPServerConnection.h" +#include "Poco/Net/TCPServerConnectionFactory.h" +#include "Poco/Net/TCPServerParams.h" +#include "Poco/Net/StreamSocket.h" +#include "Poco/Net/ServerSocket.h" +#include "Poco/Timestamp.h" +#include "Poco/DateTimeFormatter.h" +#include "Poco/DateTimeFormat.h" +#include "Poco/Exception.h" +#include "Poco/Util/ServerApplication.h" +#include "Poco/Util/Option.h" +#include "Poco/Util/OptionSet.h" +#include "Poco/Util/HelpFormatter.h" #include -using Net::ServerSocket; -using Net::StreamSocket; -using Net::TCPServerConnection; -using Net::TCPServerConnectionFactory; -using Net::TCPServer; -using Foundation::Timestamp; -using Foundation::DateTimeFormatter; -using Foundation::DateTimeFormat; -using Util::ServerApplication; -using Util::Application; -using Util::Option; -using Util::OptionSet; -using Util::HelpFormatter; +using Poco::Net::ServerSocket; +using Poco::Net::StreamSocket; +using Poco::Net::TCPServerConnection; +using Poco::Net::TCPServerConnectionFactory; +using Poco::Net::TCPServer; +using Poco::Timestamp; +using Poco::DateTimeFormatter; +using Poco::DateTimeFormat; +using Poco::Util::ServerApplication; +using Poco::Util::Application; +using Poco::Util::Option; +using Poco::Util::OptionSet; +using Poco::Util::HelpFormatter; class TimeServerConnection: public TCPServerConnection @@ -87,7 +87,7 @@ public: dt.append("\r\n"); socket().sendBytes(dt.data(), (int) dt.length()); } - catch (Foundation::Exception& exc) + catch (Poco::Exception& exc) { app.logger().log(exc); } @@ -117,7 +117,7 @@ private: }; -class TimeServer: public Util::ServerApplication +class TimeServer: public Poco::Util::ServerApplication /// The main application class. /// /// This class handles command-line arguments and diff --git a/Net/samples/dict/Makefile b/Net/samples/dict/Makefile index b6fcaa530..fc9fe3065 100644 --- a/Net/samples/dict/Makefile +++ b/Net/samples/dict/Makefile @@ -1,7 +1,7 @@ # # Makefile # -# $Id: //poco/1.1.0/Net/samples/dict/Makefile#1 $ +# $Id: //poco/1.2/Net/samples/dict/Makefile#1 $ # # Makefile for Poco dict # @@ -12,6 +12,6 @@ objects = dict target = dict target_version = 1 -target_libs = PocoFoundation PocoXML PocoNet PocoUtil +target_libs = PocoUtil PocoNet PocoXML PocoFoundation include $(POCO_BASE)/build/rules/exec diff --git a/Net/samples/dict/dict.vmsbuild b/Net/samples/dict/dict.vmsbuild index 30077c7a7..d7295e256 100644 --- a/Net/samples/dict/dict.vmsbuild +++ b/Net/samples/dict/dict.vmsbuild @@ -1,7 +1,7 @@ # # sample.vmsbuild # -# $Id: //poco/1.1.0/Net/samples/dict/dict.vmsbuild#1 $ +# $Id: //poco/1.2/Net/samples/dict/dict.vmsbuild#1 $ # EXE=dict dict diff --git a/Net/samples/dict/src/dict.cpp b/Net/samples/dict/src/dict.cpp index c1c92e3a0..6cf795f00 100644 --- a/Net/samples/dict/src/dict.cpp +++ b/Net/samples/dict/src/dict.cpp @@ -1,7 +1,7 @@ // // dict.cpp // -// $Id: //poco/1.1.0/Net/samples/dict/src/dict.cpp#2 $ +// $Id: //poco/1.2/Net/samples/dict/src/dict.cpp#1 $ // // This sample demonstrates the StreamSocket and SocketStream classes. // @@ -32,21 +32,21 @@ // -#include "Net/StreamSocket.h" -#include "Net/SocketStream.h" -#include "Net/SocketAddress.h" -#include "Foundation/StreamCopier.h" -#include "Foundation/Path.h" -#include "Foundation/Exception.h" +#include "Poco/Net/StreamSocket.h" +#include "Poco/Net/SocketStream.h" +#include "Poco/Net/SocketAddress.h" +#include "Poco/StreamCopier.h" +#include "Poco/Path.h" +#include "Poco/Exception.h" #include -using Net::StreamSocket; -using Net::SocketStream; -using Net::SocketAddress; -using Foundation::StreamCopier; -using Foundation::Path; -using Foundation::Exception; +using Poco::Net::StreamSocket; +using Poco::Net::SocketStream; +using Poco::Net::SocketAddress; +using Poco::StreamCopier; +using Poco::Path; +using Poco::Exception; int main(int argc, char** argv) diff --git a/Net/samples/download/Makefile b/Net/samples/download/Makefile index b7a169c73..8a97b2483 100644 --- a/Net/samples/download/Makefile +++ b/Net/samples/download/Makefile @@ -12,6 +12,6 @@ objects = download target = download target_version = 1 -target_libs = PocoFoundation PocoXML PocoNet PocoUtil +target_libs = PocoUtil PocoNet PocoXML PocoFoundation include $(POCO_BASE)/build/rules/exec diff --git a/Net/samples/download/src/download.cpp b/Net/samples/download/src/download.cpp index b03cc2a21..49a3a264c 100644 --- a/Net/samples/download/src/download.cpp +++ b/Net/samples/download/src/download.cpp @@ -1,7 +1,7 @@ // // download.cpp // -// $Id: //poco/1.1.0/Net/samples/download/src/download.cpp#2 $ +// $Id: //poco/1.2/Net/samples/download/src/download.cpp#1 $ // // This sample demonstrates the URIStreamOpener class. // @@ -32,24 +32,24 @@ // -#include "Foundation/URIStreamOpener.h" -#include "Foundation/StreamCopier.h" -#include "Foundation/Path.h" -#include "Foundation/URI.h" -#include "Foundation/Exception.h" -#include "Net/HTTPStreamFactory.h" -#include "Net/FTPStreamFactory.h" +#include "Poco/URIStreamOpener.h" +#include "Poco/StreamCopier.h" +#include "Poco/Path.h" +#include "Poco/URI.h" +#include "Poco/Exception.h" +#include "Poco/Net/HTTPStreamFactory.h" +#include "Poco/Net/FTPStreamFactory.h" #include #include -using Foundation::URIStreamOpener; -using Foundation::StreamCopier; -using Foundation::Path; -using Foundation::URI; -using Foundation::Exception; -using Net::HTTPStreamFactory; -using Net::FTPStreamFactory; +using Poco::URIStreamOpener; +using Poco::StreamCopier; +using Poco::Path; +using Poco::URI; +using Poco::Exception; +using Poco::Net::HTTPStreamFactory; +using Poco::Net::FTPStreamFactory; int main(int argc, char** argv) diff --git a/Net/samples/httpget/Makefile b/Net/samples/httpget/Makefile index b15697e16..54071172e 100644 --- a/Net/samples/httpget/Makefile +++ b/Net/samples/httpget/Makefile @@ -1,7 +1,7 @@ # # Makefile # -# $Id: //poco/1.1.0/Net/samples/httpget/Makefile#1 $ +# $Id: //poco/1.2/Net/samples/httpget/Makefile#1 $ # # Makefile for Poco httpget # @@ -12,6 +12,6 @@ objects = httpget target = httpget target_version = 1 -target_libs = PocoFoundation PocoXML PocoNet PocoUtil +target_libs = PocoUtil PocoNet PocoXML PocoFoundation include $(POCO_BASE)/build/rules/exec diff --git a/Net/samples/httpget/httpget.vmsbuild b/Net/samples/httpget/httpget.vmsbuild index 03b3a4d59..9cb331c2c 100644 --- a/Net/samples/httpget/httpget.vmsbuild +++ b/Net/samples/httpget/httpget.vmsbuild @@ -1,7 +1,7 @@ # # sample.vmsbuild # -# $Id: //poco/1.1.0/Net/samples/httpget/httpget.vmsbuild#1 $ +# $Id: //poco/1.2/Net/samples/httpget/httpget.vmsbuild#1 $ # EXE=httpget httpget diff --git a/Net/samples/httpget/src/httpget.cpp b/Net/samples/httpget/src/httpget.cpp index 4c386f90d..719dbdb51 100644 --- a/Net/samples/httpget/src/httpget.cpp +++ b/Net/samples/httpget/src/httpget.cpp @@ -1,7 +1,7 @@ // // httpget.cpp // -// $Id: //poco/1.1.0/Net/samples/httpget/src/httpget.cpp#2 $ +// $Id: //poco/1.2/Net/samples/httpget/src/httpget.cpp#1 $ // // This sample demonstrates the HTTPClientSession class. // @@ -32,24 +32,24 @@ // -#include "Net/HTTPClientSession.h" -#include "Net/HTTPRequest.h" -#include "Net/HTTPResponse.h" -#include "Foundation/StreamCopier.h" -#include "Foundation/Path.h" -#include "Foundation/URI.h" -#include "Foundation/Exception.h" +#include "Poco/Net/HTTPClientSession.h" +#include "Poco/Net/HTTPRequest.h" +#include "Poco/Net/HTTPResponse.h" +#include "Poco/StreamCopier.h" +#include "Poco/Path.h" +#include "Poco/URI.h" +#include "Poco/Exception.h" #include -using Net::HTTPClientSession; -using Net::HTTPRequest; -using Net::HTTPResponse; -using Net::HTTPMessage; -using Foundation::StreamCopier; -using Foundation::Path; -using Foundation::URI; -using Foundation::Exception; +using Poco::Net::HTTPClientSession; +using Poco::Net::HTTPRequest; +using Poco::Net::HTTPResponse; +using Poco::Net::HTTPMessage; +using Poco::StreamCopier; +using Poco::Path; +using Poco::URI; +using Poco::Exception; int main(int argc, char** argv) diff --git a/Net/samples/samples_vs71.sln b/Net/samples/samples_vs71.sln index b45eb7fd6..4788cfbed 100644 --- a/Net/samples/samples_vs71.sln +++ b/Net/samples/samples_vs71.sln @@ -27,6 +27,18 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Mail", "Mail\Mail_vs71.vcpr ProjectSection(ProjectDependencies) = postProject EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HTTPLoadTest", "HTTPLoadTest\HTTPLoadTest_vs71.vcproj", "{455C9515-4914-49B6-93FB-C37242A6C21C}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Ping", "Ping\Ping_vs71.vcproj", "{73408DCF-2E65-47AF-BF38-7466DAB8D5CB}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HTTPFormServer", "HTTPFormServer\HTTPFormServer_vs71.vcproj", "{45A054E6-44EC-4943-809A-BA8B2A25DA21}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject Global GlobalSection(SolutionConfiguration) = preSolution debug_shared = debug_shared @@ -61,6 +73,18 @@ Global {1B776CF5-3889-48D1-A58B-694D06FBD632}.debug_shared.Build.0 = debug_shared|Win32 {1B776CF5-3889-48D1-A58B-694D06FBD632}.release_shared.ActiveCfg = release_shared|Win32 {1B776CF5-3889-48D1-A58B-694D06FBD632}.release_shared.Build.0 = release_shared|Win32 + {455C9515-4914-49B6-93FB-C37242A6C21C}.debug_shared.ActiveCfg = debug_shared|Win32 + {455C9515-4914-49B6-93FB-C37242A6C21C}.debug_shared.Build.0 = debug_shared|Win32 + {455C9515-4914-49B6-93FB-C37242A6C21C}.release_shared.ActiveCfg = release_shared|Win32 + {455C9515-4914-49B6-93FB-C37242A6C21C}.release_shared.Build.0 = release_shared|Win32 + {73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.debug_shared.ActiveCfg = debug_shared|Win32 + {73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.debug_shared.Build.0 = debug_shared|Win32 + {73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.release_shared.ActiveCfg = release_shared|Win32 + {73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.release_shared.Build.0 = release_shared|Win32 + {45A054E6-44EC-4943-809A-BA8B2A25DA21}.debug_shared.ActiveCfg = debug_shared|Win32 + {45A054E6-44EC-4943-809A-BA8B2A25DA21}.debug_shared.Build.0 = debug_shared|Win32 + {45A054E6-44EC-4943-809A-BA8B2A25DA21}.release_shared.ActiveCfg = release_shared|Win32 + {45A054E6-44EC-4943-809A-BA8B2A25DA21}.release_shared.Build.0 = release_shared|Win32 EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution EndGlobalSection diff --git a/Net/samples/samples_vs80.sln b/Net/samples/samples_vs80.sln index 2b321de0e..df394b362 100644 --- a/Net/samples/samples_vs80.sln +++ b/Net/samples/samples_vs80.sln @@ -14,6 +14,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EchoServer", "EchoServer\Ec EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Mail", "Mail\Mail_vs80.vcproj", "{D6C4B3D4-2026-4A33-B4DA-ABE8FF2EE0B8}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HTTPLoadTest", "HTTPLoadTest\HTTPLoadTest_vs80.vcproj", "{DC23240B-5266-4486-A141-B8D6F25F7676}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Ping", "Ping\Ping_vs80.vcproj", "{73408DCF-2E65-47AF-BF38-7466DAB8D5CB}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HTTPFormServer", "HTTPFormServer\HTTPFormServer_vs80.vcproj", "{5363487F-1F23-4F9E-B6A7-5471B0F2373F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution debug_shared|Win32 = debug_shared|Win32 @@ -48,6 +54,18 @@ Global {D6C4B3D4-2026-4A33-B4DA-ABE8FF2EE0B8}.debug_shared|Win32.Build.0 = debug_shared|Win32 {D6C4B3D4-2026-4A33-B4DA-ABE8FF2EE0B8}.release_shared|Win32.ActiveCfg = release_shared|Win32 {D6C4B3D4-2026-4A33-B4DA-ABE8FF2EE0B8}.release_shared|Win32.Build.0 = release_shared|Win32 + {DC23240B-5266-4486-A141-B8D6F25F7676}.debug_shared|Win32.ActiveCfg = debug_shared|Win32 + {DC23240B-5266-4486-A141-B8D6F25F7676}.debug_shared|Win32.Build.0 = debug_shared|Win32 + {DC23240B-5266-4486-A141-B8D6F25F7676}.release_shared|Win32.ActiveCfg = release_shared|Win32 + {DC23240B-5266-4486-A141-B8D6F25F7676}.release_shared|Win32.Build.0 = release_shared|Win32 + {73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.debug_shared|Win32.ActiveCfg = debug_shared|Win32 + {73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.debug_shared|Win32.Build.0 = debug_shared|Win32 + {73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.release_shared|Win32.ActiveCfg = release_shared|Win32 + {73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.release_shared|Win32.Build.0 = release_shared|Win32 + {5363487F-1F23-4F9E-B6A7-5471B0F2373F}.debug_shared|Win32.ActiveCfg = debug_shared|Win32 + {5363487F-1F23-4F9E-B6A7-5471B0F2373F}.debug_shared|Win32.Build.0 = debug_shared|Win32 + {5363487F-1F23-4F9E-B6A7-5471B0F2373F}.release_shared|Win32.ActiveCfg = release_shared|Win32 + {5363487F-1F23-4F9E-B6A7-5471B0F2373F}.release_shared|Win32.Build.0 = release_shared|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Net/src/DNS.cpp b/Net/src/DNS.cpp index 39f239258..f550d45af 100644 --- a/Net/src/DNS.cpp +++ b/Net/src/DNS.cpp @@ -1,7 +1,7 @@ // // DNS.cpp // -// $Id: //poco/1.1.0/Net/src/DNS.cpp#2 $ +// $Id: //poco/1.2/Net/src/DNS.cpp#1 $ // // Library: Net // Package: NetCore @@ -34,17 +34,17 @@ // -#include "Net/DNS.h" -#include "Net/NetException.h" -#include "Net/SocketAddress.h" -#include "Foundation/Environment.h" -#include "Foundation/NumberFormatter.h" +#include "Poco/Net/DNS.h" +#include "Poco/Net/NetException.h" +#include "Poco/Net/SocketAddress.h" +#include "Poco/Environment.h" +#include "Poco/NumberFormatter.h" -using Foundation::FastMutex; -using Foundation::Environment; -using Foundation::NumberFormatter; -using Foundation::IOException; +using Poco::FastMutex; +using Poco::Environment; +using Poco::NumberFormatter; +using Poco::IOException; // @@ -74,11 +74,12 @@ namespace #endif // _WIN32 -Net_BEGIN +namespace Poco { +namespace Net { DNS::DNSCache DNS::_cache; -Foundation::FastMutex DNS::_mutex; +Poco::FastMutex DNS::_mutex; const HostEntry& DNS::hostByName(const std::string& hostname) @@ -223,4 +224,4 @@ void DNS::error(int code, const std::string& arg) } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/DatagramSocket.cpp b/Net/src/DatagramSocket.cpp index 9595ab9b1..0566ebc73 100644 --- a/Net/src/DatagramSocket.cpp +++ b/Net/src/DatagramSocket.cpp @@ -1,7 +1,7 @@ // // DatagramSocket.cpp // -// $Id: //poco/1.1.0/Net/src/DatagramSocket.cpp#2 $ +// $Id: //poco/1.2/Net/src/DatagramSocket.cpp#1 $ // // Library: Net // Package: Sockets @@ -34,15 +34,16 @@ // -#include "Net/DatagramSocket.h" -#include "Net/DatagramSocketImpl.h" -#include "Foundation/Exception.h" +#include "Poco/Net/DatagramSocket.h" +#include "Poco/Net/DatagramSocketImpl.h" +#include "Poco/Exception.h" -using Foundation::InvalidArgumentException; +using Poco::InvalidArgumentException; -Net_BEGIN +namespace Poco { +namespace Net { DatagramSocket::DatagramSocket(): Socket(new DatagramSocketImpl) @@ -126,4 +127,4 @@ int DatagramSocket::receiveFrom(void* buffer, int length, SocketAddress& address } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/DatagramSocketImpl.cpp b/Net/src/DatagramSocketImpl.cpp index e9bd2a78b..52f8ecc2b 100644 --- a/Net/src/DatagramSocketImpl.cpp +++ b/Net/src/DatagramSocketImpl.cpp @@ -1,7 +1,7 @@ // // DatagramSocketImpl.cpp // -// $Id: //poco/1.1.0/Net/src/DatagramSocketImpl.cpp#2 $ +// $Id: //poco/1.2/Net/src/DatagramSocketImpl.cpp#1 $ // // Library: Net // Package: Sockets @@ -34,14 +34,15 @@ // -#include "Net/DatagramSocketImpl.h" -#include "Net/NetException.h" +#include "Poco/Net/DatagramSocketImpl.h" +#include "Poco/Net/NetException.h" -using Foundation::InvalidArgumentException; +using Poco::InvalidArgumentException; -Net_BEGIN +namespace Poco { +namespace Net { DatagramSocketImpl::DatagramSocketImpl() @@ -79,4 +80,4 @@ void DatagramSocketImpl::init(int af) } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/DialogSocket.cpp b/Net/src/DialogSocket.cpp index 7a39685a5..35e726350 100644 --- a/Net/src/DialogSocket.cpp +++ b/Net/src/DialogSocket.cpp @@ -1,7 +1,7 @@ // // DialogSocket.cpp // -// $Id: //poco/1.1.0/Net/src/DialogSocket.cpp#2 $ +// $Id: //poco/1.2/Net/src/DialogSocket.cpp#1 $ // // Library: Net // Package: Sockets @@ -34,12 +34,13 @@ // -#include "Net/DialogSocket.h" +#include "Poco/Net/DialogSocket.h" #include #include -Net_BEGIN +namespace Poco { +namespace Net { DialogSocket::DialogSocket(): @@ -274,4 +275,4 @@ int DialogSocket::receiveStatusLine(std::string& line) } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/FTPClientSession.cpp b/Net/src/FTPClientSession.cpp index e786dd928..932643088 100644 --- a/Net/src/FTPClientSession.cpp +++ b/Net/src/FTPClientSession.cpp @@ -1,7 +1,7 @@ // // FTPClientSession.cpp // -// $Id: //poco/1.1.0/Net/src/FTPClientSession.cpp#2 $ +// $Id: //poco/1.2/Net/src/FTPClientSession.cpp#1 $ // // Library: Net // Package: FTP @@ -34,19 +34,20 @@ // -#include "Net/FTPClientSession.h" -#include "Net/SocketAddress.h" -#include "Net/SocketStream.h" -#include "Net/ServerSocket.h" -#include "Net/NetException.h" -#include "Foundation/NumberFormatter.h" +#include "Poco/Net/FTPClientSession.h" +#include "Poco/Net/SocketAddress.h" +#include "Poco/Net/SocketStream.h" +#include "Poco/Net/ServerSocket.h" +#include "Poco/Net/NetException.h" +#include "Poco/NumberFormatter.h" #include -using Foundation::NumberFormatter; +using Poco::NumberFormatter; -Net_BEGIN +namespace Poco { +namespace Net { FTPClientSession::FTPClientSession(const StreamSocket& socket): @@ -62,7 +63,7 @@ FTPClientSession::FTPClientSession(const StreamSocket& socket): } -FTPClientSession::FTPClientSession(const std::string& host, Foundation::UInt16 port): +FTPClientSession::FTPClientSession(const std::string& host, Poco::UInt16 port): _controlSocket(SocketAddress(host, port)), _pDataStream(0), _passiveMode(true), @@ -87,14 +88,14 @@ FTPClientSession::~FTPClientSession() } -void FTPClientSession::setTimeout(const Foundation::Timespan& timeout) +void FTPClientSession::setTimeout(const Poco::Timespan& timeout) { _timeout = timeout; _controlSocket.setReceiveTimeout(timeout); } -Foundation::Timespan FTPClientSession::getTimeout() const +Poco::Timespan FTPClientSession::getTimeout() const { return _timeout; } @@ -415,7 +416,7 @@ void FTPClientSession::sendPORT(const SocketAddress& addr) if (*it == '.') *it = ','; } arg += ','; - Foundation::UInt16 port = addr.port(); + Poco::UInt16 port = addr.port(); arg += NumberFormatter::format(port/256); arg += ','; arg += NumberFormatter::format(port % 256); @@ -466,10 +467,10 @@ void FTPClientSession::parseAddress(const std::string& str, SocketAddress& addr) if (it != end && *it == ',') { host += '.'; ++it; } while (it != end && isdigit(*it)) host += *it++; if (it != end && *it == ',') ++it; - Foundation::UInt16 portHi = 0; + Poco::UInt16 portHi = 0; while (it != end && isdigit(*it)) { portHi *= 10; portHi += *it++ - '0'; } if (it != end && *it == ',') ++it; - Foundation::UInt16 portLo = 0; + Poco::UInt16 portLo = 0; while (it != end && isdigit(*it)) { portLo *= 10; portLo += *it++ - '0'; } addr = SocketAddress(host, portHi*256 + portLo); } @@ -485,7 +486,7 @@ void FTPClientSession::parseExtAddress(const std::string& str, SocketAddress& ad if (it != end) delim = *it++; if (it != end && *it == delim) ++it; if (it != end && *it == delim) ++it; - Foundation::UInt16 port = 0; + Poco::UInt16 port = 0; while (it != end && isdigit(*it)) { port *= 10; port += *it++ - '0'; } addr = SocketAddress(_controlSocket.peerAddress().host(), port); } @@ -504,4 +505,4 @@ void FTPClientSession::endTransfer() } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/FTPStreamFactory.cpp b/Net/src/FTPStreamFactory.cpp index 015ddb887..70f49aa5b 100644 --- a/Net/src/FTPStreamFactory.cpp +++ b/Net/src/FTPStreamFactory.cpp @@ -1,7 +1,7 @@ // // FTPStreamFactory.cpp // -// $Id: //poco/1.1.0/Net/src/FTPStreamFactory.cpp#2 $ +// $Id: //poco/1.2/Net/src/FTPStreamFactory.cpp#1 $ // // Library: Net // Package: FTP @@ -34,23 +34,24 @@ // -#include "Net/FTPStreamFactory.h" -#include "Net/FTPClientSession.h" -#include "Net/NetException.h" -#include "Foundation/URI.h" -#include "Foundation/URIStreamOpener.h" -#include "Foundation/UnbufferedStreamBuf.h" -#include "Foundation/Path.h" +#include "Poco/Net/FTPStreamFactory.h" +#include "Poco/Net/FTPClientSession.h" +#include "Poco/Net/NetException.h" +#include "Poco/URI.h" +#include "Poco/URIStreamOpener.h" +#include "Poco/UnbufferedStreamBuf.h" +#include "Poco/Path.h" -using Foundation::URIStreamFactory; -using Foundation::URI; -using Foundation::URIStreamOpener; -using Foundation::UnbufferedStreamBuf; -using Foundation::Path; +using Poco::URIStreamFactory; +using Poco::URI; +using Poco::URIStreamOpener; +using Poco::UnbufferedStreamBuf; +using Poco::Path; -Net_BEGIN +namespace Poco { +namespace Net { class FTPStreamBuf: public UnbufferedStreamBuf @@ -231,7 +232,7 @@ void FTPStreamFactory::getUserInfo(const URI& uri, std::string& username, std::s } -void FTPStreamFactory::getPathAndType(const Foundation::URI& uri, std::string& path, char& type) +void FTPStreamFactory::getPathAndType(const Poco::URI& uri, std::string& path, char& type) { path = uri.getPath(); type = 'i'; @@ -253,4 +254,4 @@ void FTPStreamFactory::registerFactory() } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/FilePartSource.cpp b/Net/src/FilePartSource.cpp index eadf73b12..d613af3c5 100644 --- a/Net/src/FilePartSource.cpp +++ b/Net/src/FilePartSource.cpp @@ -1,7 +1,7 @@ // // FilePartSource.cpp // -// $Id: //poco/1.1.0/Net/src/FilePartSource.cpp#2 $ +// $Id: //poco/1.2/Net/src/FilePartSource.cpp#1 $ // // Library: Net // Package: Messages @@ -34,16 +34,17 @@ // -#include "Net/FilePartSource.h" -#include "Foundation/Path.h" -#include "Foundation/Exception.h" +#include "Poco/Net/FilePartSource.h" +#include "Poco/Path.h" +#include "Poco/Exception.h" -using Foundation::Path; -using Foundation::OpenFileException; +using Poco::Path; +using Poco::OpenFileException; -Net_BEGIN +namespace Poco { +namespace Net { FilePartSource::FilePartSource(const std::string& path): @@ -84,4 +85,4 @@ const std::string& FilePartSource::filename() } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/HTMLForm.cpp b/Net/src/HTMLForm.cpp index ce919f9bc..c7b3f3f7e 100644 --- a/Net/src/HTMLForm.cpp +++ b/Net/src/HTMLForm.cpp @@ -1,7 +1,7 @@ // // HTMLForm.cpp // -// $Id: //poco/1.1.0/Net/src/HTMLForm.cpp#2 $ +// $Id: //poco/1.2/Net/src/HTMLForm.cpp#1 $ // // Library: Net // Package: HTML @@ -34,30 +34,31 @@ // -#include "Net/HTMLForm.h" -#include "Net/HTTPRequest.h" -#include "Net/PartSource.h" -#include "Net/PartHandler.h" -#include "Net/MultipartWriter.h" -#include "Net/MultipartReader.h" -#include "Net/NullPartHandler.h" -#include "Foundation/NullStream.h" -#include "Foundation/StreamCopier.h" -#include "Foundation/Exception.h" -#include "Foundation/URI.h" -#include "Foundation/String.h" +#include "Poco/Net/HTMLForm.h" +#include "Poco/Net/HTTPRequest.h" +#include "Poco/Net/PartSource.h" +#include "Poco/Net/PartHandler.h" +#include "Poco/Net/MultipartWriter.h" +#include "Poco/Net/MultipartReader.h" +#include "Poco/Net/NullPartHandler.h" +#include "Poco/NullStream.h" +#include "Poco/StreamCopier.h" +#include "Poco/Exception.h" +#include "Poco/URI.h" +#include "Poco/String.h" #include #include -using Foundation::NullInputStream; -using Foundation::StreamCopier; -using Foundation::SyntaxException; -using Foundation::URI; -using Foundation::icompare; +using Poco::NullInputStream; +using Poco::StreamCopier; +using Poco::SyntaxException; +using Poco::URI; +using Poco::icompare; -Net_BEGIN +namespace Poco { +namespace Net { const std::string HTMLForm::ENCODING_URL = "application/x-www-form-urlencoded"; @@ -76,15 +77,15 @@ HTMLForm::HTMLForm(const std::string& encoding): } -HTMLForm::HTMLForm(const HTTPRequest& request, std::istream& istr, PartHandler& handler) +HTMLForm::HTMLForm(const HTTPRequest& request, std::istream& requestBody, PartHandler& handler) { - load(request, istr, handler); + load(request, requestBody, handler); } -HTMLForm::HTMLForm(const HTTPRequest& request, std::istream& istr) +HTMLForm::HTMLForm(const HTTPRequest& request, std::istream& requestBody) { - load(request, istr); + load(request, requestBody); } @@ -122,13 +123,7 @@ void HTMLForm::addPart(const std::string& name, PartSource* pSource) void HTMLForm::load(const HTTPRequest& request, std::istream& requestBody, PartHandler& handler) { - if (request.getMethod() == HTTPRequest::HTTP_GET) - { - URI uri(request.getURI()); - std::istringstream istr(uri.getRawQuery()); - readUrl(istr); - } - else + if (request.getMethod() == HTTPRequest::HTTP_POST) { std::string mediaType; NameValueCollection params; @@ -144,6 +139,12 @@ void HTMLForm::load(const HTTPRequest& request, std::istream& requestBody, PartH readUrl(requestBody); } } + else + { + URI uri(request.getURI()); + std::istringstream istr(uri.getRawQuery()); + readUrl(istr); + } } @@ -173,16 +174,7 @@ void HTMLForm::read(std::istream& istr, PartHandler& handler) void HTMLForm::prepareSubmit(HTTPRequest& request) { - if (request.getMethod() == HTTPRequest::HTTP_GET) - { - std::string uri = request.getURI(); - std::ostringstream ostr; - write(ostr); - uri.append("?"); - uri.append(ostr.str()); - request.setURI(uri); - } - else if (request.getMethod() == HTTPRequest::HTTP_POST) + if (request.getMethod() == HTTPRequest::HTTP_POST) { if (_encoding == ENCODING_URL) { @@ -207,6 +199,15 @@ void HTMLForm::prepareSubmit(HTTPRequest& request) request.setChunkedTransferEncoding(true); } } + else + { + std::string uri = request.getURI(); + std::ostringstream ostr; + write(ostr); + uri.append("?"); + uri.append(ostr.str()); + request.setURI(uri); + } } @@ -284,7 +285,7 @@ void HTMLForm::readMultipart(std::istream& istr, PartHandler& handler) std::string cd = header.get("Content-Disposition"); MessageHeader::splitParameters(cd, disp, params); } - if (icompare(disp, "file") == 0) + if (params.has("filename")) { handler.handlePart(header, reader.stream()); } @@ -355,4 +356,4 @@ void HTMLForm::writeMultipart(std::ostream& ostr) } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/HTTPBasicCredentials.cpp b/Net/src/HTTPBasicCredentials.cpp index dc6421fef..75300b750 100644 --- a/Net/src/HTTPBasicCredentials.cpp +++ b/Net/src/HTTPBasicCredentials.cpp @@ -1,7 +1,7 @@ // // HTTPBasicCredentials.cpp // -// $Id: //poco/1.1.0/Net/src/HTTPBasicCredentials.cpp#2 $ +// $Id: //poco/1.2/Net/src/HTTPBasicCredentials.cpp#1 $ // // Library: Net // Package: HTTP @@ -34,21 +34,22 @@ // -#include "Net/HTTPBasicCredentials.h" -#include "Net/HTTPRequest.h" -#include "Net/NetException.h" -#include "Foundation/Base64Encoder.h" -#include "Foundation/Base64Decoder.h" -#include "Foundation/String.h" +#include "Poco/Net/HTTPBasicCredentials.h" +#include "Poco/Net/HTTPRequest.h" +#include "Poco/Net/NetException.h" +#include "Poco/Base64Encoder.h" +#include "Poco/Base64Decoder.h" +#include "Poco/String.h" #include -using Foundation::Base64Decoder; -using Foundation::Base64Encoder; -using Foundation::icompare; +using Poco::Base64Decoder; +using Poco::Base64Encoder; +using Poco::icompare; -Net_BEGIN +namespace Poco { +namespace Net { const std::string HTTPBasicCredentials::SCHEME = "Basic"; @@ -121,4 +122,4 @@ void HTTPBasicCredentials::authenticate(HTTPRequest& request) } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/HTTPBufferAllocator.cpp b/Net/src/HTTPBufferAllocator.cpp index a8e910bbc..ebc69c2f3 100644 --- a/Net/src/HTTPBufferAllocator.cpp +++ b/Net/src/HTTPBufferAllocator.cpp @@ -34,13 +34,14 @@ // -#include "Net/HTTPBufferAllocator.h" +#include "Poco/Net/HTTPBufferAllocator.h" -using Foundation::MemoryPool; +using Poco::MemoryPool; -Net_BEGIN +namespace Poco { +namespace Net { MemoryPool HTTPBufferAllocator::_pool(HTTPBufferAllocator::BUFFER_SIZE, 16); @@ -62,4 +63,4 @@ void HTTPBufferAllocator::deallocate(char* ptr, std::streamsize size) } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/HTTPChunkedStream.cpp b/Net/src/HTTPChunkedStream.cpp index b89681b9f..c1af30c04 100644 --- a/Net/src/HTTPChunkedStream.cpp +++ b/Net/src/HTTPChunkedStream.cpp @@ -1,7 +1,7 @@ // // HTTPChunkedStream.cpp // -// $Id: //poco/1.1.0/Net/src/HTTPChunkedStream.cpp#2 $ +// $Id: //poco/1.2/Net/src/HTTPChunkedStream.cpp#1 $ // // Library: Net // Package: HTTP @@ -34,18 +34,19 @@ // -#include "Net/HTTPChunkedStream.h" -#include "Net/HTTPSession.h" -#include "Foundation/NumberFormatter.h" -#include "Foundation/NumberParser.h" +#include "Poco/Net/HTTPChunkedStream.h" +#include "Poco/Net/HTTPSession.h" +#include "Poco/NumberFormatter.h" +#include "Poco/NumberParser.h" #include -using Foundation::NumberFormatter; -using Foundation::NumberParser; +using Poco::NumberFormatter; +using Poco::NumberParser; -Net_BEGIN +namespace Poco { +namespace Net { // @@ -151,7 +152,7 @@ HTTPChunkedStreamBuf* HTTPChunkedIOS::rdbuf() // -Foundation::MemoryPool HTTPChunkedInputStream::_pool(sizeof(HTTPChunkedInputStream)); +Poco::MemoryPool HTTPChunkedInputStream::_pool(sizeof(HTTPChunkedInputStream)); HTTPChunkedInputStream::HTTPChunkedInputStream(HTTPSession& session): @@ -183,7 +184,7 @@ void HTTPChunkedInputStream::operator delete(void* ptr) // -Foundation::MemoryPool HTTPChunkedOutputStream::_pool(sizeof(HTTPChunkedOutputStream)); +Poco::MemoryPool HTTPChunkedOutputStream::_pool(sizeof(HTTPChunkedOutputStream)); HTTPChunkedOutputStream::HTTPChunkedOutputStream(HTTPSession& session): @@ -210,4 +211,4 @@ void HTTPChunkedOutputStream::operator delete(void* ptr) } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/HTTPClientSession.cpp b/Net/src/HTTPClientSession.cpp index 8b280a00a..9825de994 100644 --- a/Net/src/HTTPClientSession.cpp +++ b/Net/src/HTTPClientSession.cpp @@ -1,7 +1,7 @@ // // HTTPClientSession.cpp // -// $Id: //poco/1.1.0/Net/src/HTTPClientSession.cpp#2 $ +// $Id: //poco/1.2/Net/src/HTTPClientSession.cpp#1 $ // // Library: Net // Package: HTTPClient @@ -34,22 +34,23 @@ // -#include "Net/HTTPClientSession.h" -#include "Net/HTTPRequest.h" -#include "Net/HTTPResponse.h" -#include "Net/HTTPHeaderStream.h" -#include "Net/HTTPStream.h" -#include "Net/HTTPFixedLengthStream.h" -#include "Net/HTTPChunkedStream.h" -#include "Net/NetException.h" -#include "Foundation/NumberFormatter.h" +#include "Poco/Net/HTTPClientSession.h" +#include "Poco/Net/HTTPRequest.h" +#include "Poco/Net/HTTPResponse.h" +#include "Poco/Net/HTTPHeaderStream.h" +#include "Poco/Net/HTTPStream.h" +#include "Poco/Net/HTTPFixedLengthStream.h" +#include "Poco/Net/HTTPChunkedStream.h" +#include "Poco/Net/NetException.h" +#include "Poco/NumberFormatter.h" -using Foundation::NumberFormatter; -using Foundation::IllegalStateException; +using Poco::NumberFormatter; +using Poco::IllegalStateException; -Net_BEGIN +namespace Poco { +namespace Net { HTTPClientSession::HTTPClientSession(): @@ -75,7 +76,19 @@ HTTPClientSession::HTTPClientSession(const StreamSocket& socket): } -HTTPClientSession::HTTPClientSession(const std::string& host, Foundation::UInt16 port): +HTTPClientSession::HTTPClientSession(const SocketAddress& address): + _host(address.host().toString()), + _port(address.port()), + _proxyPort(HTTPSession::HTTP_PORT), + _reconnect(false), + _expectResponseBody(false), + _pRequestStream(0), + _pResponseStream(0) +{ +} + + +HTTPClientSession::HTTPClientSession(const std::string& host, Poco::UInt16 port): _host(host), _port(port), _proxyPort(HTTPSession::HTTP_PORT), @@ -103,7 +116,7 @@ void HTTPClientSession::setHost(const std::string& host) } -void HTTPClientSession::setPort(Foundation::UInt16 port) +void HTTPClientSession::setPort(Poco::UInt16 port) { if (!connected()) _port = port; @@ -112,7 +125,7 @@ void HTTPClientSession::setPort(Foundation::UInt16 port) } -void HTTPClientSession::setProxy(const std::string& host, Foundation::UInt16 port) +void HTTPClientSession::setProxy(const std::string& host, Poco::UInt16 port) { if (!connected()) { @@ -132,7 +145,7 @@ void HTTPClientSession::setProxyHost(const std::string& host) } -void HTTPClientSession::setProxyPort(Foundation::UInt16 port) +void HTTPClientSession::setProxyPort(Poco::UInt16 port) { if (!connected()) _proxyPort = port; @@ -178,9 +191,24 @@ std::istream& HTTPClientSession::receiveResponse(HTTPResponse& response) delete _pRequestStream; _pRequestStream = 0; - response.clear(); - HTTPHeaderInputStream his(*this); - response.read(his); + do + { + response.clear(); + HTTPHeaderInputStream his(*this); + try + { + response.read(his); + } + catch (MessageException&) + { + if (networkException()) + networkException()->rethrow(); + else + throw; + } + } + while (response.getStatus() == HTTPResponse::HTTP_CONTINUE); + if (!_expectResponseBody) _pResponseStream = new HTTPFixedLengthInputStream(*this, 0); else if (response.getChunkedTransferEncoding()) @@ -266,4 +294,4 @@ void HTTPClientSession::setRequestStream(std::ostream* pRequestStream) } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/HTTPCookie.cpp b/Net/src/HTTPCookie.cpp index c26dcb04c..1868a0036 100644 --- a/Net/src/HTTPCookie.cpp +++ b/Net/src/HTTPCookie.cpp @@ -1,7 +1,7 @@ // // HTTPCookie.cpp // -// $Id: //poco/1.1.0/Net/src/HTTPCookie.cpp#2 $ +// $Id: //poco/1.2/Net/src/HTTPCookie.cpp#1 $ // // Library: Net // Package: HTTP @@ -34,29 +34,30 @@ // -#include "Net/HTTPCookie.h" -#include "Net/NameValueCollection.h" -#include "Foundation/Timestamp.h" -#include "Foundation/DateTime.h" -#include "Foundation/DateTimeFormatter.h" -#include "Foundation/DateTimeFormat.h" -#include "Foundation/DateTimeParser.h" -#include "Foundation/NumberFormatter.h" -#include "Foundation/NumberParser.h" -#include "Foundation/String.h" +#include "Poco/Net/HTTPCookie.h" +#include "Poco/Net/NameValueCollection.h" +#include "Poco/Timestamp.h" +#include "Poco/DateTime.h" +#include "Poco/DateTimeFormatter.h" +#include "Poco/DateTimeFormat.h" +#include "Poco/DateTimeParser.h" +#include "Poco/NumberFormatter.h" +#include "Poco/NumberParser.h" +#include "Poco/String.h" -using Foundation::Timestamp; -using Foundation::DateTime; -using Foundation::DateTimeFormatter; -using Foundation::DateTimeFormat; -using Foundation::DateTimeParser; -using Foundation::NumberFormatter; -using Foundation::NumberParser; -using Foundation::icompare; +using Poco::Timestamp; +using Poco::DateTime; +using Poco::DateTimeFormatter; +using Poco::DateTimeFormat; +using Poco::DateTimeParser; +using Poco::NumberFormatter; +using Poco::NumberParser; +using Poco::icompare; -Net_BEGIN +namespace Poco { +namespace Net { HTTPCookie::HTTPCookie(): @@ -288,4 +289,4 @@ std::string HTTPCookie::toString() const } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/HTTPFixedLengthStream.cpp b/Net/src/HTTPFixedLengthStream.cpp index f098cbdd4..6abfc4aa3 100644 --- a/Net/src/HTTPFixedLengthStream.cpp +++ b/Net/src/HTTPFixedLengthStream.cpp @@ -1,7 +1,7 @@ // // HTTPFixedLengthStream.cpp // -// $Id: //poco/1.1.0/Net/src/HTTPFixedLengthStream.cpp#2 $ +// $Id: //poco/1.2/Net/src/HTTPFixedLengthStream.cpp#1 $ // // Library: Net // Package: HTTP @@ -34,14 +34,15 @@ // -#include "Net/HTTPFixedLengthStream.h" -#include "Net/HTTPSession.h" +#include "Poco/Net/HTTPFixedLengthStream.h" +#include "Poco/Net/HTTPSession.h" -using Foundation::BufferedStreamBuf; +using Poco::BufferedStreamBuf; -Net_BEGIN +namespace Poco { +namespace Net { // @@ -126,7 +127,7 @@ HTTPFixedLengthStreamBuf* HTTPFixedLengthIOS::rdbuf() // -Foundation::MemoryPool HTTPFixedLengthInputStream::_pool(sizeof(HTTPFixedLengthInputStream)); +Poco::MemoryPool HTTPFixedLengthInputStream::_pool(sizeof(HTTPFixedLengthInputStream)); HTTPFixedLengthInputStream::HTTPFixedLengthInputStream(HTTPSession& session, std::streamsize length): @@ -158,7 +159,7 @@ void HTTPFixedLengthInputStream::operator delete(void* ptr) // -Foundation::MemoryPool HTTPFixedLengthOutputStream::_pool(sizeof(HTTPFixedLengthOutputStream)); +Poco::MemoryPool HTTPFixedLengthOutputStream::_pool(sizeof(HTTPFixedLengthOutputStream)); HTTPFixedLengthOutputStream::HTTPFixedLengthOutputStream(HTTPSession& session, std::streamsize length): @@ -185,4 +186,4 @@ void HTTPFixedLengthOutputStream::operator delete(void* ptr) } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/HTTPHeaderStream.cpp b/Net/src/HTTPHeaderStream.cpp index 28ef3f80c..aec8e2f7b 100644 --- a/Net/src/HTTPHeaderStream.cpp +++ b/Net/src/HTTPHeaderStream.cpp @@ -1,7 +1,7 @@ // // HTTPHeaderStream.cpp // -// $Id: //poco/1.1.0/Net/src/HTTPHeaderStream.cpp#2 $ +// $Id: //poco/1.2/Net/src/HTTPHeaderStream.cpp#1 $ // // Library: Net // Package: HTTP @@ -34,11 +34,12 @@ // -#include "Net/HTTPHeaderStream.h" -#include "Net/HTTPSession.h" +#include "Poco/Net/HTTPHeaderStream.h" +#include "Poco/Net/HTTPSession.h" -Net_BEGIN +namespace Poco { +namespace Net { // @@ -123,7 +124,7 @@ HTTPHeaderStreamBuf* HTTPHeaderIOS::rdbuf() // -Foundation::MemoryPool HTTPHeaderInputStream::_pool(sizeof(HTTPHeaderInputStream)); +Poco::MemoryPool HTTPHeaderInputStream::_pool(sizeof(HTTPHeaderInputStream)); HTTPHeaderInputStream::HTTPHeaderInputStream(HTTPSession& session): @@ -155,7 +156,7 @@ void HTTPHeaderInputStream::operator delete(void* ptr) // -Foundation::MemoryPool HTTPHeaderOutputStream::_pool(sizeof(HTTPHeaderOutputStream)); +Poco::MemoryPool HTTPHeaderOutputStream::_pool(sizeof(HTTPHeaderOutputStream)); HTTPHeaderOutputStream::HTTPHeaderOutputStream(HTTPSession& session): @@ -182,4 +183,4 @@ void HTTPHeaderOutputStream::operator delete(void* ptr) } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/HTTPIOStream.cpp b/Net/src/HTTPIOStream.cpp index c69ab909d..e9bffe14d 100644 --- a/Net/src/HTTPIOStream.cpp +++ b/Net/src/HTTPIOStream.cpp @@ -34,14 +34,15 @@ // -#include "Net/HTTPIOStream.h" -#include "Net/HTTPClientSession.h" +#include "Poco/Net/HTTPIOStream.h" +#include "Poco/Net/HTTPClientSession.h" -using Foundation::UnbufferedStreamBuf; +using Poco::UnbufferedStreamBuf; -Net_BEGIN +namespace Poco { +namespace Net { HTTPResponseStreamBuf::HTTPResponseStreamBuf(std::istream& istr): @@ -81,4 +82,4 @@ HTTPResponseStream::~HTTPResponseStream() } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/HTTPMessage.cpp b/Net/src/HTTPMessage.cpp index 793c0f8c8..700afe192 100644 --- a/Net/src/HTTPMessage.cpp +++ b/Net/src/HTTPMessage.cpp @@ -1,7 +1,7 @@ // // HTTPMessage.cpp // -// $Id: //poco/1.1.0/Net/src/HTTPMessage.cpp#2 $ +// $Id: //poco/1.2/Net/src/HTTPMessage.cpp#1 $ // // Library: Net // Package: HTTP @@ -34,19 +34,20 @@ // -#include "Net/HTTPMessage.h" -#include "Net/MediaType.h" -#include "Foundation/NumberFormatter.h" -#include "Foundation/NumberParser.h" -#include "Foundation/String.h" +#include "Poco/Net/HTTPMessage.h" +#include "Poco/Net/MediaType.h" +#include "Poco/NumberFormatter.h" +#include "Poco/NumberParser.h" +#include "Poco/String.h" -using Foundation::NumberFormatter; -using Foundation::NumberParser; -using Foundation::icompare; +using Poco::NumberFormatter; +using Poco::NumberParser; +using Poco::icompare; -Net_BEGIN +namespace Poco { +namespace Net { const std::string HTTPMessage::HTTP_1_0 = "HTTP/1.0"; @@ -179,4 +180,4 @@ bool HTTPMessage::getKeepAlive() const } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/HTTPRequest.cpp b/Net/src/HTTPRequest.cpp index 4b426c1d9..cc833a369 100644 --- a/Net/src/HTTPRequest.cpp +++ b/Net/src/HTTPRequest.cpp @@ -1,7 +1,7 @@ // // HTTPRequest.cpp // -// $Id: //poco/1.1.0/Net/src/HTTPRequest.cpp#2 $ +// $Id: //poco/1.2/Net/src/HTTPRequest.cpp#1 $ // // Library: Net // Package: HTTP @@ -34,18 +34,19 @@ // -#include "Net/HTTPRequest.h" -#include "Net/HTTPSession.h" -#include "Net/NetException.h" -#include "Net/NameValueCollection.h" -#include "Foundation/NumberFormatter.h" +#include "Poco/Net/HTTPRequest.h" +#include "Poco/Net/HTTPSession.h" +#include "Poco/Net/NetException.h" +#include "Poco/Net/NameValueCollection.h" +#include "Poco/NumberFormatter.h" #include -using Foundation::NumberFormatter; +using Poco::NumberFormatter; -Net_BEGIN +namespace Poco { +namespace Net { const std::string HTTPRequest::HTTP_GET = "GET"; @@ -114,7 +115,7 @@ void HTTPRequest::setHost(const std::string& host) } -void HTTPRequest::setHost(const std::string& host, Foundation::UInt16 port) +void HTTPRequest::setHost(const std::string& host, Poco::UInt16 port) { std::string value(host); if (port != HTTPSession::HTTP_PORT) @@ -208,6 +209,7 @@ void HTTPRequest::read(std::istream& istr) std::string version; int ch = istr.get(); while (isspace(ch)) ch = istr.get(); + if (ch == eof) throw MessageException("No HTTP request header"); while (!isspace(ch) && ch != eof && method.length() < MAX_METHOD_LENGTH) { method += (char) ch; ch = istr.get(); } if (!isspace(ch)) throw MessageException("HTTP request method too long"); while (isspace(ch)) ch = istr.get(); @@ -226,4 +228,4 @@ void HTTPRequest::read(std::istream& istr) } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/HTTPRequestHandler.cpp b/Net/src/HTTPRequestHandler.cpp index f5f385c20..7b5943a3d 100644 --- a/Net/src/HTTPRequestHandler.cpp +++ b/Net/src/HTTPRequestHandler.cpp @@ -1,7 +1,7 @@ // // HTTPRequestHandler.cpp // -// $Id: //poco/1.1.0/Net/src/HTTPRequestHandler.cpp#2 $ +// $Id: //poco/1.2/Net/src/HTTPRequestHandler.cpp#1 $ // // Library: Net // Package: HTTPServer @@ -34,10 +34,11 @@ // -#include "Net/HTTPRequestHandler.h" +#include "Poco/Net/HTTPRequestHandler.h" -Net_BEGIN +namespace Poco { +namespace Net { HTTPRequestHandler::HTTPRequestHandler() @@ -50,4 +51,4 @@ HTTPRequestHandler::~HTTPRequestHandler() } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/HTTPRequestHandlerFactory.cpp b/Net/src/HTTPRequestHandlerFactory.cpp index f30d72ba1..c30ed9648 100644 --- a/Net/src/HTTPRequestHandlerFactory.cpp +++ b/Net/src/HTTPRequestHandlerFactory.cpp @@ -1,7 +1,7 @@ // // HTTPRequestHandlerFactory.cpp // -// $Id: //poco/1.1.0/Net/src/HTTPRequestHandlerFactory.cpp#2 $ +// $Id: //poco/1.2/Net/src/HTTPRequestHandlerFactory.cpp#1 $ // // Library: Net // Package: HTTPServer @@ -34,10 +34,11 @@ // -#include "Net/HTTPRequestHandlerFactory.h" +#include "Poco/Net/HTTPRequestHandlerFactory.h" -Net_BEGIN +namespace Poco { +namespace Net { HTTPRequestHandlerFactory::HTTPRequestHandlerFactory() @@ -50,4 +51,4 @@ HTTPRequestHandlerFactory::~HTTPRequestHandlerFactory() } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/HTTPResponse.cpp b/Net/src/HTTPResponse.cpp index 32680dfb8..b1164c29d 100644 --- a/Net/src/HTTPResponse.cpp +++ b/Net/src/HTTPResponse.cpp @@ -1,7 +1,7 @@ // // HTTPResponse.cpp // -// $Id: //poco/1.1.0/Net/src/HTTPResponse.cpp#2 $ +// $Id: //poco/1.2/Net/src/HTTPResponse.cpp#1 $ // // Library: Net // Package: HTTP @@ -34,26 +34,27 @@ // -#include "Net/HTTPResponse.h" -#include "Net/NetException.h" -#include "Foundation/NumberFormatter.h" -#include "Foundation/NumberParser.h" -#include "Foundation/DateTime.h" -#include "Foundation/DateTimeFormatter.h" -#include "Foundation/DateTimeFormat.h" -#include "Foundation/DateTimeParser.h" +#include "Poco/Net/HTTPResponse.h" +#include "Poco/Net/NetException.h" +#include "Poco/NumberFormatter.h" +#include "Poco/NumberParser.h" +#include "Poco/DateTime.h" +#include "Poco/DateTimeFormatter.h" +#include "Poco/DateTimeFormat.h" +#include "Poco/DateTimeParser.h" #include -using Foundation::DateTime; -using Foundation::NumberFormatter; -using Foundation::NumberParser; -using Foundation::DateTimeFormatter; -using Foundation::DateTimeFormat; -using Foundation::DateTimeParser; +using Poco::DateTime; +using Poco::NumberFormatter; +using Poco::NumberParser; +using Poco::DateTimeFormatter; +using Poco::DateTimeFormat; +using Poco::DateTimeParser; -Net_BEGIN +namespace Poco { +namespace Net { const std::string HTTPResponse::HTTP_REASON_CONTINUE = "Continue"; @@ -175,13 +176,13 @@ void HTTPResponse::setStatusAndReason(HTTPStatus status) } -void HTTPResponse::setDate(const Foundation::Timestamp& dateTime) +void HTTPResponse::setDate(const Poco::Timestamp& dateTime) { set(DATE, DateTimeFormatter::format(dateTime, DateTimeFormat::HTTP_FORMAT)); } -Foundation::Timestamp HTTPResponse::getDate() const +Poco::Timestamp HTTPResponse::getDate() const { const std::string& dateTime = get(DATE); int tzd; @@ -224,25 +225,20 @@ void HTTPResponse::read(std::istream& istr) std::string version; std::string status; std::string reason; - int ch = 0; - do - { - version.clear(); - status.clear(); - reason.clear(); - ch = istr.get(); - while (isspace(ch)) ch = istr.get(); - while (!isspace(ch) && ch != eof && version.length() < MAX_VERSION_LENGTH) { version += (char) ch; ch = istr.get(); } - if (!isspace(ch)) throw MessageException("Invalid HTTP version string"); - while (isspace(ch)) ch = istr.get(); - while (!isspace(ch) && ch != eof && status.length() < MAX_STATUS_LENGTH) { status += (char) ch; ch = istr.get(); } - if (!isspace(ch)) throw MessageException("Invalid HTTP status code"); - while (isspace(ch)) ch = istr.get(); - while (ch != '\r' && ch != '\n' && ch != eof && reason.length() < MAX_REASON_LENGTH) { reason += (char) ch; ch = istr.get(); } - if (!isspace(ch)) throw MessageException("HTTP reason string too long"); - if (ch == '\r') ch = istr.get(); - } - while (ch != eof && status == "100"); + + int ch = istr.get(); + while (isspace(ch)) ch = istr.get(); + if (ch == eof) throw MessageException("No HTTP response header"); + while (!isspace(ch) && ch != eof && version.length() < MAX_VERSION_LENGTH) { version += (char) ch; ch = istr.get(); } + if (!isspace(ch)) throw MessageException("Invalid HTTP version string"); + while (isspace(ch)) ch = istr.get(); + while (!isspace(ch) && ch != eof && status.length() < MAX_STATUS_LENGTH) { status += (char) ch; ch = istr.get(); } + if (!isspace(ch)) throw MessageException("Invalid HTTP status code"); + while (isspace(ch)) ch = istr.get(); + while (ch != '\r' && ch != '\n' && ch != eof && reason.length() < MAX_REASON_LENGTH) { reason += (char) ch; ch = istr.get(); } + if (!isspace(ch)) throw MessageException("HTTP reason string too long"); + if (ch == '\r') ch = istr.get(); + HTTPMessage::read(istr); ch = istr.get(); while (ch != '\n' && ch != eof) { ch = istr.get(); } @@ -342,4 +338,4 @@ const std::string& HTTPResponse::getReasonForStatus(HTTPStatus status) } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/HTTPServer.cpp b/Net/src/HTTPServer.cpp index c23ac0e1b..36364a215 100644 --- a/Net/src/HTTPServer.cpp +++ b/Net/src/HTTPServer.cpp @@ -1,7 +1,7 @@ // // HTTPServer.cpp // -// $Id: //poco/1.1.0/Net/src/HTTPServer.cpp#2 $ +// $Id: //poco/1.2/Net/src/HTTPServer.cpp#1 $ // // Library: Net // Package: HTTPServer @@ -34,12 +34,13 @@ // -#include "Net/HTTPServer.h" -#include "Net/HTTPServerParams.h" -#include "Net/HTTPServerConnectionFactory.h" +#include "Poco/Net/HTTPServer.h" +#include "Poco/Net/HTTPServerParams.h" +#include "Poco/Net/HTTPServerConnectionFactory.h" -Net_BEGIN +namespace Poco { +namespace Net { HTTPServer::HTTPServer(HTTPRequestHandlerFactory* pFactory, const ServerSocket& socket, HTTPServerParams* pParams): @@ -48,7 +49,7 @@ HTTPServer::HTTPServer(HTTPRequestHandlerFactory* pFactory, const ServerSocket& } -HTTPServer::HTTPServer(HTTPRequestHandlerFactory* pFactory, Foundation::ThreadPool& threadPool, const ServerSocket& socket, HTTPServerParams* pParams): +HTTPServer::HTTPServer(HTTPRequestHandlerFactory* pFactory, Poco::ThreadPool& threadPool, const ServerSocket& socket, HTTPServerParams* pParams): TCPServer(new HTTPServerConnectionFactory(pParams, pFactory), threadPool, socket, pParams) { } @@ -59,4 +60,4 @@ HTTPServer::~HTTPServer() } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/HTTPServerConnection.cpp b/Net/src/HTTPServerConnection.cpp index 10f71711c..e9f634c9a 100644 --- a/Net/src/HTTPServerConnection.cpp +++ b/Net/src/HTTPServerConnection.cpp @@ -1,7 +1,7 @@ // // HTTPServerConnection.cpp // -// $Id: //poco/1.1.0/Net/src/HTTPServerConnection.cpp#2 $ +// $Id: //poco/1.2/Net/src/HTTPServerConnection.cpp#1 $ // // Library: Net // Package: HTTPServer @@ -34,19 +34,20 @@ // -#include "Net/HTTPServerConnection.h" -#include "Net/HTTPServerSession.h" -#include "Net/HTTPServerRequest.h" -#include "Net/HTTPServerResponse.h" -#include "Net/HTTPRequestHandler.h" -#include "Net/HTTPRequestHandlerFactory.h" -#include "Net/HTTPServerParams.h" -#include "Net/NetException.h" -#include "Foundation/NumberFormatter.h" +#include "Poco/Net/HTTPServerConnection.h" +#include "Poco/Net/HTTPServerSession.h" +#include "Poco/Net/HTTPServerRequest.h" +#include "Poco/Net/HTTPServerResponse.h" +#include "Poco/Net/HTTPRequestHandler.h" +#include "Poco/Net/HTTPRequestHandlerFactory.h" +#include "Poco/Net/HTTPServerParams.h" +#include "Poco/Net/NetException.h" +#include "Poco/NumberFormatter.h" #include -Net_BEGIN +namespace Poco { +namespace Net { HTTPServerConnection::HTTPServerConnection(const StreamSocket& socket, HTTPServerParams* pParams, HTTPRequestHandlerFactory* pFactory): @@ -99,4 +100,4 @@ void HTTPServerConnection::run() } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/HTTPServerConnectionFactory.cpp b/Net/src/HTTPServerConnectionFactory.cpp index dd9045f02..f77d64a43 100644 --- a/Net/src/HTTPServerConnectionFactory.cpp +++ b/Net/src/HTTPServerConnectionFactory.cpp @@ -1,7 +1,7 @@ // // HTTPServerConnectionFactory.cpp // -// $Id: //poco/1.1.0/Net/src/HTTPServerConnectionFactory.cpp#2 $ +// $Id: //poco/1.2/Net/src/HTTPServerConnectionFactory.cpp#1 $ // // Library: Net // Package: HTTPServer @@ -34,13 +34,14 @@ // -#include "Net/HTTPServerConnectionFactory.h" -#include "Net/HTTPServerConnection.h" -#include "Net/HTTPServerParams.h" -#include "Net/HTTPRequestHandlerFactory.h" +#include "Poco/Net/HTTPServerConnectionFactory.h" +#include "Poco/Net/HTTPServerConnection.h" +#include "Poco/Net/HTTPServerParams.h" +#include "Poco/Net/HTTPRequestHandlerFactory.h" -Net_BEGIN +namespace Poco { +namespace Net { HTTPServerConnectionFactory::HTTPServerConnectionFactory(HTTPServerParams* pParams, HTTPRequestHandlerFactory* pFactory): @@ -67,4 +68,4 @@ TCPServerConnection* HTTPServerConnectionFactory::createConnection(const StreamS } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/HTTPServerParams.cpp b/Net/src/HTTPServerParams.cpp index 9a5063275..da47f88c7 100644 --- a/Net/src/HTTPServerParams.cpp +++ b/Net/src/HTTPServerParams.cpp @@ -1,7 +1,7 @@ // // HTTPServerParams.cpp // -// $Id: //poco/1.1.0/Net/src/HTTPServerParams.cpp#2 $ +// $Id: //poco/1.2/Net/src/HTTPServerParams.cpp#1 $ // // Library: Net // Package: HTTPServer @@ -34,10 +34,11 @@ // -#include "Net/HTTPServerParams.h" +#include "Poco/Net/HTTPServerParams.h" -Net_BEGIN +namespace Poco { +namespace Net { HTTPServerParams::HTTPServerParams(): @@ -66,7 +67,7 @@ void HTTPServerParams::setSoftwareVersion(const std::string& softwareVersion) } -void HTTPServerParams::setTimeout(const Foundation::Timespan& timeout) +void HTTPServerParams::setTimeout(const Poco::Timespan& timeout) { _timeout = timeout; } @@ -78,7 +79,7 @@ void HTTPServerParams::setKeepAlive(bool keepAlive) } -void HTTPServerParams::setKeepAliveTimeout(const Foundation::Timespan& timeout) +void HTTPServerParams::setKeepAliveTimeout(const Poco::Timespan& timeout) { _keepAliveTimeout = timeout; } @@ -91,4 +92,4 @@ void HTTPServerParams::setMaxKeepAliveRequests(int maxKeepAliveRequests) } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/HTTPServerRequest.cpp b/Net/src/HTTPServerRequest.cpp index 6804a1dd1..982f5daf1 100644 --- a/Net/src/HTTPServerRequest.cpp +++ b/Net/src/HTTPServerRequest.cpp @@ -1,7 +1,7 @@ // // HTTPServerRequest.cpp // -// $Id: //poco/1.1.0/Net/src/HTTPServerRequest.cpp#2 $ +// $Id: //poco/1.2/Net/src/HTTPServerRequest.cpp#1 $ // // Library: Net // Package: HTTPServer @@ -34,20 +34,21 @@ // -#include "Net/HTTPServerRequest.h" -#include "Net/HTTPServerSession.h" -#include "Net/HTTPHeaderStream.h" -#include "Net/HTTPStream.h" -#include "Net/HTTPFixedLengthStream.h" -#include "Net/HTTPChunkedStream.h" -#include "Net/HTTPServerParams.h" -#include "Foundation/String.h" +#include "Poco/Net/HTTPServerRequest.h" +#include "Poco/Net/HTTPServerSession.h" +#include "Poco/Net/HTTPHeaderStream.h" +#include "Poco/Net/HTTPStream.h" +#include "Poco/Net/HTTPFixedLengthStream.h" +#include "Poco/Net/HTTPChunkedStream.h" +#include "Poco/Net/HTTPServerParams.h" +#include "Poco/String.h" -using Foundation::icompare; +using Poco::icompare; -Net_BEGIN +namespace Poco { +namespace Net { HTTPServerRequest::HTTPServerRequest(HTTPServerSession& session, HTTPServerParams* pParams): @@ -87,4 +88,4 @@ bool HTTPServerRequest::expectContinue() const } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/HTTPServerResponse.cpp b/Net/src/HTTPServerResponse.cpp index c13d8f7db..a58987a4c 100644 --- a/Net/src/HTTPServerResponse.cpp +++ b/Net/src/HTTPServerResponse.cpp @@ -1,7 +1,7 @@ // // HTTPServerResponse.cpp // -// $Id: //poco/1.1.0/Net/src/HTTPServerResponse.cpp#2 $ +// $Id: //poco/1.2/Net/src/HTTPServerResponse.cpp#1 $ // // Library: Net // Package: HTTPServer @@ -34,28 +34,29 @@ // -#include "Net/HTTPServerResponse.h" -#include "Net/HTTPServerSession.h" -#include "Net/HTTPHeaderStream.h" -#include "Net/HTTPStream.h" -#include "Net/HTTPFixedLengthStream.h" -#include "Net/HTTPChunkedStream.h" -#include "Foundation/File.h" -#include "Foundation/Timestamp.h" -#include "Foundation/NumberFormatter.h" -#include "Foundation/StreamCopier.h" -#include "Foundation/Exception.h" +#include "Poco/Net/HTTPServerResponse.h" +#include "Poco/Net/HTTPServerSession.h" +#include "Poco/Net/HTTPHeaderStream.h" +#include "Poco/Net/HTTPStream.h" +#include "Poco/Net/HTTPFixedLengthStream.h" +#include "Poco/Net/HTTPChunkedStream.h" +#include "Poco/File.h" +#include "Poco/Timestamp.h" +#include "Poco/NumberFormatter.h" +#include "Poco/StreamCopier.h" +#include "Poco/Exception.h" #include -using Foundation::File; -using Foundation::Timestamp; -using Foundation::NumberFormatter; -using Foundation::StreamCopier; -using Foundation::OpenFileException; +using Poco::File; +using Poco::Timestamp; +using Poco::NumberFormatter; +using Poco::StreamCopier; +using Poco::OpenFileException; -Net_BEGIN +namespace Poco { +namespace Net { HTTPServerResponse::HTTPServerResponse(HTTPServerSession& session): @@ -74,7 +75,7 @@ HTTPServerResponse::~HTTPServerResponse() void HTTPServerResponse::sendContinue() { HTTPHeaderOutputStream hs(_session); - hs << getVersion() << " 100 Continue\r\n"; + hs << getVersion() << " 100 Continue\r\n\r\n"; } @@ -147,4 +148,4 @@ void HTTPServerResponse::requireAuthentication(const std::string& realm) } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/HTTPServerSession.cpp b/Net/src/HTTPServerSession.cpp index da7174806..dfeb9160e 100644 --- a/Net/src/HTTPServerSession.cpp +++ b/Net/src/HTTPServerSession.cpp @@ -1,7 +1,7 @@ // // HTTPServerSession.cpp // -// $Id: //poco/1.1.0/Net/src/HTTPServerSession.cpp#2 $ +// $Id: //poco/1.2/Net/src/HTTPServerSession.cpp#1 $ // // Library: Net // Package: HTTPServer @@ -34,11 +34,12 @@ // -#include "Net/HTTPServerSession.h" -#include "Net/HTTPServerParams.h" +#include "Poco/Net/HTTPServerSession.h" +#include "Poco/Net/HTTPServerParams.h" -Net_BEGIN +namespace Poco { +namespace Net { HTTPServerSession::HTTPServerSession(const StreamSocket& socket, HTTPServerParams* pParams): @@ -84,4 +85,4 @@ SocketAddress HTTPServerSession::serverAddress() } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/HTTPSession.cpp b/Net/src/HTTPSession.cpp index 1afc853ef..fb0e14b34 100644 --- a/Net/src/HTTPSession.cpp +++ b/Net/src/HTTPSession.cpp @@ -1,7 +1,7 @@ // // HTTPSession.cpp // -// $Id: //poco/1.1.0/Net/src/HTTPSession.cpp#2 $ +// $Id: //poco/1.2/Net/src/HTTPSession.cpp#1 $ // // Library: Net // Package: HTTP @@ -34,16 +34,17 @@ // -#include "Net/HTTPSession.h" -#include "Net/HTTPBufferAllocator.h" -#include "Net/NetException.h" +#include "Poco/Net/HTTPSession.h" +#include "Poco/Net/HTTPBufferAllocator.h" +#include "Poco/Net/NetException.h" #include -using Foundation::TimeoutException; +using Poco::TimeoutException; -Net_BEGIN +namespace Poco { +namespace Net { HTTPSession::HTTPSession(): @@ -51,7 +52,8 @@ HTTPSession::HTTPSession(): _pCurrent(0), _pEnd(0), _keepAlive(false), - _timeout(HTTP_DEFAULT_TIMEOUT) + _timeout(HTTP_DEFAULT_TIMEOUT), + _pException(0) { } @@ -62,7 +64,8 @@ HTTPSession::HTTPSession(const StreamSocket& socket): _pCurrent(0), _pEnd(0), _keepAlive(false), - _timeout(HTTP_DEFAULT_TIMEOUT) + _timeout(HTTP_DEFAULT_TIMEOUT), + _pException(0) { } @@ -73,7 +76,8 @@ HTTPSession::HTTPSession(const StreamSocket& socket, bool keepAlive): _pCurrent(0), _pEnd(0), _keepAlive(keepAlive), - _timeout(HTTP_DEFAULT_TIMEOUT) + _timeout(HTTP_DEFAULT_TIMEOUT), + _pException(0) { } @@ -82,6 +86,7 @@ HTTPSession::~HTTPSession() { if (_pBuffer) HTTPBufferAllocator::deallocate(_pBuffer, HTTPBufferAllocator::BUFFER_SIZE); close(); + delete _pException; } @@ -91,7 +96,7 @@ void HTTPSession::setKeepAlive(bool keepAlive) } -void HTTPSession::setTimeout(const Foundation::Timespan& timeout) +void HTTPSession::setTimeout(const Poco::Timespan& timeout) { _timeout = timeout; } @@ -137,16 +142,32 @@ int HTTPSession::read(char* buffer, std::streamsize length) int HTTPSession::write(const char* buffer, std::streamsize length) { - return _socket.sendBytes(buffer, (int) length); + try + { + return _socket.sendBytes(buffer, (int) length); + } + catch (Poco::Exception& exc) + { + setException(exc); + throw; + } } int HTTPSession::receive(char* buffer, int length) { - if (_socket.poll(_timeout, Socket::SELECT_READ)) - return _socket.receiveBytes(buffer, length); - else - throw TimeoutException(); + try + { + if (_socket.poll(_timeout, Socket::SELECT_READ)) + return _socket.receiveBytes(buffer, length); + else + throw TimeoutException(); + } + catch (Poco::Exception& exc) + { + setException(exc); + throw; + } } @@ -187,4 +208,11 @@ void HTTPSession::close() } -Net_END +void HTTPSession::setException(const Poco::Exception& exc) +{ + delete _pException; + _pException = exc.clone(); +} + + +} } // namespace Poco::Net diff --git a/Net/src/HTTPSessionFactory.cpp b/Net/src/HTTPSessionFactory.cpp new file mode 100644 index 000000000..ce7ea83c3 --- /dev/null +++ b/Net/src/HTTPSessionFactory.cpp @@ -0,0 +1,153 @@ +// +// HTTPSessionFactory.cpp +// +// $Id: //poco/1.2/Net/src/HTTPSessionFactory.cpp#1 $ +// +// Library: Net +// Package: HTTPClient +// Module: HTTPSessionFactory +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#include "Poco/Net/HTTPSessionFactory.h" +#include "Poco/Net/HTTPSessionInstantiator.h" +#include "Poco/Exception.h" + + +using Poco::SingletonHolder; +using Poco::FastMutex; +using Poco::NotFoundException; +using Poco::ExistsException; + + +namespace Poco { +namespace Net { + + +HTTPSessionFactory::HTTPSessionFactory(): + _proxyPort(0) +{ +} + + +HTTPSessionFactory::HTTPSessionFactory(const std::string& proxyHost, Poco::UInt16 proxyPort): + _proxyHost(proxyHost), + _proxyPort(proxyPort) +{ +} + + +HTTPSessionFactory::~HTTPSessionFactory() +{ + for (Instantiators::iterator it = _instantiators.begin(); it != _instantiators.end(); ++it) + { + delete it->second.pIn; + } +} + + +void HTTPSessionFactory::registerProtocol(const std::string& protocol, HTTPSessionInstantiator* pSessionInstantiator) +{ + poco_assert_dbg(pSessionInstantiator); + + FastMutex::ScopedLock lock(_mutex); + std::pair tmp = _instantiators.insert(make_pair(protocol, InstantiatorInfo(pSessionInstantiator))); + if (!tmp.second) + { + ++tmp.first->second.cnt; + delete pSessionInstantiator; + } +} + + +void HTTPSessionFactory::unregisterProtocol(const std::string& protocol) +{ + FastMutex::ScopedLock lock(_mutex); + + Instantiators::iterator it = _instantiators.find(protocol); + if (it != _instantiators.end()) + { + if (it->second.cnt == 1) + { + delete it->second.pIn; + _instantiators.erase(it); + } + else --it->second.cnt; + } + else throw NotFoundException("No HTTPSessionInstantiator registered for", protocol); +} + + +bool HTTPSessionFactory::supportsProtocol(const std::string& protocol) +{ + FastMutex::ScopedLock lock(_mutex); + + Instantiators::iterator it = _instantiators.find(protocol); + return it != _instantiators.end(); +} + + +HTTPClientSession* HTTPSessionFactory::createClientSession(const Poco::URI& uri) +{ + FastMutex::ScopedLock lock(_mutex); + + if (uri.isRelative()) throw Poco::UnknownURISchemeException("Relative URIs are not supported by HTTPSessionFactory."); + + Instantiators::iterator it = _instantiators.find(uri.getScheme()); + if (it != _instantiators.end()) + { + it->second.pIn->setProxy(_proxyHost, _proxyPort); + return it->second.pIn->createClientSession(uri); + } + else throw Poco::UnknownURISchemeException(uri.getScheme()); +} + + +void HTTPSessionFactory::setProxy(const std::string& host, Poco::UInt16 port) +{ + FastMutex::ScopedLock lock(_mutex); + + _proxyHost = host; + _proxyPort = port; +} + + +HTTPSessionFactory& HTTPSessionFactory::defaultFactory() +{ + static SingletonHolder singleton; + return *singleton.get(); +} + + +HTTPSessionFactory::InstantiatorInfo::InstantiatorInfo(HTTPSessionInstantiator* pInst): pIn(pInst), cnt(1) +{ + poco_check_ptr (pIn); +} + + +} } // namespace Poco::Net diff --git a/Net/src/HTTPSessionInstantiator.cpp b/Net/src/HTTPSessionInstantiator.cpp new file mode 100644 index 000000000..652eb8e52 --- /dev/null +++ b/Net/src/HTTPSessionInstantiator.cpp @@ -0,0 +1,88 @@ +// +// HTTPSessionInstantiator.cpp +// +// $Id: //poco/1.2/Net/src/HTTPSessionInstantiator.cpp#1 $ +// +// Library: Net +// Package: HTTPClient +// Module: HTTPSessionInstantiator +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#include "Poco/Net/HTTPSessionInstantiator.h" +#include "Poco/Net/HTTPSessionFactory.h" +#include "Poco/Net/HTTPClientSession.h" + + +using Poco::URI; + + +namespace Poco { +namespace Net { + + +HTTPSessionInstantiator::HTTPSessionInstantiator(): + _proxyPort(0) +{ +} + + +HTTPSessionInstantiator::~HTTPSessionInstantiator() +{ +} + + +HTTPClientSession* HTTPSessionInstantiator::createClientSession(const Poco::URI& uri) +{ + poco_assert (uri.getScheme() == "http"); + HTTPClientSession* pSession = new HTTPClientSession(uri.getHost(), uri.getPort()); + pSession->setProxy(proxyHost(), proxyPort()); + return pSession; +} + + +void HTTPSessionInstantiator::registerInstantiator() +{ + HTTPSessionFactory::defaultFactory().registerProtocol("http", new HTTPSessionInstantiator); +} + + +void HTTPSessionInstantiator::unregisterInstantiator() +{ + HTTPSessionFactory::defaultFactory().unregisterProtocol("http"); +} + + +void HTTPSessionInstantiator::setProxy(const std::string& host, Poco::UInt16 port) +{ + _proxyHost = host; + _proxyPort = port; +} + + +} } // namespace Poco::Net diff --git a/Net/src/HTTPStream.cpp b/Net/src/HTTPStream.cpp index 056b6e823..c75ca0253 100644 --- a/Net/src/HTTPStream.cpp +++ b/Net/src/HTTPStream.cpp @@ -1,7 +1,7 @@ // // HTTPStream.cpp // -// $Id: //poco/1.1.0/Net/src/HTTPStream.cpp#2 $ +// $Id: //poco/1.2/Net/src/HTTPStream.cpp#1 $ // // Library: Net // Package: HTTP @@ -34,11 +34,12 @@ // -#include "Net/HTTPStream.h" -#include "Net/HTTPSession.h" +#include "Poco/Net/HTTPStream.h" +#include "Poco/Net/HTTPSession.h" -Net_BEGIN +namespace Poco { +namespace Net { // @@ -117,7 +118,7 @@ HTTPStreamBuf* HTTPIOS::rdbuf() // -Foundation::MemoryPool HTTPInputStream::_pool(sizeof(HTTPInputStream)); +Poco::MemoryPool HTTPInputStream::_pool(sizeof(HTTPInputStream)); HTTPInputStream::HTTPInputStream(HTTPSession& session): @@ -149,7 +150,7 @@ void HTTPInputStream::operator delete(void* ptr) // -Foundation::MemoryPool HTTPOutputStream::_pool(sizeof(HTTPOutputStream)); +Poco::MemoryPool HTTPOutputStream::_pool(sizeof(HTTPOutputStream)); HTTPOutputStream::HTTPOutputStream(HTTPSession& session): @@ -176,4 +177,4 @@ void HTTPOutputStream::operator delete(void* ptr) } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/HTTPStreamFactory.cpp b/Net/src/HTTPStreamFactory.cpp index 7a46646c4..1087fb970 100644 --- a/Net/src/HTTPStreamFactory.cpp +++ b/Net/src/HTTPStreamFactory.cpp @@ -1,7 +1,7 @@ // // HTTPStreamFactory.cpp // -// $Id: //poco/1.1.0/Net/src/HTTPStreamFactory.cpp#2 $ +// $Id: //poco/1.2/Net/src/HTTPStreamFactory.cpp#1 $ // // Library: Net // Package: HTTP @@ -34,24 +34,25 @@ // -#include "Net/HTTPStreamFactory.h" -#include "Net/HTTPClientSession.h" -#include "Net/HTTPIOStream.h" -#include "Net/HTTPRequest.h" -#include "Net/HTTPResponse.h" -#include "Net/NetException.h" -#include "Foundation/URI.h" -#include "Foundation/URIStreamOpener.h" -#include "Foundation/UnbufferedStreamBuf.h" +#include "Poco/Net/HTTPStreamFactory.h" +#include "Poco/Net/HTTPClientSession.h" +#include "Poco/Net/HTTPIOStream.h" +#include "Poco/Net/HTTPRequest.h" +#include "Poco/Net/HTTPResponse.h" +#include "Poco/Net/NetException.h" +#include "Poco/URI.h" +#include "Poco/URIStreamOpener.h" +#include "Poco/UnbufferedStreamBuf.h" -using Foundation::URIStreamFactory; -using Foundation::URI; -using Foundation::URIStreamOpener; -using Foundation::UnbufferedStreamBuf; +using Poco::URIStreamFactory; +using Poco::URI; +using Poco::URIStreamOpener; +using Poco::UnbufferedStreamBuf; -Net_BEGIN +namespace Poco { +namespace Net { HTTPStreamFactory::HTTPStreamFactory(): @@ -60,7 +61,7 @@ HTTPStreamFactory::HTTPStreamFactory(): } -HTTPStreamFactory::HTTPStreamFactory(const std::string& proxyHost, Foundation::UInt16 proxyPort): +HTTPStreamFactory::HTTPStreamFactory(const std::string& proxyHost, Poco::UInt16 proxyPort): _proxyHost(proxyHost), _proxyPort(proxyPort) { @@ -98,6 +99,7 @@ std::istream* HTTPStreamFactory::open(const URI& uri) { resolvedURI.resolve(res.get("Location")); delete pSession; + if (resolvedURI.getScheme() != "http") throw UnsupportedRedirectException(uri.toString()); ++redirects; } else if (res.getStatus() == HTTPResponse::HTTP_OK) @@ -123,4 +125,4 @@ void HTTPStreamFactory::registerFactory() } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/HostEntry.cpp b/Net/src/HostEntry.cpp index 9ec602eb2..3e8e341cb 100644 --- a/Net/src/HostEntry.cpp +++ b/Net/src/HostEntry.cpp @@ -1,7 +1,7 @@ // // HostEntry.cpp // -// $Id: //poco/1.1.0/Net/src/HostEntry.cpp#2 $ +// $Id: //poco/1.2/Net/src/HostEntry.cpp#1 $ // // Library: Net // Package: NetCore @@ -34,12 +34,13 @@ // -#include "Net/HostEntry.h" -#include "Foundation/Exception.h" +#include "Poco/Net/HostEntry.h" +#include "Poco/Exception.h" #include -Net_BEGIN +namespace Poco { +namespace Net { HostEntry::HostEntry() @@ -126,4 +127,4 @@ HostEntry::~HostEntry() } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/ICMPClient.cpp b/Net/src/ICMPClient.cpp new file mode 100644 index 000000000..9e56c921e --- /dev/null +++ b/Net/src/ICMPClient.cpp @@ -0,0 +1,166 @@ +// +// ICMPClient.cpp +// +// $Id: //poco/1.2/Net/src/ICMPClient.cpp#1 $ +// +// Library: Net +// Package: ICMP +// Module: ICMPClient +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#include "Poco/Net/SocketAddress.h" +#include "Poco/Net/ICMPClient.h" +#include "Poco/Net/ICMPSocket.h" +#include "Poco/Net/NetException.h" +#include "Poco/Channel.h" +#include "Poco/Message.h" +#include "Poco/Exception.h" +#include + + +using Poco::Channel; +using Poco::Message; +using Poco::InvalidArgumentException; +using Poco::NotImplementedException; +using Poco::TimeoutException; +using Poco::Exception; + + +namespace Poco { +namespace Net { + + +ICMPClient::ICMPClient(IPAddress::Family family): + _family(family) +{ +} + + +ICMPClient::~ICMPClient() +{ +} + + +int ICMPClient::ping(const std::string& address, int repeat) const +{ + if (repeat <= 0) return 0; + + SocketAddress addr(address, 0); + return ping(addr, repeat); +} + + +int ICMPClient::ping(SocketAddress& address, int repeat) const +{ + if (repeat <= 0) return 0; + + ICMPSocket icmpSocket(_family); + SocketAddress returnAddress; + + ICMPEventArgs eventArgs(address, repeat, icmpSocket.dataSize(), icmpSocket.ttl()); + pingBegin.notify(this, eventArgs); + + for (int i = 0; i < repeat; ++i) + { + icmpSocket.sendTo(address); + ++eventArgs; + + try + { + int t = icmpSocket.receiveFrom(returnAddress); + eventArgs.setReplyTime(i, t); + pingReply.notify(this, eventArgs); + } + catch (TimeoutException&) + { + std::ostringstream os; + os << address.host().toString() << ": Request timed out."; + eventArgs.setError(i, os.str()); + pingError.notify(this, eventArgs); + continue; + } + catch (ICMPException& ex) + { + std::ostringstream os; + os << address.host().toString() << ": " << ex.what(); + eventArgs.setError(i, os.str()); + pingError.notify(this, eventArgs); + continue; + } + catch (Exception& ex) + { + std::ostringstream os; + os << ex.displayText(); + eventArgs.setError(i, os.str()); + pingError.notify(this, eventArgs); + continue; + } + } + pingEnd.notify(this, eventArgs); + return eventArgs.received(); +} + + +int ICMPClient::pingIPv4(const std::string& address, int repeat) +{ + if (repeat <= 0) return 0; + + SocketAddress a(address, 0); + return ping(a, IPAddress::IPv4, repeat); +} + + +int ICMPClient::ping(SocketAddress& address, IPAddress::Family family, int repeat) +{ + if (repeat <= 0) return 0; + + ICMPSocket icmpSocket(family); + SocketAddress returnAddress; + int received = 0; + + for (int i = 0; i < repeat; ++i) + { + icmpSocket.sendTo(address); + try + { + icmpSocket.receiveFrom(returnAddress); + ++received; + } + catch (TimeoutException&) + { + } + catch (ICMPException&) + { + } + } + return received; +} + + +} } // namespace Poco::Net diff --git a/Net/src/ICMPEventArgs.cpp b/Net/src/ICMPEventArgs.cpp new file mode 100644 index 000000000..9c6f97160 --- /dev/null +++ b/Net/src/ICMPEventArgs.cpp @@ -0,0 +1,195 @@ +// +// ICMPEventArgs.cpp +// +// $Id: //poco/1.2/Net/src/ICMPEventArgs.cpp#1 $ +// +// Library: Net +// Package: ICMP +// Module: ICMPEventArgs +// +// Implementation of ICMPEventArgs +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#include "Poco/Net/ICMPEventArgs.h" +#include "Poco/Net/SocketAddress.h" +#include "Poco/Net/DNS.h" +#include "Poco/Exception.h" +#include "Poco/Net/NetException.h" + + +using Poco::IOException; +using Poco::InvalidArgumentException; + + +namespace Poco { +namespace Net { + + +ICMPEventArgs::ICMPEventArgs(const SocketAddress& address, int repetitions, int dataSize, int ttl): + _address(address), + _sent(0), + _dataSize(dataSize), + _ttl(ttl), + _rtt(0, repetitions), + _errors(repetitions) +{ +} + + +ICMPEventArgs::~ICMPEventArgs() +{ +} + + +std::string ICMPEventArgs::hostName() const +{ + try + { + return DNS::resolve(_address.host().toString()).name(); + } + catch (HostNotFoundException&) + { + } + catch (NoAddressFoundException&) + { + } + catch (DNSException&) + { + } + catch (IOException&) + { + } + return _address.host().toString(); +} + + +std::string ICMPEventArgs::hostAddress() const +{ + return _address.host().toString(); +} + + +void ICMPEventArgs::setRepetitions(int repetitions) +{ + _rtt.apply(&ICMPEventArgs::zeroVal); + if (_rtt.size() != repetitions) _rtt.resize(repetitions, 0); + _errors.assign(repetitions, ""); +} + + +ICMPEventArgs& ICMPEventArgs::operator ++ () +{ + ++_sent; + return *this; +} + + +ICMPEventArgs ICMPEventArgs::operator ++ (int) +{ + ICMPEventArgs prev(*this); + operator ++ (); + return prev; +} + + +int ICMPEventArgs::received() const +{ + int received = 0; + + for (int i = 0; i < _rtt.size(); ++i) + { + if (_rtt[i]) ++received; + } + return received; +} + + +void ICMPEventArgs::setError(int index, const std::string& text) +{ + if (index >= _errors.size()) + throw InvalidArgumentException("Supplied index exceeds vector capacity."); + + _errors[index] = text; +} + + +const std::string& ICMPEventArgs::error(int index) const +{ + if (0 == _errors.size()) + throw InvalidArgumentException("Supplied index exceeds vector capacity."); + + if (-1 == index) index = _sent - 1; + + return _errors[index]; +} + + +void ICMPEventArgs::setReplyTime(int index, int time) +{ + if (index >= _rtt.size()) + throw InvalidArgumentException("Supplied index exceeds array capacity."); + if (0 == time) time = 1; + _rtt[index] = time; +} + + +int ICMPEventArgs::replyTime(int index) const +{ + if (0 == _rtt.size()) + throw InvalidArgumentException("Supplied index exceeds array capacity."); + + if (-1 == index) index = _sent - 1; + + return _rtt[index]; +} + + +int ICMPEventArgs::avgRTT() const +{ + if (0 == _rtt.size()) return 0; + + return (int) (_rtt.sum() / _rtt.size()); +} + + +float ICMPEventArgs::percent() const +{ + if (0 == _rtt.size()) return 0; + + return ((float) received() / (float) _rtt.size()) * (float) 100.0; +} + + +int ICMPEventArgs::zeroVal(int n) +{ + return n*0; +} + + +} } // namespace Poco::Net diff --git a/Net/src/ICMPPacket.cpp b/Net/src/ICMPPacket.cpp new file mode 100644 index 000000000..3ffd80160 --- /dev/null +++ b/Net/src/ICMPPacket.cpp @@ -0,0 +1,134 @@ +// +// ICMPPacket.cpp +// +// $Id: //poco/1.2/Net/src/ICMPPacket.cpp#1 $ +// +// Library: Net +// Package: ICMP +// Module: ICMPPacket +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#include "Poco/Net/ICMPPacket.h" +#include "Poco/Net/ICMPv4PacketImpl.h" +#include "Poco/Net/NetException.h" +#include "Poco/Timestamp.h" +#include "Poco/Timespan.h" +#include "Poco/Process.h" +#include "Poco/NumberFormatter.h" +#include + + +using Poco::InvalidArgumentException; +using Poco::NotImplementedException; +using Poco::Timestamp; +using Poco::Timespan; +using Poco::Process; +using Poco::NumberFormatter; +using Poco::UInt8; +using Poco::UInt16; +using Poco::Int32; + + +namespace Poco { +namespace Net { + + +ICMPPacket::ICMPPacket(IPAddress::Family family, int dataSize):_pImpl(0) +{ + if (family == IPAddress::IPv4) + _pImpl = new ICMPv4PacketImpl(dataSize); +#if POCO_HAVE_IPv6 + else if (family == IPAddress::IPv6) + throw NotImplementedException("ICMPv6 packets not implemented."); +#endif + else throw InvalidArgumentException("Invalid or unsupported address family passed to ICMPPacket"); +} + + +ICMPPacket::~ICMPPacket() +{ + delete _pImpl; +} + + +void ICMPPacket::setDataSize(int dataSize) +{ + _pImpl->setDataSize(dataSize); +} + + +int ICMPPacket::getDataSize() const +{ + return _pImpl->getDataSize(); +} + + +int ICMPPacket::packetSize() const +{ + return _pImpl->packetSize(); +} + + +int ICMPPacket::maxPacketSize() const +{ + return _pImpl->maxPacketSize(); +} + + +const Poco::UInt8* ICMPPacket::packet() +{ + return _pImpl->packet(); +} + + +struct timeval ICMPPacket::time(Poco::UInt8* buffer, int length) const +{ + return _pImpl->time(buffer, length); +} + + +bool ICMPPacket::validReplyID(Poco::UInt8* buffer, int length) const +{ + return _pImpl->validReplyID(buffer, length); +} + + +std::string ICMPPacket::errorDescription(Poco::UInt8* buffer, int length) +{ + return _pImpl->errorDescription(buffer, length); +} + + +std::string ICMPPacket::typeDescription(int typeId) +{ + return _pImpl->typeDescription(typeId); +} + + +} } // namespace Poco::Net diff --git a/Net/src/ICMPPacketImpl.cpp b/Net/src/ICMPPacketImpl.cpp new file mode 100644 index 000000000..796445503 --- /dev/null +++ b/Net/src/ICMPPacketImpl.cpp @@ -0,0 +1,127 @@ +// +// ICMPPacketImpl.cpp +// +// $Id: //poco/1.2/Net/src/ICMPPacketImpl.cpp#1 $ +// +// Library: Net +// Package: ICMP +// Module: ICMPPacketImpl +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#include "Poco/Net/ICMPPacketImpl.h" +#include "Poco/Net/NetException.h" +#include "Poco/Timestamp.h" +#include "Poco/Timespan.h" +#include "Poco/Process.h" +#include "Poco/NumberFormatter.h" +#include + + +using Poco::InvalidArgumentException; +using Poco::Timestamp; +using Poco::Timespan; +using Poco::Process; +using Poco::NumberFormatter; +using Poco::UInt8; +using Poco::UInt16; +using Poco::Int32; + + +namespace Poco { +namespace Net { + + +const UInt16 ICMPPacketImpl::MAX_PACKET_SIZE = 4096; +const UInt16 ICMPPacketImpl::MAX_SEQ_VALUE = 65535; + + +ICMPPacketImpl::ICMPPacketImpl(int dataSize): + _seq(0), + _pPacket(new UInt8[MAX_PACKET_SIZE]), + _dataSize(dataSize) +{ + if (_dataSize > MAX_PACKET_SIZE) + throw InvalidArgumentException("Packet size must be <= " + NumberFormatter::format(MAX_PACKET_SIZE)); +} + + +ICMPPacketImpl::~ICMPPacketImpl() +{ + delete _pPacket; +} + + +void ICMPPacketImpl::setDataSize(int dataSize) +{ + _dataSize = dataSize; + initPacket(); +} + + +int ICMPPacketImpl::getDataSize() const +{ + return _dataSize; +} + + +const Poco::UInt8* ICMPPacketImpl::packet(bool init) +{ + if (init) initPacket(); + return _pPacket; +} + + +unsigned short ICMPPacketImpl::checksum(UInt16 *addr, Int32 len) +{ + Int32 nleft = len; + UInt16* w = addr; + UInt16 answer; + Int32 sum = 0; + + while (nleft > 1) + { + sum += *w++; + nleft -= sizeof(UInt16); + } + + if (nleft == 1) + { + UInt16 u = 0; + *(UInt8*) (&u) = *(UInt8*) w; + sum += u; + } + + sum = (sum >> 16) + (sum & 0xffff); + sum += (sum >> 16); + answer = ~sum; + return answer; +} + + +} } // namespace Poco::Net diff --git a/Net/src/ICMPSocket.cpp b/Net/src/ICMPSocket.cpp new file mode 100644 index 000000000..ab08d7caa --- /dev/null +++ b/Net/src/ICMPSocket.cpp @@ -0,0 +1,101 @@ +// +// ICMPSocket.cpp +// +// $Id: //poco/1.2/Net/src/ICMPSocket.cpp#1 $ +// +// Library: Net +// Package: ICMP +// Module: ICMPSocket +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#include "Poco/Net/ICMPSocket.h" +#include "Poco/Net/ICMPSocketImpl.h" +#include "Poco/Exception.h" + + +using Poco::InvalidArgumentException; + + +namespace Poco { +namespace Net { + + +ICMPSocket::ICMPSocket(IPAddress::Family family, int dataSize, int ttl, int timeout): + Socket(new ICMPSocketImpl(family, dataSize, ttl, timeout)), + _dataSize(dataSize), + _ttl(ttl), + _timeout(timeout) +{ +} + + +ICMPSocket::ICMPSocket(const Socket& socket): + Socket(socket) +{ + if (!dynamic_cast(impl())) + throw InvalidArgumentException("Cannot assign incompatible socket"); +} + + +ICMPSocket::ICMPSocket(SocketImpl* pImpl): + Socket(pImpl) +{ + if (!dynamic_cast(impl())) + throw InvalidArgumentException("Cannot assign incompatible socket"); +} + + +ICMPSocket::~ICMPSocket() +{ +} + + +ICMPSocket& ICMPSocket::operator = (const Socket& socket) +{ + if (dynamic_cast(socket.impl())) + Socket::operator = (socket); + else + throw InvalidArgumentException("Cannot assign incompatible socket"); + return *this; +} + + +int ICMPSocket::sendTo(const SocketAddress& address, int flags) +{ + return impl()->sendTo(0, 0, address, flags); +} + + +int ICMPSocket::receiveFrom(SocketAddress& address, int flags) +{ + return impl()->receiveFrom(0, 0, address, flags); +} + + +} } // namespace Poco::Net diff --git a/Net/src/ICMPSocketImpl.cpp b/Net/src/ICMPSocketImpl.cpp new file mode 100644 index 000000000..27123ad09 --- /dev/null +++ b/Net/src/ICMPSocketImpl.cpp @@ -0,0 +1,111 @@ +// +// ICMPSocketImpl.cpp +// +// $Id: //poco/1.2/Net/src/ICMPSocketImpl.cpp#1 $ +// +// Library: Net +// Package: ICMP +// Module: ICMPSocketImpl +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#include "Poco/Net/ICMPSocketImpl.h" +#include "Poco/Net/NetException.h" +#include "Poco/Timespan.h" +#include "Poco/Exception.h" + + +using Poco::TimeoutException; +using Poco::Timespan; +using Poco::Exception; + + +namespace Poco { +namespace Net { + + +ICMPSocketImpl::ICMPSocketImpl(IPAddress::Family family, int dataSize, int ttl, int timeout): + RawSocketImpl(family, IPPROTO_ICMP), + _icmpPacket(family, dataSize) +{ + setOption(IPPROTO_IP, IP_TTL, ttl); + setReceiveTimeout(Timespan(timeout)); +} + + +ICMPSocketImpl::~ICMPSocketImpl() +{ +} + + +int ICMPSocketImpl::sendTo(const void*, int, const SocketAddress& address, int flags) +{ + int n = SocketImpl::sendTo(_icmpPacket.packet(), _icmpPacket.packetSize(), address, flags); + return n; +} + + +int ICMPSocketImpl::receiveFrom(void*, int, SocketAddress& address, int flags) +{ + int maxPacketSize = _icmpPacket.maxPacketSize(); + unsigned char* buffer = new unsigned char[maxPacketSize]; + + try + { + do + { + SocketImpl::receiveFrom(buffer, maxPacketSize, address, flags); + } + while(!_icmpPacket.validReplyID(buffer, maxPacketSize)); + } + catch (TimeoutException&) + { + delete[] buffer; + throw; + } + catch (Exception&) + { + std::string err = _icmpPacket.errorDescription(buffer, maxPacketSize); + delete[] buffer; + if (!err.empty()) + throw ICMPException(err); + else + throw; + } + + struct timeval then = _icmpPacket.time(buffer, maxPacketSize); + struct timeval now = _icmpPacket.time(); + + int elapsed = (((now.tv_sec * 1000000) + now.tv_usec) - ((then.tv_sec * 1000000) + then.tv_usec))/1000; + + delete[] buffer; + return elapsed; +} + + +} } // namespace Poco::Net diff --git a/Net/src/ICMPv4PacketImpl.cpp b/Net/src/ICMPv4PacketImpl.cpp new file mode 100644 index 000000000..0fb19b7db --- /dev/null +++ b/Net/src/ICMPv4PacketImpl.cpp @@ -0,0 +1,275 @@ +// +// ICMPv4PacketImpl.cpp +// +// $Id: //poco/1.2/Net/src/ICMPv4PacketImpl.cpp#1 $ +// +// Library: Net +// Package: ICMP +// Module: ICMPv4PacketImpl +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#include "Poco/Net/ICMPv4PacketImpl.h" +#include "Poco/Net/NetException.h" +#include "Poco/Timestamp.h" +#include "Poco/Timespan.h" +#include "Poco/Process.h" +#include "Poco/NumberFormatter.h" +#include + + +using Poco::InvalidArgumentException; +using Poco::Timestamp; +using Poco::Timespan; +using Poco::Process; +using Poco::NumberFormatter; +using Poco::UInt8; +using Poco::UInt16; +using Poco::Int32; + + +namespace Poco { +namespace Net { + + +const UInt8 ICMPv4PacketImpl::DESTINATION_UNREACHABLE_TYPE = 3; +const Poco::UInt8 ICMPv4PacketImpl::SOURCE_QUENCH_TYPE = 4; +const Poco::UInt8 ICMPv4PacketImpl::REDIRECT_MESSAGE_TYPE = 5; +const UInt8 ICMPv4PacketImpl::TIME_EXCEEDED_TYPE = 11; +const Poco::UInt8 ICMPv4PacketImpl::PARAMETER_PROBLEM_TYPE = 12; + + +const std::string ICMPv4PacketImpl::MESSAGE_TYPE[] = +{ + "Echo Reply", + "ICMP 1", + "ICMP 2", + "Dest Unreachable", + "Source Quench", + "Redirect", + "ICMP 6", + "ICMP 7", + "Echo", + "ICMP 9", + "ICMP 10", + "Time Exceeded", + "Parameter Problem", + "Timestamp", + "Timestamp Reply", + "Info Request", + "Info Reply", + "Unknown type" +}; + + +const std::string ICMPv4PacketImpl::DESTINATION_UNREACHABLE_CODE[] = +{ + "Net unreachable", + "Host unreachable", + "Protocol unreachable", + "Port unreachable", + "Fragmentation needed and DF set", + "Source route failed", + "Unknown code" +}; + + +const std::string ICMPv4PacketImpl::REDIRECT_MESSAGE_CODE[] = +{ + "Redirect datagrams for the network", + "Redirect datagrams for the host", + "Redirect datagrams for the type of service and network", + "Redirect datagrams for the type of service and host", + "Unknown code" +}; + + +const std::string ICMPv4PacketImpl::TIME_EXCEEDED_CODE[] = +{ + "Time to live exceeded in transit", + "Fragment reassembly time exceeded", + "Unknown code" +}; + + +const std::string ICMPv4PacketImpl::PARAMETER_PROBLEM_CODE[] = +{ + "Pointer indicates the error", + "Unknown code" +}; + + +ICMPv4PacketImpl::ICMPv4PacketImpl(int dataSize): + ICMPPacketImpl(dataSize) +{ + initPacket(); +} + + +ICMPv4PacketImpl::~ICMPv4PacketImpl() +{ +} + + +int ICMPv4PacketImpl::packetSize() const +{ + return getDataSize() + sizeof(Header); +} + + +void ICMPv4PacketImpl::initPacket() +{ + if (_seq >= MAX_SEQ_VALUE) resetSequence(); + + Header* icp = (Header*) packet(false); + icp->type = ECHO; + icp->code = 0; + icp->checksum = 0; + icp->seq = ++_seq; + icp->id = static_cast(Process::id()); + + struct timeval* ptp = (struct timeval *) (icp + 1); + *ptp = time(); + + icp->checksum = checksum((UInt16*) icp, getDataSize() + sizeof(Header)); +} + + +struct timeval ICMPv4PacketImpl::time(Poco::UInt8* buffer, int length) const +{ + struct timeval tv; + + if (0 == buffer || 0 == length) + { + Timespan value(Timestamp().epochMicroseconds()); + tv.tv_sec = (long) value.totalSeconds(); + tv.tv_usec = (long) value.useconds(); + } + else + { + struct timeval* ptv = (struct timeval*) data(buffer, length); + if (ptv) tv = *ptv; + else throw InvalidArgumentException("Invalid packet."); + } + return tv; +} + + +ICMPv4PacketImpl::Header* ICMPv4PacketImpl::header(Poco::UInt8* buffer, int length) const +{ + poco_check_ptr (buffer); + + int offset = (buffer[0] & 0x0F) * 4; + if ((offset + sizeof(Header)) > length) return 0; + + buffer += offset; + return (Header *) buffer; +} + + +Poco::UInt8* ICMPv4PacketImpl::data(Poco::UInt8* buffer, int length) const +{ + return ((Poco::UInt8*) header(buffer, length)) + sizeof(Header); +} + + +bool ICMPv4PacketImpl::validReplyID(Poco::UInt8* buffer, int length) const +{ + Header *icp = header(buffer, length); + return icp && (Process::id() == icp->id); +} + + +std::string ICMPv4PacketImpl::errorDescription(unsigned char* buffer, int length) +{ + Header *icp = header(buffer, length); + + if (!icp) return "Invalid header."; + if (ECHO_REPLY == icp->type) return std::string(); // not an error + + UInt8 pointer = 0; + if (PARAMETER_PROBLEM == icp->type) + { + UInt8 mask = 0x00FF; + pointer = icp->id & mask; + } + + MessageType type = static_cast(icp->type); + int code = icp->code; + std::ostringstream err; + + switch (type) + { + case DESTINATION_UNREACHABLE_TYPE: + if (code >= NET_UNREACHABLE && code < DESTINATION_UNREACHABLE_UNKNOWN) + err << DESTINATION_UNREACHABLE_CODE[code]; + else + err << DESTINATION_UNREACHABLE_CODE[DESTINATION_UNREACHABLE_UNKNOWN]; + break; + + case SOURCE_QUENCH_TYPE: + err << "Source quench"; + break; + + case REDIRECT_MESSAGE_TYPE: + if (code >= REDIRECT_NETWORK && code < REDIRECT_MESSAGE_UNKNOWN) + err << REDIRECT_MESSAGE_CODE[code]; + else + err << REDIRECT_MESSAGE_CODE[REDIRECT_MESSAGE_UNKNOWN]; + break; + + case TIME_EXCEEDED_TYPE: + if (code >= TIME_TO_LIVE || code < TIME_EXCEEDED_UNKNOWN) + err << TIME_EXCEEDED_CODE[code]; + else + err << TIME_EXCEEDED_CODE[TIME_EXCEEDED_UNKNOWN]; + break; + + case PARAMETER_PROBLEM_TYPE: + if (POINTER_INDICATES_THE_ERROR != code) + code = PARAMETER_PROBLEM_UNKNOWN; + err << PARAMETER_PROBLEM_CODE[code] << ": error in octet #" << pointer; + break; + + default: + err << "Unknown type."; + break; + } + + return err.str(); +} + +std::string ICMPv4PacketImpl::typeDescription(int typeId) +{ + poco_assert (typeId >= ECHO_REPLY && typeId < MESSAGE_TYPE_LENGTH); + + return MESSAGE_TYPE[typeId]; +} + + +} } // namespace Poco::Net diff --git a/Net/src/IPAddress.cpp b/Net/src/IPAddress.cpp index 0aeeb73b0..d207b024c 100644 --- a/Net/src/IPAddress.cpp +++ b/Net/src/IPAddress.cpp @@ -1,7 +1,7 @@ // // IPAddress.cpp // -// $Id: //poco/1.1.0/Net/src/IPAddress.cpp#2 $ +// $Id: //poco/1.2/Net/src/IPAddress.cpp#1 $ // // Library: Net // Package: NetCore @@ -34,23 +34,24 @@ // -#include "Net/IPAddress.h" -#include "Net/NetException.h" -#include "Foundation/RefCountedObject.h" -#include "Foundation/NumberFormatter.h" -#include "Foundation/Types.h" +#include "Poco/Net/IPAddress.h" +#include "Poco/Net/NetException.h" +#include "Poco/RefCountedObject.h" +#include "Poco/NumberFormatter.h" +#include "Poco/Types.h" #include #include -using Foundation::RefCountedObject; -using Foundation::NumberFormatter; -using Foundation::UInt8; -using Foundation::UInt16; -using Foundation::UInt32; +using Poco::RefCountedObject; +using Poco::NumberFormatter; +using Poco::UInt8; +using Poco::UInt16; +using Poco::UInt32; -Net_BEGIN +namespace Poco { +namespace Net { // @@ -465,7 +466,7 @@ IPAddress::IPAddress(Family family): _pImpl(0) else if (family == IPv6) _pImpl = new IPv6AddressImpl(); #endif - else Foundation::InvalidArgumentException("Invalid or unsupported address family passed to IPAddress()"); + else Poco::InvalidArgumentException("Invalid or unsupported address family passed to IPAddress()"); } @@ -488,7 +489,7 @@ IPAddress::IPAddress(const std::string& addr, Family family): _pImpl(0) else if (family == IPv6) _pImpl = IPv6AddressImpl::parse(addr); #endif - else throw Foundation::InvalidArgumentException("Invalid or unsupported address family passed to IPAddress()"); + else throw Poco::InvalidArgumentException("Invalid or unsupported address family passed to IPAddress()"); } @@ -500,7 +501,7 @@ IPAddress::IPAddress(const void* addr, poco_socklen_t length) else if (length == sizeof(struct in6_addr)) _pImpl = new IPv6AddressImpl(addr); #endif - else throw Foundation::InvalidArgumentException("Invalid address length passed to IPAddress()"); + else throw Poco::InvalidArgumentException("Invalid address length passed to IPAddress()"); } @@ -741,4 +742,4 @@ bool IPAddress::tryParse(const std::string& addr, IPAddress& result) } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/MailMessage.cpp b/Net/src/MailMessage.cpp index 4c92c3250..1c4d9b126 100644 --- a/Net/src/MailMessage.cpp +++ b/Net/src/MailMessage.cpp @@ -1,7 +1,7 @@ // // MailMessage.cpp // -// $Id: //poco/1.1.0/Net/src/MailMessage.cpp#2 $ +// $Id: //poco/1.2/Net/src/MailMessage.cpp#1 $ // // Library: Net // Package: Mail @@ -34,35 +34,36 @@ // -#include "Net/MailMessage.h" -#include "Net/MediaType.h" -#include "Net/MultipartReader.h" -#include "Net/MultipartWriter.h" -#include "Net/PartSource.h" -#include "Net/PartHandler.h" -#include "Net/QuotedPrintableEncoder.h" -#include "Net/QuotedPrintableDecoder.h" -#include "Foundation/Base64Encoder.h" -#include "Foundation/Base64Decoder.h" -#include "Foundation/StreamCopier.h" -#include "Foundation/DateTimeFormat.h" -#include "Foundation/DateTimeFormatter.h" -#include "Foundation/DateTimeParser.h" -#include "Foundation/String.h" +#include "Poco/Net/MailMessage.h" +#include "Poco/Net/MediaType.h" +#include "Poco/Net/MultipartReader.h" +#include "Poco/Net/MultipartWriter.h" +#include "Poco/Net/PartSource.h" +#include "Poco/Net/PartHandler.h" +#include "Poco/Net/QuotedPrintableEncoder.h" +#include "Poco/Net/QuotedPrintableDecoder.h" +#include "Poco/Base64Encoder.h" +#include "Poco/Base64Decoder.h" +#include "Poco/StreamCopier.h" +#include "Poco/DateTimeFormat.h" +#include "Poco/DateTimeFormatter.h" +#include "Poco/DateTimeParser.h" +#include "Poco/String.h" #include #include -using Foundation::Base64Encoder; -using Foundation::Base64Decoder; -using Foundation::StreamCopier; -using Foundation::DateTimeFormat; -using Foundation::DateTimeFormatter; -using Foundation::DateTimeParser; -using Foundation::icompare; +using Poco::Base64Encoder; +using Poco::Base64Decoder; +using Poco::StreamCopier; +using Poco::DateTimeFormat; +using Poco::DateTimeFormatter; +using Poco::DateTimeParser; +using Poco::icompare; -Net_BEGIN +namespace Poco { +namespace Net { namespace @@ -115,7 +116,7 @@ const std::string MailMessage::CTE_BASE64("base64"); MailMessage::MailMessage() { - Foundation::Timestamp now; + Poco::Timestamp now; setDate(now); setContentType("text/plain"); } @@ -195,13 +196,13 @@ const std::string& MailMessage::getContentType() const } -void MailMessage::setDate(const Foundation::Timestamp& dateTime) +void MailMessage::setDate(const Poco::Timestamp& dateTime) { set(HEADER_DATE, DateTimeFormatter::format(dateTime, DateTimeFormat::RFC1123_FORMAT)); } -Foundation::Timestamp MailMessage::getDate() const +Poco::Timestamp MailMessage::getDate() const { const std::string& dateTime = get(HEADER_DATE); int tzd; @@ -489,4 +490,4 @@ void MailMessage::appendRecipient(const MailRecipient& recipient, std::string& s } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/MailRecipient.cpp b/Net/src/MailRecipient.cpp index 5d2adca44..8f9dcac21 100644 --- a/Net/src/MailRecipient.cpp +++ b/Net/src/MailRecipient.cpp @@ -1,7 +1,7 @@ // // MailRecipient.cpp // -// $Id: //poco/1.1.0/Net/src/MailRecipient.cpp#2 $ +// $Id: //poco/1.2/Net/src/MailRecipient.cpp#1 $ // // Library: Net // Package: Mail @@ -34,11 +34,12 @@ // -#include "Net/MailRecipient.h" +#include "Poco/Net/MailRecipient.h" #include -Net_BEGIN +namespace Poco { +namespace Net { MailRecipient::MailRecipient(): @@ -48,24 +49,24 @@ MailRecipient::MailRecipient(): MailRecipient::MailRecipient(const MailRecipient& recipient): - _type(recipient._type), _address(recipient._address), - _realName(recipient._realName) + _realName(recipient._realName), + _type(recipient._type) { } MailRecipient::MailRecipient(RecipientType type, const std::string& address): - _type(type), - _address(address) + _address(address), + _type(type) { } MailRecipient::MailRecipient(RecipientType type, const std::string& address, const std::string& realName): - _type(type), _address(address), - _realName(realName) + _realName(realName), + _type(type) { } @@ -112,4 +113,4 @@ void MailRecipient::setRealName(const std::string& realName) } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/MailStream.cpp b/Net/src/MailStream.cpp index eeb10705a..4fce868d5 100644 --- a/Net/src/MailStream.cpp +++ b/Net/src/MailStream.cpp @@ -1,7 +1,7 @@ // // MailStream.cpp // -// $Id: //poco/1.1.0/Net/src/MailStream.cpp#2 $ +// $Id: //poco/1.2/Net/src/MailStream.cpp#1 $ // // Library: Net // Package: Mail @@ -34,10 +34,11 @@ // -#include "Net/MailStream.h" +#include "Poco/Net/MailStream.h" -Net_BEGIN +namespace Poco { +namespace Net { MailStreamBuf::MailStreamBuf(std::istream& istr): @@ -237,4 +238,4 @@ MailOutputStream::~MailOutputStream() } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/MediaType.cpp b/Net/src/MediaType.cpp index 07af1f1fe..10e4d6e32 100644 --- a/Net/src/MediaType.cpp +++ b/Net/src/MediaType.cpp @@ -1,7 +1,7 @@ // // MediaType.cpp // -// $Id: //poco/1.1.0/Net/src/MediaType.cpp#2 $ +// $Id: //poco/1.2/Net/src/MediaType.cpp#1 $ // // Library: Net // Package: Messages @@ -34,17 +34,18 @@ // -#include "Net/MediaType.h" -#include "Net/MessageHeader.h" -#include "Foundation/String.h" +#include "Poco/Net/MediaType.h" +#include "Poco/Net/MessageHeader.h" +#include "Poco/String.h" #include #include -using Foundation::icompare; +using Poco::icompare; -Net_BEGIN +namespace Poco { +namespace Net { MediaType::MediaType(const std::string& mediaType) @@ -187,4 +188,4 @@ void MediaType::parse(const std::string& mediaType) } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/MessageHeader.cpp b/Net/src/MessageHeader.cpp index 44f7e114d..3102923bf 100644 --- a/Net/src/MessageHeader.cpp +++ b/Net/src/MessageHeader.cpp @@ -1,7 +1,7 @@ // // MessageHeader.cpp // -// $Id: //poco/1.1.0/Net/src/MessageHeader.cpp#2 $ +// $Id: //poco/1.2/Net/src/MessageHeader.cpp#1 $ // // Library: Net // Package: Messages @@ -34,13 +34,14 @@ // -#include "Net/MessageHeader.h" -#include "Net/NetException.h" -#include "Foundation/String.h" +#include "Poco/Net/MessageHeader.h" +#include "Poco/Net/NetException.h" +#include "Poco/String.h" #include -Net_BEGIN +namespace Poco { +namespace Net { MessageHeader::MessageHeader() @@ -139,7 +140,7 @@ void MessageHeader::splitElements(const std::string& s, std::vector } else if (*it == ',') { - Foundation::trimInPlace(elem); + Poco::trimInPlace(elem); if (!ignoreEmpty || !elem.empty()) elements.push_back(elem); elem.clear(); @@ -149,7 +150,7 @@ void MessageHeader::splitElements(const std::string& s, std::vector } if (!elem.empty()) { - Foundation::trimInPlace(elem); + Poco::trimInPlace(elem); if (!ignoreEmpty || !elem.empty()) elements.push_back(elem); } @@ -164,7 +165,7 @@ void MessageHeader::splitParameters(const std::string& s, std::string& value, Na std::string::const_iterator end = s.end(); while (it != end && isspace(*it)) ++it; while (it != end && *it != ';') value += *it++; - Foundation::trimRightInPlace(value); + Poco::trimRightInPlace(value); if (it != end) ++it; splitParameters(it, end, parameters); } @@ -179,7 +180,7 @@ void MessageHeader::splitParameters(const std::string::const_iterator& begin, co std::string pvalue; while (it != end && isspace(*it)) ++it; while (it != end && *it != '=' && *it != ';') pname += *it++; - Foundation::trimRightInPlace(pname); + Poco::trimRightInPlace(pname); if (it != end && *it != ';') ++it; while (it != end && isspace(*it)) ++it; while (it != end && *it != ';') @@ -205,7 +206,7 @@ void MessageHeader::splitParameters(const std::string::const_iterator& begin, co } else pvalue += *it++; } - Foundation::trimRightInPlace(pvalue); + Poco::trimRightInPlace(pvalue); if (!pname.empty()) parameters.add(pname, pvalue); if (it != end) ++it; } @@ -226,4 +227,4 @@ void MessageHeader::quote(const std::string& value, std::string& result, bool al } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/MulticastSocket.cpp b/Net/src/MulticastSocket.cpp index 2f978f275..6dfbc84cb 100644 --- a/Net/src/MulticastSocket.cpp +++ b/Net/src/MulticastSocket.cpp @@ -1,7 +1,7 @@ // // MulticastSocket.cpp // -// $Id: //poco/1.1.0/Net/src/MulticastSocket.cpp#2 $ +// $Id: //poco/1.2/Net/src/MulticastSocket.cpp#1 $ // // Library: Net // Package: Sockets @@ -34,8 +34,8 @@ // -#include "Net/MulticastSocket.h" -#include "Net/NetException.h" +#include "Poco/Net/MulticastSocket.h" +#include "Poco/Net/NetException.h" #include @@ -57,7 +57,8 @@ struct ip_mreq #endif -Net_BEGIN +namespace Poco { +namespace Net { MulticastSocket::MulticastSocket() @@ -115,7 +116,7 @@ NetworkInterface MulticastSocket::getInterface() const impl()->getOption(IPPROTO_IP, IP_MULTICAST_IF, addr); return NetworkInterface::forAddress(addr); } - catch (Foundation::Exception&) + catch (Poco::Exception&) { #if defined(POCO_HAVE_IPv6) int ix; @@ -257,4 +258,4 @@ void MulticastSocket::leaveGroup(const IPAddress& groupAddress, const NetworkInt } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/MultipartReader.cpp b/Net/src/MultipartReader.cpp index ecaa3c231..060e47c8f 100644 --- a/Net/src/MultipartReader.cpp +++ b/Net/src/MultipartReader.cpp @@ -1,7 +1,7 @@ // // MultipartReader.cpp // -// $Id: //poco/1.1.0/Net/src/MultipartReader.cpp#2 $ +// $Id: //poco/1.2/Net/src/MultipartReader.cpp#1 $ // // Library: Net // Package: Messages @@ -34,16 +34,17 @@ // -#include "Net/MultipartReader.h" -#include "Net/MessageHeader.h" -#include "Net/NetException.h" +#include "Poco/Net/MultipartReader.h" +#include "Poco/Net/MessageHeader.h" +#include "Poco/Net/NetException.h" #include -using Foundation::BufferedStreamBuf; +using Poco::BufferedStreamBuf; -Net_BEGIN +namespace Poco { +namespace Net { // @@ -313,4 +314,4 @@ bool MultipartReader::readLine(std::string& line, std::string::size_type n) } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/MultipartWriter.cpp b/Net/src/MultipartWriter.cpp index 015da07db..e73ed6393 100644 --- a/Net/src/MultipartWriter.cpp +++ b/Net/src/MultipartWriter.cpp @@ -1,7 +1,7 @@ // // MultipartWriter.cpp // -// $Id: //poco/1.1.0/Net/src/MultipartWriter.cpp#2 $ +// $Id: //poco/1.2/Net/src/MultipartWriter.cpp#1 $ // // Library: Net // Package: Messages @@ -34,17 +34,18 @@ // -#include "Net/MultipartWriter.h" -#include "Net/MessageHeader.h" -#include "Foundation/Random.h" -#include "Foundation/NumberFormatter.h" +#include "Poco/Net/MultipartWriter.h" +#include "Poco/Net/MessageHeader.h" +#include "Poco/Random.h" +#include "Poco/NumberFormatter.h" -using Foundation::Random; -using Foundation::NumberFormatter; +using Poco::Random; +using Poco::NumberFormatter; -Net_BEGIN +namespace Poco { +namespace Net { MultipartWriter::MultipartWriter(std::ostream& ostr): @@ -98,4 +99,4 @@ std::string MultipartWriter::createBoundary() } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/NameValueCollection.cpp b/Net/src/NameValueCollection.cpp index e531e6894..1c6826e8f 100644 --- a/Net/src/NameValueCollection.cpp +++ b/Net/src/NameValueCollection.cpp @@ -1,7 +1,7 @@ // // NameValueCollection.cpp // -// $Id: //poco/1.1.0/Net/src/NameValueCollection.cpp#2 $ +// $Id: //poco/1.2/Net/src/NameValueCollection.cpp#1 $ // // Library: Net // Package: Messages @@ -34,15 +34,16 @@ // -#include "Net/NameValueCollection.h" -#include "Foundation/Exception.h" +#include "Poco/Net/NameValueCollection.h" +#include "Poco/Exception.h" #include -using Foundation::NotFoundException; +using Poco::NotFoundException; -Net_BEGIN +namespace Poco { +namespace Net { NameValueCollection::NameValueCollection() @@ -112,6 +113,16 @@ const std::string& NameValueCollection::get(const std::string& name) const } +const std::string& NameValueCollection::get(const std::string& name, const std::string& defaultValue) const +{ + ConstIterator it = _map.find(name); + if (it != _map.end()) + return it->second; + else + return defaultValue; +} + + bool NameValueCollection::has(const std::string& name) const { return _map.find(name) != _map.end(); @@ -160,4 +171,4 @@ void NameValueCollection::clear() } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/NetException.cpp b/Net/src/NetException.cpp index 7fc7c8732..bb3a11243 100644 --- a/Net/src/NetException.cpp +++ b/Net/src/NetException.cpp @@ -1,7 +1,7 @@ // // NetException.cpp // -// $Id: //poco/1.1.0/Net/src/NetException.cpp#2 $ +// $Id: //poco/1.2/Net/src/NetException.cpp#1 $ // // Library: Net // Package: NetCore @@ -34,14 +34,15 @@ // -#include "Net/NetException.h" +#include "Poco/Net/NetException.h" #include -using Foundation::IOException; +using Poco::IOException; -Net_BEGIN +namespace Poco { +namespace Net { POCO_IMPLEMENT_EXCEPTION(NetException, IOException, "Net Exception") @@ -58,9 +59,11 @@ POCO_IMPLEMENT_EXCEPTION(MessageException, NetException, "Malformed message") POCO_IMPLEMENT_EXCEPTION(MultipartException, MessageException, "Malformed multipart message") POCO_IMPLEMENT_EXCEPTION(HTTPException, NetException, "HTTP Exception") POCO_IMPLEMENT_EXCEPTION(NotAuthenticatedException, HTTPException, "No authentication information found") +POCO_IMPLEMENT_EXCEPTION(UnsupportedRedirectException, HTTPException, "Unsupported HTTP redirect (protocol change)") POCO_IMPLEMENT_EXCEPTION(FTPException, NetException, "FTP Exception") POCO_IMPLEMENT_EXCEPTION(SMTPException, NetException, "SMTP Exception") POCO_IMPLEMENT_EXCEPTION(POP3Exception, NetException, "POP3 Exception") +POCO_IMPLEMENT_EXCEPTION(ICMPException, NetException, "ICMP Exception") -Net_END +} } // namespace Poco::Net diff --git a/Net/src/NetworkInterface.cpp b/Net/src/NetworkInterface.cpp index 334fc1c6e..074fa7b76 100644 --- a/Net/src/NetworkInterface.cpp +++ b/Net/src/NetworkInterface.cpp @@ -1,7 +1,7 @@ // // NetworkInterface.cpp // -// $Id: //poco/1.1.0/Net/src/NetworkInterface.cpp#3 $ +// $Id: //poco/1.2/Net/src/NetworkInterface.cpp#1 $ // // Library: Net // Package: Sockets @@ -34,18 +34,19 @@ // -#include "Net/NetworkInterface.h" -#include "Net/DatagramSocket.h" -#include "Net/NetException.h" -#include "Foundation/NumberFormatter.h" +#include "Poco/Net/NetworkInterface.h" +#include "Poco/Net/DatagramSocket.h" +#include "Poco/Net/NetException.h" +#include "Poco/NumberFormatter.h" #include -using Foundation::NumberFormatter; -using Foundation::FastMutex; +using Poco::NumberFormatter; +using Poco::FastMutex; -Net_BEGIN +namespace Poco { +namespace Net { FastMutex NetworkInterface::_mutex; @@ -66,9 +67,9 @@ NetworkInterface::NetworkInterface(const std::string& name, const IPAddress& add NetworkInterface::NetworkInterface(const NetworkInterface& interface): - _index(interface._index), _name(interface._name), - _address(interface._address) + _address(interface._address), + _index(interface._index) { } @@ -82,9 +83,9 @@ NetworkInterface& NetworkInterface::operator = (const NetworkInterface& interfac { if (&interface != this) { - _index = interface._index; _name = interface._name; _address = interface._address; + _index = interface._index; } return *this; } @@ -154,7 +155,7 @@ NetworkInterface NetworkInterface::forIndex(int i) } -Foundation_END +} } // namespace Poco::Net // @@ -169,7 +170,8 @@ Foundation_END #include -Net_BEGIN +namespace Poco { +namespace Net { NetworkInterface::NetworkInterfaceList NetworkInterface::list() @@ -212,13 +214,15 @@ NetworkInterface::NetworkInterfaceList NetworkInterface::list() } else throw NetException("cannot get network adapter list"); } - catch (Foundation::Exception&) + catch (Poco::Exception&) { delete [] reinterpret_cast(pAdapterAddresses); throw; } delete [] reinterpret_cast(pAdapterAddresses); #else + // Add loopback interface (not returned by GetAdaptersInfo) + result.push_back(NetworkInterface("Loopback", IPAddress("127.0.0.1"), -1)); // On Windows 2000 we use GetAdaptersInfo. PIP_ADAPTER_INFO pAdapterInfo; PIP_ADAPTER_INFO pAdapter = 0; @@ -250,7 +254,7 @@ NetworkInterface::NetworkInterfaceList NetworkInterface::list() } else throw NetException("cannot get network adapter list"); } - catch (Foundation::Exception&) + catch (Poco::Exception&) { delete [] reinterpret_cast(pAdapterInfo); throw; @@ -262,7 +266,7 @@ NetworkInterface::NetworkInterfaceList NetworkInterface::list() } -Net_END +} } // namespace Poco::Net #elif defined(POCO_OS_FAMILY_BSD) || POCO_OS == POCO_OS_QNX @@ -275,7 +279,8 @@ Net_END #include -Net_BEGIN +namespace Poco { +namespace Net { NetworkInterface::NetworkInterfaceList NetworkInterface::list() @@ -310,7 +315,7 @@ NetworkInterface::NetworkInterfaceList NetworkInterface::list() } -Net_END +} } // namespace Poco::Net #elif POCO_OS == POCO_OS_LINUX @@ -319,7 +324,8 @@ Net_END // -Net_BEGIN +namespace Poco { +namespace Net { NetworkInterface::NetworkInterfaceList NetworkInterface::list() @@ -396,7 +402,7 @@ NetworkInterface::NetworkInterfaceList NetworkInterface::list() } -Net_END +} } // namespace Poco::Net #else @@ -405,7 +411,8 @@ Net_END // -Net_BEGIN +namespace Poco { +namespace Net { NetworkInterface::NetworkInterfaceList NetworkInterface::list() @@ -491,7 +498,7 @@ NetworkInterface::NetworkInterfaceList NetworkInterface::list() } -Net_END +} } // namespace Poco::Net #endif diff --git a/Net/src/NullPartHandler.cpp b/Net/src/NullPartHandler.cpp index f594b94b2..4e4fd4293 100644 --- a/Net/src/NullPartHandler.cpp +++ b/Net/src/NullPartHandler.cpp @@ -1,7 +1,7 @@ // // NullPartHandler.cpp // -// $Id: //poco/1.1.0/Net/src/NullPartHandler.cpp#2 $ +// $Id: //poco/1.2/Net/src/NullPartHandler.cpp#1 $ // // Library: Net // Package: Messages @@ -34,17 +34,18 @@ // -#include "Net/NullPartHandler.h" -#include "Net/MessageHeader.h" -#include "Foundation/NullStream.h" -#include "Foundation/StreamCopier.h" +#include "Poco/Net/NullPartHandler.h" +#include "Poco/Net/MessageHeader.h" +#include "Poco/NullStream.h" +#include "Poco/StreamCopier.h" -using Foundation::NullOutputStream; -using Foundation::StreamCopier; +using Poco::NullOutputStream; +using Poco::StreamCopier; -Net_BEGIN +namespace Poco { +namespace Net { NullPartHandler::NullPartHandler() @@ -64,4 +65,4 @@ void NullPartHandler::handlePart(const MessageHeader& header, std::istream& stre } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/POP3ClientSession.cpp b/Net/src/POP3ClientSession.cpp index e91d01996..03574a2e0 100644 --- a/Net/src/POP3ClientSession.cpp +++ b/Net/src/POP3ClientSession.cpp @@ -1,7 +1,7 @@ // // POP3ClientSession.cpp // -// $Id: //poco/1.1.0/Net/src/POP3ClientSession.cpp#2 $ +// $Id: //poco/1.2/Net/src/POP3ClientSession.cpp#1 $ // // Library: Net // Package: Mail @@ -34,26 +34,27 @@ // -#include "Net/POP3ClientSession.h" -#include "Net/MailMessage.h" -#include "Net/MailStream.h" -#include "Net/SocketAddress.h" -#include "Net/NetException.h" -#include "Foundation/StreamCopier.h" -#include "Foundation/NumberFormatter.h" -#include "Foundation/UnbufferedStreamBuf.h" +#include "Poco/Net/POP3ClientSession.h" +#include "Poco/Net/MailMessage.h" +#include "Poco/Net/MailStream.h" +#include "Poco/Net/SocketAddress.h" +#include "Poco/Net/NetException.h" +#include "Poco/StreamCopier.h" +#include "Poco/NumberFormatter.h" +#include "Poco/UnbufferedStreamBuf.h" #include #include -using Foundation::NumberFormatter; -using Foundation::StreamCopier; +using Poco::NumberFormatter; +using Poco::StreamCopier; -Net_BEGIN +namespace Poco { +namespace Net { -class DialogStreamBuf: public Foundation::UnbufferedStreamBuf +class DialogStreamBuf: public Poco::UnbufferedStreamBuf { public: DialogStreamBuf(DialogSocket& socket): @@ -120,7 +121,7 @@ POP3ClientSession::POP3ClientSession(const StreamSocket& socket): } -POP3ClientSession::POP3ClientSession(const std::string& host, Foundation::UInt16 port): +POP3ClientSession::POP3ClientSession(const std::string& host, Poco::UInt16 port): _socket(SocketAddress(host, port)), _isOpen(true) { @@ -139,13 +140,13 @@ POP3ClientSession::~POP3ClientSession() } -void POP3ClientSession::setTimeout(const Foundation::Timespan& timeout) +void POP3ClientSession::setTimeout(const Poco::Timespan& timeout) { _socket.setReceiveTimeout(timeout); } -Foundation::Timespan POP3ClientSession::getTimeout() const +Poco::Timespan POP3ClientSession::getTimeout() const { return _socket.getReceiveTimeout(); } @@ -296,4 +297,4 @@ bool POP3ClientSession::isPositive(const std::string& response) } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/PartHandler.cpp b/Net/src/PartHandler.cpp index 9e4b5a33c..a03043819 100644 --- a/Net/src/PartHandler.cpp +++ b/Net/src/PartHandler.cpp @@ -1,7 +1,7 @@ // // PartHandler.cpp // -// $Id: //poco/1.1.0/Net/src/PartHandler.cpp#2 $ +// $Id: //poco/1.2/Net/src/PartHandler.cpp#1 $ // // Library: Net // Package: Messages @@ -34,10 +34,11 @@ // -#include "Net/PartHandler.h" +#include "Poco/Net/PartHandler.h" -Net_BEGIN +namespace Poco { +namespace Net { PartHandler::PartHandler() @@ -50,4 +51,4 @@ PartHandler::~PartHandler() } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/PartSource.cpp b/Net/src/PartSource.cpp index 3afa611b6..239aa22d3 100644 --- a/Net/src/PartSource.cpp +++ b/Net/src/PartSource.cpp @@ -1,7 +1,7 @@ // // PartSource.cpp // -// $Id: //poco/1.1.0/Net/src/PartSource.cpp#2 $ +// $Id: //poco/1.2/Net/src/PartSource.cpp#1 $ // // Library: Net // Package: Messages @@ -34,10 +34,11 @@ // -#include "Net/PartSource.h" +#include "Poco/Net/PartSource.h" -Net_BEGIN +namespace Poco { +namespace Net { PartSource::PartSource(): @@ -64,4 +65,4 @@ const std::string& PartSource::filename() } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/QuotedPrintableDecoder.cpp b/Net/src/QuotedPrintableDecoder.cpp index 92b699253..ca61629dd 100644 --- a/Net/src/QuotedPrintableDecoder.cpp +++ b/Net/src/QuotedPrintableDecoder.cpp @@ -1,7 +1,7 @@ // // QuotedPrintableDecoder.cpp // -// $Id: //poco/1.1.0/Net/src/QuotedPrintableDecoder.cpp#2 $ +// $Id: //poco/1.2/Net/src/QuotedPrintableDecoder.cpp#1 $ // // Library: Net // Package: Messages @@ -34,18 +34,19 @@ // -#include "Net/QuotedPrintableDecoder.h" -#include "Foundation/NumberParser.h" -#include "Foundation/Exception.h" +#include "Poco/Net/QuotedPrintableDecoder.h" +#include "Poco/NumberParser.h" +#include "Poco/Exception.h" #include -using Foundation::UnbufferedStreamBuf; -using Foundation::NumberParser; -using Foundation::DataFormatException; +using Poco::UnbufferedStreamBuf; +using Poco::NumberParser; +using Poco::DataFormatException; -Net_BEGIN +namespace Poco { +namespace Net { QuotedPrintableDecoderBuf::QuotedPrintableDecoderBuf(std::istream& istr): @@ -61,8 +62,6 @@ QuotedPrintableDecoderBuf::~QuotedPrintableDecoderBuf() int QuotedPrintableDecoderBuf::readFromDevice() { - static const int eof = std::char_traits::eof(); - int ch = _istr.get(); while (ch == '=') { @@ -122,4 +121,4 @@ QuotedPrintableDecoder::~QuotedPrintableDecoder() } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/QuotedPrintableEncoder.cpp b/Net/src/QuotedPrintableEncoder.cpp index 6d76f27e5..d3160c166 100644 --- a/Net/src/QuotedPrintableEncoder.cpp +++ b/Net/src/QuotedPrintableEncoder.cpp @@ -1,7 +1,7 @@ // // QuotedPrintableEncoder.cpp // -// $Id: //poco/1.1.0/Net/src/QuotedPrintableEncoder.cpp#2 $ +// $Id: //poco/1.2/Net/src/QuotedPrintableEncoder.cpp#1 $ // // Library: Net // Package: Messages @@ -34,15 +34,16 @@ // -#include "Net/QuotedPrintableEncoder.h" -#include "Foundation/NumberFormatter.h" +#include "Poco/Net/QuotedPrintableEncoder.h" +#include "Poco/NumberFormatter.h" -using Foundation::UnbufferedStreamBuf; -using Foundation::NumberFormatter; +using Poco::UnbufferedStreamBuf; +using Poco::NumberFormatter; -Net_BEGIN +namespace Poco { +namespace Net { QuotedPrintableEncoderBuf::QuotedPrintableEncoderBuf(std::ostream& ostr): @@ -168,4 +169,4 @@ QuotedPrintableEncoder::~QuotedPrintableEncoder() } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/RawSocket.cpp b/Net/src/RawSocket.cpp new file mode 100644 index 000000000..370f862bb --- /dev/null +++ b/Net/src/RawSocket.cpp @@ -0,0 +1,133 @@ +// +// RawSocket.cpp +// +// $Id: //poco/1.2/Net/src/RawSocket.cpp#1 $ +// +// Library: Net +// Package: Sockets +// Module: RawSocket +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#include "Poco/Net/RawSocket.h" +#include "Poco/Net/RawSocketImpl.h" +#include "Poco/Exception.h" + + +using Poco::InvalidArgumentException; + + +namespace Poco { +namespace Net { + + +RawSocket::RawSocket(): + Socket(new RawSocketImpl) +{ +} + + +RawSocket::RawSocket(IPAddress::Family family, int proto): + Socket(new RawSocketImpl(family, proto)) +{ +} + + +RawSocket::RawSocket(const SocketAddress& address, bool reuseAddress): + Socket(new RawSocketImpl) +{ + bind(address, reuseAddress); +} + + +RawSocket::RawSocket(const Socket& socket): Socket(socket) +{ + if (!dynamic_cast(impl())) + throw InvalidArgumentException("Cannot assign incompatible socket"); +} + + +RawSocket::RawSocket(SocketImpl* pImpl): Socket(pImpl) +{ + if (!dynamic_cast(impl())) + throw InvalidArgumentException("Cannot assign incompatible socket"); +} + + +RawSocket::~RawSocket() +{ +} + + +RawSocket& RawSocket::operator = (const Socket& socket) +{ + if (dynamic_cast(socket.impl())) + Socket::operator = (socket); + else + throw InvalidArgumentException("Cannot assign incompatible socket"); + return *this; +} + + +void RawSocket::connect(const SocketAddress& address) +{ + impl()->connect(address); +} + + +void RawSocket::bind(const SocketAddress& address, bool reuseAddress) +{ + impl()->bind(address, reuseAddress); +} + + +int RawSocket::sendBytes(const void* buffer, int length, int flags) +{ + return impl()->sendBytes(buffer, length, flags); +} + + +int RawSocket::receiveBytes(void* buffer, int length, int flags) +{ + return impl()->receiveBytes(buffer, length, flags); +} + + +int RawSocket::sendTo(const void* buffer, int length, const SocketAddress& address, int flags) +{ + return impl()->sendTo(buffer, length, address, flags); +} + + +int RawSocket::receiveFrom(void* buffer, int length, SocketAddress& address, int flags) +{ + return impl()->receiveFrom(buffer, length, address, flags); +} + + +} } // namespace Poco::Net diff --git a/Net/src/RawSocketImpl.cpp b/Net/src/RawSocketImpl.cpp new file mode 100644 index 000000000..40fffed39 --- /dev/null +++ b/Net/src/RawSocketImpl.cpp @@ -0,0 +1,91 @@ +// +// RawSocketImpl.cpp +// +// $Id: //poco/1.2/Net/src/RawSocketImpl.cpp#1 $ +// +// Library: Net +// Package: Sockets +// Module: RawSocketImpl +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#include "Poco/Net/RawSocketImpl.h" +#include "Poco/Net/NetException.h" + + +using Poco::InvalidArgumentException; + + +namespace Poco { +namespace Net { + + +RawSocketImpl::RawSocketImpl() +{ + init(AF_INET); +} + + +RawSocketImpl::RawSocketImpl(IPAddress::Family family, int proto) +{ + if (family == IPAddress::IPv4) + init2(AF_INET, proto); +#if POCO_HAVE_IPv6 + else if (family == IPAddress::IPv6) + init2(AF_INET6, proto); +#endif + else throw InvalidArgumentException("Invalid or unsupported address family passed to RawSocketImpl"); + +} + + +RawSocketImpl::RawSocketImpl(poco_socket_t sockfd): + SocketImpl(sockfd) +{ +} + + +RawSocketImpl::~RawSocketImpl() +{ +} + + +void RawSocketImpl::init(int af) +{ + init2(af, IPPROTO_RAW); +} + + +void RawSocketImpl::init2(int af, int proto) +{ + initSocket(af, SOCK_RAW, proto); + setOption(IPPROTO_IP, IP_HDRINCL, 0); +} + + +} } // namespace Poco::Net diff --git a/Net/src/SMTPClientSession.cpp b/Net/src/SMTPClientSession.cpp index 69fc9d458..d3448946d 100644 --- a/Net/src/SMTPClientSession.cpp +++ b/Net/src/SMTPClientSession.cpp @@ -1,7 +1,7 @@ // // SMTPClientSession.cpp // -// $Id: //poco/1.1.0/Net/src/SMTPClientSession.cpp#2 $ +// $Id: //poco/1.2/Net/src/SMTPClientSession.cpp#1 $ // // Library: Net // Package: Mail @@ -34,20 +34,21 @@ // -#include "Net/SMTPClientSession.h" -#include "Net/MailMessage.h" -#include "Net/MailRecipient.h" -#include "Net/MailStream.h" -#include "Net/SocketAddress.h" -#include "Net/SocketStream.h" -#include "Net/NetException.h" -#include "Foundation/Environment.h" +#include "Poco/Net/SMTPClientSession.h" +#include "Poco/Net/MailMessage.h" +#include "Poco/Net/MailRecipient.h" +#include "Poco/Net/MailStream.h" +#include "Poco/Net/SocketAddress.h" +#include "Poco/Net/SocketStream.h" +#include "Poco/Net/NetException.h" +#include "Poco/Environment.h" -using Foundation::Environment; +using Poco::Environment; -Net_BEGIN +namespace Poco { +namespace Net { SMTPClientSession::SMTPClientSession(const StreamSocket& socket): @@ -57,7 +58,7 @@ SMTPClientSession::SMTPClientSession(const StreamSocket& socket): } -SMTPClientSession::SMTPClientSession(const std::string& host, Foundation::UInt16 port): +SMTPClientSession::SMTPClientSession(const std::string& host, Poco::UInt16 port): _socket(SocketAddress(host, port)), _isOpen(true) { @@ -76,13 +77,13 @@ SMTPClientSession::~SMTPClientSession() } -void SMTPClientSession::setTimeout(const Foundation::Timespan& timeout) +void SMTPClientSession::setTimeout(const Poco::Timespan& timeout) { _socket.setReceiveTimeout(timeout); } -Foundation::Timespan SMTPClientSession::getTimeout() const +Poco::Timespan SMTPClientSession::getTimeout() const { return _socket.getReceiveTimeout(); } @@ -160,4 +161,4 @@ int SMTPClientSession::sendCommand(const std::string& command, const std::string } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/ServerSocket.cpp b/Net/src/ServerSocket.cpp index be8ed1757..52c978bc9 100644 --- a/Net/src/ServerSocket.cpp +++ b/Net/src/ServerSocket.cpp @@ -1,7 +1,7 @@ // // ServerSocket.cpp // -// $Id: //poco/1.1.0/Net/src/ServerSocket.cpp#2 $ +// $Id: //poco/1.2/Net/src/ServerSocket.cpp#1 $ // // Library: Net // Package: Sockets @@ -34,15 +34,16 @@ // -#include "Net/ServerSocket.h" -#include "Net/ServerSocketImpl.h" -#include "Foundation/Exception.h" +#include "Poco/Net/ServerSocket.h" +#include "Poco/Net/ServerSocketImpl.h" +#include "Poco/Exception.h" -using Foundation::InvalidArgumentException; +using Poco::InvalidArgumentException; -Net_BEGIN +namespace Poco { +namespace Net { ServerSocket::ServerSocket(): Socket(new ServerSocketImpl) @@ -64,7 +65,7 @@ ServerSocket::ServerSocket(const SocketAddress& address, int backlog): Socket(ne } -ServerSocket::ServerSocket(Foundation::UInt16 port, int backlog): Socket(new ServerSocketImpl) +ServerSocket::ServerSocket(Poco::UInt16 port, int backlog): Socket(new ServerSocketImpl) { IPAddress wildcardAddr; SocketAddress address(wildcardAddr, port); @@ -99,7 +100,7 @@ void ServerSocket::bind(const SocketAddress& address, bool reuseAddress) } -void ServerSocket::bind(Foundation::UInt16 port, bool reuseAddress) +void ServerSocket::bind(Poco::UInt16 port, bool reuseAddress) { IPAddress wildcardAddr; SocketAddress address(wildcardAddr, port); @@ -126,4 +127,4 @@ StreamSocket ServerSocket::acceptConnection() } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/ServerSocketImpl.cpp b/Net/src/ServerSocketImpl.cpp index e5af64d78..d0eebae96 100644 --- a/Net/src/ServerSocketImpl.cpp +++ b/Net/src/ServerSocketImpl.cpp @@ -1,7 +1,7 @@ // // ServerSocketImpl.cpp // -// $Id: //poco/1.1.0/Net/src/ServerSocketImpl.cpp#2 $ +// $Id: //poco/1.2/Net/src/ServerSocketImpl.cpp#1 $ // // Library: Net // Package: Sockets @@ -34,10 +34,11 @@ // -#include "Net/ServerSocketImpl.h" +#include "Poco/Net/ServerSocketImpl.h" -Net_BEGIN +namespace Poco { +namespace Net { ServerSocketImpl::ServerSocketImpl() @@ -50,4 +51,4 @@ ServerSocketImpl::~ServerSocketImpl() } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/Socket.cpp b/Net/src/Socket.cpp index d066f397d..7a931c1cd 100644 --- a/Net/src/Socket.cpp +++ b/Net/src/Socket.cpp @@ -1,7 +1,7 @@ // // Socket.cpp // -// $Id: //poco/1.1.0/Net/src/Socket.cpp#2 $ +// $Id: //poco/1.2/Net/src/Socket.cpp#1 $ // // Library: Net // Package: Sockets @@ -34,13 +34,14 @@ // -#include "Net/Socket.h" -#include "Net/StreamSocketImpl.h" +#include "Poco/Net/Socket.h" +#include "Poco/Net/StreamSocketImpl.h" #include #include -Net_BEGIN +namespace Poco { +namespace Net { Socket::Socket(): @@ -83,7 +84,7 @@ Socket::~Socket() } -int Socket::select(SocketList& readList, SocketList& writeList, SocketList& exceptList, const Foundation::Timespan& timeout) +int Socket::select(SocketList& readList, SocketList& writeList, SocketList& exceptList, const Poco::Timespan& timeout) { fd_set fdRead; fd_set fdWrite; @@ -141,4 +142,4 @@ int Socket::select(SocketList& readList, SocketList& writeList, SocketList& exce } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/SocketAddress.cpp b/Net/src/SocketAddress.cpp index ee30f80fe..4dca57e0e 100644 --- a/Net/src/SocketAddress.cpp +++ b/Net/src/SocketAddress.cpp @@ -1,7 +1,7 @@ // // SocketAddress.cpp // -// $Id: //poco/1.1.0/Net/src/SocketAddress.cpp#2 $ +// $Id: //poco/1.2/Net/src/SocketAddress.cpp#1 $ // // Library: Net // Package: NetCore @@ -34,24 +34,26 @@ // -#include "Net/SocketAddress.h" -#include "Net/IPAddress.h" -#include "Net/NetException.h" -#include "Net/DNS.h" -#include "Foundation/RefCountedObject.h" -#include "Foundation/NumberParser.h" -#include "Foundation/NumberFormatter.h" +#include "Poco/Net/SocketAddress.h" +#include "Poco/Net/IPAddress.h" +#include "Poco/Net/NetException.h" +#include "Poco/Net/DNS.h" +#include "Poco/RefCountedObject.h" +#include "Poco/NumberParser.h" +#include "Poco/NumberFormatter.h" #include #include -using Foundation::RefCountedObject; -using Foundation::NumberParser; -using Foundation::NumberFormatter; -using Foundation::UInt16; +using Poco::RefCountedObject; +using Poco::NumberParser; +using Poco::NumberFormatter; +using Poco::UInt16; +using Poco::InvalidArgumentException; -Net_BEGIN +namespace Poco { +namespace Net { // @@ -200,13 +202,13 @@ SocketAddress::SocketAddress() } -SocketAddress::SocketAddress(const IPAddress& addr, Foundation::UInt16 port) +SocketAddress::SocketAddress(const IPAddress& addr, Poco::UInt16 port) { init(addr, port); } -SocketAddress::SocketAddress(const std::string& addr, Foundation::UInt16 port) +SocketAddress::SocketAddress(const std::string& addr, Poco::UInt16 port) { init(addr, port); } @@ -218,6 +220,35 @@ SocketAddress::SocketAddress(const std::string& addr, const std::string& port) } +SocketAddress::SocketAddress(const std::string& hostAndPort) +{ + poco_assert (!hostAndPort.empty()); + + std::string host; + std::string port; + std::string::const_iterator it = hostAndPort.begin(); + std::string::const_iterator end = hostAndPort.end(); + if (*it == '[') + { + ++it; + while (it != end && *it != ']') host += *it++; + if (it == end) throw InvalidArgumentException("Malformed IPv6 address"); + ++it; + } + else + { + while (it != end && *it != ':') host += *it++; + } + if (it != end && *it == ':') + { + ++it; + while (it != end) port += *it++; + } + else throw InvalidArgumentException("Missing port number"); + init(host, resolveService(port)); +} + + SocketAddress::SocketAddress(const SocketAddress& addr) { _pImpl = addr._pImpl; @@ -233,7 +264,7 @@ SocketAddress::SocketAddress(const struct sockaddr* addr, poco_socklen_t length) else if (length == sizeof(struct sockaddr_in6)) _pImpl = new IPv6SocketAddressImpl(reinterpret_cast(addr)); #endif - else throw Foundation::InvalidArgumentException("Invalid address length passed to SocketAddress()"); + else throw Poco::InvalidArgumentException("Invalid address length passed to SocketAddress()"); } @@ -267,7 +298,7 @@ IPAddress SocketAddress::host() const } -Foundation::UInt16 SocketAddress::port() const +Poco::UInt16 SocketAddress::port() const { return ntohs(_pImpl->port()); } @@ -293,14 +324,19 @@ int SocketAddress::af() const std::string SocketAddress::toString() const { - std::string result = host().toString(); + std::string result; + if (host().family() == IPAddress::IPv6) + result.append("["); + result.append(host().toString()); + if (host().family() == IPAddress::IPv6) + result.append("]"); result.append(":"); result.append(NumberFormatter::format(port())); return result; } -void SocketAddress::init(const IPAddress& host, Foundation::UInt16 port) +void SocketAddress::init(const IPAddress& host, Poco::UInt16 port) { if (host.family() == IPAddress::IPv4) _pImpl = new IPv4SocketAddressImpl(host.addr(), htons(port)); @@ -308,11 +344,11 @@ void SocketAddress::init(const IPAddress& host, Foundation::UInt16 port) else if (host.family() == IPAddress::IPv6) _pImpl = new IPv6SocketAddressImpl(host.addr(), htons(port)); #endif - else throw Foundation::NotImplementedException("unsupported IP address family"); + else throw Poco::NotImplementedException("unsupported IP address family"); } -void SocketAddress::init(const std::string& host, Foundation::UInt16 port) +void SocketAddress::init(const std::string& host, Poco::UInt16 port) { IPAddress ip; if (IPAddress::tryParse(host, ip)) @@ -329,7 +365,7 @@ void SocketAddress::init(const std::string& host, Foundation::UInt16 port) } -Foundation::UInt16 SocketAddress::resolveService(const std::string& service) +Poco::UInt16 SocketAddress::resolveService(const std::string& service) { unsigned port; if (NumberParser::tryParseUnsigned(service, port) && port <= 0xFFFF) @@ -347,4 +383,4 @@ Foundation::UInt16 SocketAddress::resolveService(const std::string& service) } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/SocketImpl.cpp b/Net/src/SocketImpl.cpp index b64c156d3..38b164302 100644 --- a/Net/src/SocketImpl.cpp +++ b/Net/src/SocketImpl.cpp @@ -1,7 +1,7 @@ // // SocketImpl.cpp // -// $Id: //poco/1.1.0/Net/src/SocketImpl.cpp#2 $ +// $Id: //poco/1.2/Net/src/SocketImpl.cpp#1 $ // // Library: Net // Package: Sockets @@ -34,21 +34,22 @@ // -#include "Net/SocketImpl.h" -#include "Net/NetException.h" -#include "Net/StreamSocketImpl.h" -#include "Foundation/NumberFormatter.h" +#include "Poco/Net/SocketImpl.h" +#include "Poco/Net/NetException.h" +#include "Poco/Net/StreamSocketImpl.h" +#include "Poco/NumberFormatter.h" #include -using Foundation::IOException; -using Foundation::TimeoutException; -using Foundation::InvalidArgumentException; -using Foundation::NumberFormatter; -using Foundation::Timespan; +using Poco::IOException; +using Poco::TimeoutException; +using Poco::InvalidArgumentException; +using Poco::NumberFormatter; +using Poco::Timespan; -Net_BEGIN +namespace Poco { +namespace Net { SocketImpl::SocketImpl(): @@ -108,7 +109,7 @@ void SocketImpl::connect(const SocketAddress& address) } -void SocketImpl::connect(const SocketAddress& address, const Foundation::Timespan& timeout) +void SocketImpl::connect(const SocketAddress& address, const Poco::Timespan& timeout) { poco_assert (_sockfd == POCO_INVALID_SOCKET); @@ -122,12 +123,12 @@ void SocketImpl::connect(const SocketAddress& address, const Foundation::Timespa if (lastError() != POCO_EINPROGRESS && lastError() != POCO_EWOULDBLOCK) error(address.toString()); if (!poll(timeout, SELECT_READ | SELECT_WRITE)) - throw Foundation::TimeoutException("connect timed out", address.toString()); + throw Poco::TimeoutException("connect timed out", address.toString()); int err = socketError(); if (err != 0) error(err); } } - catch (Foundation::Exception&) + catch (Poco::Exception&) { setBlocking(true); throw; @@ -324,7 +325,7 @@ int SocketImpl::available() } -bool SocketImpl::poll(const Foundation::Timespan& timeout, int mode) +bool SocketImpl::poll(const Poco::Timespan& timeout, int mode) { fd_set fdRead; fd_set fdWrite; @@ -381,7 +382,7 @@ int SocketImpl::getReceiveBufferSize() } -void SocketImpl::setSendTimeout(const Foundation::Timespan& timeout) +void SocketImpl::setSendTimeout(const Poco::Timespan& timeout) { #if defined(_WIN32) int value = (int) timeout.totalMilliseconds(); @@ -392,7 +393,7 @@ void SocketImpl::setSendTimeout(const Foundation::Timespan& timeout) } -Foundation::Timespan SocketImpl::getSendTimeout() +Poco::Timespan SocketImpl::getSendTimeout() { Timespan result; #if defined(_WIN32) @@ -406,7 +407,7 @@ Foundation::Timespan SocketImpl::getSendTimeout() } -void SocketImpl::setReceiveTimeout(const Foundation::Timespan& timeout) +void SocketImpl::setReceiveTimeout(const Poco::Timespan& timeout) { #if defined(_WIN32) int value = (int) timeout.totalMilliseconds(); @@ -420,7 +421,7 @@ void SocketImpl::setReceiveTimeout(const Foundation::Timespan& timeout) } -Foundation::Timespan SocketImpl::getReceiveTimeout() +Poco::Timespan SocketImpl::getReceiveTimeout() { Timespan result; #if defined(_WIN32) @@ -492,7 +493,7 @@ void SocketImpl::setOption(int level, int option, const IPAddress& value) } -void SocketImpl::setOption(int level, int option, const Foundation::Timespan& value) +void SocketImpl::setOption(int level, int option, const Poco::Timespan& value) { struct timeval tv; tv.tv_sec = (long) value.totalSeconds(); @@ -532,7 +533,7 @@ void SocketImpl::getOption(int level, int option, unsigned char& value) } -void SocketImpl::getOption(int level, int option, Foundation::Timespan& value) +void SocketImpl::getOption(int level, int option, Poco::Timespan& value) { struct timeval tv; poco_socklen_t len = sizeof(tv); @@ -640,6 +641,7 @@ void SocketImpl::setReusePort(bool flag) #endif } + bool SocketImpl::getReusePort() { #ifdef SO_REUSEPORT @@ -842,4 +844,4 @@ void SocketImpl::error(int code, const std::string& arg) } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/SocketNotification.cpp b/Net/src/SocketNotification.cpp index 1c65ca9da..b1f93ad26 100644 --- a/Net/src/SocketNotification.cpp +++ b/Net/src/SocketNotification.cpp @@ -1,7 +1,7 @@ // // SocketNotification.cpp // -// $Id: //poco/1.1.0/Net/src/SocketNotification.cpp#2 $ +// $Id: //poco/1.2/Net/src/SocketNotification.cpp#1 $ // // Library: Net // Package: Reactor @@ -34,10 +34,11 @@ // -#include "Net/SocketNotification.h" +#include "Poco/Net/SocketNotification.h" -Net_BEGIN +namespace Poco { +namespace Net { SocketNotification::SocketNotification(SocketReactor* pReactor): @@ -112,4 +113,4 @@ ShutdownNotification::~ShutdownNotification() } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/SocketNotifier.cpp b/Net/src/SocketNotifier.cpp index 84aabd652..a95c54988 100644 --- a/Net/src/SocketNotifier.cpp +++ b/Net/src/SocketNotifier.cpp @@ -1,7 +1,7 @@ // // SocketNotifier.cpp // -// $Id: //poco/1.1.0/Net/src/SocketNotifier.cpp#2 $ +// $Id: //poco/1.2/Net/src/SocketNotifier.cpp#1 $ // // Library: Net // Package: Reactor @@ -34,12 +34,13 @@ // -#include "Net/SocketNotifier.h" -#include "Net/SocketReactor.h" -#include "Net/SocketNotification.h" +#include "Poco/Net/SocketNotifier.h" +#include "Poco/Net/SocketReactor.h" +#include "Poco/Net/SocketNotification.h" -Net_BEGIN +namespace Poco { +namespace Net { SocketNotifier::SocketNotifier(const Socket& socket): @@ -53,7 +54,7 @@ SocketNotifier::~SocketNotifier() } -void SocketNotifier::addObserver(SocketReactor* pReactor, const Foundation::AbstractObserver& observer) +void SocketNotifier::addObserver(SocketReactor* pReactor, const Poco::AbstractObserver& observer) { _nc.addObserver(observer); if (observer.accepts(pReactor->_pReadableNotification)) @@ -67,7 +68,7 @@ void SocketNotifier::addObserver(SocketReactor* pReactor, const Foundation::Abst } -void SocketNotifier::removeObserver(SocketReactor* pReactor, const Foundation::AbstractObserver& observer) +void SocketNotifier::removeObserver(SocketReactor* pReactor, const Poco::AbstractObserver& observer) { _nc.removeObserver(observer); EventSet::iterator it = _events.end(); @@ -92,4 +93,4 @@ void SocketNotifier::dispatch(SocketNotification* pNotification) } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/SocketReactor.cpp b/Net/src/SocketReactor.cpp index 764219868..45d3c6293 100644 --- a/Net/src/SocketReactor.cpp +++ b/Net/src/SocketReactor.cpp @@ -1,7 +1,7 @@ // // SocketReactor.cpp // -// $Id: //poco/1.1.0/Net/src/SocketReactor.cpp#2 $ +// $Id: //poco/1.2/Net/src/SocketReactor.cpp#1 $ // // Library: Net // Package: Reactor @@ -34,19 +34,20 @@ // -#include "Net/SocketReactor.h" -#include "Net/SocketNotification.h" -#include "Net/SocketNotifier.h" -#include "Foundation/ErrorHandler.h" -#include "Foundation/Exception.h" +#include "Poco/Net/SocketReactor.h" +#include "Poco/Net/SocketNotification.h" +#include "Poco/Net/SocketNotifier.h" +#include "Poco/ErrorHandler.h" +#include "Poco/Exception.h" -using Foundation::FastMutex; -using Foundation::Exception; -using Foundation::ErrorHandler; +using Poco::FastMutex; +using Poco::Exception; +using Poco::ErrorHandler; -Net_BEGIN +namespace Poco { +namespace Net { SocketReactor::SocketReactor(): @@ -61,7 +62,7 @@ SocketReactor::SocketReactor(): } -SocketReactor::SocketReactor(const Foundation::Timespan& timeout): +SocketReactor::SocketReactor(const Poco::Timespan& timeout): _stop(false), _timeout(timeout), _pReadableNotification(new ReadableNotification(this)), @@ -122,19 +123,19 @@ void SocketReactor::stop() } -void SocketReactor::setTimeout(const Foundation::Timespan& timeout) +void SocketReactor::setTimeout(const Poco::Timespan& timeout) { _timeout = timeout; } -const Foundation::Timespan& SocketReactor::getTimeout() const +const Poco::Timespan& SocketReactor::getTimeout() const { return _timeout; } -void SocketReactor::addEventHandler(const Socket& socket, const Foundation::AbstractObserver& observer) +void SocketReactor::addEventHandler(const Socket& socket, const Poco::AbstractObserver& observer) { FastMutex::ScopedLock lock(_mutex); @@ -150,7 +151,7 @@ void SocketReactor::addEventHandler(const Socket& socket, const Foundation::Abst } -void SocketReactor::removeEventHandler(const Socket& socket, const Foundation::AbstractObserver& observer) +void SocketReactor::removeEventHandler(const Socket& socket, const Poco::AbstractObserver& observer) { FastMutex::ScopedLock lock(_mutex); @@ -229,4 +230,4 @@ void SocketReactor::dispatch(NotifierPtr& pNotifier, SocketNotification* pNotifi } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/SocketStream.cpp b/Net/src/SocketStream.cpp index 2c2ed9db7..5063f41ac 100644 --- a/Net/src/SocketStream.cpp +++ b/Net/src/SocketStream.cpp @@ -1,7 +1,7 @@ // // SocketStream.cpp // -// $Id: //poco/1.1.0/Net/src/SocketStream.cpp#2 $ +// $Id: //poco/1.2/Net/src/SocketStream.cpp#1 $ // // Library: Net // Package: Sockets @@ -34,16 +34,17 @@ // -#include "Net/SocketStream.h" -#include "Net/StreamSocketImpl.h" -#include "Foundation/Exception.h" +#include "Poco/Net/SocketStream.h" +#include "Poco/Net/StreamSocketImpl.h" +#include "Poco/Exception.h" -using Foundation::BufferedBidirectionalStreamBuf; -using Foundation::InvalidArgumentException; +using Poco::BufferedBidirectionalStreamBuf; +using Poco::InvalidArgumentException; -Net_BEGIN +namespace Poco { +namespace Net { // @@ -174,4 +175,4 @@ SocketStream::~SocketStream() } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/StreamSocket.cpp b/Net/src/StreamSocket.cpp index d0748f354..07114a54d 100644 --- a/Net/src/StreamSocket.cpp +++ b/Net/src/StreamSocket.cpp @@ -1,7 +1,7 @@ // // StreamSocket.cpp // -// $Id: //poco/1.1.0/Net/src/StreamSocket.cpp#2 $ +// $Id: //poco/1.2/Net/src/StreamSocket.cpp#1 $ // // Library: Net // Package: Sockets @@ -34,15 +34,16 @@ // -#include "Net/StreamSocket.h" -#include "Net/StreamSocketImpl.h" -#include "Foundation/Exception.h" +#include "Poco/Net/StreamSocket.h" +#include "Poco/Net/StreamSocketImpl.h" +#include "Poco/Exception.h" -using Foundation::InvalidArgumentException; +using Poco::InvalidArgumentException; -Net_BEGIN +namespace Poco { +namespace Net { StreamSocket::StreamSocket(): Socket(new StreamSocketImpl) @@ -91,7 +92,7 @@ void StreamSocket::connect(const SocketAddress& address) } -void StreamSocket::connect(const SocketAddress& address, const Foundation::Timespan& timeout) +void StreamSocket::connect(const SocketAddress& address, const Poco::Timespan& timeout) { impl()->connect(address, timeout); } @@ -139,4 +140,4 @@ void StreamSocket::sendUrgent(unsigned char data) } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/StreamSocketImpl.cpp b/Net/src/StreamSocketImpl.cpp index dd6aa88b2..19f1ccb3f 100644 --- a/Net/src/StreamSocketImpl.cpp +++ b/Net/src/StreamSocketImpl.cpp @@ -1,7 +1,7 @@ // // StreamSocketImpl.cpp // -// $Id: //poco/1.1.0/Net/src/StreamSocketImpl.cpp#2 $ +// $Id: //poco/1.2/Net/src/StreamSocketImpl.cpp#1 $ // // Library: Net // Package: Sockets @@ -34,10 +34,11 @@ // -#include "Net/StreamSocketImpl.h" +#include "Poco/Net/StreamSocketImpl.h" -Net_BEGIN +namespace Poco { +namespace Net { StreamSocketImpl::StreamSocketImpl() @@ -69,4 +70,4 @@ int StreamSocketImpl::sendBytes(const void* buffer, int length, int flags) } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/StringPartSource.cpp b/Net/src/StringPartSource.cpp index 01b4771ea..f07b09259 100644 --- a/Net/src/StringPartSource.cpp +++ b/Net/src/StringPartSource.cpp @@ -1,7 +1,7 @@ // // StringPartSource.cpp // -// $Id: //poco/1.1.0/Net/src/StringPartSource.cpp#2 $ +// $Id: //poco/1.2/Net/src/StringPartSource.cpp#1 $ // // Library: Net // Package: Messages @@ -34,10 +34,11 @@ // -#include "Net/StringPartSource.h" +#include "Poco/Net/StringPartSource.h" -Net_BEGIN +namespace Poco { +namespace Net { StringPartSource::StringPartSource(const std::string& str): @@ -79,4 +80,4 @@ const std::string& StringPartSource::filename() } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/TCPServer.cpp b/Net/src/TCPServer.cpp index 3b9a2a4b9..bb972f03b 100644 --- a/Net/src/TCPServer.cpp +++ b/Net/src/TCPServer.cpp @@ -1,7 +1,7 @@ // // TCPServer.cpp // -// $Id: //poco/1.1.0/Net/src/TCPServer.cpp#3 $ +// $Id: //poco/1.2/Net/src/TCPServer.cpp#1 $ // // Library: Net // Package: TCPServer @@ -34,33 +34,34 @@ // -#include "Net/TCPServer.h" -#include "Net/TCPServerDispatcher.h" -#include "Net/TCPServerConnection.h" -#include "Net/TCPServerConnectionFactory.h" -#include "Foundation/Timespan.h" -#include "Foundation/Exception.h" -#include "Foundation/ErrorHandler.h" +#include "Poco/Net/TCPServer.h" +#include "Poco/Net/TCPServerDispatcher.h" +#include "Poco/Net/TCPServerConnection.h" +#include "Poco/Net/TCPServerConnectionFactory.h" +#include "Poco/Timespan.h" +#include "Poco/Exception.h" +#include "Poco/ErrorHandler.h" -using Foundation::ErrorHandler; +using Poco::ErrorHandler; -Net_BEGIN +namespace Poco { +namespace Net { TCPServer::TCPServer(TCPServerConnectionFactory* pFactory, const ServerSocket& socket, TCPServerParams* pParams): - _pDispatcher(new TCPServerDispatcher(pFactory, Foundation::ThreadPool::defaultPool(), pParams)), _socket(socket), + _pDispatcher(new TCPServerDispatcher(pFactory, Poco::ThreadPool::defaultPool(), pParams)), _thread(threadName(socket)), _stopped(false) { } -TCPServer::TCPServer(TCPServerConnectionFactory* pFactory, Foundation::ThreadPool& threadPool, const ServerSocket& socket, TCPServerParams* pParams): - _pDispatcher(new TCPServerDispatcher(pFactory, threadPool, pParams)), +TCPServer::TCPServer(TCPServerConnectionFactory* pFactory, Poco::ThreadPool& threadPool, const ServerSocket& socket, TCPServerParams* pParams): _socket(socket), + _pDispatcher(new TCPServerDispatcher(pFactory, threadPool, pParams)), _thread(threadName(socket)), _stopped(false) { @@ -103,7 +104,7 @@ void TCPServer::run() { while (!_stopped) { - Foundation::Timespan timeout(250000); + Poco::Timespan timeout(250000); if (_socket.poll(timeout, Socket::SELECT_READ)) { try @@ -111,7 +112,7 @@ void TCPServer::run() StreamSocket ss = _socket.acceptConnection(); _pDispatcher->enqueue(ss); } - catch (Foundation::Exception& exc) + catch (Poco::Exception& exc) { ErrorHandler::handle(exc); } @@ -172,4 +173,4 @@ std::string TCPServer::threadName(const ServerSocket& socket) } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/TCPServerConnection.cpp b/Net/src/TCPServerConnection.cpp index e37c29e3f..8093a6287 100644 --- a/Net/src/TCPServerConnection.cpp +++ b/Net/src/TCPServerConnection.cpp @@ -1,7 +1,7 @@ // // TCPServerConnection.cpp // -// $Id: //poco/1.1.0/Net/src/TCPServerConnection.cpp#2 $ +// $Id: //poco/1.2/Net/src/TCPServerConnection.cpp#1 $ // // Library: Net // Package: TCPServer @@ -34,16 +34,17 @@ // -#include "Net/TCPServerConnection.h" -#include "Foundation/Exception.h" -#include "Foundation/ErrorHandler.h" +#include "Poco/Net/TCPServerConnection.h" +#include "Poco/Exception.h" +#include "Poco/ErrorHandler.h" -using Foundation::Exception; -using Foundation::ErrorHandler; +using Poco::Exception; +using Poco::ErrorHandler; -Net_BEGIN +namespace Poco { +namespace Net { TCPServerConnection::TCPServerConnection(const StreamSocket& socket): @@ -78,4 +79,4 @@ void TCPServerConnection::start() } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/TCPServerConnectionFactory.cpp b/Net/src/TCPServerConnectionFactory.cpp index bedcc1715..92f09a56c 100644 --- a/Net/src/TCPServerConnectionFactory.cpp +++ b/Net/src/TCPServerConnectionFactory.cpp @@ -1,7 +1,7 @@ // // TCPServerConnectionFactory.cpp // -// $Id: //poco/1.1.0/Net/src/TCPServerConnectionFactory.cpp#2 $ +// $Id: //poco/1.2/Net/src/TCPServerConnectionFactory.cpp#1 $ // // Library: Net // Package: TCPServer @@ -34,10 +34,11 @@ // -#include "Net/TCPServerConnectionFactory.h" +#include "Poco/Net/TCPServerConnectionFactory.h" -Net_BEGIN +namespace Poco { +namespace Net { TCPServerConnectionFactory::TCPServerConnectionFactory() @@ -50,4 +51,4 @@ TCPServerConnectionFactory::~TCPServerConnectionFactory() } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/TCPServerDispatcher.cpp b/Net/src/TCPServerDispatcher.cpp index ddb89e88a..70407a5de 100644 --- a/Net/src/TCPServerDispatcher.cpp +++ b/Net/src/TCPServerDispatcher.cpp @@ -1,7 +1,7 @@ // // TCPServerDispatcher.cpp // -// $Id: //poco/1.1.0/Net/src/TCPServerDispatcher.cpp#2 $ +// $Id: //poco/1.2/Net/src/TCPServerDispatcher.cpp#1 $ // // Library: Net // Package: TCPServer @@ -34,20 +34,21 @@ // -#include "Net/TCPServerDispatcher.h" -#include "Net/TCPServerConnectionFactory.h" -#include "Net/TCPServerParams.h" -#include "Foundation/Notification.h" -#include "Foundation/AutoPtr.h" +#include "Poco/Net/TCPServerDispatcher.h" +#include "Poco/Net/TCPServerConnectionFactory.h" +#include "Poco/Net/TCPServerParams.h" +#include "Poco/Notification.h" +#include "Poco/AutoPtr.h" #include -using Foundation::Notification; -using Foundation::FastMutex; -using Foundation::AutoPtr; +using Poco::Notification; +using Poco::FastMutex; +using Poco::AutoPtr; -Net_BEGIN +namespace Poco { +namespace Net { class TCPConnectionNotification: public Notification @@ -72,7 +73,7 @@ private: }; -TCPServerDispatcher::TCPServerDispatcher(TCPServerConnectionFactory* pFactory, Foundation::ThreadPool& threadPool, TCPServerParams* pParams): +TCPServerDispatcher::TCPServerDispatcher(TCPServerConnectionFactory* pFactory, Poco::ThreadPool& threadPool, TCPServerParams* pParams): _rc(1), _pParams(pParams), _currentThreads(0), @@ -165,7 +166,7 @@ void TCPServerDispatcher::enqueue(const StreamSocket& socket) _threadPool.start(*this, threadName); ++_currentThreads; } - catch (Foundation::Exception&) + catch (Poco::Exception&) { // no problem here, connection is already queued // and a new thread might be available later. @@ -252,4 +253,4 @@ void TCPServerDispatcher::endConnection() } -Net_END +} } // namespace Poco::Net diff --git a/Net/src/TCPServerParams.cpp b/Net/src/TCPServerParams.cpp index 281e46007..550d8f778 100644 --- a/Net/src/TCPServerParams.cpp +++ b/Net/src/TCPServerParams.cpp @@ -1,7 +1,7 @@ // // TCPServerParams.cpp // -// $Id: //poco/1.1.0/Net/src/TCPServerParams.cpp#2 $ +// $Id: //poco/1.2/Net/src/TCPServerParams.cpp#1 $ // // Library: Net // Package: TCPServer @@ -34,10 +34,11 @@ // -#include "Net/TCPServerParams.h" +#include "Poco/Net/TCPServerParams.h" -Net_BEGIN +namespace Poco { +namespace Net { TCPServerParams::TCPServerParams(): @@ -53,7 +54,7 @@ TCPServerParams::~TCPServerParams() } -void TCPServerParams::setThreadIdleTime(const Foundation::Timespan& milliseconds) +void TCPServerParams::setThreadIdleTime(const Poco::Timespan& milliseconds) { _threadIdleTime = milliseconds; } @@ -77,4 +78,4 @@ void TCPServerParams::setMaxQueued(int count) -Net_END +} } // namespace Poco::Net diff --git a/Net/testsuite/Makefile b/Net/testsuite/Makefile index fb73cfaf0..ec1075a65 100644 --- a/Net/testsuite/Makefile +++ b/Net/testsuite/Makefile @@ -1,7 +1,7 @@ # # Makefile # -# $Id: //poco/1.1.0/Net/testsuite/Makefile#1 $ +# $Id: //poco/1.2/Net/testsuite/Makefile#1 $ # # Makefile for Poco Net testsuite # @@ -23,7 +23,8 @@ objects = \ FTPStreamFactoryTest DialogServer \ SocketReactorTest ReactorTestSuite \ MailTestSuite MailMessageTest MailStreamTest \ - SMTPClientSessionTest POP3ClientSessionTest + SMTPClientSessionTest POP3ClientSessionTest \ + RawSocketTest ICMPClientTest ICMPSocketTest ICMPClientTestSuite target = testrunner target_version = 1 diff --git a/Net/testsuite/TestSuite.vmsbuild b/Net/testsuite/TestSuite.vmsbuild index 3b9bb32d1..64b415679 100644 --- a/Net/testsuite/TestSuite.vmsbuild +++ b/Net/testsuite/TestSuite.vmsbuild @@ -1,7 +1,7 @@ # # TestSuite.vmsbuild # -# $Id: //poco/1.1.0/Net/testsuite/TestSuite.vmsbuild#1 $ +# $Id: //poco/1.2/Net/testsuite/TestSuite.vmsbuild#1 $ # EXE=TestRunner NetTestSuite diff --git a/Net/testsuite/TestSuite_vs71.vcproj b/Net/testsuite/TestSuite_vs71.vcproj index e8694eb0e..998434d80 100644 --- a/Net/testsuite/TestSuite_vs71.vcproj +++ b/Net/testsuite/TestSuite_vs71.vcproj @@ -224,6 +224,9 @@ + + @@ -261,6 +264,9 @@ + + @@ -575,6 +581,36 @@
+ + + + + + + + + + + + + + + + + + diff --git a/Net/testsuite/TestSuite_vs80.vcproj b/Net/testsuite/TestSuite_vs80.vcproj index b40abbaf3..9133ae711 100644 --- a/Net/testsuite/TestSuite_vs80.vcproj +++ b/Net/testsuite/TestSuite_vs80.vcproj @@ -305,6 +305,10 @@ RelativePath=".\src\NetworkInterfaceTest.h" > + + @@ -353,6 +357,10 @@ RelativePath=".\src\NetworkInterfaceTest.cpp" > + + @@ -735,6 +743,42 @@ + + + + + + + + + + + + + + + + + + diff --git a/Net/testsuite/src/DNSTest.cpp b/Net/testsuite/src/DNSTest.cpp index 66019ef33..0769033d4 100644 --- a/Net/testsuite/src/DNSTest.cpp +++ b/Net/testsuite/src/DNSTest.cpp @@ -1,7 +1,7 @@ // // DNSTest.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/DNSTest.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/DNSTest.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,18 +33,18 @@ #include "DNSTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Net/DNS.h" -#include "Net/HostEntry.h" -#include "Net/NetException.h" +#include "Poco/Net/DNS.h" +#include "Poco/Net/HostEntry.h" +#include "Poco/Net/NetException.h" -using Net::DNS; -using Net::IPAddress; -using Net::HostEntry; -using Net::InvalidAddressException; -using Net::HostNotFoundException; -using Net::ServiceNotFoundException; -using Net::NoAddressFoundException; +using Poco::Net::DNS; +using Poco::Net::IPAddress; +using Poco::Net::HostEntry; +using Poco::Net::InvalidAddressException; +using Poco::Net::HostNotFoundException; +using Poco::Net::ServiceNotFoundException; +using Poco::Net::NoAddressFoundException; DNSTest::DNSTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Net/testsuite/src/DNSTest.h b/Net/testsuite/src/DNSTest.h index 9a68c4a2a..4f14e039c 100644 --- a/Net/testsuite/src/DNSTest.h +++ b/Net/testsuite/src/DNSTest.h @@ -1,7 +1,7 @@ // // DNSTest.h // -// $Id: //poco/1.1.0/Net/testsuite/src/DNSTest.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/DNSTest.h#1 $ // // Definition of the DNSTest class. // @@ -36,12 +36,8 @@ #define DNSTest_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Net/Net.h" #include "CppUnit/TestCase.h" -#endif class DNSTest: public CppUnit::TestCase diff --git a/Net/testsuite/src/DatagramSocketTest.cpp b/Net/testsuite/src/DatagramSocketTest.cpp index fbc400aa9..6ea8c1888 100644 --- a/Net/testsuite/src/DatagramSocketTest.cpp +++ b/Net/testsuite/src/DatagramSocketTest.cpp @@ -1,7 +1,7 @@ // // DatagramSocketTest.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/DatagramSocketTest.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/DatagramSocketTest.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -34,22 +34,22 @@ #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" #include "UDPEchoServer.h" -#include "Net/DatagramSocket.h" -#include "Net/SocketAddress.h" -#include "Net/NetException.h" -#include "Foundation/Timespan.h" -#include "Foundation/Stopwatch.h" +#include "Poco/Net/DatagramSocket.h" +#include "Poco/Net/SocketAddress.h" +#include "Poco/Net/NetException.h" +#include "Poco/Timespan.h" +#include "Poco/Stopwatch.h" -using Net::Socket; -using Net::DatagramSocket; -using Net::SocketAddress; -using Net::IPAddress; -using Foundation::Timespan; -using Foundation::Stopwatch; -using Foundation::TimeoutException; -using Foundation::InvalidArgumentException; -using Foundation::IOException; +using Poco::Net::Socket; +using Poco::Net::DatagramSocket; +using Poco::Net::SocketAddress; +using Poco::Net::IPAddress; +using Poco::Timespan; +using Poco::Stopwatch; +using Poco::TimeoutException; +using Poco::InvalidArgumentException; +using Poco::IOException; DatagramSocketTest::DatagramSocketTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Net/testsuite/src/DatagramSocketTest.h b/Net/testsuite/src/DatagramSocketTest.h index ccf78e4ff..46f82dbd4 100644 --- a/Net/testsuite/src/DatagramSocketTest.h +++ b/Net/testsuite/src/DatagramSocketTest.h @@ -1,7 +1,7 @@ // // DatagramSocketTest.h // -// $Id: //poco/1.1.0/Net/testsuite/src/DatagramSocketTest.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/DatagramSocketTest.h#1 $ // // Definition of the DatagramSocketTest class. // @@ -36,12 +36,8 @@ #define DatagramSocketTest_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Net/Net.h" #include "CppUnit/TestCase.h" -#endif class DatagramSocketTest: public CppUnit::TestCase diff --git a/Net/testsuite/src/DialogServer.cpp b/Net/testsuite/src/DialogServer.cpp index a1456cff8..56c669cf1 100644 --- a/Net/testsuite/src/DialogServer.cpp +++ b/Net/testsuite/src/DialogServer.cpp @@ -1,7 +1,7 @@ // // DialogServer.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/DialogServer.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/DialogServer.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -31,17 +31,17 @@ #include "DialogServer.h" -#include "Net/DialogSocket.h" -#include "Net/SocketAddress.h" -#include "Foundation/Timespan.h" +#include "Poco/Net/DialogSocket.h" +#include "Poco/Net/SocketAddress.h" +#include "Poco/Timespan.h" #include -using Net::Socket; -using Net::DialogSocket; -using Net::SocketAddress; -using Foundation::FastMutex; -using Foundation::Thread; +using Poco::Net::Socket; +using Poco::Net::DialogSocket; +using Poco::Net::SocketAddress; +using Poco::FastMutex; +using Poco::Thread; DialogServer::DialogServer(bool acceptCommands): @@ -63,7 +63,7 @@ DialogServer::~DialogServer() } -Foundation::UInt16 DialogServer::port() const +Poco::UInt16 DialogServer::port() const { return _socket.address().port(); } @@ -72,7 +72,7 @@ Foundation::UInt16 DialogServer::port() const void DialogServer::run() { _ready.set(); - Foundation::Timespan span(250000); + Poco::Timespan span(250000); while (!_stop) { if (_socket.poll(span, Socket::SELECT_READ)) @@ -106,7 +106,7 @@ void DialogServer::run() } } } - catch (Foundation::Exception& exc) + catch (Poco::Exception& exc) { std::cerr << "DialogServer: " << exc.displayText() << std::endl; } diff --git a/Net/testsuite/src/DialogServer.h b/Net/testsuite/src/DialogServer.h index f16e083f5..641f86db0 100644 --- a/Net/testsuite/src/DialogServer.h +++ b/Net/testsuite/src/DialogServer.h @@ -1,7 +1,7 @@ // // DialogServer.h // -// $Id: //poco/1.1.0/Net/testsuite/src/DialogServer.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/DialogServer.h#1 $ // // Definition of the DialogServer class. // @@ -36,31 +36,16 @@ #define DialogServer_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_ServerSocket_INCLUDED -#include "Net/ServerSocket.h" -#endif -#ifndef Net_StreamSocket_INCLUDED -#include "Net/StreamSocket.h" -#endif -#ifndef Net_Foundation_Thread_INCLUDED -#include "Foundation/Thread.h" -#endif -#ifndef Net_Foundation_Event_INCLUDED -#include "Foundation/Event.h" -#endif -#ifndef Net_Foundation_Mutex_INCLUDED -#include "Foundation/Mutex.h" -#endif -#ifndef STD_VECTOR_INCLUDED +#include "Poco/Net/Net.h" +#include "Poco/Net/ServerSocket.h" +#include "Poco/Net/StreamSocket.h" +#include "Poco/Thread.h" +#include "Poco/Event.h" +#include "Poco/Mutex.h" #include -#define STD_VECTOR_INCLUDED -#endif -class DialogServer: public Foundation::Runnable +class DialogServer: public Poco::Runnable /// A server for testing FTPClientSession and friends. { public: @@ -70,7 +55,7 @@ public: ~DialogServer(); /// Destroys the DialogServer. - Foundation::UInt16 port() const; + Poco::UInt16 port() const; /// Returns the port the echo server is /// listening on. @@ -103,15 +88,15 @@ public: /// Enables or disables logging to stdout. private: - Net::ServerSocket _socket; - Foundation::Thread _thread; - Foundation::Event _ready; - mutable Foundation::FastMutex _mutex; - bool _stop; - std::vector _nextResponses; - std::vector _lastCommands; - bool _acceptCommands; - bool _log; + Poco::Net::ServerSocket _socket; + Poco::Thread _thread; + Poco::Event _ready; + mutable Poco::FastMutex _mutex; + bool _stop; + std::vector _nextResponses; + std::vector _lastCommands; + bool _acceptCommands; + bool _log; }; diff --git a/Net/testsuite/src/DialogSocketTest.cpp b/Net/testsuite/src/DialogSocketTest.cpp index e392cb69d..6a2b5743a 100644 --- a/Net/testsuite/src/DialogSocketTest.cpp +++ b/Net/testsuite/src/DialogSocketTest.cpp @@ -1,7 +1,7 @@ // // DialogSocketTest.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/DialogSocketTest.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/DialogSocketTest.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -34,12 +34,12 @@ #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" #include "EchoServer.h" -#include "Net/DialogSocket.h" -#include "Net/SocketAddress.h" +#include "Poco/Net/DialogSocket.h" +#include "Poco/Net/SocketAddress.h" -using Net::DialogSocket; -using Net::SocketAddress; +using Poco::Net::DialogSocket; +using Poco::Net::SocketAddress; DialogSocketTest::DialogSocketTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Net/testsuite/src/DialogSocketTest.h b/Net/testsuite/src/DialogSocketTest.h index 110061c9b..16e635eae 100644 --- a/Net/testsuite/src/DialogSocketTest.h +++ b/Net/testsuite/src/DialogSocketTest.h @@ -1,7 +1,7 @@ // // DialogSocketTest.h // -// $Id: //poco/1.1.0/Net/testsuite/src/DialogSocketTest.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/DialogSocketTest.h#1 $ // // Definition of the DialogSocketTest class. // @@ -36,12 +36,8 @@ #define DialogSocketTest_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Net/Net.h" #include "CppUnit/TestCase.h" -#endif class DialogSocketTest: public CppUnit::TestCase diff --git a/Net/testsuite/src/Driver.cpp b/Net/testsuite/src/Driver.cpp index 22c060707..f08078e91 100644 --- a/Net/testsuite/src/Driver.cpp +++ b/Net/testsuite/src/Driver.cpp @@ -1,7 +1,7 @@ // // Driver.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/Driver.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/Driver.cpp#1 $ // // Console-based test driver for Poco Net. // diff --git a/Net/testsuite/src/EchoServer.cpp b/Net/testsuite/src/EchoServer.cpp index 73329b8cc..1f093fcde 100644 --- a/Net/testsuite/src/EchoServer.cpp +++ b/Net/testsuite/src/EchoServer.cpp @@ -1,7 +1,7 @@ // // EchoServer.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/EchoServer.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/EchoServer.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -31,15 +31,15 @@ #include "EchoServer.h" -#include "Net/StreamSocket.h" -#include "Net/SocketAddress.h" -#include "Foundation/Timespan.h" +#include "Poco/Net/StreamSocket.h" +#include "Poco/Net/SocketAddress.h" +#include "Poco/Timespan.h" #include -using Net::Socket; -using Net::StreamSocket; -using Net::SocketAddress; +using Poco::Net::Socket; +using Poco::Net::StreamSocket; +using Poco::Net::SocketAddress; EchoServer::EchoServer(): @@ -59,7 +59,7 @@ EchoServer::~EchoServer() } -Foundation::UInt16 EchoServer::port() const +Poco::UInt16 EchoServer::port() const { return _socket.address().port(); } @@ -68,7 +68,7 @@ Foundation::UInt16 EchoServer::port() const void EchoServer::run() { _ready.set(); - Foundation::Timespan span(250000); + Poco::Timespan span(250000); while (!_stop) { if (_socket.poll(span, Socket::SELECT_READ)) @@ -84,7 +84,7 @@ void EchoServer::run() n = ss.receiveBytes(buffer, sizeof(buffer)); } } - catch (Foundation::Exception& exc) + catch (Poco::Exception& exc) { std::cerr << "EchoServer: " << exc.displayText() << std::endl; } diff --git a/Net/testsuite/src/EchoServer.h b/Net/testsuite/src/EchoServer.h index 141d7aae3..53d9648b4 100644 --- a/Net/testsuite/src/EchoServer.h +++ b/Net/testsuite/src/EchoServer.h @@ -1,7 +1,7 @@ // // EchoServer.h // -// $Id: //poco/1.1.0/Net/testsuite/src/EchoServer.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/EchoServer.h#1 $ // // Definition of the EchoServer class. // @@ -36,21 +36,13 @@ #define EchoServer_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_ServerSocket_INCLUDED -#include "Net/ServerSocket.h" -#endif -#ifndef Net_Foundation_Thread_INCLUDED -#include "Foundation/Thread.h" -#endif -#ifndef Net_Foundation_Event_INCLUDED -#include "Foundation/Event.h" -#endif +#include "Poco/Net/Net.h" +#include "Poco/Net/ServerSocket.h" +#include "Poco/Thread.h" +#include "Poco/Event.h" -class EchoServer: public Foundation::Runnable +class EchoServer: public Poco::Runnable /// A simple sequential echo server. { public: @@ -60,7 +52,7 @@ public: ~EchoServer(); /// Destroys the EchoServer. - Foundation::UInt16 port() const; + Poco::UInt16 port() const; /// Returns the port the echo server is /// listening on. @@ -68,10 +60,10 @@ public: /// Does the work. private: - Net::ServerSocket _socket; - Foundation::Thread _thread; - Foundation::Event _ready; - bool _stop; + Poco::Net::ServerSocket _socket; + Poco::Thread _thread; + Poco::Event _ready; + bool _stop; }; diff --git a/Net/testsuite/src/FTPClientSessionTest.cpp b/Net/testsuite/src/FTPClientSessionTest.cpp index c0c17ba35..2f9a1d902 100644 --- a/Net/testsuite/src/FTPClientSessionTest.cpp +++ b/Net/testsuite/src/FTPClientSessionTest.cpp @@ -1,7 +1,7 @@ // // FTPClientSessionTest.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/FTPClientSessionTest.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/FTPClientSessionTest.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -34,24 +34,24 @@ #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" #include "DialogServer.h" -#include "Net/FTPClientSession.h" -#include "Net/DialogSocket.h" -#include "Net/SocketAddress.h" -#include "Net/NetException.h" -#include "Foundation/Thread.h" -#include "Foundation/ActiveMethod.h" -#include "Foundation/StreamCopier.h" +#include "Poco/Net/FTPClientSession.h" +#include "Poco/Net/DialogSocket.h" +#include "Poco/Net/SocketAddress.h" +#include "Poco/Net/NetException.h" +#include "Poco/Thread.h" +#include "Poco/ActiveMethod.h" +#include "Poco/StreamCopier.h" #include -using Net::FTPClientSession; -using Net::DialogSocket; -using Net::SocketAddress; -using Net::FTPException; -using Foundation::ActiveMethod; -using Foundation::ActiveResult; -using Foundation::StreamCopier; -using Foundation::Thread; +using Poco::Net::FTPClientSession; +using Poco::Net::DialogSocket; +using Poco::Net::SocketAddress; +using Poco::Net::FTPException; +using Poco::ActiveMethod; +using Poco::ActiveResult; +using Poco::StreamCopier; +using Poco::Thread; namespace @@ -321,7 +321,7 @@ void FTPClientSessionTest::testDownloadPORT() cmd = server.popCommandWait(); assert (cmd == "RETR test.txt"); - SocketAddress sa("localhost", (Foundation::UInt16) port); + SocketAddress sa("localhost", (Poco::UInt16) port); DialogSocket dataSock; dataSock.connect(sa); @@ -369,7 +369,7 @@ void FTPClientSessionTest::testDownloadEPRT() cmd = server.popCommandWait(); assert (cmd == "RETR test.txt"); - SocketAddress sa("localhost", (Foundation::UInt16) port); + SocketAddress sa("localhost", (Poco::UInt16) port); DialogSocket dataSock; dataSock.connect(sa); diff --git a/Net/testsuite/src/FTPClientSessionTest.h b/Net/testsuite/src/FTPClientSessionTest.h index 15b85746c..4af13c2fe 100644 --- a/Net/testsuite/src/FTPClientSessionTest.h +++ b/Net/testsuite/src/FTPClientSessionTest.h @@ -1,7 +1,7 @@ // // FTPClientSessionTest.h // -// $Id: //poco/1.1.0/Net/testsuite/src/FTPClientSessionTest.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/FTPClientSessionTest.h#1 $ // // Definition of the FTPClientSessionTest class. // @@ -36,12 +36,8 @@ #define FTPClientSessionTest_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Net/Net.h" #include "CppUnit/TestCase.h" -#endif class FTPClientSessionTest: public CppUnit::TestCase diff --git a/Net/testsuite/src/FTPClientTestSuite.cpp b/Net/testsuite/src/FTPClientTestSuite.cpp index 359409f78..d8c0f9526 100644 --- a/Net/testsuite/src/FTPClientTestSuite.cpp +++ b/Net/testsuite/src/FTPClientTestSuite.cpp @@ -1,7 +1,7 @@ // // FTPClientTestSuite.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/FTPClientTestSuite.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/FTPClientTestSuite.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. diff --git a/Net/testsuite/src/FTPClientTestSuite.h b/Net/testsuite/src/FTPClientTestSuite.h index 8f12de26c..3fff22477 100644 --- a/Net/testsuite/src/FTPClientTestSuite.h +++ b/Net/testsuite/src/FTPClientTestSuite.h @@ -1,7 +1,7 @@ // // FTPClientTestSuite.h // -// $Id: //poco/1.1.0/Net/testsuite/src/FTPClientTestSuite.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/FTPClientTestSuite.h#1 $ // // Definition of the FTPClientTestSuite class. // @@ -36,9 +36,7 @@ #define FTPClientTestSuite_INCLUDED -#ifndef CppUnit_TestSuite_INCLUDED #include "CppUnit/TestSuite.h" -#endif class FTPClientTestSuite diff --git a/Net/testsuite/src/FTPStreamFactoryTest.cpp b/Net/testsuite/src/FTPStreamFactoryTest.cpp index 2f2a02989..63197159d 100644 --- a/Net/testsuite/src/FTPStreamFactoryTest.cpp +++ b/Net/testsuite/src/FTPStreamFactoryTest.cpp @@ -1,7 +1,7 @@ // // FTPStreamFactoryTest.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/FTPStreamFactoryTest.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/FTPStreamFactoryTest.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -34,23 +34,23 @@ #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" #include "DialogServer.h" -#include "Net/FTPStreamFactory.h" -#include "Net/DialogSocket.h" -#include "Net/SocketAddress.h" -#include "Net/NetException.h" -#include "Foundation/URI.h" -#include "Foundation/StreamCopier.h" +#include "Poco/Net/FTPStreamFactory.h" +#include "Poco/Net/DialogSocket.h" +#include "Poco/Net/SocketAddress.h" +#include "Poco/Net/NetException.h" +#include "Poco/URI.h" +#include "Poco/StreamCopier.h" #include #include -using Net::FTPStreamFactory; -using Net::FTPPasswordProvider; -using Net::DialogSocket; -using Net::SocketAddress; -using Net::FTPException; -using Foundation::URI; -using Foundation::StreamCopier; +using Poco::Net::FTPStreamFactory; +using Poco::Net::FTPPasswordProvider; +using Poco::Net::DialogSocket; +using Poco::Net::SocketAddress; +using Poco::Net::FTPException; +using Poco::URI; +using Poco::StreamCopier; namespace diff --git a/Net/testsuite/src/FTPStreamFactoryTest.h b/Net/testsuite/src/FTPStreamFactoryTest.h index 85bea2cfe..6ebb2bd8c 100644 --- a/Net/testsuite/src/FTPStreamFactoryTest.h +++ b/Net/testsuite/src/FTPStreamFactoryTest.h @@ -1,7 +1,7 @@ // // FTPStreamFactoryTest.h // -// $Id: //poco/1.1.0/Net/testsuite/src/FTPStreamFactoryTest.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/FTPStreamFactoryTest.h#1 $ // // Definition of the FTPStreamFactoryTest class. // @@ -36,12 +36,8 @@ #define FTPStreamFactoryTest_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Net/Net.h" #include "CppUnit/TestCase.h" -#endif class FTPStreamFactoryTest: public CppUnit::TestCase diff --git a/Net/testsuite/src/HTMLFormTest.cpp b/Net/testsuite/src/HTMLFormTest.cpp index fd48a54c5..5c31ef1ff 100644 --- a/Net/testsuite/src/HTMLFormTest.cpp +++ b/Net/testsuite/src/HTMLFormTest.cpp @@ -1,7 +1,7 @@ // // HTMLFormTest.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/HTMLFormTest.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/HTMLFormTest.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,21 +33,21 @@ #include "HTMLFormTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Net/HTMLForm.h" -#include "Net/PartSource.h" -#include "Net/StringPartSource.h" -#include "Net/PartHandler.h" -#include "Net/HTTPRequest.h" +#include "Poco/Net/HTMLForm.h" +#include "Poco/Net/PartSource.h" +#include "Poco/Net/StringPartSource.h" +#include "Poco/Net/PartHandler.h" +#include "Poco/Net/HTTPRequest.h" #include -using Net::HTMLForm; -using Net::PartSource; -using Net::StringPartSource; -using Net::PartHandler; -using Net::HTTPRequest; -using Net::HTTPMessage; -using Net::MessageHeader; +using Poco::Net::HTMLForm; +using Poco::Net::PartSource; +using Poco::Net::StringPartSource; +using Poco::Net::PartHandler; +using Poco::Net::HTTPRequest; +using Poco::Net::HTTPMessage; +using Poco::Net::MessageHeader; namespace diff --git a/Net/testsuite/src/HTMLFormTest.h b/Net/testsuite/src/HTMLFormTest.h index 0797c13d4..69326163a 100644 --- a/Net/testsuite/src/HTMLFormTest.h +++ b/Net/testsuite/src/HTMLFormTest.h @@ -1,7 +1,7 @@ // // HTMLFormTest.h // -// $Id: //poco/1.1.0/Net/testsuite/src/HTMLFormTest.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/HTMLFormTest.h#1 $ // // Definition of the HTMLFormTest class. // @@ -36,12 +36,8 @@ #define HTMLFormTest_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Net/Net.h" #include "CppUnit/TestCase.h" -#endif class HTMLFormTest: public CppUnit::TestCase diff --git a/Net/testsuite/src/HTMLTestSuite.cpp b/Net/testsuite/src/HTMLTestSuite.cpp index 2a3324994..f918ca455 100644 --- a/Net/testsuite/src/HTMLTestSuite.cpp +++ b/Net/testsuite/src/HTMLTestSuite.cpp @@ -1,7 +1,7 @@ // // HTMLTestSuite.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/HTMLTestSuite.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/HTMLTestSuite.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. diff --git a/Net/testsuite/src/HTMLTestSuite.h b/Net/testsuite/src/HTMLTestSuite.h index e0b9d2299..228147b4e 100644 --- a/Net/testsuite/src/HTMLTestSuite.h +++ b/Net/testsuite/src/HTMLTestSuite.h @@ -1,7 +1,7 @@ // // HTMLTestSuite.h // -// $Id: //poco/1.1.0/Net/testsuite/src/HTMLTestSuite.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/HTMLTestSuite.h#1 $ // // Definition of the HTMLTestSuite class. // @@ -36,9 +36,7 @@ #define HTMLTestSuite_INCLUDED -#ifndef CppUnit_TestSuite_INCLUDED #include "CppUnit/TestSuite.h" -#endif class HTMLTestSuite diff --git a/Net/testsuite/src/HTTPClientSessionTest.cpp b/Net/testsuite/src/HTTPClientSessionTest.cpp index c1e76d6c3..e8438ff73 100644 --- a/Net/testsuite/src/HTTPClientSessionTest.cpp +++ b/Net/testsuite/src/HTTPClientSessionTest.cpp @@ -1,7 +1,7 @@ // // HTTPClientSessionTest.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/HTTPClientSessionTest.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/HTTPClientSessionTest.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,21 +33,21 @@ #include "HTTPClientSessionTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Net/HTTPClientSession.h" -#include "Net/HTTPRequest.h" -#include "Net/HTTPResponse.h" -#include "Foundation/StreamCopier.h" +#include "Poco/Net/HTTPClientSession.h" +#include "Poco/Net/HTTPRequest.h" +#include "Poco/Net/HTTPResponse.h" +#include "Poco/StreamCopier.h" #include "HTTPTestServer.h" #include #include #include -using Net::HTTPClientSession; -using Net::HTTPRequest; -using Net::HTTPResponse; -using Net::HTTPMessage; -using Foundation::StreamCopier; +using Poco::Net::HTTPClientSession; +using Poco::Net::HTTPRequest; +using Poco::Net::HTTPResponse; +using Poco::Net::HTTPMessage; +using Poco::StreamCopier; HTTPClientSessionTest::HTTPClientSessionTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Net/testsuite/src/HTTPClientSessionTest.h b/Net/testsuite/src/HTTPClientSessionTest.h index 6204ce01a..d3980a45f 100644 --- a/Net/testsuite/src/HTTPClientSessionTest.h +++ b/Net/testsuite/src/HTTPClientSessionTest.h @@ -1,7 +1,7 @@ // // HTTPClientSessionTest.h // -// $Id: //poco/1.1.0/Net/testsuite/src/HTTPClientSessionTest.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/HTTPClientSessionTest.h#1 $ // // Definition of the HTTPClientSessionTest class. // @@ -36,12 +36,8 @@ #define HTTPClientSessionTest_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Net/Net.h" #include "CppUnit/TestCase.h" -#endif class HTTPClientSessionTest: public CppUnit::TestCase diff --git a/Net/testsuite/src/HTTPClientTestSuite.cpp b/Net/testsuite/src/HTTPClientTestSuite.cpp index be839f951..06f7da19f 100644 --- a/Net/testsuite/src/HTTPClientTestSuite.cpp +++ b/Net/testsuite/src/HTTPClientTestSuite.cpp @@ -1,7 +1,7 @@ // // HTTPClientTestSuite.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/HTTPClientTestSuite.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/HTTPClientTestSuite.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. diff --git a/Net/testsuite/src/HTTPClientTestSuite.h b/Net/testsuite/src/HTTPClientTestSuite.h index 347156a2f..5adfe9e98 100644 --- a/Net/testsuite/src/HTTPClientTestSuite.h +++ b/Net/testsuite/src/HTTPClientTestSuite.h @@ -1,7 +1,7 @@ // // HTTPClientTestSuite.h // -// $Id: //poco/1.1.0/Net/testsuite/src/HTTPClientTestSuite.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/HTTPClientTestSuite.h#1 $ // // Definition of the HTTPClientTestSuite class. // @@ -36,9 +36,7 @@ #define HTTPClientTestSuite_INCLUDED -#ifndef CppUnit_TestSuite_INCLUDED #include "CppUnit/TestSuite.h" -#endif class HTTPClientTestSuite diff --git a/Net/testsuite/src/HTTPCookieTest.cpp b/Net/testsuite/src/HTTPCookieTest.cpp index 3bae006eb..c3f66923f 100644 --- a/Net/testsuite/src/HTTPCookieTest.cpp +++ b/Net/testsuite/src/HTTPCookieTest.cpp @@ -1,7 +1,7 @@ // // HTTPCookieTest.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/HTTPCookieTest.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/HTTPCookieTest.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,10 +33,10 @@ #include "HTTPCookieTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Net/HTTPCookie.h" +#include "Poco/Net/HTTPCookie.h" -using Net::HTTPCookie; +using Poco::Net::HTTPCookie; HTTPCookieTest::HTTPCookieTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Net/testsuite/src/HTTPCookieTest.h b/Net/testsuite/src/HTTPCookieTest.h index 80f795edb..c53c025be 100644 --- a/Net/testsuite/src/HTTPCookieTest.h +++ b/Net/testsuite/src/HTTPCookieTest.h @@ -1,7 +1,7 @@ // // HTTPCookieTest.h // -// $Id: //poco/1.1.0/Net/testsuite/src/HTTPCookieTest.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/HTTPCookieTest.h#1 $ // // Definition of the HTTPCookieTest class. // @@ -36,12 +36,8 @@ #define HTTPCookieTest_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Net/Net.h" #include "CppUnit/TestCase.h" -#endif class HTTPCookieTest: public CppUnit::TestCase diff --git a/Net/testsuite/src/HTTPCredentialsTest.cpp b/Net/testsuite/src/HTTPCredentialsTest.cpp index b45485a00..90eb56280 100644 --- a/Net/testsuite/src/HTTPCredentialsTest.cpp +++ b/Net/testsuite/src/HTTPCredentialsTest.cpp @@ -1,7 +1,7 @@ // // HTTPCredentialsTest.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/HTTPCredentialsTest.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/HTTPCredentialsTest.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,14 +33,14 @@ #include "HTTPCredentialsTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Net/HTTPRequest.h" -#include "Net/HTTPBasicCredentials.h" -#include "Net/NetException.h" +#include "Poco/Net/HTTPRequest.h" +#include "Poco/Net/HTTPBasicCredentials.h" +#include "Poco/Net/NetException.h" -using Net::HTTPRequest; -using Net::HTTPBasicCredentials; -using Net::NotAuthenticatedException; +using Poco::Net::HTTPRequest; +using Poco::Net::HTTPBasicCredentials; +using Poco::Net::NotAuthenticatedException; HTTPCredentialsTest::HTTPCredentialsTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Net/testsuite/src/HTTPCredentialsTest.h b/Net/testsuite/src/HTTPCredentialsTest.h index a298f964d..19d31e16c 100644 --- a/Net/testsuite/src/HTTPCredentialsTest.h +++ b/Net/testsuite/src/HTTPCredentialsTest.h @@ -1,7 +1,7 @@ // // HTTPCredentialsTest.h // -// $Id: //poco/1.1.0/Net/testsuite/src/HTTPCredentialsTest.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/HTTPCredentialsTest.h#1 $ // // Definition of the HTTPCredentialsTest class. // @@ -36,12 +36,8 @@ #define HTTPCredentialsTest_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Net/Net.h" #include "CppUnit/TestCase.h" -#endif class HTTPCredentialsTest: public CppUnit::TestCase diff --git a/Net/testsuite/src/HTTPRequestTest.cpp b/Net/testsuite/src/HTTPRequestTest.cpp index 2562a2f77..58d51fb13 100644 --- a/Net/testsuite/src/HTTPRequestTest.cpp +++ b/Net/testsuite/src/HTTPRequestTest.cpp @@ -1,7 +1,7 @@ // // HTTPRequestTest.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/HTTPRequestTest.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/HTTPRequestTest.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,15 +33,15 @@ #include "HTTPRequestTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Net/HTTPRequest.h" -#include "Net/NetException.h" +#include "Poco/Net/HTTPRequest.h" +#include "Poco/Net/NetException.h" #include -using Net::HTTPRequest; -using Net::HTTPMessage; -using Net::MessageException; -using Net::NameValueCollection; +using Poco::Net::HTTPRequest; +using Poco::Net::HTTPMessage; +using Poco::Net::MessageException; +using Poco::Net::NameValueCollection; HTTPRequestTest::HTTPRequestTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Net/testsuite/src/HTTPRequestTest.h b/Net/testsuite/src/HTTPRequestTest.h index 35b571359..c99437689 100644 --- a/Net/testsuite/src/HTTPRequestTest.h +++ b/Net/testsuite/src/HTTPRequestTest.h @@ -1,7 +1,7 @@ // // HTTPRequestTest.h // -// $Id: //poco/1.1.0/Net/testsuite/src/HTTPRequestTest.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/HTTPRequestTest.h#1 $ // // Definition of the HTTPRequestTest class. // @@ -36,12 +36,8 @@ #define HTTPRequestTest_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Net/Net.h" #include "CppUnit/TestCase.h" -#endif class HTTPRequestTest: public CppUnit::TestCase diff --git a/Net/testsuite/src/HTTPResponseTest.cpp b/Net/testsuite/src/HTTPResponseTest.cpp index 2a5ac721a..6d20c842f 100644 --- a/Net/testsuite/src/HTTPResponseTest.cpp +++ b/Net/testsuite/src/HTTPResponseTest.cpp @@ -1,7 +1,7 @@ // // HTTPResponseTest.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/HTTPResponseTest.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/HTTPResponseTest.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,16 +33,16 @@ #include "HTTPResponseTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Net/HTTPResponse.h" -#include "Net/HTTPCookie.h" -#include "Net/NetException.h" +#include "Poco/Net/HTTPResponse.h" +#include "Poco/Net/HTTPCookie.h" +#include "Poco/Net/NetException.h" #include -using Net::HTTPResponse; -using Net::HTTPMessage; -using Net::HTTPCookie; -using Net::MessageException; +using Poco::Net::HTTPResponse; +using Poco::Net::HTTPMessage; +using Poco::Net::HTTPCookie; +using Poco::Net::MessageException; HTTPResponseTest::HTTPResponseTest(const std::string& name): CppUnit::TestCase(name) @@ -107,22 +107,6 @@ void HTTPResponseTest::testRead2() } -void HTTPResponseTest::testRead3() -{ - std::string s("HTTP/1.0 100 Continue\r\nHTTP/1.0 301 Moved Permanently\r\nLocation: http://www.appinf.com/index.html\r\nServer: Poco/1.0\r\n\r\n"); - std::istringstream istr(s); - HTTPResponse response; - response.read(istr); - assert (response.getStatus() == HTTPResponse::HTTP_MOVED_PERMANENTLY); - assert (response.getReason() == "Moved Permanently"); - assert (response.getVersion() == HTTPMessage::HTTP_1_0); - assert (response.size() == 2); - assert (response["Location"] == "http://www.appinf.com/index.html"); - assert (response["Server"] == "Poco/1.0"); - assert (istr.get() == -1); -} - - void HTTPResponseTest::testInvalid1() { std::string s(256, 'x'); @@ -233,7 +217,6 @@ CppUnit::Test* HTTPResponseTest::suite() CppUnit_addTest(pSuite, HTTPResponseTest, testWrite2); CppUnit_addTest(pSuite, HTTPResponseTest, testRead1); CppUnit_addTest(pSuite, HTTPResponseTest, testRead2); - CppUnit_addTest(pSuite, HTTPResponseTest, testRead3); CppUnit_addTest(pSuite, HTTPResponseTest, testInvalid1); CppUnit_addTest(pSuite, HTTPResponseTest, testInvalid2); CppUnit_addTest(pSuite, HTTPResponseTest, testInvalid3); diff --git a/Net/testsuite/src/HTTPResponseTest.h b/Net/testsuite/src/HTTPResponseTest.h index 672836428..bd3769caa 100644 --- a/Net/testsuite/src/HTTPResponseTest.h +++ b/Net/testsuite/src/HTTPResponseTest.h @@ -1,7 +1,7 @@ // // HTTPResponseTest.h // -// $Id: //poco/1.1.0/Net/testsuite/src/HTTPResponseTest.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/HTTPResponseTest.h#1 $ // // Definition of the HTTPResponseTest class. // @@ -36,12 +36,8 @@ #define HTTPResponseTest_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Net/Net.h" #include "CppUnit/TestCase.h" -#endif class HTTPResponseTest: public CppUnit::TestCase @@ -54,7 +50,6 @@ public: void testWrite2(); void testRead1(); void testRead2(); - void testRead3(); void testInvalid1(); void testInvalid2(); void testInvalid3(); diff --git a/Net/testsuite/src/HTTPServerTest.cpp b/Net/testsuite/src/HTTPServerTest.cpp index fe3ea1c0e..299a15edf 100644 --- a/Net/testsuite/src/HTTPServerTest.cpp +++ b/Net/testsuite/src/HTTPServerTest.cpp @@ -1,7 +1,7 @@ // // HTTPServerTest.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/HTTPServerTest.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/HTTPServerTest.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,32 +33,32 @@ #include "HTTPServerTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Net/HTTPServer.h" -#include "Net/HTTPServerParams.h" -#include "Net/HTTPRequestHandler.h" -#include "Net/HTTPRequestHandlerFactory.h" -#include "Net/HTTPClientSession.h" -#include "Net/HTTPRequest.h" -#include "Net/HTTPServerRequest.h" -#include "Net/HTTPResponse.h" -#include "Net/HTTPServerResponse.h" -#include "Net/ServerSocket.h" -#include "Foundation/StreamCopier.h" +#include "Poco/Net/HTTPServer.h" +#include "Poco/Net/HTTPServerParams.h" +#include "Poco/Net/HTTPRequestHandler.h" +#include "Poco/Net/HTTPRequestHandlerFactory.h" +#include "Poco/Net/HTTPClientSession.h" +#include "Poco/Net/HTTPRequest.h" +#include "Poco/Net/HTTPServerRequest.h" +#include "Poco/Net/HTTPResponse.h" +#include "Poco/Net/HTTPServerResponse.h" +#include "Poco/Net/ServerSocket.h" +#include "Poco/StreamCopier.h" #include -using Net::HTTPServer; -using Net::HTTPServerParams; -using Net::HTTPRequestHandler; -using Net::HTTPRequestHandlerFactory; -using Net::HTTPClientSession; -using Net::HTTPRequest; -using Net::HTTPServerRequest; -using Net::HTTPResponse; -using Net::HTTPServerResponse; -using Net::HTTPMessage; -using Net::ServerSocket; -using Foundation::StreamCopier; +using Poco::Net::HTTPServer; +using Poco::Net::HTTPServerParams; +using Poco::Net::HTTPRequestHandler; +using Poco::Net::HTTPRequestHandlerFactory; +using Poco::Net::HTTPClientSession; +using Poco::Net::HTTPRequest; +using Poco::Net::HTTPServerRequest; +using Poco::Net::HTTPResponse; +using Poco::Net::HTTPServerResponse; +using Poco::Net::HTTPMessage; +using Poco::Net::ServerSocket; +using Poco::StreamCopier; namespace @@ -168,6 +168,29 @@ void HTTPServerTest::testIdentityRequest() } +void HTTPServerTest::testPutIdentityRequest() +{ + ServerSocket svs(0); + HTTPServerParams* pParams = new HTTPServerParams; + pParams->setKeepAlive(false); + HTTPServer srv(new RequestHandlerFactory, svs, pParams); + srv.start(); + + HTTPClientSession cs("localhost", svs.address().port()); + std::string body(5000, 'x'); + HTTPRequest request("PUT", "/echoBody"); + request.setContentLength((int) body.length()); + request.setContentType("text/plain"); + cs.sendRequest(request) << body; + HTTPResponse response; + std::string rbody; + cs.receiveResponse(response) >> rbody; + assert (response.getContentLength() == body.size()); + assert (response.getContentType() == "text/plain"); + assert (rbody == body); +} + + void HTTPServerTest::testChunkedRequest() { ServerSocket svs(0); @@ -407,6 +430,7 @@ CppUnit::Test* HTTPServerTest::suite() CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("HTTPServerTest"); CppUnit_addTest(pSuite, HTTPServerTest, testIdentityRequest); + CppUnit_addTest(pSuite, HTTPServerTest, testPutIdentityRequest); CppUnit_addTest(pSuite, HTTPServerTest, testChunkedRequest); CppUnit_addTest(pSuite, HTTPServerTest, testClosedRequest); CppUnit_addTest(pSuite, HTTPServerTest, testIdentityRequestKeepAlive); diff --git a/Net/testsuite/src/HTTPServerTest.h b/Net/testsuite/src/HTTPServerTest.h index 6a270550c..1caae5f59 100644 --- a/Net/testsuite/src/HTTPServerTest.h +++ b/Net/testsuite/src/HTTPServerTest.h @@ -1,7 +1,7 @@ // // HTTPServerTest.h // -// $Id: //poco/1.1.0/Net/testsuite/src/HTTPServerTest.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/HTTPServerTest.h#1 $ // // Definition of the HTTPServerTest class. // @@ -36,12 +36,8 @@ #define HTTPServerTest_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Net/Net.h" #include "CppUnit/TestCase.h" -#endif class HTTPServerTest: public CppUnit::TestCase @@ -51,6 +47,7 @@ public: ~HTTPServerTest(); void testIdentityRequest(); + void testPutIdentityRequest(); void testChunkedRequest(); void testClosedRequest(); void testIdentityRequestKeepAlive(); diff --git a/Net/testsuite/src/HTTPServerTestSuite.cpp b/Net/testsuite/src/HTTPServerTestSuite.cpp index c89de64ce..d29fb6442 100644 --- a/Net/testsuite/src/HTTPServerTestSuite.cpp +++ b/Net/testsuite/src/HTTPServerTestSuite.cpp @@ -1,7 +1,7 @@ // // HTTPServerTestSuite.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/HTTPServerTestSuite.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/HTTPServerTestSuite.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. diff --git a/Net/testsuite/src/HTTPServerTestSuite.h b/Net/testsuite/src/HTTPServerTestSuite.h index 1660c4533..4fb439f46 100644 --- a/Net/testsuite/src/HTTPServerTestSuite.h +++ b/Net/testsuite/src/HTTPServerTestSuite.h @@ -1,7 +1,7 @@ // // HTTPServerTestSuite.h // -// $Id: //poco/1.1.0/Net/testsuite/src/HTTPServerTestSuite.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/HTTPServerTestSuite.h#1 $ // // Definition of the HTTPServerTestSuite class. // @@ -36,9 +36,7 @@ #define HTTPServerTestSuite_INCLUDED -#ifndef CppUnit_TestSuite_INCLUDED #include "CppUnit/TestSuite.h" -#endif class HTTPServerTestSuite diff --git a/Net/testsuite/src/HTTPStreamFactoryTest.cpp b/Net/testsuite/src/HTTPStreamFactoryTest.cpp index 39a125e35..790038a6b 100644 --- a/Net/testsuite/src/HTTPStreamFactoryTest.cpp +++ b/Net/testsuite/src/HTTPStreamFactoryTest.cpp @@ -1,7 +1,7 @@ // // HTTPStreamFactoryTest.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/HTTPStreamFactoryTest.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/HTTPStreamFactoryTest.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,20 +33,20 @@ #include "HTTPStreamFactoryTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Net/HTTPStreamFactory.h" -#include "Net/NetException.h" -#include "Foundation/URI.h" -#include "Foundation/StreamCopier.h" +#include "Poco/Net/HTTPStreamFactory.h" +#include "Poco/Net/NetException.h" +#include "Poco/URI.h" +#include "Poco/StreamCopier.h" #include "HTTPTestServer.h" #include #include -using Net::HTTPStreamFactory; -using Net::NetException; -using Net::HTTPException; -using Foundation::URI; -using Foundation::StreamCopier; +using Poco::Net::HTTPStreamFactory; +using Poco::Net::NetException; +using Poco::Net::HTTPException; +using Poco::URI; +using Poco::StreamCopier; HTTPStreamFactoryTest::HTTPStreamFactoryTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Net/testsuite/src/HTTPStreamFactoryTest.h b/Net/testsuite/src/HTTPStreamFactoryTest.h index b253e7167..21a4c293f 100644 --- a/Net/testsuite/src/HTTPStreamFactoryTest.h +++ b/Net/testsuite/src/HTTPStreamFactoryTest.h @@ -1,7 +1,7 @@ // // HTTPStreamFactoryTest.h // -// $Id: //poco/1.1.0/Net/testsuite/src/HTTPStreamFactoryTest.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/HTTPStreamFactoryTest.h#1 $ // // Definition of the HTTPStreamFactoryTest class. // @@ -36,12 +36,8 @@ #define HTTPStreamFactoryTest_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Net/Net.h" #include "CppUnit/TestCase.h" -#endif class HTTPStreamFactoryTest: public CppUnit::TestCase diff --git a/Net/testsuite/src/HTTPTestServer.cpp b/Net/testsuite/src/HTTPTestServer.cpp index a13a230dd..2c00faee4 100644 --- a/Net/testsuite/src/HTTPTestServer.cpp +++ b/Net/testsuite/src/HTTPTestServer.cpp @@ -1,7 +1,7 @@ // // HTTPTestServer.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/HTTPTestServer.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/HTTPTestServer.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -31,17 +31,17 @@ #include "HTTPTestServer.h" -#include "Net/StreamSocket.h" -#include "Net/SocketAddress.h" -#include "Foundation/Timespan.h" -#include "Foundation/NumberFormatter.h" +#include "Poco/Net/StreamSocket.h" +#include "Poco/Net/SocketAddress.h" +#include "Poco/Timespan.h" +#include "Poco/NumberFormatter.h" #include -using Net::Socket; -using Net::StreamSocket; -using Net::SocketAddress; -using Foundation::NumberFormatter; +using Poco::Net::Socket; +using Poco::Net::StreamSocket; +using Poco::Net::SocketAddress; +using Poco::NumberFormatter; const std::string HTTPTestServer::SMALL_BODY("This is some random text data returned by the server"); @@ -66,7 +66,7 @@ HTTPTestServer::~HTTPTestServer() } -Foundation::UInt16 HTTPTestServer::port() const +Poco::UInt16 HTTPTestServer::port() const { return _socket.address().port(); } @@ -81,7 +81,7 @@ const std::string& HTTPTestServer::lastRequest() const void HTTPTestServer::run() { _ready.set(); - Foundation::Timespan span(250000); + Poco::Timespan span(250000); while (!_stop) { if (_socket.poll(span, Socket::SELECT_READ)) @@ -102,9 +102,9 @@ void HTTPTestServer::run() } std::string response = handleRequest(); ss.sendBytes(response.data(), (int) response.size()); - Foundation::Thread::sleep(1000); + Poco::Thread::sleep(1000); } - catch (Foundation::Exception& exc) + catch (Poco::Exception& exc) { std::cerr << "HTTPTestServer: " << exc.displayText() << std::endl; } diff --git a/Net/testsuite/src/HTTPTestServer.h b/Net/testsuite/src/HTTPTestServer.h index 915c85507..f7ec693fe 100644 --- a/Net/testsuite/src/HTTPTestServer.h +++ b/Net/testsuite/src/HTTPTestServer.h @@ -1,7 +1,7 @@ // // HTTPTestServer.h // -// $Id: //poco/1.1.0/Net/testsuite/src/HTTPTestServer.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/HTTPTestServer.h#1 $ // // Definition of the HTTPTestServer class. // @@ -36,21 +36,13 @@ #define HTTPTestServer_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_ServerSocket_INCLUDED -#include "Net/ServerSocket.h" -#endif -#ifndef Net_Foundation_Thread_INCLUDED -#include "Foundation/Thread.h" -#endif -#ifndef Net_Foundation_Event_INCLUDED -#include "Foundation/Event.h" -#endif +#include "Poco/Net/Net.h" +#include "Poco/Net/ServerSocket.h" +#include "Poco/Thread.h" +#include "Poco/Event.h" -class HTTPTestServer: public Foundation::Runnable +class HTTPTestServer: public Poco::Runnable /// A simple sequential echo server. { public: @@ -60,7 +52,7 @@ public: ~HTTPTestServer(); /// Destroys the HTTPTestServer. - Foundation::UInt16 port() const; + Poco::UInt16 port() const; /// Returns the port the echo server is /// listening on. @@ -78,11 +70,11 @@ protected: std::string handleRequest() const; private: - Net::ServerSocket _socket; - Foundation::Thread _thread; - Foundation::Event _ready; - bool _stop; - std::string _lastRequest; + Poco::Net::ServerSocket _socket; + Poco::Thread _thread; + Poco::Event _ready; + bool _stop; + std::string _lastRequest; }; diff --git a/Net/testsuite/src/HTTPTestSuite.cpp b/Net/testsuite/src/HTTPTestSuite.cpp index 909d675d2..83469aba4 100644 --- a/Net/testsuite/src/HTTPTestSuite.cpp +++ b/Net/testsuite/src/HTTPTestSuite.cpp @@ -1,7 +1,7 @@ // // HTTPTestSuite.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/HTTPTestSuite.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/HTTPTestSuite.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. diff --git a/Net/testsuite/src/HTTPTestSuite.h b/Net/testsuite/src/HTTPTestSuite.h index 1bc78cbae..26b1c3211 100644 --- a/Net/testsuite/src/HTTPTestSuite.h +++ b/Net/testsuite/src/HTTPTestSuite.h @@ -1,7 +1,7 @@ // // HTTPTestSuite.h // -// $Id: //poco/1.1.0/Net/testsuite/src/HTTPTestSuite.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/HTTPTestSuite.h#1 $ // // Definition of the HTTPTestSuite class. // @@ -36,9 +36,7 @@ #define HTTPTestSuite_INCLUDED -#ifndef CppUnit_TestSuite_INCLUDED #include "CppUnit/TestSuite.h" -#endif class HTTPTestSuite diff --git a/Net/testsuite/src/ICMPClientTest.cpp b/Net/testsuite/src/ICMPClientTest.cpp new file mode 100644 index 000000000..dac390aa2 --- /dev/null +++ b/Net/testsuite/src/ICMPClientTest.cpp @@ -0,0 +1,152 @@ +// +// ICMPClientTest.cpp +// +// $Id: //poco/1.2/Net/testsuite/src/ICMPClientTest.cpp#1 $ +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#include "ICMPClientTest.h" +#include "CppUnit/TestCaller.h" +#include "CppUnit/TestSuite.h" +#include "Poco/Net/ICMPSocket.h" +#include "Poco/Net/ICMPClient.h" +#include "Poco/Net/ICMPEventArgs.h" +#include "Poco/Net/SocketAddress.h" +#include "Poco/Net/NetException.h" +#include "Poco/AutoPtr.h" +#include "Poco/Delegate.h" +#include +#include + + +using Poco::Net::ICMPSocket; +using Poco::Net::ICMPClient; +using Poco::Net::ICMPEventArgs; +using Poco::Net::SocketAddress; +using Poco::Net::IPAddress; +using Poco::Net::HostNotFoundException; +using Poco::Delegate; +using Poco::AutoPtr; + + +ICMPClientTest::ICMPClientTest(const std::string& name): + CppUnit::TestCase(name), + _icmpClient(IPAddress::IPv4) +{ +} + + +ICMPClientTest::~ICMPClientTest() +{ +} + + +void ICMPClientTest::testPing() +{ + assert(ICMPClient::pingIPv4("localhost") > 0); + + assert(_icmpClient.ping("localhost") > 0); + assert(_icmpClient.ping("www.appinf.com", 4) > 0); + + // warning: may fail depending on the existence of the addresses at test site + // if so, adjust accordingly (i.e. specify non-existent or unreachable IP addresses) + assert(0 == _icmpClient.ping("192.168.243.1")); + assert(0 == _icmpClient.ping("10.0.0.1")); +} + + +void ICMPClientTest::setUp() +{ + _icmpClient.pingBegin += Delegate(this, &ICMPClientTest::onBegin); + _icmpClient.pingReply += Delegate(this, &ICMPClientTest::onReply); + _icmpClient.pingError += Delegate(this, &ICMPClientTest::onError); + _icmpClient.pingEnd += Delegate(this, &ICMPClientTest::onEnd); +} + + +void ICMPClientTest::tearDown() +{ + _icmpClient.pingBegin -= Delegate(this, &ICMPClientTest::onBegin); + _icmpClient.pingReply -= Delegate(this, &ICMPClientTest::onReply); + _icmpClient.pingError -= Delegate(this, &ICMPClientTest::onError); + _icmpClient.pingEnd -= Delegate(this, &ICMPClientTest::onEnd); +} + + +void ICMPClientTest::onBegin(const void* pSender, ICMPEventArgs& args) +{ + std::ostringstream os; + os << std::endl << "Pinging " << args.hostName() << " [" << args.hostAddress() << "] with " + << args.dataSize() << " bytes of data:" + << std::endl << "-------------------------------------------------------" << std::endl; + std::cout << os.str() << std::endl; +} + + +void ICMPClientTest::onReply(const void* pSender, ICMPEventArgs& args) +{ + std::ostringstream os; + os << "Reply from " << args.hostAddress() + << " bytes=" << args.dataSize() + << " time=" << args.replyTime() << "ms" + << " TTL=" << args.ttl(); + std::cout << os.str() << std::endl; +} + + +void ICMPClientTest::onError(const void* pSender, ICMPEventArgs& args) +{ + std::ostringstream os; + os << args.error(); + std::cerr << os.str() << std::endl; +} + + +void ICMPClientTest::onEnd(const void* pSender, ICMPEventArgs& args) +{ + std::ostringstream os; + int received = args.received(); + os << std::endl << "--- Ping statistics for " << args.hostAddress() << " ---" + << std::endl << "Packets: Sent=" << args.sent() << ", Received=" << received + << " Lost=" << args.repetitions() - received << " (" << 100.0 - args.percent() << "% loss)," + << std::endl << "Approximate round trip times in milliseconds: " << std::endl + << "Minimum=" << args.minRTT() << "ms, Maximum=" << args.maxRTT() + << "ms, Average=" << args.avgRTT() << "ms" + << std::endl << "-----------------------------------------------" << std::endl; + std::cout << os.str() << std::endl; +} + + +CppUnit::Test* ICMPClientTest::suite() +{ + CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("ICMPClientTest"); + + CppUnit_addTest(pSuite, ICMPClientTest, testPing); + + return pSuite; +} diff --git a/Net/testsuite/src/ICMPClientTest.h b/Net/testsuite/src/ICMPClientTest.h new file mode 100644 index 000000000..9a1134b04 --- /dev/null +++ b/Net/testsuite/src/ICMPClientTest.h @@ -0,0 +1,68 @@ +// +// ICMPClientTest.h +// +// $Id: //poco/1.2/Net/testsuite/src/ICMPClientTest.h#1 $ +// +// Definition of the ICMPClientTest class. +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef ICMPClientTest_INCLUDED +#define ICMPClientTest_INCLUDED + + +#include "Poco/Net/Net.h" +#include "CppUnit/TestCase.h" +#include "Poco/Net/ICMPClient.h" +#include "Poco/Net/ICMPEventArgs.h" + + +class ICMPClientTest: public CppUnit::TestCase +{ +public: + ICMPClientTest(const std::string& name); + ~ICMPClientTest(); + + void testPing(); + + void setUp(); + void tearDown(); + + static CppUnit::Test* suite(); + + void onBegin(const void* pSender, Poco::Net::ICMPEventArgs& args); + void onReply(const void* pSender, Poco::Net::ICMPEventArgs& args); + void onError(const void* pSender, Poco::Net::ICMPEventArgs& args); + void onEnd(const void* pSender, Poco::Net::ICMPEventArgs& args); + +private: + Poco::Net::ICMPClient _icmpClient; +}; + + +#endif // ICMPClientTest_INCLUDED diff --git a/Net/testsuite/src/ICMPClientTestSuite.cpp b/Net/testsuite/src/ICMPClientTestSuite.cpp new file mode 100644 index 000000000..b7f32bac8 --- /dev/null +++ b/Net/testsuite/src/ICMPClientTestSuite.cpp @@ -0,0 +1,44 @@ +// +// ICMPClientTestSuite.cpp +// +// $Id: //poco/1.2/Net/testsuite/src/ICMPClientTestSuite.cpp#1 $ +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#include "ICMPClientTestSuite.h" +#include "ICMPClientTest.h" + + +CppUnit::Test* ICMPClientTestSuite::suite() +{ + CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("ICMPClientTestSuite"); + + pSuite->addTest(ICMPClientTest::suite()); + + return pSuite; +} diff --git a/Net/testsuite/src/ICMPClientTestSuite.h b/Net/testsuite/src/ICMPClientTestSuite.h new file mode 100644 index 000000000..6fa7d4b5c --- /dev/null +++ b/Net/testsuite/src/ICMPClientTestSuite.h @@ -0,0 +1,49 @@ +// +// ICMPClientTestSuite.h +// +// $Id: //poco/1.2/Net/testsuite/src/ICMPClientTestSuite.h#1 $ +// +// Definition of the ICMPClientTestSuite class. +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef ICMPClientTestSuite_INCLUDED +#define ICMPClientTestSuite_INCLUDED + + +#include "CppUnit/TestSuite.h" + + +class ICMPClientTestSuite +{ +public: + static CppUnit::Test* suite(); +}; + + +#endif // ICMPClientTestSuite_INCLUDED diff --git a/Net/testsuite/src/ICMPSocketTest.cpp b/Net/testsuite/src/ICMPSocketTest.cpp new file mode 100644 index 000000000..365e4abe8 --- /dev/null +++ b/Net/testsuite/src/ICMPSocketTest.cpp @@ -0,0 +1,115 @@ +// +// ICMPSocketTest.cpp +// +// $Id: //poco/1.2/Net/testsuite/src/ICMPSocketTest.cpp#1 $ +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#include "ICMPSocketTest.h" +#include "CppUnit/TestCaller.h" +#include "CppUnit/TestSuite.h" +#include "UDPEchoServer.h" +#include "Poco/Net/ICMPSocket.h" +#include "Poco/Net/SocketAddress.h" +#include "Poco/Net/NetException.h" +#include "Poco/Timespan.h" +#include "Poco/Stopwatch.h" + + +using Poco::Net::Socket; +using Poco::Net::ICMPSocket; +using Poco::Net::SocketAddress; +using Poco::Net::IPAddress; +using Poco::Timespan; +using Poco::Stopwatch; +using Poco::TimeoutException; +using Poco::Net::ICMPException; + + +ICMPSocketTest::ICMPSocketTest(const std::string& name): CppUnit::TestCase(name) +{ +} + + +ICMPSocketTest::~ICMPSocketTest() +{ +} + + +void ICMPSocketTest::testAssign() +{ + ICMPSocket s1(IPAddress::IPv4); + ICMPSocket s2(s1); +} + +void ICMPSocketTest::testSendToReceiveFrom() +{ + ICMPSocket ss(IPAddress::IPv4); + + SocketAddress sa("www.appinf.com", 0); + SocketAddress sr(sa); + + try + { + ss.receiveFrom(sa); + fail("must throw"); + } + catch(ICMPException&) + { + } + catch(TimeoutException&) + { + } + + ss.sendTo(sa); + ss.receiveFrom(sa); + + assert(sr.host().toString() == sa.host().toString()); + ss.close(); +} + + +void ICMPSocketTest::setUp() +{ +} + + +void ICMPSocketTest::tearDown() +{ +} + + +CppUnit::Test* ICMPSocketTest::suite() +{ + CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("ICMPSocketTest"); + + CppUnit_addTest(pSuite, ICMPSocketTest, testSendToReceiveFrom); + CppUnit_addTest(pSuite, ICMPSocketTest, testAssign); + + return pSuite; +} diff --git a/Net/testsuite/src/ICMPSocketTest.h b/Net/testsuite/src/ICMPSocketTest.h new file mode 100644 index 000000000..c7629cebf --- /dev/null +++ b/Net/testsuite/src/ICMPSocketTest.h @@ -0,0 +1,61 @@ +// +// ICMPSocketTest.h +// +// $Id: //poco/1.2/Net/testsuite/src/ICMPSocketTest.h#1 $ +// +// Definition of the ICMPSocketTest class. +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef ICMPSocketTest_INCLUDED +#define ICMPSocketTest_INCLUDED + + +#include "Poco/Net/Net.h" +#include "CppUnit/TestCase.h" + + +class ICMPSocketTest: public CppUnit::TestCase +{ +public: + ICMPSocketTest(const std::string& name); + ~ICMPSocketTest(); + + void testSendToReceiveFrom(); + void testAssign(); + + void setUp(); + void tearDown(); + + static CppUnit::Test* suite(); + +private: +}; + + +#endif // ICMPSocketTest_INCLUDED diff --git a/Net/testsuite/src/IPAddressTest.cpp b/Net/testsuite/src/IPAddressTest.cpp index c25c3670d..40ccdf084 100644 --- a/Net/testsuite/src/IPAddressTest.cpp +++ b/Net/testsuite/src/IPAddressTest.cpp @@ -1,7 +1,7 @@ // // IPAddressTest.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/IPAddressTest.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/IPAddressTest.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,12 +33,12 @@ #include "IPAddressTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Net/IPAddress.h" -#include "Net/NetException.h" +#include "Poco/Net/IPAddress.h" +#include "Poco/Net/NetException.h" -using Net::IPAddress; -using Net::InvalidAddressException; +using Poco::Net::IPAddress; +using Poco::Net::InvalidAddressException; IPAddressTest::IPAddressTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Net/testsuite/src/IPAddressTest.h b/Net/testsuite/src/IPAddressTest.h index 2b94508b1..e10b7bf8c 100644 --- a/Net/testsuite/src/IPAddressTest.h +++ b/Net/testsuite/src/IPAddressTest.h @@ -1,7 +1,7 @@ // // IPAddressTest.h // -// $Id: //poco/1.1.0/Net/testsuite/src/IPAddressTest.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/IPAddressTest.h#1 $ // // Definition of the IPAddressTest class. // @@ -36,12 +36,8 @@ #define IPAddressTest_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Net/Net.h" #include "CppUnit/TestCase.h" -#endif class IPAddressTest: public CppUnit::TestCase diff --git a/Net/testsuite/src/MailMessageTest.cpp b/Net/testsuite/src/MailMessageTest.cpp index badf39b1a..b00d92c46 100644 --- a/Net/testsuite/src/MailMessageTest.cpp +++ b/Net/testsuite/src/MailMessageTest.cpp @@ -1,7 +1,7 @@ // // MailMessageTest.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/MailMessageTest.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/MailMessageTest.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,23 +33,23 @@ #include "MailMessageTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Net/MailMessage.h" -#include "Net/MailRecipient.h" -#include "Net/PartHandler.h" -#include "Net/StringPartSource.h" -#include "Net/MediaType.h" -#include "Foundation/Timestamp.h" +#include "Poco/Net/MailMessage.h" +#include "Poco/Net/MailRecipient.h" +#include "Poco/Net/PartHandler.h" +#include "Poco/Net/StringPartSource.h" +#include "Poco/Net/MediaType.h" +#include "Poco/Timestamp.h" #include #include -using Net::MailMessage; -using Net::MailRecipient; -using Net::MessageHeader; -using Net::PartHandler; -using Net::MediaType; -using Net::StringPartSource; -using Foundation::Timestamp; +using Poco::Net::MailMessage; +using Poco::Net::MailRecipient; +using Poco::Net::MessageHeader; +using Poco::Net::PartHandler; +using Poco::Net::MediaType; +using Poco::Net::StringPartSource; +using Poco::Timestamp; namespace diff --git a/Net/testsuite/src/MailMessageTest.h b/Net/testsuite/src/MailMessageTest.h index 4c5704d90..28894146e 100644 --- a/Net/testsuite/src/MailMessageTest.h +++ b/Net/testsuite/src/MailMessageTest.h @@ -1,7 +1,7 @@ // // MailMessageTest.h // -// $Id: //poco/1.1.0/Net/testsuite/src/MailMessageTest.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/MailMessageTest.h#1 $ // // Definition of the MailMessageTest class. // @@ -36,12 +36,8 @@ #define MailMessageTest_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Net/Net.h" #include "CppUnit/TestCase.h" -#endif class MailMessageTest: public CppUnit::TestCase diff --git a/Net/testsuite/src/MailStreamTest.cpp b/Net/testsuite/src/MailStreamTest.cpp index 481f457c5..13a01676f 100644 --- a/Net/testsuite/src/MailStreamTest.cpp +++ b/Net/testsuite/src/MailStreamTest.cpp @@ -1,7 +1,7 @@ // // MailStreamTest.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/MailStreamTest.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/MailStreamTest.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,14 +33,14 @@ #include "MailStreamTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Net/MailStream.h" -#include "Foundation/StreamCopier.h" +#include "Poco/Net/MailStream.h" +#include "Poco/StreamCopier.h" #include -using Net::MailInputStream; -using Net::MailOutputStream; -using Foundation::StreamCopier; +using Poco::Net::MailInputStream; +using Poco::Net::MailOutputStream; +using Poco::StreamCopier; MailStreamTest::MailStreamTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Net/testsuite/src/MailStreamTest.h b/Net/testsuite/src/MailStreamTest.h index 7d97c951b..88f4a701c 100644 --- a/Net/testsuite/src/MailStreamTest.h +++ b/Net/testsuite/src/MailStreamTest.h @@ -1,7 +1,7 @@ // // MailStreamTest.h // -// $Id: //poco/1.1.0/Net/testsuite/src/MailStreamTest.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/MailStreamTest.h#1 $ // // Definition of the MailStreamTest class. // @@ -36,12 +36,8 @@ #define MailStreamTest_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Net/Net.h" #include "CppUnit/TestCase.h" -#endif class MailStreamTest: public CppUnit::TestCase diff --git a/Net/testsuite/src/MailTestSuite.cpp b/Net/testsuite/src/MailTestSuite.cpp index 76d21fabf..6cde46c34 100644 --- a/Net/testsuite/src/MailTestSuite.cpp +++ b/Net/testsuite/src/MailTestSuite.cpp @@ -1,7 +1,7 @@ // // MailTestSuite.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/MailTestSuite.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/MailTestSuite.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. diff --git a/Net/testsuite/src/MailTestSuite.h b/Net/testsuite/src/MailTestSuite.h index 621442957..bc81c0351 100644 --- a/Net/testsuite/src/MailTestSuite.h +++ b/Net/testsuite/src/MailTestSuite.h @@ -1,7 +1,7 @@ // // MailTestSuite.h // -// $Id: //poco/1.1.0/Net/testsuite/src/MailTestSuite.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/MailTestSuite.h#1 $ // // Definition of the MailTestSuite class. // @@ -36,9 +36,7 @@ #define MailTestSuite_INCLUDED -#ifndef CppUnit_TestSuite_INCLUDED #include "CppUnit/TestSuite.h" -#endif class MailTestSuite diff --git a/Net/testsuite/src/MediaTypeTest.cpp b/Net/testsuite/src/MediaTypeTest.cpp index 739b45635..a2a9b1c2d 100644 --- a/Net/testsuite/src/MediaTypeTest.cpp +++ b/Net/testsuite/src/MediaTypeTest.cpp @@ -1,7 +1,7 @@ // // MediaTypeTest.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/MediaTypeTest.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/MediaTypeTest.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,10 +33,10 @@ #include "MediaTypeTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Net/MediaType.h" +#include "Poco/Net/MediaType.h" -using Net::MediaType; +using Poco::Net::MediaType; MediaTypeTest::MediaTypeTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Net/testsuite/src/MediaTypeTest.h b/Net/testsuite/src/MediaTypeTest.h index c809da830..93457016b 100644 --- a/Net/testsuite/src/MediaTypeTest.h +++ b/Net/testsuite/src/MediaTypeTest.h @@ -1,7 +1,7 @@ // // MediaTypeTest.h // -// $Id: //poco/1.1.0/Net/testsuite/src/MediaTypeTest.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/MediaTypeTest.h#1 $ // // Definition of the MediaTypeTest class. // @@ -36,12 +36,8 @@ #define MediaTypeTest_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Net/Net.h" #include "CppUnit/TestCase.h" -#endif class MediaTypeTest: public CppUnit::TestCase diff --git a/Net/testsuite/src/MessageHeaderTest.cpp b/Net/testsuite/src/MessageHeaderTest.cpp index 8d9bbed55..baafea579 100644 --- a/Net/testsuite/src/MessageHeaderTest.cpp +++ b/Net/testsuite/src/MessageHeaderTest.cpp @@ -1,7 +1,7 @@ // // MessageHeaderTest.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/MessageHeaderTest.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/MessageHeaderTest.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,14 +33,14 @@ #include "MessageHeaderTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Net/MessageHeader.h" -#include "Net/NetException.h" +#include "Poco/Net/MessageHeader.h" +#include "Poco/Net/NetException.h" #include -using Net::MessageHeader; -using Net::NameValueCollection; -using Net::MessageException; +using Poco::Net::MessageHeader; +using Poco::Net::NameValueCollection; +using Poco::Net::MessageException; MessageHeaderTest::MessageHeaderTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Net/testsuite/src/MessageHeaderTest.h b/Net/testsuite/src/MessageHeaderTest.h index c0b5b2511..db5319b16 100644 --- a/Net/testsuite/src/MessageHeaderTest.h +++ b/Net/testsuite/src/MessageHeaderTest.h @@ -1,7 +1,7 @@ // // MessageHeaderTest.h // -// $Id: //poco/1.1.0/Net/testsuite/src/MessageHeaderTest.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/MessageHeaderTest.h#1 $ // // Definition of the MessageHeaderTest class. // @@ -36,12 +36,8 @@ #define MessageHeaderTest_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Net/Net.h" #include "CppUnit/TestCase.h" -#endif class MessageHeaderTest: public CppUnit::TestCase diff --git a/Net/testsuite/src/MessagesTestSuite.cpp b/Net/testsuite/src/MessagesTestSuite.cpp index a92b63167..28b765e62 100644 --- a/Net/testsuite/src/MessagesTestSuite.cpp +++ b/Net/testsuite/src/MessagesTestSuite.cpp @@ -1,7 +1,7 @@ // // MessagesTestSuite.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/MessagesTestSuite.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/MessagesTestSuite.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. diff --git a/Net/testsuite/src/MessagesTestSuite.h b/Net/testsuite/src/MessagesTestSuite.h index bdf1eb48c..d8c4bf31a 100644 --- a/Net/testsuite/src/MessagesTestSuite.h +++ b/Net/testsuite/src/MessagesTestSuite.h @@ -1,7 +1,7 @@ // // MessagesTestSuite.h // -// $Id: //poco/1.1.0/Net/testsuite/src/MessagesTestSuite.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/MessagesTestSuite.h#1 $ // // Definition of the MessagesTestSuite class. // @@ -36,9 +36,7 @@ #define MessagesTestSuite_INCLUDED -#ifndef CppUnit_TestSuite_INCLUDED #include "CppUnit/TestSuite.h" -#endif class MessagesTestSuite diff --git a/Net/testsuite/src/MulticastEchoServer.cpp b/Net/testsuite/src/MulticastEchoServer.cpp index 43714af54..f175c5124 100644 --- a/Net/testsuite/src/MulticastEchoServer.cpp +++ b/Net/testsuite/src/MulticastEchoServer.cpp @@ -1,7 +1,7 @@ // // MulticastEchoServer.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/MulticastEchoServer.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/MulticastEchoServer.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -31,15 +31,15 @@ #include "MulticastEchoServer.h" -#include "Foundation/Timespan.h" +#include "Poco/Timespan.h" #include -using Net::Socket; -using Net::DatagramSocket; -using Net::SocketAddress; -using Net::IPAddress; -using Net::NetworkInterface; +using Poco::Net::Socket; +using Poco::Net::DatagramSocket; +using Poco::Net::SocketAddress; +using Poco::Net::IPAddress; +using Poco::Net::NetworkInterface; MulticastEchoServer::MulticastEchoServer(): @@ -63,7 +63,7 @@ MulticastEchoServer::~MulticastEchoServer() } -Foundation::UInt16 MulticastEchoServer::port() const +Poco::UInt16 MulticastEchoServer::port() const { return _socket.address().port(); } @@ -72,7 +72,7 @@ Foundation::UInt16 MulticastEchoServer::port() const void MulticastEchoServer::run() { _ready.set(); - Foundation::Timespan span(250000); + Poco::Timespan span(250000); while (!_stop) { if (_socket.poll(span, Socket::SELECT_READ)) @@ -84,7 +84,7 @@ void MulticastEchoServer::run() int n = _socket.receiveFrom(buffer, sizeof(buffer), sender); _socket.sendTo(buffer, n, sender); } - catch (Foundation::Exception& exc) + catch (Poco::Exception& exc) { std::cerr << "MulticastEchoServer: " << exc.displayText() << std::endl; } @@ -105,7 +105,7 @@ const NetworkInterface& MulticastEchoServer::interface() const } -Net::NetworkInterface MulticastEchoServer::findInterface() +Poco::Net::NetworkInterface MulticastEchoServer::findInterface() { NetworkInterface::NetworkInterfaceList ifs = NetworkInterface::list(); for (NetworkInterface::NetworkInterfaceList::const_iterator it = ifs.begin(); it != ifs.end(); ++it) diff --git a/Net/testsuite/src/MulticastEchoServer.h b/Net/testsuite/src/MulticastEchoServer.h index be88fb66e..8e180bd1d 100644 --- a/Net/testsuite/src/MulticastEchoServer.h +++ b/Net/testsuite/src/MulticastEchoServer.h @@ -1,7 +1,7 @@ // // MulticastEchoServer.h // -// $Id: //poco/1.1.0/Net/testsuite/src/MulticastEchoServer.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/MulticastEchoServer.h#1 $ // // Definition of the MulticastEchoServer class. // @@ -36,27 +36,15 @@ #define MulticastEchoServer_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_MulticastSocket_INCLUDED -#include "Net/MulticastSocket.h" -#endif -#ifndef Net_SocketAddress_INCLUDED -#include "Net/SocketAddress.h" -#endif -#ifndef Net_NetworkInterface_INCLUDED -#include "Net/NetworkInterface.h" -#endif -#ifndef Net_Foundation_Thread_INCLUDED -#include "Foundation/Thread.h" -#endif -#ifndef Net_Foundation_Event_INCLUDED -#include "Foundation/Event.h" -#endif +#include "Poco/Net/Net.h" +#include "Poco/Net/MulticastSocket.h" +#include "Poco/Net/SocketAddress.h" +#include "Poco/Net/NetworkInterface.h" +#include "Poco/Thread.h" +#include "Poco/Event.h" -class MulticastEchoServer: public Foundation::Runnable +class MulticastEchoServer: public Poco::Runnable /// A simple sequential Multicast echo server. { public: @@ -66,31 +54,31 @@ public: ~MulticastEchoServer(); /// Destroys the MulticastEchoServer. - Foundation::UInt16 port() const; + Poco::UInt16 port() const; /// Returns the port the echo server is /// listening on. void run(); /// Does the work. - const Net::SocketAddress& group() const; + const Poco::Net::SocketAddress& group() const; /// Returns the group address where the server listens. - const Net::NetworkInterface& interface() const; + const Poco::Net::NetworkInterface& interface() const; /// Returns the network interface for multicasting. protected: - static Net::NetworkInterface findInterface(); + static Poco::Net::NetworkInterface findInterface(); /// Finds an appropriate network interface for /// multicasting. private: - Net::MulticastSocket _socket; - Net::SocketAddress _group; - Net::NetworkInterface _if; - Foundation::Thread _thread; - Foundation::Event _ready; - bool _stop; + Poco::Net::MulticastSocket _socket; + Poco::Net::SocketAddress _group; + Poco::Net::NetworkInterface _if; + Poco::Thread _thread; + Poco::Event _ready; + bool _stop; }; diff --git a/Net/testsuite/src/MulticastSocketTest.cpp b/Net/testsuite/src/MulticastSocketTest.cpp index 2275060bd..45bf84ff4 100644 --- a/Net/testsuite/src/MulticastSocketTest.cpp +++ b/Net/testsuite/src/MulticastSocketTest.cpp @@ -1,7 +1,7 @@ // // MulticastSocketTest.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/MulticastSocketTest.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/MulticastSocketTest.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -34,22 +34,22 @@ #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" #include "MulticastEchoServer.h" -#include "Net/MulticastSocket.h" -#include "Net/SocketAddress.h" -#include "Net/NetException.h" -#include "Foundation/Timespan.h" -#include "Foundation/Stopwatch.h" +#include "Poco/Net/MulticastSocket.h" +#include "Poco/Net/SocketAddress.h" +#include "Poco/Net/NetException.h" +#include "Poco/Timespan.h" +#include "Poco/Stopwatch.h" -using Net::Socket; -using Net::MulticastSocket; -using Net::SocketAddress; -using Net::IPAddress; -using Foundation::Timespan; -using Foundation::Stopwatch; -using Foundation::TimeoutException; -using Foundation::InvalidArgumentException; -using Foundation::IOException; +using Poco::Net::Socket; +using Poco::Net::MulticastSocket; +using Poco::Net::SocketAddress; +using Poco::Net::IPAddress; +using Poco::Timespan; +using Poco::Stopwatch; +using Poco::TimeoutException; +using Poco::InvalidArgumentException; +using Poco::IOException; MulticastSocketTest::MulticastSocketTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Net/testsuite/src/MulticastSocketTest.h b/Net/testsuite/src/MulticastSocketTest.h index 13f0e5b03..cdd121692 100644 --- a/Net/testsuite/src/MulticastSocketTest.h +++ b/Net/testsuite/src/MulticastSocketTest.h @@ -1,7 +1,7 @@ // // MulticastSocketTest.h // -// $Id: //poco/1.1.0/Net/testsuite/src/MulticastSocketTest.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/MulticastSocketTest.h#1 $ // // Definition of the MulticastSocketTest class. // @@ -36,12 +36,8 @@ #define MulticastSocketTest_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Net/Net.h" #include "CppUnit/TestCase.h" -#endif class MulticastSocketTest: public CppUnit::TestCase diff --git a/Net/testsuite/src/MultipartReaderTest.cpp b/Net/testsuite/src/MultipartReaderTest.cpp index 7a3b58d25..ddcaaea78 100644 --- a/Net/testsuite/src/MultipartReaderTest.cpp +++ b/Net/testsuite/src/MultipartReaderTest.cpp @@ -1,7 +1,7 @@ // // MultipartReaderTest.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/MultipartReaderTest.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/MultipartReaderTest.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,15 +33,15 @@ #include "MultipartReaderTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Net/MultipartReader.h" -#include "Net/MessageHeader.h" -#include "Net/NetException.h" +#include "Poco/Net/MultipartReader.h" +#include "Poco/Net/MessageHeader.h" +#include "Poco/Net/NetException.h" #include -using Net::MultipartReader; -using Net::MessageHeader; -using Net::MultipartException; +using Poco::Net::MultipartReader; +using Poco::Net::MessageHeader; +using Poco::Net::MultipartException; MultipartReaderTest::MultipartReaderTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Net/testsuite/src/MultipartReaderTest.h b/Net/testsuite/src/MultipartReaderTest.h index d0dcbead2..fe58a7d06 100644 --- a/Net/testsuite/src/MultipartReaderTest.h +++ b/Net/testsuite/src/MultipartReaderTest.h @@ -1,7 +1,7 @@ // // MultipartReaderTest.h // -// $Id: //poco/1.1.0/Net/testsuite/src/MultipartReaderTest.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/MultipartReaderTest.h#1 $ // // Definition of the MultipartReaderTest class. // @@ -36,12 +36,8 @@ #define MultipartReaderTest_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Net/Net.h" #include "CppUnit/TestCase.h" -#endif class MultipartReaderTest: public CppUnit::TestCase diff --git a/Net/testsuite/src/MultipartWriterTest.cpp b/Net/testsuite/src/MultipartWriterTest.cpp index cb1e551d9..f757bd63d 100644 --- a/Net/testsuite/src/MultipartWriterTest.cpp +++ b/Net/testsuite/src/MultipartWriterTest.cpp @@ -1,7 +1,7 @@ // // MultipartWriterTest.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/MultipartWriterTest.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/MultipartWriterTest.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,13 +33,13 @@ #include "MultipartWriterTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Net/MultipartWriter.h" -#include "Net/MessageHeader.h" +#include "Poco/Net/MultipartWriter.h" +#include "Poco/Net/MessageHeader.h" #include -using Net::MultipartWriter; -using Net::MessageHeader; +using Poco::Net::MultipartWriter; +using Poco::Net::MessageHeader; MultipartWriterTest::MultipartWriterTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Net/testsuite/src/MultipartWriterTest.h b/Net/testsuite/src/MultipartWriterTest.h index af7ac1420..2e5c08997 100644 --- a/Net/testsuite/src/MultipartWriterTest.h +++ b/Net/testsuite/src/MultipartWriterTest.h @@ -1,7 +1,7 @@ // // MultipartWriterTest.h // -// $Id: //poco/1.1.0/Net/testsuite/src/MultipartWriterTest.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/MultipartWriterTest.h#1 $ // // Definition of the MultipartWriterTest class. // @@ -36,12 +36,8 @@ #define MultipartWriterTest_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Net/Net.h" #include "CppUnit/TestCase.h" -#endif class MultipartWriterTest: public CppUnit::TestCase diff --git a/Net/testsuite/src/NameValueCollectionTest.cpp b/Net/testsuite/src/NameValueCollectionTest.cpp index 688f6e169..90c92e731 100644 --- a/Net/testsuite/src/NameValueCollectionTest.cpp +++ b/Net/testsuite/src/NameValueCollectionTest.cpp @@ -1,7 +1,7 @@ // // NameValueCollectionTest.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/NameValueCollectionTest.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/NameValueCollectionTest.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,12 +33,12 @@ #include "NameValueCollectionTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Net/NameValueCollection.h" -#include "Foundation/Exception.h" +#include "Poco/Net/NameValueCollection.h" +#include "Poco/Exception.h" -using Net::NameValueCollection; -using Foundation::NotFoundException; +using Poco::Net::NameValueCollection; +using Poco::NotFoundException; NameValueCollectionTest::NameValueCollectionTest(const std::string& name): CppUnit::TestCase(name) @@ -86,6 +86,9 @@ void NameValueCollectionTest::testNameValueCollection() catch (NotFoundException&) { } + + assert (nvc.get("name", "default") == "value"); + assert (nvc.get("name3", "default") == "default"); assert (nvc.has("name")); assert (nvc.has("name2")); diff --git a/Net/testsuite/src/NameValueCollectionTest.h b/Net/testsuite/src/NameValueCollectionTest.h index 90686992d..776c588ec 100644 --- a/Net/testsuite/src/NameValueCollectionTest.h +++ b/Net/testsuite/src/NameValueCollectionTest.h @@ -1,7 +1,7 @@ // // NameValueCollectionTest.h // -// $Id: //poco/1.1.0/Net/testsuite/src/NameValueCollectionTest.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/NameValueCollectionTest.h#1 $ // // Definition of the NameValueCollectionTest class. // @@ -36,12 +36,8 @@ #define NameValueCollectionTest_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Net/Net.h" #include "CppUnit/TestCase.h" -#endif class NameValueCollectionTest: public CppUnit::TestCase diff --git a/Net/testsuite/src/NetCoreTestSuite.cpp b/Net/testsuite/src/NetCoreTestSuite.cpp index 59ed96ce5..3c96e3f13 100644 --- a/Net/testsuite/src/NetCoreTestSuite.cpp +++ b/Net/testsuite/src/NetCoreTestSuite.cpp @@ -1,7 +1,7 @@ // // NetCoreTestSuite.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/NetCoreTestSuite.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/NetCoreTestSuite.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. diff --git a/Net/testsuite/src/NetCoreTestSuite.h b/Net/testsuite/src/NetCoreTestSuite.h index 6b8e41af0..88a5fb2ad 100644 --- a/Net/testsuite/src/NetCoreTestSuite.h +++ b/Net/testsuite/src/NetCoreTestSuite.h @@ -1,7 +1,7 @@ // // NetCoreTestSuite.h // -// $Id: //poco/1.1.0/Net/testsuite/src/NetCoreTestSuite.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/NetCoreTestSuite.h#1 $ // // Definition of the NetCoreTestSuite class. // @@ -36,9 +36,7 @@ #define NetCoreTestSuite_INCLUDED -#ifndef CppUnit_TestSuite_INCLUDED #include "CppUnit/TestSuite.h" -#endif class NetCoreTestSuite diff --git a/Net/testsuite/src/NetTestSuite.cpp b/Net/testsuite/src/NetTestSuite.cpp index fc5097516..2d8f1a9f6 100644 --- a/Net/testsuite/src/NetTestSuite.cpp +++ b/Net/testsuite/src/NetTestSuite.cpp @@ -1,7 +1,7 @@ // // NetTestSuite.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/NetTestSuite.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/NetTestSuite.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -42,6 +42,7 @@ #include "ReactorTestSuite.h" #include "FTPClientTestSuite.h" #include "MailTestSuite.h" +#include "ICMPClientTestSuite.h" CppUnit::Test* NetTestSuite::suite() @@ -59,6 +60,7 @@ CppUnit::Test* NetTestSuite::suite() pSuite->addTest(ReactorTestSuite::suite()); pSuite->addTest(FTPClientTestSuite::suite()); pSuite->addTest(MailTestSuite::suite()); + pSuite->addTest(ICMPClientTestSuite::suite()); return pSuite; } diff --git a/Net/testsuite/src/NetTestSuite.h b/Net/testsuite/src/NetTestSuite.h index a7ff42714..4fb19ab4e 100644 --- a/Net/testsuite/src/NetTestSuite.h +++ b/Net/testsuite/src/NetTestSuite.h @@ -1,7 +1,7 @@ // // NetTestSuite.h // -// $Id: //poco/1.1.0/Net/testsuite/src/NetTestSuite.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/NetTestSuite.h#1 $ // // Definition of the NetTestSuite class. // @@ -36,9 +36,7 @@ #define NetTestSuite_INCLUDED -#ifndef CppUnit_TestSuite_INCLUDED #include "CppUnit/TestSuite.h" -#endif class NetTestSuite diff --git a/Net/testsuite/src/NetworkInterfaceTest.cpp b/Net/testsuite/src/NetworkInterfaceTest.cpp index 7cf8be84b..2c1e1b068 100644 --- a/Net/testsuite/src/NetworkInterfaceTest.cpp +++ b/Net/testsuite/src/NetworkInterfaceTest.cpp @@ -1,7 +1,7 @@ // // NetworkInterfaceTest.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/NetworkInterfaceTest.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/NetworkInterfaceTest.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,11 +33,11 @@ #include "NetworkInterfaceTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Net/NetworkInterface.h" +#include "Poco/Net/NetworkInterface.h" #include -using Net::NetworkInterface; +using Poco::Net::NetworkInterface; NetworkInterfaceTest::NetworkInterfaceTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Net/testsuite/src/NetworkInterfaceTest.h b/Net/testsuite/src/NetworkInterfaceTest.h index 8bbfdab65..6d238950c 100644 --- a/Net/testsuite/src/NetworkInterfaceTest.h +++ b/Net/testsuite/src/NetworkInterfaceTest.h @@ -1,7 +1,7 @@ // // NetworkInterfaceTest.h // -// $Id: //poco/1.1.0/Net/testsuite/src/NetworkInterfaceTest.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/NetworkInterfaceTest.h#1 $ // // Definition of the NetworkInterfaceTest class. // @@ -36,12 +36,8 @@ #define NetworkInterfaceTest_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Net/Net.h" #include "CppUnit/TestCase.h" -#endif class NetworkInterfaceTest: public CppUnit::TestCase diff --git a/Net/testsuite/src/POP3ClientSessionTest.cpp b/Net/testsuite/src/POP3ClientSessionTest.cpp index e8ea0df62..574fc7b81 100644 --- a/Net/testsuite/src/POP3ClientSessionTest.cpp +++ b/Net/testsuite/src/POP3ClientSessionTest.cpp @@ -1,7 +1,7 @@ // // POP3ClientSessionTest.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/POP3ClientSessionTest.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/POP3ClientSessionTest.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -34,15 +34,15 @@ #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" #include "DialogServer.h" -#include "Net/POP3ClientSession.h" -#include "Net/MailMessage.h" -#include "Net/NetException.h" +#include "Poco/Net/POP3ClientSession.h" +#include "Poco/Net/MailMessage.h" +#include "Poco/Net/NetException.h" -using Net::POP3ClientSession; -using Net::MessageHeader; -using Net::MailMessage; -using Net::POP3Exception; +using Poco::Net::POP3ClientSession; +using Poco::Net::MessageHeader; +using Poco::Net::MailMessage; +using Poco::Net::POP3Exception; POP3ClientSessionTest::POP3ClientSessionTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Net/testsuite/src/POP3ClientSessionTest.h b/Net/testsuite/src/POP3ClientSessionTest.h index 1957ada10..146abb41d 100644 --- a/Net/testsuite/src/POP3ClientSessionTest.h +++ b/Net/testsuite/src/POP3ClientSessionTest.h @@ -1,7 +1,7 @@ // // POP3ClientSessionTest.h // -// $Id: //poco/1.1.0/Net/testsuite/src/POP3ClientSessionTest.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/POP3ClientSessionTest.h#1 $ // // Definition of the POP3ClientSessionTest class. // @@ -36,12 +36,8 @@ #define POP3ClientSessionTest_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Net/Net.h" #include "CppUnit/TestCase.h" -#endif class POP3ClientSessionTest: public CppUnit::TestCase diff --git a/Net/testsuite/src/QuotedPrintableTest.cpp b/Net/testsuite/src/QuotedPrintableTest.cpp index 24c318e0d..53d9415e4 100644 --- a/Net/testsuite/src/QuotedPrintableTest.cpp +++ b/Net/testsuite/src/QuotedPrintableTest.cpp @@ -1,7 +1,7 @@ // // QuotedPrintableTest.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/QuotedPrintableTest.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/QuotedPrintableTest.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,13 +33,13 @@ #include "QuotedPrintableTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Net/QuotedPrintableEncoder.h" -#include "Net/QuotedPrintableDecoder.h" +#include "Poco/Net/QuotedPrintableEncoder.h" +#include "Poco/Net/QuotedPrintableDecoder.h" #include -using Net::QuotedPrintableEncoder; -using Net::QuotedPrintableDecoder; +using Poco::Net::QuotedPrintableEncoder; +using Poco::Net::QuotedPrintableDecoder; QuotedPrintableTest::QuotedPrintableTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Net/testsuite/src/QuotedPrintableTest.h b/Net/testsuite/src/QuotedPrintableTest.h index 688adf085..d7ce2da41 100644 --- a/Net/testsuite/src/QuotedPrintableTest.h +++ b/Net/testsuite/src/QuotedPrintableTest.h @@ -1,7 +1,7 @@ // // QuotedPrintableTest.h // -// $Id: //poco/1.1.0/Net/testsuite/src/QuotedPrintableTest.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/QuotedPrintableTest.h#1 $ // // Definition of the QuotedPrintableTest class. // @@ -36,12 +36,8 @@ #define QuotedPrintableTest_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Net/Net.h" #include "CppUnit/TestCase.h" -#endif class QuotedPrintableTest: public CppUnit::TestCase diff --git a/Net/testsuite/src/RawSocketTest.cpp b/Net/testsuite/src/RawSocketTest.cpp new file mode 100644 index 000000000..7c006776a --- /dev/null +++ b/Net/testsuite/src/RawSocketTest.cpp @@ -0,0 +1,127 @@ +// +// RawSocketTest.cpp +// +// $Id: //poco/1.2/Net/testsuite/src/RawSocketTest.cpp#1 $ +// +// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#include "RawSocketTest.h" +#include "CppUnit/TestCaller.h" +#include "CppUnit/TestSuite.h" +#include "Poco/Net/RawSocket.h" +#include "Poco/Net/RawSocketImpl.h" +#include "Poco/Net/SocketAddress.h" +#include "Poco/Net/NetException.h" +#include "Poco/Timespan.h" +#include "Poco/Stopwatch.h" + + +using Poco::Net::Socket; +using Poco::Net::RawSocket; +using Poco::Net::RawSocketImpl; +using Poco::Net::SocketAddress; +using Poco::Net::IPAddress; +using Poco::Timespan; +using Poco::Stopwatch; +using Poco::TimeoutException; +using Poco::InvalidArgumentException; +using Poco::IOException; + + +RawSocketTest::RawSocketTest(const std::string& name): CppUnit::TestCase(name) +{ +} + + +RawSocketTest::~RawSocketTest() +{ +} + + +void RawSocketTest::testEchoIPv4() +{ + SocketAddress sa("localhost", 0); + RawSocket rs(IPAddress::IPv4); + rs.connect(sa); + + int n = rs.sendBytes("hello", 5); + assert (5 == n); + + char buffer[256] = ""; + unsigned char* ptr = (unsigned char*) buffer; + + n = rs.receiveBytes(buffer, sizeof(buffer)); + int shift = ((buffer[0] & 0x0F) * 4); + ptr += shift; + + assert (5 == (n - shift)); + assert ("hello" == std::string((char*)ptr, 5)); + + rs.close(); +} + + +void RawSocketTest::testSendToReceiveFromIPv4() +{ + RawSocket rs(IPAddress::IPv4); + + int n = rs.sendTo("hello", 5, SocketAddress("localhost", 0)); + assert (n == 5); + + char buffer[256] = ""; + unsigned char* ptr = (unsigned char*) buffer; + SocketAddress sa; + n = rs.receiveFrom(buffer, sizeof(buffer), sa); + int shift = ((buffer[0] & 0x0F) * 4); + ptr += shift; + + assert ((n - shift) == 5); + assert ("hello" == std::string((char*)ptr, 5)); + rs.close(); +} + + +void RawSocketTest::setUp() +{ +} + + +void RawSocketTest::tearDown() +{ +} + + +CppUnit::Test* RawSocketTest::suite() +{ + CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("RawSocketTest"); + + CppUnit_addTest(pSuite, RawSocketTest, testEchoIPv4); + CppUnit_addTest(pSuite, RawSocketTest, testSendToReceiveFromIPv4); + + return pSuite; +} diff --git a/Net/testsuite/src/RawSocketTest.h b/Net/testsuite/src/RawSocketTest.h new file mode 100644 index 000000000..ad156edd8 --- /dev/null +++ b/Net/testsuite/src/RawSocketTest.h @@ -0,0 +1,61 @@ +// +// RawSocketTest.h +// +// $Id: //poco/1.2/Net/testsuite/src/RawSocketTest.h#1 $ +// +// Definition of the RawSocketTest class. +// +// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef RawSocketTest_INCLUDED +#define RawSocketTest_INCLUDED + + +#include "Poco/Net/Net.h" +#include "CppUnit/TestCase.h" + + +class RawSocketTest: public CppUnit::TestCase +{ +public: + RawSocketTest(const std::string& name); + ~RawSocketTest(); + + void testEchoIPv4(); + void testSendToReceiveFromIPv4(); + + void setUp(); + void tearDown(); + + static CppUnit::Test* suite(); + +private: +}; + + +#endif // RawSocketTest_INCLUDED diff --git a/Net/testsuite/src/ReactorTestSuite.cpp b/Net/testsuite/src/ReactorTestSuite.cpp index 24bd3956a..b75416603 100644 --- a/Net/testsuite/src/ReactorTestSuite.cpp +++ b/Net/testsuite/src/ReactorTestSuite.cpp @@ -1,7 +1,7 @@ // // ReactorTestSuite.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/ReactorTestSuite.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/ReactorTestSuite.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. diff --git a/Net/testsuite/src/ReactorTestSuite.h b/Net/testsuite/src/ReactorTestSuite.h index 6f7438113..1dc6c5659 100644 --- a/Net/testsuite/src/ReactorTestSuite.h +++ b/Net/testsuite/src/ReactorTestSuite.h @@ -1,7 +1,7 @@ // // ReactorTestSuite.h // -// $Id: //poco/1.1.0/Net/testsuite/src/ReactorTestSuite.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/ReactorTestSuite.h#1 $ // // Definition of the ReactorTestSuite class. // @@ -36,9 +36,7 @@ #define ReactorTestSuite_INCLUDED -#ifndef CppUnit_TestSuite_INCLUDED #include "CppUnit/TestSuite.h" -#endif class ReactorTestSuite diff --git a/Net/testsuite/src/SMTPClientSessionTest.cpp b/Net/testsuite/src/SMTPClientSessionTest.cpp index 3f4659298..0e2e18ff6 100644 --- a/Net/testsuite/src/SMTPClientSessionTest.cpp +++ b/Net/testsuite/src/SMTPClientSessionTest.cpp @@ -1,7 +1,7 @@ // // SMTPClientSessionTest.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/SMTPClientSessionTest.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/SMTPClientSessionTest.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -34,16 +34,16 @@ #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" #include "DialogServer.h" -#include "Net/SMTPClientSession.h" -#include "Net/MailMessage.h" -#include "Net/MailRecipient.h" -#include "Net/NetException.h" +#include "Poco/Net/SMTPClientSession.h" +#include "Poco/Net/MailMessage.h" +#include "Poco/Net/MailRecipient.h" +#include "Poco/Net/NetException.h" -using Net::SMTPClientSession; -using Net::MailMessage; -using Net::MailRecipient; -using Net::SMTPException; +using Poco::Net::SMTPClientSession; +using Poco::Net::MailMessage; +using Poco::Net::MailRecipient; +using Poco::Net::SMTPException; SMTPClientSessionTest::SMTPClientSessionTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Net/testsuite/src/SMTPClientSessionTest.h b/Net/testsuite/src/SMTPClientSessionTest.h index b25bcde39..989b5c542 100644 --- a/Net/testsuite/src/SMTPClientSessionTest.h +++ b/Net/testsuite/src/SMTPClientSessionTest.h @@ -1,7 +1,7 @@ // // SMTPClientSessionTest.h // -// $Id: //poco/1.1.0/Net/testsuite/src/SMTPClientSessionTest.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/SMTPClientSessionTest.h#1 $ // // Definition of the SMTPClientSessionTest class. // @@ -36,12 +36,8 @@ #define SMTPClientSessionTest_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Net/Net.h" #include "CppUnit/TestCase.h" -#endif class SMTPClientSessionTest: public CppUnit::TestCase diff --git a/Net/testsuite/src/SocketAddressTest.cpp b/Net/testsuite/src/SocketAddressTest.cpp index 04b52ac28..a11699611 100644 --- a/Net/testsuite/src/SocketAddressTest.cpp +++ b/Net/testsuite/src/SocketAddressTest.cpp @@ -1,7 +1,7 @@ // // SocketAddressTest.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/SocketAddressTest.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/SocketAddressTest.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,16 +33,17 @@ #include "SocketAddressTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Net/SocketAddress.h" -#include "Net/NetException.h" +#include "Poco/Net/SocketAddress.h" +#include "Poco/Net/NetException.h" -using Net::SocketAddress; -using Net::IPAddress; -using Net::InvalidAddressException; -using Net::HostNotFoundException; -using Net::ServiceNotFoundException; -using Net::NoAddressFoundException; +using Poco::Net::SocketAddress; +using Poco::Net::IPAddress; +using Poco::Net::InvalidAddressException; +using Poco::Net::HostNotFoundException; +using Poco::Net::ServiceNotFoundException; +using Poco::Net::NoAddressFoundException; +using Poco::InvalidArgumentException; SocketAddressTest::SocketAddressTest(const std::string& name): CppUnit::TestCase(name) @@ -106,6 +107,32 @@ void SocketAddressTest::testSocketAddress() catch (ServiceNotFoundException&) { } + + SocketAddress sa7("192.168.2.120:88"); + assert (sa7.host().toString() == "192.168.2.120"); + assert (sa7.port() == 88); + + SocketAddress sa8("[192.168.2.120]:88"); + assert (sa8.host().toString() == "192.168.2.120"); + assert (sa8.port() == 88); + + try + { + SocketAddress sa9("[192.168.2.260]"); + fail("invalid address - must throw"); + } + catch (InvalidArgumentException&) + { + } + + try + { + SocketAddress sa9("[192.168.2.260:88"); + fail("invalid address - must throw"); + } + catch (InvalidArgumentException&) + { + } } diff --git a/Net/testsuite/src/SocketAddressTest.h b/Net/testsuite/src/SocketAddressTest.h index 63f3b0492..1f9a9e005 100644 --- a/Net/testsuite/src/SocketAddressTest.h +++ b/Net/testsuite/src/SocketAddressTest.h @@ -1,7 +1,7 @@ // // SocketAddressTest.h // -// $Id: //poco/1.1.0/Net/testsuite/src/SocketAddressTest.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/SocketAddressTest.h#1 $ // // Definition of the SocketAddressTest class. // @@ -36,12 +36,8 @@ #define SocketAddressTest_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Net/Net.h" #include "CppUnit/TestCase.h" -#endif class SocketAddressTest: public CppUnit::TestCase diff --git a/Net/testsuite/src/SocketReactorTest.cpp b/Net/testsuite/src/SocketReactorTest.cpp index b184c1066..b5257cffa 100644 --- a/Net/testsuite/src/SocketReactorTest.cpp +++ b/Net/testsuite/src/SocketReactorTest.cpp @@ -1,7 +1,7 @@ // // SocketReactorTest.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/SocketReactorTest.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/SocketReactorTest.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,29 +33,29 @@ #include "SocketReactorTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Net/SocketReactor.h" -#include "Net/SocketNotification.h" -#include "Net/SocketConnector.h" -#include "Net/SocketAcceptor.h" -#include "Net/StreamSocket.h" -#include "Net/ServerSocket.h" -#include "Net/SocketAddress.h" -#include "Foundation/Observer.h" +#include "Poco/Net/SocketReactor.h" +#include "Poco/Net/SocketNotification.h" +#include "Poco/Net/SocketConnector.h" +#include "Poco/Net/SocketAcceptor.h" +#include "Poco/Net/StreamSocket.h" +#include "Poco/Net/ServerSocket.h" +#include "Poco/Net/SocketAddress.h" +#include "Poco/Observer.h" #include -using Net::SocketReactor; -using Net::SocketConnector; -using Net::SocketAcceptor; -using Net::StreamSocket; -using Net::ServerSocket; -using Net::SocketAddress; -using Net::SocketNotification; -using Net::ReadableNotification; -using Net::WritableNotification; -using Net::TimeoutNotification; -using Net::ShutdownNotification; -using Foundation::Observer; +using Poco::Net::SocketReactor; +using Poco::Net::SocketConnector; +using Poco::Net::SocketAcceptor; +using Poco::Net::StreamSocket; +using Poco::Net::ServerSocket; +using Poco::Net::SocketAddress; +using Poco::Net::SocketNotification; +using Poco::Net::ReadableNotification; +using Poco::Net::WritableNotification; +using Poco::Net::TimeoutNotification; +using Poco::Net::ShutdownNotification; +using Poco::Observer; namespace diff --git a/Net/testsuite/src/SocketReactorTest.h b/Net/testsuite/src/SocketReactorTest.h index 245ed7ce0..49c11503a 100644 --- a/Net/testsuite/src/SocketReactorTest.h +++ b/Net/testsuite/src/SocketReactorTest.h @@ -1,7 +1,7 @@ // // SocketReactorTest.h // -// $Id: //poco/1.1.0/Net/testsuite/src/SocketReactorTest.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/SocketReactorTest.h#1 $ // // Definition of the SocketReactorTest class. // @@ -36,12 +36,8 @@ #define SocketReactorTest_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Net/Net.h" #include "CppUnit/TestCase.h" -#endif class SocketReactorTest: public CppUnit::TestCase diff --git a/Net/testsuite/src/SocketStreamTest.cpp b/Net/testsuite/src/SocketStreamTest.cpp index ad654b367..89582ddf6 100644 --- a/Net/testsuite/src/SocketStreamTest.cpp +++ b/Net/testsuite/src/SocketStreamTest.cpp @@ -1,7 +1,7 @@ // // SocketStreamTest.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/SocketStreamTest.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/SocketStreamTest.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -34,25 +34,25 @@ #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" #include "EchoServer.h" -#include "Net/SocketStream.h" -#include "Net/StreamSocket.h" -#include "Net/ServerSocket.h" -#include "Net/SocketAddress.h" -#include "Net/NetException.h" -#include "Foundation/Timespan.h" -#include "Foundation/Stopwatch.h" +#include "Poco/Net/SocketStream.h" +#include "Poco/Net/StreamSocket.h" +#include "Poco/Net/ServerSocket.h" +#include "Poco/Net/SocketAddress.h" +#include "Poco/Net/NetException.h" +#include "Poco/Timespan.h" +#include "Poco/Stopwatch.h" -using Net::Socket; -using Net::SocketStream; -using Net::StreamSocket; -using Net::ServerSocket; -using Net::SocketAddress; -using Net::ConnectionRefusedException; -using Foundation::Timespan; -using Foundation::Stopwatch; -using Foundation::TimeoutException; -using Foundation::InvalidArgumentException; +using Poco::Net::Socket; +using Poco::Net::SocketStream; +using Poco::Net::StreamSocket; +using Poco::Net::ServerSocket; +using Poco::Net::SocketAddress; +using Poco::Net::ConnectionRefusedException; +using Poco::Timespan; +using Poco::Stopwatch; +using Poco::TimeoutException; +using Poco::InvalidArgumentException; SocketStreamTest::SocketStreamTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Net/testsuite/src/SocketStreamTest.h b/Net/testsuite/src/SocketStreamTest.h index 5ab2f9398..c7ee799e5 100644 --- a/Net/testsuite/src/SocketStreamTest.h +++ b/Net/testsuite/src/SocketStreamTest.h @@ -1,7 +1,7 @@ // // SocketStreamTest.h // -// $Id: //poco/1.1.0/Net/testsuite/src/SocketStreamTest.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/SocketStreamTest.h#1 $ // // Definition of the SocketStreamTest class. // @@ -36,12 +36,8 @@ #define SocketStreamTest_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Net/Net.h" #include "CppUnit/TestCase.h" -#endif class SocketStreamTest: public CppUnit::TestCase diff --git a/Net/testsuite/src/SocketTest.cpp b/Net/testsuite/src/SocketTest.cpp index 5ff665001..8f9d636b3 100644 --- a/Net/testsuite/src/SocketTest.cpp +++ b/Net/testsuite/src/SocketTest.cpp @@ -1,7 +1,7 @@ // // SocketTest.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/SocketTest.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/SocketTest.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -34,24 +34,24 @@ #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" #include "EchoServer.h" -#include "Net/StreamSocket.h" -#include "Net/ServerSocket.h" -#include "Net/SocketAddress.h" -#include "Net/NetException.h" -#include "Foundation/Timespan.h" -#include "Foundation/Stopwatch.h" +#include "Poco/Net/StreamSocket.h" +#include "Poco/Net/ServerSocket.h" +#include "Poco/Net/SocketAddress.h" +#include "Poco/Net/NetException.h" +#include "Poco/Timespan.h" +#include "Poco/Stopwatch.h" #include -using Net::Socket; -using Net::StreamSocket; -using Net::ServerSocket; -using Net::SocketAddress; -using Net::ConnectionRefusedException; -using Foundation::Timespan; -using Foundation::Stopwatch; -using Foundation::TimeoutException; -using Foundation::InvalidArgumentException; +using Poco::Net::Socket; +using Poco::Net::StreamSocket; +using Poco::Net::ServerSocket; +using Poco::Net::SocketAddress; +using Poco::Net::ConnectionRefusedException; +using Poco::Timespan; +using Poco::Stopwatch; +using Poco::TimeoutException; +using Poco::InvalidArgumentException; SocketTest::SocketTest(const std::string& name): CppUnit::TestCase(name) @@ -138,7 +138,7 @@ void SocketTest::testConnectRefused() ServerSocket serv; serv.bind(SocketAddress()); serv.listen(); - Foundation::UInt16 port = serv.address().port(); + Poco::UInt16 port = serv.address().port(); serv.close(); StreamSocket ss; Timespan timeout(250000); @@ -158,7 +158,7 @@ void SocketTest::testConnectRefusedNB() ServerSocket serv; serv.bind(SocketAddress()); serv.listen(); - Foundation::UInt16 port = serv.address().port(); + Poco::UInt16 port = serv.address().port(); serv.close(); StreamSocket ss; Timespan timeout(10000); diff --git a/Net/testsuite/src/SocketTest.h b/Net/testsuite/src/SocketTest.h index 8dfaa7b06..dfb5eef48 100644 --- a/Net/testsuite/src/SocketTest.h +++ b/Net/testsuite/src/SocketTest.h @@ -1,7 +1,7 @@ // // SocketTest.h // -// $Id: //poco/1.1.0/Net/testsuite/src/SocketTest.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/SocketTest.h#1 $ // // Definition of the SocketTest class. // @@ -36,12 +36,8 @@ #define SocketTest_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Net/Net.h" #include "CppUnit/TestCase.h" -#endif class SocketTest: public CppUnit::TestCase diff --git a/Net/testsuite/src/SocketsTestSuite.cpp b/Net/testsuite/src/SocketsTestSuite.cpp index 0076a02a6..742d5086e 100644 --- a/Net/testsuite/src/SocketsTestSuite.cpp +++ b/Net/testsuite/src/SocketsTestSuite.cpp @@ -1,7 +1,7 @@ // // SocketsTestSuite.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/SocketsTestSuite.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/SocketsTestSuite.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -37,6 +37,7 @@ #include "NetworkInterfaceTest.h" #include "MulticastSocketTest.h" #include "DialogSocketTest.h" +#include "RawSocketTest.h" CppUnit::Test* SocketsTestSuite::suite() @@ -49,6 +50,7 @@ CppUnit::Test* SocketsTestSuite::suite() pSuite->addTest(NetworkInterfaceTest::suite()); pSuite->addTest(MulticastSocketTest::suite()); pSuite->addTest(DialogSocketTest::suite()); + pSuite->addTest(RawSocketTest::suite()); return pSuite; } diff --git a/Net/testsuite/src/SocketsTestSuite.h b/Net/testsuite/src/SocketsTestSuite.h index 85b260739..5b48c3ddc 100644 --- a/Net/testsuite/src/SocketsTestSuite.h +++ b/Net/testsuite/src/SocketsTestSuite.h @@ -1,7 +1,7 @@ // // SocketsTestSuite.h // -// $Id: //poco/1.1.0/Net/testsuite/src/SocketsTestSuite.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/SocketsTestSuite.h#1 $ // // Definition of the SocketsTestSuite class. // @@ -36,9 +36,7 @@ #define SocketsTestSuite_INCLUDED -#ifndef CppUnit_TestSuite_INCLUDED #include "CppUnit/TestSuite.h" -#endif class SocketsTestSuite diff --git a/Net/testsuite/src/TCPServerTest.cpp b/Net/testsuite/src/TCPServerTest.cpp index acf61f195..cafa66c8e 100644 --- a/Net/testsuite/src/TCPServerTest.cpp +++ b/Net/testsuite/src/TCPServerTest.cpp @@ -1,7 +1,7 @@ // // TCPServerTest.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/TCPServerTest.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/TCPServerTest.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,25 +33,25 @@ #include "TCPServerTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Net/TCPServer.h" -#include "Net/TCPServerConnection.h" -#include "Net/TCPServerConnectionFactory.h" -#include "Net/TCPServerParams.h" -#include "Net/StreamSocket.h" -#include "Net/ServerSocket.h" -#include "Foundation/Thread.h" +#include "Poco/Net/TCPServer.h" +#include "Poco/Net/TCPServerConnection.h" +#include "Poco/Net/TCPServerConnectionFactory.h" +#include "Poco/Net/TCPServerParams.h" +#include "Poco/Net/StreamSocket.h" +#include "Poco/Net/ServerSocket.h" +#include "Poco/Thread.h" #include -using Net::TCPServer; -using Net::TCPServerConnection; -using Net::TCPServerConnectionFactory; -using Net::TCPServerConnectionFactoryImpl; -using Net::TCPServerParams; -using Net::StreamSocket; -using Net::ServerSocket; -using Net::SocketAddress; -using Foundation::Thread; +using Poco::Net::TCPServer; +using Poco::Net::TCPServerConnection; +using Poco::Net::TCPServerConnectionFactory; +using Poco::Net::TCPServerConnectionFactoryImpl; +using Poco::Net::TCPServerParams; +using Poco::Net::StreamSocket; +using Poco::Net::ServerSocket; +using Poco::Net::SocketAddress; +using Poco::Thread; namespace @@ -76,7 +76,7 @@ namespace n = ss.receiveBytes(buffer, sizeof(buffer)); } } - catch (Foundation::Exception& exc) + catch (Poco::Exception& exc) { std::cerr << "EchoConnection: " << exc.displayText() << std::endl; } diff --git a/Net/testsuite/src/TCPServerTest.h b/Net/testsuite/src/TCPServerTest.h index f8e48a63e..ad5747cfa 100644 --- a/Net/testsuite/src/TCPServerTest.h +++ b/Net/testsuite/src/TCPServerTest.h @@ -1,7 +1,7 @@ // // TCPServerTest.h // -// $Id: //poco/1.1.0/Net/testsuite/src/TCPServerTest.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/TCPServerTest.h#1 $ // // Definition of the TCPServerTest class. // @@ -36,12 +36,8 @@ #define TCPServerTest_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Net/Net.h" #include "CppUnit/TestCase.h" -#endif class TCPServerTest: public CppUnit::TestCase diff --git a/Net/testsuite/src/TCPServerTestSuite.cpp b/Net/testsuite/src/TCPServerTestSuite.cpp index bd1c2845f..1a80c2350 100644 --- a/Net/testsuite/src/TCPServerTestSuite.cpp +++ b/Net/testsuite/src/TCPServerTestSuite.cpp @@ -1,7 +1,7 @@ // // TCPServerTestSuite.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/TCPServerTestSuite.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/TCPServerTestSuite.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. diff --git a/Net/testsuite/src/TCPServerTestSuite.h b/Net/testsuite/src/TCPServerTestSuite.h index 114df9c46..e5da11272 100644 --- a/Net/testsuite/src/TCPServerTestSuite.h +++ b/Net/testsuite/src/TCPServerTestSuite.h @@ -1,7 +1,7 @@ // // TCPServerTestSuite.h // -// $Id: //poco/1.1.0/Net/testsuite/src/TCPServerTestSuite.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/TCPServerTestSuite.h#1 $ // // Definition of the TCPServerTestSuite class. // @@ -36,9 +36,7 @@ #define TCPServerTestSuite_INCLUDED -#ifndef CppUnit_TestSuite_INCLUDED #include "CppUnit/TestSuite.h" -#endif class TCPServerTestSuite diff --git a/Net/testsuite/src/UDPEchoServer.cpp b/Net/testsuite/src/UDPEchoServer.cpp index 43c7f7cca..310f40450 100644 --- a/Net/testsuite/src/UDPEchoServer.cpp +++ b/Net/testsuite/src/UDPEchoServer.cpp @@ -1,7 +1,7 @@ // // UDPEchoServer.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/UDPEchoServer.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/UDPEchoServer.cpp#1 $ // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -31,15 +31,15 @@ #include "UDPEchoServer.h" -#include "Net/SocketAddress.h" -#include "Foundation/Timespan.h" +#include "Poco/Net/SocketAddress.h" +#include "Poco/Timespan.h" #include -using Net::Socket; -using Net::DatagramSocket; -using Net::SocketAddress; -using Net::IPAddress; +using Poco::Net::Socket; +using Poco::Net::DatagramSocket; +using Poco::Net::SocketAddress; +using Poco::Net::IPAddress; UDPEchoServer::UDPEchoServer(): @@ -69,7 +69,7 @@ UDPEchoServer::~UDPEchoServer() } -Foundation::UInt16 UDPEchoServer::port() const +Poco::UInt16 UDPEchoServer::port() const { return _socket.address().port(); } @@ -78,7 +78,7 @@ Foundation::UInt16 UDPEchoServer::port() const void UDPEchoServer::run() { _ready.set(); - Foundation::Timespan span(250000); + Poco::Timespan span(250000); while (!_stop) { if (_socket.poll(span, Socket::SELECT_READ)) @@ -90,7 +90,7 @@ void UDPEchoServer::run() int n = _socket.receiveFrom(buffer, sizeof(buffer), sender); _socket.sendTo(buffer, n, sender); } - catch (Foundation::Exception& exc) + catch (Poco::Exception& exc) { std::cerr << "UDPEchoServer: " << exc.displayText() << std::endl; } diff --git a/Net/testsuite/src/UDPEchoServer.h b/Net/testsuite/src/UDPEchoServer.h index db7d6592b..efaf110c0 100644 --- a/Net/testsuite/src/UDPEchoServer.h +++ b/Net/testsuite/src/UDPEchoServer.h @@ -1,7 +1,7 @@ // // UDPEchoServer.h // -// $Id: //poco/1.1.0/Net/testsuite/src/UDPEchoServer.h#2 $ +// $Id: //poco/1.2/Net/testsuite/src/UDPEchoServer.h#1 $ // // Definition of the UDPEchoServer class. // @@ -36,52 +36,42 @@ #define UDPEchoServer_INCLUDED -#ifndef Net_Net_INCLUDED -#include "Net/Net.h" -#endif -#ifndef Net_DatagramSocket_INCLUDED -#include "Net/DatagramSocket.h" -#endif -#ifndef Net_SocketAddress_INCLUDED -#include "Net/SocketAddress.h" -#endif -#ifndef Net_Foundation_Thread_INCLUDED -#include "Foundation/Thread.h" -#endif -#ifndef Net_Foundation_Event_INCLUDED -#include "Foundation/Event.h" -#endif +#include "Poco/Net/Net.h" +#include "Poco/Net/DatagramSocket.h" +#include "Poco/Net/SocketAddress.h" +#include "Poco/Thread.h" +#include "Poco/Event.h" -class UDPEchoServer: public Foundation::Runnable +class UDPEchoServer: public Poco::Runnable /// A simple sequential UDP echo server. { public: UDPEchoServer(); /// Creates the UDPEchoServer. - UDPEchoServer(const Net::SocketAddress& sa); + UDPEchoServer(const Poco::Net::SocketAddress& sa); /// Creates the UDPEchoServer and binds it to /// the given address. ~UDPEchoServer(); /// Destroys the UDPEchoServer. - Foundation::UInt16 port() const; + Poco::UInt16 port() const; /// Returns the port the echo server is /// listening on. - Net::SocketAddress address() const; + Poco::Net::SocketAddress address() const; /// Returns the address of the server. void run(); /// Does the work. private: - Net::DatagramSocket _socket; - Foundation::Thread _thread; - Foundation::Event _ready; - bool _stop; + Poco::Net::DatagramSocket _socket; + Poco::Thread _thread; + Poco::Event _ready; + bool _stop; }; diff --git a/Net/testsuite/src/WinDriver.cpp b/Net/testsuite/src/WinDriver.cpp index 52f8fa031..6c7f2fd0c 100644 --- a/Net/testsuite/src/WinDriver.cpp +++ b/Net/testsuite/src/WinDriver.cpp @@ -1,7 +1,7 @@ // // WinDriver.cpp // -// $Id: //poco/1.1.0/Net/testsuite/src/WinDriver.cpp#2 $ +// $Id: //poco/1.2/Net/testsuite/src/WinDriver.cpp#1 $ // // Windows test driver for Poco Net. // diff --git a/README b/README index 99bf59278..4109e409b 100644 --- a/README +++ b/README @@ -1,9 +1,9 @@ -This is the README file for the Applied Informatics C++ Portable Components. +This is the README file for POCO - The C++ Portable Components. In this document you will find a brief description of the directory layout, as well as a description necessary steps to build the C++ Portable Components. -The Applied Informatics C++ Portable Components currently consist of four libraries. +The C++ Portable Components currently consist of four libraries. The Foundation library contains a platform abstraction layer (including classes for multithreading, file system access, logging, etc.), as well as a large number of useful utility classes, such various stream buffer and stream @@ -58,9 +58,10 @@ XML/ project and make/build files for the XML library DOCUMENTATION ============= -At this time, no online-browsable API documentation is available. Please refer to -the comments in the header files. API documentation in HTML format will be -provided with the 1.0 release. +Online browsable reference documentation in HTML is available at +. Additional documentation, +including and overview and an introduction to the samples +is available at . BUILDING ON WINDOWS @@ -99,9 +100,9 @@ BUILDING ON UNIX/LINUX/MAC OS X For building on Unix platforms, the C++ Portable Components come with their own build system. The build system is based on GNU Make 3.80, with the help from a few -shell scripts. If you do not have GNU Make 3.80 installed on your machine, you will -need to download it from , build -and install it prior to building the C++ Portable Components. +shell scripts. If you do not have GNU Make 3.80 (or later) installed on your machine, +you will need to download it from , +build and install it prior to building the C++ Portable Components. You can check the version of GNU Make installed on your system with @@ -112,28 +113,26 @@ or > make --version Once you have GNU Make up and running, the rest is quite simple. -Before starting a build, you must define the environment variable POCO_BASE to point -to the directory where you have extracted the sources for the C++ Portable Components. -For example, if you have extracted the sources to /home/jdoe/poco-0.95, then you would -define POCO_BASE as follows (assuming you are using sh or bash) +To extract the sources and build all libraries, testsuites and samples, simply -> export POCO_BASE=/home/jdoe/poco-0.95 +> gunzip poco-X.Y.tar.gz +> tar -xf poco-X.Y.tar.gz +> cd poco-X.Y.tar.gz +> ./configure +> gmake -s -Once you have defined POCO_BASE, you are ready to go. -To build all libraries, testsuites and samples, simply +See the configure script source for a list of possible options. -> cd $POCO_BASE -> gmake +Once you have successfully built POCO, you can install it +to /usr/local (or another directory specified as parameter +to configure --prefix=): -NOTE: The global Makefile automatically sets POCO_BASE to the current working -directory if it is undefined. However, you must define POCO_BASE yourself if -you want to build only specific components (for example, the Foundation library, -a test suite or the samples). +> sudo gmake -s install -To build on Mac OS X 10.4 with GCC 4.0, define the following environment variable: +To build on Mac OS X 10.3 with GCC 3, do the following: -> export POCO_CONFIG=Darwin8 -> make +> ./configure --config=Darwin7 +> make -s BUILDING ON QNX NEUTRINO @@ -156,6 +155,10 @@ default (Dinkumware) C++ standard library. BUILDING ON OPENVMS =================== +OpenVMS is no longer supported in recent versions of POCO, due to both a +lack of interest and a lack of contributors. The following +instructions are here for historical reasons. + The C++ Portable Components come with their own build system for OpenVMS, implemented by a bunch of DCL scripts. The scripts can be found in the build/vms directory. @@ -188,4 +191,4 @@ at . -- -$Id: //poco/1.1.0/dist/README#2 $ +$Id: //poco/1.2/dist/README#1 $ diff --git a/Util/Makefile b/Util/Makefile index 76cf84a27..506a1c29d 100644 --- a/Util/Makefile +++ b/Util/Makefile @@ -1,7 +1,7 @@ # # Makefile # -# $Id: //poco/1.1.0/Util/Makefile#1 $ +# $Id: //poco/1.2/Util/Makefile#1 $ # # Makefile for Poco Util # @@ -13,10 +13,11 @@ objects = AbstractConfiguration Application ConfigurationMapper \ LoggingConfigurator LoggingSubsystem MapConfiguration \ Option OptionException OptionProcessor OptionSet \ PropertyFileConfiguration Subsystem SystemConfiguration \ - XMLConfiguration FilesystemConfiguration ServerApplication + XMLConfiguration FilesystemConfiguration ServerApplication \ + Validator IntValidator RegExpValidator OptionCallback target = PocoUtil -target_version = 1 +target_version = $(LIBVERSION) target_libs = PocoFoundation PocoXML include $(POCO_BASE)/build/rules/lib diff --git a/Util/Util.vmsbuild b/Util/Util.vmsbuild index 5680170e4..5b617c07f 100644 --- a/Util/Util.vmsbuild +++ b/Util/Util.vmsbuild @@ -1,7 +1,7 @@ # # Util.vmsbuild # -# $Id: //poco/1.1.0/Util/Util.vmsbuild#1 $ +# $Id: //poco/1.2/Util/Util.vmsbuild#1 $ # LIB=PocoUtil AbstractConfiguration diff --git a/Util/Util_vs71.vcproj b/Util/Util_vs71.vcproj index 595605145..d8b86e983 100644 --- a/Util/Util_vs71.vcproj +++ b/Util/Util_vs71.vcproj @@ -149,16 +149,16 @@ Name="Header Files" Filter=""> + RelativePath=".\include\Poco\Util\Application.h"> + RelativePath=".\include\Poco\Util\LoggingSubsystem.h"> + RelativePath=".\include\Poco\Util\ServerApplication.h"> + RelativePath=".\include\Poco\Util\Subsystem.h"> + RelativePath=".\include\Poco\Util\AbstractConfiguration.h"> + RelativePath=".\include\Poco\Util\ConfigurationMapper.h"> + RelativePath=".\include\Poco\Util\ConfigurationView.h"> + RelativePath=".\include\Poco\Util\FilesystemConfiguration.h"> + RelativePath=".\include\Poco\Util\IniFileConfiguration.h"> + RelativePath=".\include\Poco\Util\LayeredConfiguration.h"> + RelativePath=".\include\Poco\Util\LoggingConfigurator.h"> + RelativePath=".\include\Poco\Util\MapConfiguration.h"> + RelativePath=".\include\Poco\Util\PropertyFileConfiguration.h"> + RelativePath=".\include\Poco\Util\SystemConfiguration.h"> + RelativePath=".\include\Poco\Util\XMLConfiguration.h"> + RelativePath=".\include\Poco\Util\HelpFormatter.h"> + RelativePath=".\include\Poco\Util\IntValidator.h"> + RelativePath=".\include\Poco\Util\Option.h"> + RelativePath=".\include\Poco\Util\OptionCallback.h"> + RelativePath=".\include\Poco\Util\OptionException.h"> + + + + + + + + + + + + @@ -296,6 +314,12 @@ + + + + + RelativePath=".\include\Poco\Util\WinRegistryConfiguration.h"> + RelativePath=".\include\Poco\Util\WinRegistryKey.h"> + + + + @@ -329,7 +359,7 @@ Name="Header Files" Filter=""> + RelativePath=".\include\Poco\Util\Util.h"> @@ -256,47 +256,47 @@ Name="Header Files" > @@ -356,23 +356,39 @@ Name="Header Files" > + + + + + + + + @@ -383,10 +399,18 @@ RelativePath=".\src\HelpFormatter.cpp" > + + + + @@ -399,6 +423,14 @@ RelativePath=".\src\OptionSet.cpp" > + + + + + + + + @@ -436,7 +476,7 @@ Name="Header Files" > diff --git a/Util/include/Util/AbstractConfiguration.h b/Util/include/Poco/Util/AbstractConfiguration.h similarity index 92% rename from Util/include/Util/AbstractConfiguration.h rename to Util/include/Poco/Util/AbstractConfiguration.h index 84776d4be..390ea3f44 100644 --- a/Util/include/Util/AbstractConfiguration.h +++ b/Util/include/Poco/Util/AbstractConfiguration.h @@ -1,7 +1,7 @@ // // AbstractConfiguration.h // -// $Id: //poco/1.1.0/Util/include/Util/AbstractConfiguration.h#2 $ +// $Id: //poco/1.2/Util/include/Poco/Util/AbstractConfiguration.h#1 $ // // Library: Util // Package: Configuration @@ -40,25 +40,17 @@ #define Util_AbstractConfiguration_INCLUDED -#ifndef Util_Util_INCLUDED -#include "Util/Util.h" -#endif -#ifndef Foundation_Mutex_INCLUDED -#include "Foundation/Mutex.h" -#endif -#ifndef Foundation_RefCountedObject_INCLUDED -#include "Foundation/RefCountedObject.h" -#endif -#ifndef STD_VECTOR_INCLUDED +#include "Poco/Util/Util.h" +#include "Poco/Mutex.h" +#include "Poco/RefCountedObject.h" #include -#define STD_VECTOR_INCLUDED -#endif -Util_BEGIN +namespace Poco { +namespace Util { -class Util_API AbstractConfiguration: public Foundation::RefCountedObject +class Util_API AbstractConfiguration: public Poco::RefCountedObject /// AbstractConfiguration is an abstract base class for different /// kinds of configuration data, such as INI files, property files, /// XML configuration files or the Windows Registry. @@ -229,7 +221,7 @@ private: AbstractConfiguration& operator = (const AbstractConfiguration&); mutable int _depth; - mutable Foundation::FastMutex _mutex; + mutable Poco::FastMutex _mutex; friend class LayeredConfiguration; friend class ConfigurationView; @@ -237,7 +229,7 @@ private: }; -Util_END +} } // namespace Poco::Util #endif // Util_AbstractConfiguration_INCLUDED diff --git a/Util/include/Util/Application.h b/Util/include/Poco/Util/Application.h similarity index 74% rename from Util/include/Util/Application.h rename to Util/include/Poco/Util/Application.h index 510643303..ab2fb8e99 100644 --- a/Util/include/Util/Application.h +++ b/Util/include/Poco/Util/Application.h @@ -1,7 +1,7 @@ // // Application.h // -// $Id: //poco/1.1.0/Util/include/Util/Application.h#2 $ +// $Id: //poco/1.2/Util/include/Poco/Util/Application.h#1 $ // // Library: Util // Package: Application @@ -40,40 +40,20 @@ #define Util_Application_INCLUDED -#ifndef Util_Util_INCLUDED -#include "Util/Util.h" -#endif -#ifndef Util_Subsystem_INCLUDED -#include "Util/Subsystem.h" -#endif -#ifndef Util_LayeredConfiguration_INCLUDED -#include "Util/LayeredConfiguration.h" -#endif -#ifndef Util_OptionSet_INCLUDED -#include "Util/OptionSet.h" -#endif -#ifndef Foundation_AutoPtr_INCLUDED -#include "Foundation/AutoPtr.h" -#endif -#ifndef Foundation_Logger_INCLUDED -#include "Foundation/Logger.h" -#endif -#ifndef Foundation_Path_INCLUDED -#include "Foundation/Path.h" -#endif -#ifndef Foundation_Timestamp_INCLUDED -#include "Foundation/Timestamp.h" -#endif -#ifndef Foundation_Timespan_INCLUDED -#include "Foundation/Timespan.h" -#endif -#ifndef STD_VECTOR_INCLUDED +#include "Poco/Util/Util.h" +#include "Poco/Util/Subsystem.h" +#include "Poco/Util/LayeredConfiguration.h" +#include "Poco/Util/OptionSet.h" +#include "Poco/AutoPtr.h" +#include "Poco/Logger.h" +#include "Poco/Path.h" +#include "Poco/Timestamp.h" +#include "Poco/Timespan.h" #include -#define STD_VECTOR_INCLUDED -#endif -Util_BEGIN +namespace Poco { +namespace Util { class OptionSet; @@ -107,6 +87,10 @@ class Util_API Application: public Subsystem /// - application.dir: the path to the directory where the application executable resides /// - application.configDir: the path to the directory where the last configuration file loaded with loadConfiguration() was found. /// If loadConfiguration() has never been called, application.configDir will be equal to application.dir. + /// + /// The POCO_APP_MAIN macro can be used to implement main(argc, argv). + /// If POCO has been built with POCO_WIN32_UTF8, POCO_APP_MAIN supports + /// Unicode command line arguments. { public: enum ExitCode @@ -148,6 +132,19 @@ public: /// Initializes the application and all registered subsystems, /// using the given command line arguments. +#if defined(POCO_WIN32_UTF8) + void init(int argc, wchar_t* argv[]); + /// Initializes the application and all registered subsystems, + /// using the given command line arguments. + /// + /// This Windows-specific version of init is used for passing + /// Unicode command line arguments from wmain(). +#endif + + void init(const std::vector& args); + /// Initializes the application and all registered subsystems, + /// using the given command line arguments. + bool initialized() const; /// Returns true iff the application is in initialized state /// (that means, has been initialized but not yet uninitialized). @@ -209,7 +206,7 @@ public: LayeredConfiguration& config() const; /// Returns the application's configuration. - Foundation::Logger& logger() const; + Poco::Logger& logger() const; /// Returns the application's logger. /// /// Before the logging subsystem has been initialized, the @@ -230,11 +227,23 @@ public: /// /// Throws a NullPointerException if no Application instance exists. - const Foundation::Timestamp& startTime() const; + const Poco::Timestamp& startTime() const; /// Returns the application start time (UTC). - Foundation::Timespan uptime() const; + Poco::Timespan uptime() const; /// Returns the application uptime. + + void stopOptionsProcessing(); + /// If called from an option callback, stops all further + /// options processing. + /// + /// If called, the following options on the command line + /// will not be processed, and required options will not + /// be checked. + /// + /// This is useful, for example, if an option for displaying + /// help information has been encountered and no other things + /// besides displaying help shall be done. const char* name() const; @@ -271,11 +280,13 @@ protected: virtual void handleOption(const std::string& name, const std::string& value); /// Called when the option with the given name is encountered /// during command line arguments processing. - /// The default implementation does nothing. /// - /// Overriding implementations should call the base class implementation. + /// The default implementation does option validation, bindings + /// and callback handling. + /// + /// Overriding implementations must call the base class implementation. - void setLogger(Foundation::Logger& logger); + void setLogger(Poco::Logger& logger); /// Sets the logger used by the application. virtual int main(const std::vector& args); @@ -288,7 +299,7 @@ protected: /// Returns an exit code which should be one of the values /// from the ExitCode enumeration. - bool findFile(Foundation::Path& path) const; + bool findFile(Poco::Path& path) const; /// Searches for the file in path in the application directory. /// /// If path is absolute, the method immediately returns true and @@ -300,30 +311,35 @@ protected: /// path if the file could be found. Returns false and leaves path /// unchanged otherwise. + void init(); + /// Common initialization code. + ~Application(); /// Destroys the Application and deletes all registered subsystems. private: void setup(); void setArgs(int argc, char* argv[]); - void getApplicationPath(Foundation::Path& path) const; + void setArgs(const std::vector& args); + void getApplicationPath(Poco::Path& path) const; void processOptions(); - bool findAppConfigFile(const std::string& appName, const std::string& extension, Foundation::Path& path) const; + bool findAppConfigFile(const std::string& appName, const std::string& extension, Poco::Path& path) const; - typedef Foundation::AutoPtr SubsystemPtr; + typedef Poco::AutoPtr SubsystemPtr; typedef std::vector SubsystemVec; - typedef Foundation::AutoPtr ConfigPtr; + typedef Poco::AutoPtr ConfigPtr; typedef std::vector ArgVec; - ConfigPtr _pConfig; - SubsystemVec _subsystems; - bool _initialized; - std::string _command; - ArgVec _args; - OptionSet _options; - bool _unixOptions; - Foundation::Logger* _pLogger; - Foundation::Timestamp _startTime; + ConfigPtr _pConfig; + SubsystemVec _subsystems; + bool _initialized; + std::string _command; + ArgVec _args; + OptionSet _options; + bool _unixOptions; + Poco::Logger* _pLogger; + Poco::Timestamp _startTime; + bool _stopOptionsProcessing; static Application* _pInstance; @@ -341,7 +357,7 @@ template C& Application::getSubsystem() const if (dynamic_cast(*it)) return **it; } - throw Foundation::NotFoundException("The subsystem has not been registered"); + throw Poco::NotFoundException("The subsystem has not been registered"); } @@ -357,7 +373,7 @@ inline LayeredConfiguration& Application::config() const } -inline Foundation::Logger& Application::logger() const +inline Poco::Logger& Application::logger() const { poco_check_ptr (_pLogger); return *_pLogger; @@ -377,22 +393,60 @@ inline Application& Application::instance() } -inline const Foundation::Timestamp& Application::startTime() const +inline const Poco::Timestamp& Application::startTime() const { return _startTime; } -inline Foundation::Timespan Application::uptime() const +inline Poco::Timespan Application::uptime() const { - Foundation::Timestamp now; - Foundation::Timespan uptime = now - _startTime; + Poco::Timestamp now; + Poco::Timespan uptime = now - _startTime; return uptime; } -Util_END +} } // namespace Poco::Util + + +// +// Macro to implement main() +// +#if defined(POCO_WIN32_UTF8) + #define POCO_APP_MAIN(App) \ + int wmain(int argc, wchar_t** argv) \ + { \ + AutoPtr pApp = new App; \ + try \ + { \ + pApp->init(argc, argv); \ + } \ + catch (Poco::Exception& exc) \ + { \ + pApp->logger().log(exc); \ + return Application::EXIT_CONFIG;\ + } \ + return pApp->run(); \ + } +#else + #define POCO_APP_MAIN(App) \ + int main(int argc, char** argv) \ + { \ + AutoPtr pApp = new App; \ + try \ + { \ + pApp->init(argc, argv); \ + } \ + catch (Poco::Exception& exc) \ + { \ + pApp->logger().log(exc); \ + return Application::EXIT_CONFIG;\ + } \ + return pApp->run(); \ + } +#endif #endif // Util_Application_INCLUDED diff --git a/Util/include/Util/ConfigurationMapper.h b/Util/include/Poco/Util/ConfigurationMapper.h similarity index 91% rename from Util/include/Util/ConfigurationMapper.h rename to Util/include/Poco/Util/ConfigurationMapper.h index fc0d17bf3..16408b2d3 100644 --- a/Util/include/Util/ConfigurationMapper.h +++ b/Util/include/Poco/Util/ConfigurationMapper.h @@ -1,7 +1,7 @@ // // ConfigurationMapper.h // -// $Id: //poco/1.1.0/Util/include/Util/ConfigurationMapper.h#2 $ +// $Id: //poco/1.2/Util/include/Poco/Util/ConfigurationMapper.h#1 $ // // Library: Util // Package: Configuration @@ -40,15 +40,12 @@ #define Util_ConfigurationMapper_INCLUDED -#ifndef Util_Util_INCLUDED -#include "Util/Util.h" -#endif -#ifndef Util_AbstractConfiguration_INCLUDED -#include "Util/AbstractConfiguration.h" -#endif +#include "Poco/Util/Util.h" +#include "Poco/Util/AbstractConfiguration.h" -Util_BEGIN +namespace Poco { +namespace Util { class Util_API ConfigurationMapper: public AbstractConfiguration @@ -112,7 +109,7 @@ private: }; -Util_END +} } // namespace Poco::Util #endif // Util_ConfigurationMapper_INCLUDED diff --git a/Util/include/Util/ConfigurationView.h b/Util/include/Poco/Util/ConfigurationView.h similarity index 90% rename from Util/include/Util/ConfigurationView.h rename to Util/include/Poco/Util/ConfigurationView.h index e49fcd78b..8c7a4a072 100644 --- a/Util/include/Util/ConfigurationView.h +++ b/Util/include/Poco/Util/ConfigurationView.h @@ -1,7 +1,7 @@ // // ConfigurationView.h // -// $Id: //poco/1.1.0/Util/include/Util/ConfigurationView.h#2 $ +// $Id: //poco/1.2/Util/include/Poco/Util/ConfigurationView.h#1 $ // // Library: Util // Package: Configuration @@ -40,15 +40,12 @@ #define Util_ConfigurationView_INCLUDED -#ifndef Util_Util_INCLUDED -#include "Util/Util.h" -#endif -#ifndef Util_AbstractConfiguration_INCLUDED -#include "Util/AbstractConfiguration.h" -#endif +#include "Poco/Util/Util.h" +#include "Poco/Util/AbstractConfiguration.h" -Util_BEGIN +namespace Poco { +namespace Util { class Util_API ConfigurationView: public AbstractConfiguration @@ -100,7 +97,7 @@ private: }; -Util_END +} } // namespace Poco::Util #endif // Util_ConfigurationView_INCLUDED diff --git a/Util/include/Util/FilesystemConfiguration.h b/Util/include/Poco/Util/FilesystemConfiguration.h similarity index 88% rename from Util/include/Util/FilesystemConfiguration.h rename to Util/include/Poco/Util/FilesystemConfiguration.h index f9bc3cf46..a41f4b585 100644 --- a/Util/include/Util/FilesystemConfiguration.h +++ b/Util/include/Poco/Util/FilesystemConfiguration.h @@ -1,7 +1,7 @@ // // FilesystemConfiguration.h // -// $Id: //poco/1.1.0/Util/include/Util/FilesystemConfiguration.h#2 $ +// $Id: //poco/1.2/Util/include/Poco/Util/FilesystemConfiguration.h#1 $ // // Library: Util // Package: Configuration @@ -40,18 +40,13 @@ #define Util_FilesystemConfiguration_INCLUDED -#ifndef Util_Util_INCLUDED -#include "Util/Util.h" -#endif -#ifndef Util_AbstractConfiguration_INCLUDED -#include "Util/AbstractConfiguration.h" -#endif -#ifndef Foundation_Path_INCLUDED -#include "Foundation/Path.h" -#endif +#include "Poco/Util/Util.h" +#include "Poco/Util/AbstractConfiguration.h" +#include "Poco/Path.h" -Util_BEGIN +namespace Poco { +namespace Util { class Util_API FilesystemConfiguration: public AbstractConfiguration @@ -105,15 +100,15 @@ protected: bool getRaw(const std::string& key, std::string& value) const; void setRaw(const std::string& key, const std::string& value); void enumerate(const std::string& key, Keys& range) const; - Foundation::Path keyToPath(const std::string& key) const; + Poco::Path keyToPath(const std::string& key) const; ~FilesystemConfiguration(); private: - Foundation::Path _path; + Poco::Path _path; }; -Util_END +} } // namespace Poco::Util #endif // Util_FilesystemConfiguration_INCLUDED diff --git a/Util/include/Util/HelpFormatter.h b/Util/include/Poco/Util/HelpFormatter.h similarity index 93% rename from Util/include/Util/HelpFormatter.h rename to Util/include/Poco/Util/HelpFormatter.h index 483547ced..c25c325a7 100644 --- a/Util/include/Util/HelpFormatter.h +++ b/Util/include/Poco/Util/HelpFormatter.h @@ -1,7 +1,7 @@ // // HelpFormatter.h // -// $Id: //poco/1.1.0/Util/include/Util/HelpFormatter.h#2 $ +// $Id: //poco/1.2/Util/include/Poco/Util/HelpFormatter.h#1 $ // // Library: Util // Package: Options @@ -40,16 +40,12 @@ #define Util_HelpFormatter_INCLUDED -#ifndef Util_Util_INCLUDED -#include "Util/Util.h" -#endif -#ifndef STD_OSTREAM_INCLUDED +#include "Poco/Util/Util.h" #include -#define STD_OSTREAM_INCLUDED -#endif -Util_BEGIN +namespace Poco { +namespace Util { class OptionSet; @@ -219,7 +215,7 @@ inline bool HelpFormatter::isUnixStyle() const } -Util_END +} } // namespace Poco::Util #endif // Util_HelpFormatter_INCLUDED diff --git a/Util/include/Util/IniFileConfiguration.h b/Util/include/Poco/Util/IniFileConfiguration.h similarity index 89% rename from Util/include/Util/IniFileConfiguration.h rename to Util/include/Poco/Util/IniFileConfiguration.h index 863eaa1b3..aa8ba7341 100644 --- a/Util/include/Util/IniFileConfiguration.h +++ b/Util/include/Poco/Util/IniFileConfiguration.h @@ -1,7 +1,7 @@ // // IniFileConfiguration.h // -// $Id: //poco/1.1.0/Util/include/Util/IniFileConfiguration.h#2 $ +// $Id: //poco/1.2/Util/include/Poco/Util/IniFileConfiguration.h#1 $ // // Library: Util // Package: Configuration @@ -40,23 +40,14 @@ #define Util_IniFileConfiguration_INCLUDED -#ifndef Util_Util_INCLUDED -#include "Util/Util.h" -#endif -#ifndef Util_AbstractConfiguration_INCLUDED -#include "Util/AbstractConfiguration.h" -#endif -#ifndef STD_MAP_INCLUDED +#include "Poco/Util/Util.h" +#include "Poco/Util/AbstractConfiguration.h" #include -#define STD_MAP_INCLUDED -#endif -#ifndef STD_ISTREAM_INCLUDED #include -#define STD_ISTREAM_INCLUDED -#endif -Util_BEGIN +namespace Poco { +namespace Util { class Util_API IniFileConfiguration: public AbstractConfiguration @@ -118,7 +109,7 @@ private: }; -Util_END +} } // namespace Poco::Util #endif // Util_IniFileConfiguration_INCLUDED diff --git a/Util/include/Poco/Util/IntValidator.h b/Util/include/Poco/Util/IntValidator.h new file mode 100644 index 000000000..ec97b6888 --- /dev/null +++ b/Util/include/Poco/Util/IntValidator.h @@ -0,0 +1,78 @@ +// +// IntValidator.h +// +// $Id: //poco/1.2/Util/include/Poco/Util/IntValidator.h#1 $ +// +// Library: Util +// Package: Options +// Module: IntValidator +// +// Definition of the IntValidator class. +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef Util_IntValidator_INCLUDED +#define Util_IntValidator_INCLUDED + + +#include "Poco/Util/Util.h" +#include "Poco/Util/Validator.h" + + +namespace Poco { +namespace Util { + + +class Util_API IntValidator: public Validator + /// The IntValidator tests whether the option argument, + /// which must be an integer, lies within a given range. +{ +public: + IntValidator(int min, int max); + /// Creates the IntValidator. + + ~IntValidator(); + /// Destroys the IntValidator. + + void validate(const Option& option, const std::string& value); + /// Validates the value for the given option by + /// testing whether it's an integer that lies within + /// a given range. + +private: + IntValidator(); + + int _min; + int _max; +}; + + +} } // namespace Poco::Util + + +#endif // Util_IntValidator_INCLUDED diff --git a/Util/include/Util/LayeredConfiguration.h b/Util/include/Poco/Util/LayeredConfiguration.h similarity index 85% rename from Util/include/Util/LayeredConfiguration.h rename to Util/include/Poco/Util/LayeredConfiguration.h index b803387d0..2987276cf 100644 --- a/Util/include/Util/LayeredConfiguration.h +++ b/Util/include/Poco/Util/LayeredConfiguration.h @@ -1,7 +1,7 @@ // // LayeredConfiguration.h // -// $Id: //poco/1.1.0/Util/include/Util/LayeredConfiguration.h#2 $ +// $Id: //poco/1.2/Util/include/Poco/Util/LayeredConfiguration.h#1 $ // // Library: Util // Package: Configuration @@ -40,22 +40,14 @@ #define Util_LayeredConfiguration_INCLUDED -#ifndef Util_Util_INCLUDED -#include "Util/Util.h" -#endif -#ifndef Util_AbstractConfiguration_INCLUDED -#include "Util/AbstractConfiguration.h" -#endif -#ifndef Foundation_AutoPtr_INCLUDED -#include "Foundation/AutoPtr.h" -#endif -#ifndef STD_VECTOR_INCLUDED +#include "Poco/Util/Util.h" +#include "Poco/Util/AbstractConfiguration.h" +#include "Poco/AutoPtr.h" #include -#define STD_VECTOR_INCLUDED -#endif -Util_BEGIN +namespace Poco { +namespace Util { class Util_API LayeredConfiguration: public AbstractConfiguration @@ -80,8 +72,9 @@ public: void add(AbstractConfiguration* pConfig, bool shared); /// Adds a configuration to the back of the LayeredConfiguration. - /// If shared is true, the LayeredConfiguration takes ownership - /// of the given configuration. + /// If shared is false, the LayeredConfiguration takes ownership + /// of the given configuration (and the configuration's reference + /// count remains unchanged). void addFront(AbstractConfiguration* pConfig); /// Adds a configuration to the front of the LayeredConfiguration. @@ -104,14 +97,14 @@ private: LayeredConfiguration(const LayeredConfiguration&); LayeredConfiguration& operator = (const LayeredConfiguration&); - typedef Foundation::AutoPtr ConfigPtr; + typedef Poco::AutoPtr ConfigPtr; typedef std::vector ConfigVec; ConfigVec _configs; }; -Util_END +} } // namespace Poco::Util #endif // Util_LayeredConfiguration_INCLUDED diff --git a/Util/include/Util/LoggingConfigurator.h b/Util/include/Poco/Util/LoggingConfigurator.h similarity index 92% rename from Util/include/Util/LoggingConfigurator.h rename to Util/include/Poco/Util/LoggingConfigurator.h index 06ccb0f4b..8907aa5b1 100644 --- a/Util/include/Util/LoggingConfigurator.h +++ b/Util/include/Poco/Util/LoggingConfigurator.h @@ -1,7 +1,7 @@ // // LoggingConfigurator.h // -// $Id: //poco/1.1.0/Util/include/Util/LoggingConfigurator.h#2 $ +// $Id: //poco/1.2/Util/include/Poco/Util/LoggingConfigurator.h#1 $ // // Library: Util // Package: Configuration @@ -40,18 +40,13 @@ #define Util_LoggingConfigurator_INCLUDED -#ifndef Util_Util_INCLUDED -#include "Util/Util.h" -#endif -#ifndef Foundation_Formatter_INCLUDED -#include "Foundation/Formatter.h" -#endif -#ifndef Foundation_Channel_INCLUDED -#include "Foundation/Channel.h" -#endif +#include "Poco/Util/Util.h" +#include "Poco/Formatter.h" +#include "Poco/Channel.h" -Util_BEGIN +namespace Poco { +namespace Util { class AbstractConfiguration; @@ -182,8 +177,8 @@ private: void configureFormatters(AbstractConfiguration* pConfig); void configureChannels(AbstractConfiguration* pConfig); void configureLoggers(AbstractConfiguration* pConfig); - Foundation::Formatter* createFormatter(AbstractConfiguration* pConfig); - Foundation::Channel* createChannel(AbstractConfiguration* pConfig); + Poco::Formatter* createFormatter(AbstractConfiguration* pConfig); + Poco::Channel* createChannel(AbstractConfiguration* pConfig); void configureLogger(AbstractConfiguration* pConfig); LoggingConfigurator(const LoggingConfigurator&); @@ -191,7 +186,7 @@ private: }; -Util_END +} } // namespace Poco::Util #endif // Util_LoggingConfigurator_INCLUDED diff --git a/Util/include/Util/LoggingSubsystem.h b/Util/include/Poco/Util/LoggingSubsystem.h similarity index 88% rename from Util/include/Util/LoggingSubsystem.h rename to Util/include/Poco/Util/LoggingSubsystem.h index 4c409fcc9..672644bbf 100644 --- a/Util/include/Util/LoggingSubsystem.h +++ b/Util/include/Poco/Util/LoggingSubsystem.h @@ -1,7 +1,7 @@ // // LoggingSubsystem.h // -// $Id: //poco/1.1.0/Util/include/Util/LoggingSubsystem.h#2 $ +// $Id: //poco/1.2/Util/include/Poco/Util/LoggingSubsystem.h#1 $ // // Library: Util // Package: Application @@ -40,15 +40,12 @@ #define Util_LoggingSubsystem_INCLUDED -#ifndef Util_Util_INCLUDED -#include "Util/Util.h" -#endif -#ifndef Util_Subsystem_INCLUDED -#include "Util/Subsystem.h" -#endif +#include "Poco/Util/Util.h" +#include "Poco/Util/Subsystem.h" -Util_BEGIN +namespace Poco { +namespace Util { class Util_API LoggingSubsystem: public Subsystem @@ -71,7 +68,7 @@ protected: }; -Util_END +} } // namespace Poco::Util #endif // Util_LoggingSubsystem_INCLUDED diff --git a/Util/include/Util/MapConfiguration.h b/Util/include/Poco/Util/MapConfiguration.h similarity index 86% rename from Util/include/Util/MapConfiguration.h rename to Util/include/Poco/Util/MapConfiguration.h index 3011d18c0..4ca9a2fa5 100644 --- a/Util/include/Util/MapConfiguration.h +++ b/Util/include/Poco/Util/MapConfiguration.h @@ -1,7 +1,7 @@ // // MapConfiguration.h // -// $Id: //poco/1.1.0/Util/include/Util/MapConfiguration.h#2 $ +// $Id: //poco/1.2/Util/include/Poco/Util/MapConfiguration.h#1 $ // // Library: Util // Package: Configuration @@ -40,19 +40,13 @@ #define Util_MapConfiguration_INCLUDED -#ifndef Util_Util_INCLUDED -#include "Util/Util.h" -#endif -#ifndef Util_AbstractConfiguration_INCLUDED -#include "Util/AbstractConfiguration.h" -#endif -#ifndef STD_MAP_INCLUDED +#include "Poco/Util/Util.h" +#include "Poco/Util/AbstractConfiguration.h" #include -#define STD_MAP_INCLUDED -#endif -Util_BEGIN +namespace Poco { +namespace Util { class Util_API MapConfiguration: public AbstractConfiguration @@ -82,7 +76,7 @@ private: }; -Util_END +} } // namespace Poco::Util #endif // Util_MapConfiguration_INCLUDED diff --git a/Util/include/Util/Option.h b/Util/include/Poco/Util/Option.h similarity index 74% rename from Util/include/Util/Option.h rename to Util/include/Poco/Util/Option.h index 9441b1824..2bae38768 100644 --- a/Util/include/Util/Option.h +++ b/Util/include/Poco/Util/Option.h @@ -1,7 +1,7 @@ // // Option.h // -// $Id: //poco/1.1.0/Util/include/Util/Option.h#2 $ +// $Id: //poco/1.2/Util/include/Poco/Util/Option.h#1 $ // // Library: Util // Package: Options @@ -40,12 +40,16 @@ #define Util_Option_INCLUDED -#ifndef Util_Util_INCLUDED -#include "Util/Util.h" -#endif +#include "Poco/Util/Util.h" +#include "Poco/Util/OptionCallback.h" -Util_BEGIN +namespace Poco { +namespace Util { + + +class Application; +class Validator; class Util_API Option @@ -63,6 +67,16 @@ class Util_API Option /// option of each group may be specified on the command /// line. /// + /// An option can be bound to a configuration property. + /// In this case, a configuration property will automatically + /// receive the option's argument value. + /// + /// A callback method can be specified for options. This method + /// is called whenever an option is specified on the command line. + /// + /// Option argument values can be automatically validated using a + /// Validator. + /// /// Option instances are value objects. /// /// Typcally, after construction, an Option object is immediately @@ -98,6 +112,9 @@ public: Option& operator = (const Option& option); /// Assignment operator. + void swap(Option& option); + /// Swaps the option with another one. + Option& shortName(const std::string& name); /// Sets the short name of the option. @@ -124,6 +141,26 @@ public: Option& group(const std::string& group); /// Specifies the option group the option is part of. + + Option& binding(const std::string& propertyName); + /// Binds the option to the configuration property with the given name. + /// + /// The configuration will automatically receive the option's argument. + + Option& callback(const AbstractOptionCallback& cb); + /// Binds the option to the given method. + /// + /// The callback method will be called when the option + /// has been specified on the command line. + /// + /// Usage: + /// callback(OptionCallback(this, &MyApplication::myCallback)); + + Option& validator(Validator* pValidator); + /// Sets the validator for the given option. + /// + /// The Option takes ownership of the Validator and + /// deletes it when it's no longer needed. const std::string& shortName() const; /// Returns the short name of the option. @@ -155,6 +192,18 @@ public: /// or an empty string, if the option is not part of /// a group. + const std::string& binding() const; + /// Returns the property name the option is bound to, + /// or an empty string in case it is not bound. + + AbstractOptionCallback* callback() const; + /// Returns a pointer to the callback method for the option, + /// or NULL if no callback has been specified. + + Validator* validator() const; + /// Returns the option's Validator, if one has been specified, + /// or NULL otherwise. + bool matchesShort(const std::string& option) const; /// Returns true if the given option string matches the /// short name. @@ -192,6 +241,9 @@ private: std::string _argName; bool _argRequired; std::string _group; + std::string _binding; + Validator* _pValidator; + AbstractOptionCallback* _pCallback; }; @@ -254,7 +306,25 @@ inline const std::string& Option::group() const } -Util_END +inline const std::string& Option::binding() const +{ + return _binding; +} + + +inline AbstractOptionCallback* Option::callback() const +{ + return _pCallback; +} + + +inline Validator* Option::validator() const +{ + return _pValidator; +} + + +} } // namespace Poco::Util #endif // Util_Option_INCLUDED diff --git a/Util/include/Poco/Util/OptionCallback.h b/Util/include/Poco/Util/OptionCallback.h new file mode 100644 index 000000000..51fbd2413 --- /dev/null +++ b/Util/include/Poco/Util/OptionCallback.h @@ -0,0 +1,131 @@ +// +// OptionCallback.h +// +// $Id: //poco/1.2/Util/include/Poco/Util/OptionCallback.h#1 $ +// +// Library: Util +// Package: Options +// Module: OptionCallback +// +// Definition of the OptionCallback class. +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef Util_OptionCallback_INCLUDED +#define Util_OptionCallback_INCLUDED + + +#include "Poco/Util/Util.h" + + +namespace Poco { +namespace Util { + + +class Util_API AbstractOptionCallback + /// Base class for OptionCallback. +{ +public: + virtual void invoke(const std::string& name, const std::string& value) const = 0; + /// Invokes the callback member function. + + virtual AbstractOptionCallback* clone() const = 0; + /// Creates and returns a copy of the object. + + virtual ~AbstractOptionCallback(); + /// Destroys the AbstractOptionCallback. + +protected: + AbstractOptionCallback(); + AbstractOptionCallback(const AbstractOptionCallback&); +}; + + +template +class OptionCallback: public AbstractOptionCallback + /// This class is used as an argument to Option::callback(). + /// + /// It stores a pointer to an object and a pointer to a member + /// function of the object's class. +{ +public: + typedef void (C::*Callback)(const std::string& name, const std::string& value); + + OptionCallback(C* pObject, Callback method): + _pObject(pObject), + _method(method) + /// Creates the OptionCallback for the given object and member function. + { + poco_check_ptr (pObject); + } + + OptionCallback(const OptionCallback& cb): + AbstractOptionCallback(cb), + _pObject(cb._pObject), + _method(cb._method) + /// Creates an OptionCallback from another one. + { + } + + ~OptionCallback() + /// Destroys the OptionCallback. + { + } + + OptionCallback& operator = (const OptionCallback& cb) + { + if (&cb != this) + { + this->_pObject = cb._pObject; + this->_method = cb._method; + } + return *this; + } + + void invoke(const std::string& name, const std::string& value) const + { + (_pObject->*_method)(name, value); + } + + AbstractOptionCallback* clone() const + { + return new OptionCallback(_pObject, _method); + } + +private: + OptionCallback(); + + C* _pObject; + Callback _method; +}; + + +} } // namespace Poco::Util + + +#endif // Util_OptionCallback_INCLUDED diff --git a/Util/include/Util/OptionException.h b/Util/include/Poco/Util/OptionException.h similarity index 82% rename from Util/include/Util/OptionException.h rename to Util/include/Poco/Util/OptionException.h index 72b2212d0..a80a8c969 100644 --- a/Util/include/Util/OptionException.h +++ b/Util/include/Poco/Util/OptionException.h @@ -1,7 +1,7 @@ // // OptionException.h // -// $Id: //poco/1.1.0/Util/include/Util/OptionException.h#2 $ +// $Id: //poco/1.2/Util/include/Poco/Util/OptionException.h#1 $ // // Library: Util // Package: Options @@ -40,28 +40,27 @@ #define Util_OptionException_INCLUDED -#ifndef Util_Util_INCLUDED -#include "Util/Util.h" -#endif -#ifndef Foundation_Exception_INCLUDED -#include "Foundation/Exception.h" -#endif +#include "Poco/Util/Util.h" +#include "Poco/Exception.h" -Util_BEGIN +namespace Poco { +namespace Util { -POCO_DECLARE_EXCEPTION(Util_API, OptionException, Foundation::DataException) +POCO_DECLARE_EXCEPTION(Util_API, OptionException, Poco::DataException) POCO_DECLARE_EXCEPTION(Util_API, UnknownOptionException, OptionException) POCO_DECLARE_EXCEPTION(Util_API, AmbiguousOptionException, OptionException) +POCO_DECLARE_EXCEPTION(Util_API, MissingOptionException, OptionException) POCO_DECLARE_EXCEPTION(Util_API, MissingArgumentException, OptionException) +POCO_DECLARE_EXCEPTION(Util_API, InvalidArgumentException, OptionException) POCO_DECLARE_EXCEPTION(Util_API, UnexpectedArgumentException, OptionException) POCO_DECLARE_EXCEPTION(Util_API, IncompatibleOptionsException, OptionException) POCO_DECLARE_EXCEPTION(Util_API, DuplicateOptionException, OptionException) POCO_DECLARE_EXCEPTION(Util_API, EmptyOptionException, OptionException) -Util_END +} } // namespace Poco::Util #endif // Util_OptionException_INCLUDED diff --git a/Util/include/Util/OptionProcessor.h b/Util/include/Poco/Util/OptionProcessor.h similarity index 91% rename from Util/include/Util/OptionProcessor.h rename to Util/include/Poco/Util/OptionProcessor.h index 231242376..0fa11a1e0 100644 --- a/Util/include/Util/OptionProcessor.h +++ b/Util/include/Poco/Util/OptionProcessor.h @@ -1,7 +1,7 @@ // // OptionProcessor.h // -// $Id: //poco/1.1.0/Util/include/Util/OptionProcessor.h#2 $ +// $Id: //poco/1.2/Util/include/Poco/Util/OptionProcessor.h#1 $ // // Library: Util // Package: Options @@ -40,16 +40,12 @@ #define Util_OptionProcessor_INCLUDED -#ifndef Util_Util_INCLUDED -#include "Util/Util.h" -#endif -#ifndef STD_SET_INCLUDED +#include "Poco/Util/Util.h" #include -#define STD_SET_INCLUDED -#endif -Util_BEGIN +namespace Poco { +namespace Util { class OptionSet; @@ -118,6 +114,12 @@ public: /// /// If the option does not begin with an option prefix, false is returned. + void checkRequired() const; + /// Checks if all required options have been processed. + /// + /// Does nothing if all required options have been processed. + /// Throws a MissingOptionException otherwise. + private: bool processUnix(const std::string& argument, std::string& optionName, std::string& optionArg); bool processDefault(const std::string& argument, std::string& optionName, std::string& optionArg); @@ -140,7 +142,7 @@ inline bool OptionProcessor::isUnixStyle() const } -Util_END +} } // namespace Poco::Util #endif // Util_OptionProcessor_INCLUDED diff --git a/Util/include/Util/OptionSet.h b/Util/include/Poco/Util/OptionSet.h similarity index 90% rename from Util/include/Util/OptionSet.h rename to Util/include/Poco/Util/OptionSet.h index db550c8a9..22fd5c4a6 100644 --- a/Util/include/Util/OptionSet.h +++ b/Util/include/Poco/Util/OptionSet.h @@ -1,7 +1,7 @@ // // OptionSet.h // -// $Id: //poco/1.1.0/Util/include/Util/OptionSet.h#2 $ +// $Id: //poco/1.2/Util/include/Poco/Util/OptionSet.h#1 $ // // Library: Util // Package: Options @@ -40,19 +40,13 @@ #define Util_OptionSet_INCLUDED -#ifndef Util_Util_INCLUDED -#include "Util/Util.h" -#endif -#ifndef Util_Option_INCLUDED -#include "Util/Option.h" -#endif -#ifndef STD_VECTOR_INCLUDED +#include "Poco/Util/Util.h" +#include "Poco/Util/Option.h" #include -#define STD_VECTOR_INCLUDED -#endif -Util_BEGIN +namespace Poco { +namespace Util { class Util_API OptionSet @@ -110,7 +104,7 @@ private: }; -Util_END +} } // namespace Poco::Util #endif // Util_OptionSet_INCLUDED diff --git a/Util/include/Util/PropertyFileConfiguration.h b/Util/include/Poco/Util/PropertyFileConfiguration.h similarity index 89% rename from Util/include/Util/PropertyFileConfiguration.h rename to Util/include/Poco/Util/PropertyFileConfiguration.h index 2cc6f1808..ce1fb6c0a 100644 --- a/Util/include/Util/PropertyFileConfiguration.h +++ b/Util/include/Poco/Util/PropertyFileConfiguration.h @@ -1,7 +1,7 @@ // // PropertyFileConfiguration.h // -// $Id: //poco/1.1.0/Util/include/Util/PropertyFileConfiguration.h#2 $ +// $Id: //poco/1.2/Util/include/Poco/Util/PropertyFileConfiguration.h#1 $ // // Library: Util // Package: Configuration @@ -40,23 +40,14 @@ #define Util_PropertyFileConfiguration_INCLUDED -#ifndef Util_Util_INCLUDED -#include "Util/Util.h" -#endif -#ifndef Util_MapConfiguration_INCLUDED -#include "Util/MapConfiguration.h" -#endif -#ifndef STD_ISTREAM_INCLUDED +#include "Poco/Util/Util.h" +#include "Poco/Util/MapConfiguration.h" #include -#define STD_ISTREAM_INCLUDED -#endif -#ifndef STD_OSTREAM_INCLUDED #include -#define STD_OSTREAM_INCLUDED -#endif -Util_BEGIN +namespace Poco { +namespace Util { class Util_API PropertyFileConfiguration: public MapConfiguration @@ -124,7 +115,7 @@ private: }; -Util_END +} } // namespace Poco::Util #endif // Util_PropertyFileConfiguration_INCLUDED diff --git a/Util/include/Poco/Util/RegExpValidator.h b/Util/include/Poco/Util/RegExpValidator.h new file mode 100644 index 000000000..81f4c519c --- /dev/null +++ b/Util/include/Poco/Util/RegExpValidator.h @@ -0,0 +1,76 @@ +// +// RegExpValidator.h +// +// $Id: //poco/1.2/Util/include/Poco/Util/RegExpValidator.h#1 $ +// +// Library: Util +// Package: Options +// Module: RegExpValidator +// +// Definition of the RegExpValidator class. +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef Util_RegExpValidator_INCLUDED +#define Util_RegExpValidator_INCLUDED + + +#include "Poco/Util/Util.h" +#include "Poco/Util/Validator.h" + + +namespace Poco { +namespace Util { + + +class Util_API RegExpValidator: public Validator + /// This validator matches the option value against + /// a regular expression. +{ +public: + RegExpValidator(const std::string& regexp); + /// Creates the RegExpValidator, using the given regular expression. + + ~RegExpValidator(); + /// Destroys the RegExpValidator. + + void validate(const Option& option, const std::string& value); + /// Validates the value for the given option by + /// matching it with the regular expression. + +private: + RegExpValidator(); + + std::string _regexp; +}; + + +} } // namespace Poco::Util + + +#endif // Util_RegExpValidator_INCLUDED diff --git a/Util/include/Util/ServerApplication.h b/Util/include/Poco/Util/ServerApplication.h similarity index 82% rename from Util/include/Util/ServerApplication.h rename to Util/include/Poco/Util/ServerApplication.h index 221fc19ad..964287228 100644 --- a/Util/include/Util/ServerApplication.h +++ b/Util/include/Poco/Util/ServerApplication.h @@ -1,7 +1,7 @@ // // ServerApplication.h // -// $Id: //poco/1.1.0/Util/include/Util/ServerApplication.h#2 $ +// $Id: //poco/1.2/Util/include/Poco/Util/ServerApplication.h#1 $ // // Library: Util // Package: Application @@ -40,18 +40,13 @@ #define Util_ServerApplication_INCLUDED -#ifndef Util_Util_INCLUDED -#include "Util/Util.h" -#endif -#ifndef Util_Application_INCLUDED -#include "Util/Application.h" -#endif -#ifndef Foundation_Event_INCLUDED -#include "Foundation/Event.h" -#endif +#include "Poco/Util/Util.h" +#include "Poco/Util/Application.h" +#include "Poco/Event.h" -Util_BEGIN +namespace Poco { +namespace Util { class Util_API ServerApplication: public Application @@ -69,7 +64,7 @@ class Util_API ServerApplication: public Application /// initialize() method. /// - At the end of the main() method, waitForTerminationRequest() /// should be called. - /// - The main() function must look as follows: + /// - The main(argc, argv) function must look as follows: /// /// int main(int argc, char** argv) /// { @@ -77,6 +72,10 @@ class Util_API ServerApplication: public Application /// return app.run(argc, argv); /// } /// + /// The POCO_SERVER_MAIN macro can be used to implement main(argc, argv). + /// If POCO has been built with POCO_WIN32_UTF8, POCO_SERVER_MAIN supports + /// Unicode command line arguments. + /// /// On Windows platforms, an application built on top of the /// ServerApplication class can be run both from the command line /// or as a service. @@ -142,6 +141,15 @@ public: /// Runs the application by performing additional initializations /// and calling the main() method. +#if defined(POCO_WIN32_UTF8) + int run(int argc, wchar_t** argv); + /// Runs the application by performing additional initializations + /// and calling the main() method. + /// + /// This Windows-specific version of init is used for passing + /// Unicode command line arguments from wmain(). +#endif + protected: int run(); void waitForTerminationRequest(); @@ -173,14 +181,34 @@ private: Action _action; std::string _displayName; - static Foundation::Event _terminated; + static Poco::Event _terminated; static SERVICE_STATUS _serviceStatus; static SERVICE_STATUS_HANDLE _serviceStatusHandle; #endif }; -Util_END +} } // namespace Poco::Util + + +// +// Macro to implement main() +// +#if defined(POCO_WIN32_UTF8) + #define POCO_SERVER_MAIN(App) \ + int wmain(int argc, wchar_t** argv) \ + { \ + App app; \ + return app.run(argc, argv); \ + } +#else + #define POCO_SERVER_MAIN(App) \ + int main(int argc, char** argv) \ + { \ + App app; \ + return app.run(argc, argv); \ + } +#endif #endif // Util_ServerApplication_INCLUDED diff --git a/Util/include/Util/Subsystem.h b/Util/include/Poco/Util/Subsystem.h similarity index 88% rename from Util/include/Util/Subsystem.h rename to Util/include/Poco/Util/Subsystem.h index 4f5751090..8f7c4d2bb 100644 --- a/Util/include/Util/Subsystem.h +++ b/Util/include/Poco/Util/Subsystem.h @@ -1,7 +1,7 @@ // // Subsystem.h // -// $Id: //poco/1.1.0/Util/include/Util/Subsystem.h#2 $ +// $Id: //poco/1.2/Util/include/Poco/Util/Subsystem.h#1 $ // // Library: Util // Package: Application @@ -40,21 +40,18 @@ #define Util_Subsystem_INCLUDED -#ifndef Util_Util_INCLUDED -#include "Util/Util.h" -#endif -#ifndef Foundation_RefCountedObject_INCLUDED -#include "Foundation/RefCountedObject.h" -#endif +#include "Poco/Util/Util.h" +#include "Poco/RefCountedObject.h" -Util_BEGIN +namespace Poco { +namespace Util { class Application; -class Util_API Subsystem: public Foundation::RefCountedObject +class Util_API Subsystem: public Poco::RefCountedObject /// Subsystems extend an application in a modular way. /// /// The Subsystem class provides a common interface @@ -102,7 +99,7 @@ protected: }; -Util_END +} } // namespace Poco::Util #endif // Util_Subsystem_INCLUDED diff --git a/Util/include/Util/SystemConfiguration.h b/Util/include/Poco/Util/SystemConfiguration.h similarity index 90% rename from Util/include/Util/SystemConfiguration.h rename to Util/include/Poco/Util/SystemConfiguration.h index 0399053b0..ac1f89b02 100644 --- a/Util/include/Util/SystemConfiguration.h +++ b/Util/include/Poco/Util/SystemConfiguration.h @@ -1,7 +1,7 @@ // // SystemConfiguration.h // -// $Id: //poco/1.1.0/Util/include/Util/SystemConfiguration.h#2 $ +// $Id: //poco/1.2/Util/include/Poco/Util/SystemConfiguration.h#1 $ // // Library: Util // Package: Configuration @@ -40,15 +40,12 @@ #define Util_SystemConfiguration_INCLUDED -#ifndef Util_Util_INCLUDED -#include "Util/Util.h" -#endif -#ifndef Util_AbstractConfiguration_INCLUDED -#include "Util/AbstractConfiguration.h" -#endif +#include "Poco/Util/Util.h" +#include "Poco/Util/AbstractConfiguration.h" -Util_BEGIN +namespace Poco { +namespace Util { class Util_API SystemConfiguration: public AbstractConfiguration @@ -95,7 +92,7 @@ private: }; -Util_END +} } // namespace Poco::Util #endif // Util_SystemConfiguration_INCLUDED diff --git a/Util/include/Util/Util.h b/Util/include/Poco/Util/Util.h similarity index 86% rename from Util/include/Util/Util.h rename to Util/include/Poco/Util/Util.h index 869970e13..0f40c93ea 100644 --- a/Util/include/Util/Util.h +++ b/Util/include/Poco/Util/Util.h @@ -1,7 +1,7 @@ // // Util.h // -// $Id: //poco/1.1.0/Util/include/Util/Util.h#2 $ +// $Id: //poco/1.2/Util/include/Poco/Util/Util.h#1 $ // // Library: Util // Package: Util @@ -42,16 +42,7 @@ #define Util_Util_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif - - -// -// Macros to declare the Util namespace -// -#define Util_BEGIN namespace Util { -#define Util_END } +#include "Poco/Foundation.h" // @@ -62,7 +53,7 @@ // Util_API functions as being imported from a DLL, wheras this DLL sees symbols // defined with this macro as being exported. // -#if (defined(_WIN32) || defined(__CYGWIN__)) && defined(POCO_DLL) +#if defined(_WIN32) && defined(POCO_DLL) #if defined(Util_EXPORTS) #define Util_API __declspec(dllexport) #else diff --git a/Util/include/Poco/Util/Validator.h b/Util/include/Poco/Util/Validator.h new file mode 100644 index 000000000..b3e60b812 --- /dev/null +++ b/Util/include/Poco/Util/Validator.h @@ -0,0 +1,79 @@ +// +// Validator.h +// +// $Id: //poco/1.2/Util/include/Poco/Util/Validator.h#1 $ +// +// Library: Util +// Package: Options +// Module: Validator +// +// Definition of the Validator class. +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef Util_Validator_INCLUDED +#define Util_Validator_INCLUDED + + +#include "Poco/Util/Util.h" +#include "Poco/RefCountedObject.h" + + +namespace Poco { +namespace Util { + + +class Option; + + +class Util_API Validator: public Poco::RefCountedObject + /// Validator specifies the interface for option validators. + /// + /// Option validators provide a simple way for the automatic + /// validation of command line argument values. +{ +public: + virtual void validate(const Option& option, const std::string& value) = 0; + /// Validates the value for the given option. + /// Does nothing if the value is valid. + /// + /// Throws an InvalidOptionException otherwise. + +protected: + Validator(); + /// Creates the Validator. + + virtual ~Validator(); + /// Destroys the Validator. +}; + + +} } // namespace Poco::Util + + +#endif // Util_Validator_INCLUDED diff --git a/Util/include/Poco/Util/WinRegistryConfiguration.h b/Util/include/Poco/Util/WinRegistryConfiguration.h new file mode 100644 index 000000000..bcca1a2a4 --- /dev/null +++ b/Util/include/Poco/Util/WinRegistryConfiguration.h @@ -0,0 +1,97 @@ +// +// WinRegistryConfiguration.h +// +// $Id: //poco/1.2/Util/include/Poco/Util/WinRegistryConfiguration.h#1 $ +// +// Library: Util +// Package: Windows +// Module: WinRegistryConfiguration +// +// Definition of the WinRegistryConfiguration class. +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef Util_WinRegistryConfiguration_INCLUDED +#define Util_WinRegistryConfiguration_INCLUDED + + +#include "Poco/Util/Util.h" +#include "Poco/Util/AbstractConfiguration.h" +#include "Poco/String.h" + + +namespace Poco { +namespace Util { + + +class Util_API WinRegistryConfiguration: public AbstractConfiguration + /// An implementation of AbstractConfiguration that stores configuration data + /// in the Windows registry. +{ +public: + WinRegistryConfiguration(const std::string& rootPath); + /// Creates the WinRegistryConfiguration. + /// The rootPath must start with one of the root key names + /// like HKEY_CLASSES_ROOT, e.g. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services. + /// All further keys are relativ to the root path and can be + /// dot seperated, e.g. the path MyService.ServiceName will be converted to + /// HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MyService\ServiceName. + + bool getRaw(const std::string& key, std::string& value) const; + /// If the property with the given key exists, stores the property's value + /// in value and returns true. Otherwise, returns false. + /// + /// Must be overridden by subclasses. + + void setRaw(const std::string& key, const std::string& value); + /// Sets the property with the given key to the given value. + /// An already existing value for the key is overwritten. + /// + /// Must be overridden by subclasses. + + void enumerate(const std::string& key, Keys& range) const; + /// Returns in range the names of all subkeys under the given key. + /// If an empty key is passed, all root level keys are returned. + +protected: + ~WinRegistryConfiguration(); + /// Destroys the WinRegistryConfiguration. + + std::string ConvertToRegFormat(const std::string& key, std::string& keyName) const; + /// takes a key in the format of A.B.C and converts it to + /// registry format A\B\C, the last entry is the keyName, the rest is returned as path + +private: + std::string _rootPath; +}; + + +} } // namespace Poco::Util + + +#endif // Util_WinRegistryConfiguration_INCLUDED diff --git a/Util/include/Util/WinRegistryKey.h b/Util/include/Poco/Util/WinRegistryKey.h similarity index 85% rename from Util/include/Util/WinRegistryKey.h rename to Util/include/Poco/Util/WinRegistryKey.h index 50411d6a5..0df2b8826 100644 --- a/Util/include/Util/WinRegistryKey.h +++ b/Util/include/Poco/Util/WinRegistryKey.h @@ -1,7 +1,7 @@ // // WinRegistryKey.h // -// $Id: //poco/1.1.0/Util/include/Util/WinRegistryKey.h#2 $ +// $Id: //poco/1.2/Util/include/Poco/Util/WinRegistryKey.h#1 $ // // Library: Util // Package: Windows @@ -40,16 +40,13 @@ #define Util_WinRegistryKey_INCLUDED -#ifndef Util_Util_INCLUDED -#include "Util/Util.h" -#endif -#ifndef STD_WINDOWS_INCLUDED +#include "Poco/Util/Util.h" #include -#define STD_WINDOWS_INCLUDED -#endif +#include -Util_BEGIN +namespace Poco { +namespace Util { class Util_API WinRegistryKey @@ -59,6 +56,17 @@ class Util_API WinRegistryKey /// This class is only available on Windows platforms. { public: + typedef std::vector Keys; + typedef std::vector Values; + + enum Type + { + REGT_NONE = 0, + REGT_STRING = 1, + REGT_STRING_EXPAND = 2, + REGT_DWORD = 4 + }; + WinRegistryKey(const std::string& key); /// Creates the WinRegistryKey. /// @@ -113,10 +121,19 @@ public: bool exists(); /// Returns true iff the key exists. + + Type type(const std::string& name); + /// Returns the type of the key value. bool exists(const std::string& name); /// Returns true iff the given value exists under that key. + void subKeys(Keys& keys); + /// Appends all subKey names to keys. + + void values(Values& vals); + /// Appends all value names to vals; + protected: void open(); void close(); @@ -136,7 +153,7 @@ private: }; -Util_END +} } // namespace Poco::Util #endif // Util_WinRegistryKey_INCLUDED diff --git a/Util/include/Util/WinService.h b/Util/include/Poco/Util/WinService.h similarity index 92% rename from Util/include/Util/WinService.h rename to Util/include/Poco/Util/WinService.h index 0e944e332..6e0a74308 100644 --- a/Util/include/Util/WinService.h +++ b/Util/include/Poco/Util/WinService.h @@ -1,7 +1,7 @@ // // WinService.h // -// $Id: //poco/1.1.0/Util/include/Util/WinService.h#2 $ +// $Id: //poco/1.2/Util/include/Poco/Util/WinService.h#1 $ // // Library: Util // Package: Windows @@ -40,16 +40,12 @@ #define Util_WinService_INCLUDED -#ifndef Util_Util_INCLUDED -#include "Util/Util.h" -#endif -#ifndef STD_WINDOWS_INCLUDED +#include "Poco/Util/Util.h" #include -#define STD_WINDOWS_INCLUDED -#endif -Util_BEGIN +namespace Poco { +namespace Util { class Util_API WinService @@ -144,7 +140,7 @@ private: }; -Util_END +} } // namespace Poco::Util #endif // Util_WinService_INCLUDED diff --git a/Util/include/Util/XMLConfiguration.h b/Util/include/Poco/Util/XMLConfiguration.h similarity index 75% rename from Util/include/Util/XMLConfiguration.h rename to Util/include/Poco/Util/XMLConfiguration.h index cfe5ae5c9..c692f035a 100644 --- a/Util/include/Util/XMLConfiguration.h +++ b/Util/include/Poco/Util/XMLConfiguration.h @@ -1,7 +1,7 @@ // // XMLConfiguration.h // -// $Id: //poco/1.1.0/Util/include/Util/XMLConfiguration.h#2 $ +// $Id: //poco/1.2/Util/include/Poco/Util/XMLConfiguration.h#1 $ // // Library: Util // Package: Configuration @@ -40,28 +40,16 @@ #define Util_XMLConfiguration_INCLUDED -#ifndef Util_Util_INCLUDED -#include "Util/Util.h" -#endif -#ifndef Util_MapConfiguration_INCLUDED -#include "Util/MapConfiguration.h" -#endif -#ifndef DOM_Document_INCLUDED -#include "DOM/Document.h" -#endif -#ifndef DOM_AutoPtr_INCLUDED -#include "DOM/AutoPtr.h" -#endif -#ifndef SAX_InputSource_INCLUDED -#include "SAX/InputSource.h" -#endif -#ifndef STD_ISTREAM_INCLUDED +#include "Poco/Util/Util.h" +#include "Poco/Util/MapConfiguration.h" +#include "Poco/DOM/Document.h" +#include "Poco/DOM/AutoPtr.h" +#include "Poco/SAX/InputSource.h" #include -#define STD_ISTREAM_INCLUDED -#endif -Util_BEGIN +namespace Poco { +namespace Util { class Util_API XMLConfiguration: public AbstractConfiguration @@ -106,7 +94,7 @@ public: XMLConfiguration(); /// Creates an empty XMLConfiguration. - XMLConfiguration(XML::InputSource* pInputSource); + XMLConfiguration(Poco::XML::InputSource* pInputSource); /// Creates an XMLConfiguration and loads the XML document from /// the given InputSource. @@ -118,13 +106,13 @@ public: /// Creates an XMLConfiguration and loads the XML document from /// the given path. - XMLConfiguration(const XML::Document* pDocument); + XMLConfiguration(const Poco::XML::Document* pDocument); /// Creates the XMLConfiguration using the given XML document. - XMLConfiguration(const XML::Node* pNode); + XMLConfiguration(const Poco::XML::Node* pNode); /// Creates the XMLConfiguration using the given XML node. - void load(XML::InputSource* pInputSource); + void load(Poco::XML::InputSource* pInputSource); /// Loads the XML document containing the configuration data /// from the given InputSource. @@ -136,11 +124,11 @@ public: /// Loads the XML document containing the configuration data /// from the given file. - void load(const XML::Document* pDocument); + void load(const Poco::XML::Document* pDocument); /// Loads the XML document containing the configuration data /// from the given XML document. - void load(const XML::Node* pNode); + void load(const Poco::XML::Node* pNode); /// Loads the XML document containing the configuration data /// from the given XML node. @@ -151,18 +139,18 @@ protected: ~XMLConfiguration(); private: - const XML::Node* findNode(const std::string& key) const; - static const XML::Node* findNode(std::string::const_iterator& it, const std::string::const_iterator& end, const XML::Node* pNode); - static const XML::Node* findElement(const std::string& name, const XML::Node* pNode); - static const XML::Node* findElement(int index, const XML::Node* pNode); - static const XML::Node* findAttribute(const std::string& name, const XML::Node* pNode); + const Poco::XML::Node* findNode(const std::string& key) const; + static const Poco::XML::Node* findNode(std::string::const_iterator& it, const std::string::const_iterator& end, const Poco::XML::Node* pNode); + static const Poco::XML::Node* findElement(const std::string& name, const Poco::XML::Node* pNode); + static const Poco::XML::Node* findElement(int index, const Poco::XML::Node* pNode); + static const Poco::XML::Node* findAttribute(const std::string& name, const Poco::XML::Node* pNode); - XML::AutoPtr _pRoot; - XML::AutoPtr _pDocument; + Poco::XML::AutoPtr _pRoot; + Poco::XML::AutoPtr _pDocument; }; -Util_END +} } // namespace Poco::Util #endif // Util_XMLConfiguration_INCLUDED diff --git a/Util/samples/Makefile b/Util/samples/Makefile index 641863910..196632242 100644 --- a/Util/samples/Makefile +++ b/Util/samples/Makefile @@ -1,11 +1,13 @@ # # Makefile # -# $Id: //poco/1.1.0/Util/samples/Makefile#1 $ +# $Id: //poco/1.2/Util/samples/Makefile#1 $ # # Makefile for Poco Util Samples # -.DEFAULT all: +.PHONY: projects +clean all: projects +projects: $(MAKE) -C SampleApp $(MAKECMDGOALS) $(MAKE) -C SampleServer $(MAKECMDGOALS) diff --git a/Util/samples/SampleApp/Makefile b/Util/samples/SampleApp/Makefile index 49540875e..4ca0efe43 100644 --- a/Util/samples/SampleApp/Makefile +++ b/Util/samples/SampleApp/Makefile @@ -1,7 +1,7 @@ # # Makefile # -# $Id: //poco/1.1.0/Util/samples/SampleApp/Makefile#1 $ +# $Id: //poco/1.2/Util/samples/SampleApp/Makefile#1 $ # # Makefile for Poco SampleApp # @@ -12,6 +12,6 @@ objects = SampleApp target = SampleApp target_version = 1 -target_libs = PocoFoundation PocoXML PocoUtil +target_libs = PocoUtil PocoXML PocoFoundation include $(POCO_BASE)/build/rules/exec diff --git a/Util/samples/SampleApp/SampleApp.vmsbuild b/Util/samples/SampleApp/SampleApp.vmsbuild index 4fd7f51ac..ef50f18a4 100644 --- a/Util/samples/SampleApp/SampleApp.vmsbuild +++ b/Util/samples/SampleApp/SampleApp.vmsbuild @@ -1,7 +1,7 @@ # # sample.vmsbuild # -# $Id: //poco/1.1.0/Util/samples/SampleApp/SampleApp.vmsbuild#1 $ +# $Id: //poco/1.2/Util/samples/SampleApp/SampleApp.vmsbuild#1 $ # EXE=SampleApp SampleApp diff --git a/Util/samples/SampleApp/src/SampleApp.cpp b/Util/samples/SampleApp/src/SampleApp.cpp index fd2a0c2c7..4f8aa9b63 100644 --- a/Util/samples/SampleApp/src/SampleApp.cpp +++ b/Util/samples/SampleApp/src/SampleApp.cpp @@ -1,7 +1,7 @@ // // SampleApp.cpp // -// $Id: //poco/1.1.0/Util/samples/SampleApp/src/SampleApp.cpp#2 $ +// $Id: //poco/1.2/Util/samples/SampleApp/src/SampleApp.cpp#1 $ // // This sample demonstrates the Application class. // @@ -32,21 +32,22 @@ // -#include "Util/Application.h" -#include "Util/Option.h" -#include "Util/OptionSet.h" -#include "Util/HelpFormatter.h" -#include "Util/AbstractConfiguration.h" -#include "Foundation/AutoPtr.h" +#include "Poco/Util/Application.h" +#include "Poco/Util/Option.h" +#include "Poco/Util/OptionSet.h" +#include "Poco/Util/HelpFormatter.h" +#include "Poco/Util/AbstractConfiguration.h" +#include "Poco/AutoPtr.h" #include -using Util::Application; -using Util::Option; -using Util::OptionSet; -using Util::HelpFormatter; -using Util::AbstractConfiguration; -using Foundation::AutoPtr; +using Poco::Util::Application; +using Poco::Util::Option; +using Poco::Util::OptionSet; +using Poco::Util::HelpFormatter; +using Poco::Util::AbstractConfiguration; +using Poco::Util::OptionCallback; +using Poco::AutoPtr; class SampleApp: public Application @@ -88,39 +89,54 @@ protected: options.addOption( Option("help", "h", "display help information on command line arguments") .required(false) - .repeatable(false)); + .repeatable(false) + .callback(OptionCallback(this, &SampleApp::handleHelp))); options.addOption( Option("define", "D", "define a configuration property") .required(false) .repeatable(true) - .argument("name=value")); + .argument("name=value") + .callback(OptionCallback(this, &SampleApp::handleDefine))); options.addOption( Option("config-file", "f", "load configuration data from a file") .required(false) .repeatable(true) - .argument("file")); - } - - void handleOption(const std::string& name, const std::string& value) - { - Application::handleOption(name, value); + .argument("file") + .callback(OptionCallback(this, &SampleApp::handleConfig))); - if (name == "help") - _helpRequested = true; - else if (name == "define") - defineProperty(value); - else if (name == "config-file") - loadConfiguration(value); + options.addOption( + Option("bind", "b", "bind option value to test.property") + .required(false) + .repeatable(false) + .argument("value") + .binding("test.property")); } + void handleHelp(const std::string& name, const std::string& value) + { + _helpRequested = true; + displayHelp(); + stopOptionsProcessing(); + } + + void handleDefine(const std::string& name, const std::string& value) + { + defineProperty(value); + } + + void handleConfig(const std::string& name, const std::string& value) + { + loadConfiguration(value); + } + void displayHelp() { HelpFormatter helpFormatter(options()); helpFormatter.setCommand(commandName()); helpFormatter.setUsage("OPTIONS"); - helpFormatter.setHeader("A sample application that demonstrates some of the features of the Util::Application class."); + helpFormatter.setHeader("A sample application that demonstrates some of the features of the Poco::Util::Application class."); helpFormatter.format(std::cout); } @@ -140,11 +156,7 @@ protected: int main(const std::vector& args) { - if (_helpRequested) - { - displayHelp(); - } - else + if (!_helpRequested) { logger().information("Arguments to main():"); for (std::vector::const_iterator it = args.begin(); it != args.end(); ++it) @@ -154,7 +166,6 @@ protected: logger().information("Application properties:"); printProperties(""); } - return Application::EXIT_OK; } @@ -184,23 +195,10 @@ protected: } } } - + private: bool _helpRequested; }; -int main(int argc, char** argv) -{ - AutoPtr pApp = new SampleApp; - try - { - pApp->init(argc, argv); - } - catch (Foundation::Exception& exc) - { - pApp->logger().log(exc); - return Application::EXIT_CONFIG; - } - return pApp->run(); -} +POCO_APP_MAIN(SampleApp) diff --git a/Util/samples/SampleServer/Makefile b/Util/samples/SampleServer/Makefile index 6fdb0ed80..17ad310d9 100644 --- a/Util/samples/SampleServer/Makefile +++ b/Util/samples/SampleServer/Makefile @@ -1,7 +1,7 @@ # # Makefile # -# $Id: //poco/1.1.0/Util/samples/SampleServer/Makefile#1 $ +# $Id: //poco/1.2/Util/samples/SampleServer/Makefile#1 $ # # Makefile for Poco SampleServer # @@ -12,6 +12,6 @@ objects = SampleServer target = SampleServer target_version = 1 -target_libs = PocoFoundation PocoXML PocoUtil +target_libs = PocoUtil PocoXML PocoFoundation include $(POCO_BASE)/build/rules/exec diff --git a/Util/samples/SampleServer/SampleServer.vmsbuild b/Util/samples/SampleServer/SampleServer.vmsbuild index c6c4fc0b2..c0d5dc61f 100644 --- a/Util/samples/SampleServer/SampleServer.vmsbuild +++ b/Util/samples/SampleServer/SampleServer.vmsbuild @@ -1,7 +1,7 @@ # # sample.vmsbuild # -# $Id: //poco/1.1.0/Util/samples/SampleServer/SampleServer.vmsbuild#1 $ +# $Id: //poco/1.2/Util/samples/SampleServer/SampleServer.vmsbuild#1 $ # EXE=SampleServer SampleServer diff --git a/Util/samples/SampleServer/src/SampleServer.cpp b/Util/samples/SampleServer/src/SampleServer.cpp index 38479be79..95beea117 100644 --- a/Util/samples/SampleServer/src/SampleServer.cpp +++ b/Util/samples/SampleServer/src/SampleServer.cpp @@ -1,7 +1,7 @@ // // SampleServer.cpp // -// $Id: //poco/1.1.0/Util/samples/SampleServer/src/SampleServer.cpp#2 $ +// $Id: //poco/1.2/Util/samples/SampleServer/src/SampleServer.cpp#1 $ // // This sample demonstrates the ServerApplication class. // @@ -32,24 +32,25 @@ // -#include "Util/ServerApplication.h" -#include "Util/Option.h" -#include "Util/OptionSet.h" -#include "Util/HelpFormatter.h" -#include "Foundation/Task.h" -#include "Foundation/TaskManager.h" -#include "Foundation/DateTimeFormatter.h" +#include "Poco/Util/ServerApplication.h" +#include "Poco/Util/Option.h" +#include "Poco/Util/OptionSet.h" +#include "Poco/Util/HelpFormatter.h" +#include "Poco/Task.h" +#include "Poco/TaskManager.h" +#include "Poco/DateTimeFormatter.h" #include -using Util::Application; -using Util::ServerApplication; -using Util::Option; -using Util::OptionSet; -using Util::HelpFormatter; -using Foundation::Task; -using Foundation::TaskManager; -using Foundation::DateTimeFormatter; +using Poco::Util::Application; +using Poco::Util::ServerApplication; +using Poco::Util::Option; +using Poco::Util::OptionSet; +using Poco::Util::OptionCallback; +using Poco::Util::HelpFormatter; +using Poco::Task; +using Poco::TaskManager; +using Poco::DateTimeFormatter; class SampleTask: public Task @@ -102,15 +103,15 @@ protected: options.addOption( Option("help", "h", "display help information on command line arguments") .required(false) - .repeatable(false)); + .repeatable(false) + .callback(OptionCallback(this, &SampleServer::handleHelp))); } - void handleOption(const std::string& name, const std::string& value) + void handleHelp(const std::string& name, const std::string& value) { - ServerApplication::handleOption(name, value); - - if (name == "help") - _helpRequested = true; + _helpRequested = true; + displayHelp(); + stopOptionsProcessing(); } void displayHelp() @@ -124,11 +125,7 @@ protected: int main(const std::vector& args) { - if (_helpRequested) - { - displayHelp(); - } - else + if (!_helpRequested) { TaskManager tm; tm.start(new SampleTask); @@ -144,8 +141,4 @@ private: }; -int main(int argc, char** argv) -{ - SampleServer app; - return app.run(argc, argv); -} +POCO_SERVER_MAIN(SampleServer) diff --git a/Util/src/AbstractConfiguration.cpp b/Util/src/AbstractConfiguration.cpp index b8dfdd329..95d1ada0a 100644 --- a/Util/src/AbstractConfiguration.cpp +++ b/Util/src/AbstractConfiguration.cpp @@ -1,7 +1,7 @@ // // AbstractConfiguration.cpp // -// $Id: //poco/1.1.0/Util/src/AbstractConfiguration.cpp#2 $ +// $Id: //poco/1.2/Util/src/AbstractConfiguration.cpp#1 $ // // Library: Util // Package: Configuration @@ -34,24 +34,25 @@ // -#include "Util/AbstractConfiguration.h" -#include "Util/ConfigurationView.h" -#include "Foundation/Exception.h" -#include "Foundation/NumberParser.h" -#include "Foundation/NumberFormatter.h" -#include "Foundation/String.h" +#include "Poco/Util/AbstractConfiguration.h" +#include "Poco/Util/ConfigurationView.h" +#include "Poco/Exception.h" +#include "Poco/NumberParser.h" +#include "Poco/NumberFormatter.h" +#include "Poco/String.h" -using Foundation::FastMutex; -using Foundation::NotFoundException; -using Foundation::SyntaxException; -using Foundation::CircularReferenceException; -using Foundation::NumberParser; -using Foundation::NumberFormatter; -using Foundation::icompare; +using Poco::FastMutex; +using Poco::NotFoundException; +using Poco::SyntaxException; +using Poco::CircularReferenceException; +using Poco::NumberParser; +using Poco::NumberFormatter; +using Poco::icompare; -Util_BEGIN +namespace Poco { +namespace Util { AbstractConfiguration::AbstractConfiguration(): _depth(0) @@ -366,4 +367,4 @@ bool AbstractConfiguration::parseBool(const std::string& value) } -Util_END +} } // namespace Poco::Util diff --git a/Util/src/Application.cpp b/Util/src/Application.cpp index 221adf251..2141c76e5 100644 --- a/Util/src/Application.cpp +++ b/Util/src/Application.cpp @@ -1,7 +1,7 @@ // // Application.cpp // -// $Id: //poco/1.1.0/Util/src/Application.cpp#2 $ +// $Id: //poco/1.2/Util/src/Application.cpp#1 $ // // Library: Util // Package: Application @@ -34,43 +34,48 @@ // -#include "Util/Application.h" -#include "Util/SystemConfiguration.h" -#include "Util/MapConfiguration.h" -#include "Util/PropertyFileConfiguration.h" -#include "Util/IniFileConfiguration.h" -#include "Util/XMLConfiguration.h" -#include "Util/LoggingSubsystem.h" -#include "Util/Option.h" -#include "Util/OptionProcessor.h" -#include "Foundation/Environment.h" -#include "Foundation/Exception.h" -#include "Foundation/NumberFormatter.h" -#include "Foundation/File.h" -#include "Foundation/Path.h" -#include "Foundation/String.h" -#include "Foundation/ConsoleChannel.h" -#include "Foundation/AutoPtr.h" +#include "Poco/Util/Application.h" +#include "Poco/Util/SystemConfiguration.h" +#include "Poco/Util/MapConfiguration.h" +#include "Poco/Util/PropertyFileConfiguration.h" +#include "Poco/Util/IniFileConfiguration.h" +#include "Poco/Util/XMLConfiguration.h" +#include "Poco/Util/LoggingSubsystem.h" +#include "Poco/Util/Option.h" +#include "Poco/Util/OptionProcessor.h" +#include "Poco/Util/Validator.h" +#include "Poco/Environment.h" +#include "Poco/Exception.h" +#include "Poco/NumberFormatter.h" +#include "Poco/File.h" +#include "Poco/Path.h" +#include "Poco/String.h" +#include "Poco/ConsoleChannel.h" +#include "Poco/AutoPtr.h" #if defined(POCO_OS_FAMILY_WINDOWS) #include #endif #if defined(POCO_OS_FAMILY_UNIX) -#include "Foundation/SignalHandler.h" +#include "Poco/SignalHandler.h" +#endif +#if defined(POCO_WIN32_UTF8) +#include "Poco/UnicodeConverter.h" #endif -using Foundation::Logger; -using Foundation::Path; -using Foundation::File; -using Foundation::Environment; -using Foundation::SystemException; -using Foundation::ConsoleChannel; -using Foundation::NumberFormatter; -using Foundation::AutoPtr; -using Foundation::icompare; +using Poco::Logger; +using Poco::Path; +using Poco::File; +using Poco::Environment; +using Poco::SystemException; +using Poco::ConsoleChannel; +using Poco::NumberFormatter; +using Poco::AutoPtr; +using Poco::icompare; -Util_BEGIN +namespace Poco { +namespace Util { Application* Application::_pInstance = 0; @@ -79,8 +84,9 @@ Application* Application::_pInstance = 0; Application::Application(): _pConfig(new LayeredConfiguration), _initialized(false), + _unixOptions(true), _pLogger(&Logger::get("ApplicationStartup")), - _unixOptions(true) + _stopOptionsProcessing(false) { setup(); } @@ -89,8 +95,9 @@ Application::Application(): Application::Application(int argc, char* argv[]): _pConfig(new LayeredConfiguration), _initialized(false), + _unixOptions(true), _pLogger(&Logger::get("ApplicationStartup")), - _unixOptions(true) + _stopOptionsProcessing(false) { setup(); init(argc, argv); @@ -120,7 +127,7 @@ void Application::setup() #if defined(POCO_OS_FAMILY_UNIX) #if !defined(_DEBUG) - Foundation::SignalHandler::install(); + Poco::SignalHandler::install(); #endif #else setUnixOptions(false); @@ -144,6 +151,34 @@ void Application::addSubsystem(Subsystem* pSubsystem) void Application::init(int argc, char* argv[]) { setArgs(argc, argv); + init(); +} + + +#if defined(POCO_WIN32_UTF8) +void Application::init(int argc, wchar_t* argv[]) +{ + std::vector args; + for (int i = 0; i < argc; ++i) + { + std::string arg; + Poco::UnicodeConverter::toUTF8(argv[i], arg); + args.push_back(arg); + } + init(args); +} +#endif + + +void Application::init(const std::vector& args) +{ + setArgs(args); + init(); +} + + +void Application::init() +{ Path appPath; getApplicationPath(appPath); _pConfig->setString("application.path", appPath.toString()); @@ -243,7 +278,7 @@ void Application::loadConfiguration(const std::string& path) else if (icompare(ext, "xml") == 0) _pConfig->addFront(new XMLConfiguration(confPath.toString()), false); else - throw Foundation::InvalidArgumentException("Unsupported configuration file type", ext); + throw Poco::InvalidArgumentException("Unsupported configuration file type", ext); } @@ -253,17 +288,31 @@ std::string Application::commandName() const } +void Application::stopOptionsProcessing() +{ + _stopOptionsProcessing = true; +} + + int Application::run() { try { return main(_args); } - catch (Foundation::Exception& exc) + catch (Poco::Exception& exc) { logger().log(exc); - return EXIT_SOFTWARE; } + catch (std::exception& exc) + { + logger().error(exc.what()); + } + catch (...) + { + logger().fatal("system exception"); + } + return EXIT_SOFTWARE; } @@ -288,6 +337,21 @@ void Application::setArgs(int argc, char* argv[]) } +void Application::setArgs(const std::vector& args) +{ + poco_assert (!args.empty()); + + _command = args[0]; + _pConfig->setInt("application.argc", (int) args.size()); + _args = args; + std::string argvKey = "application.argv["; + for (int i = 0; i < args.size(); ++i) + { + _pConfig->setString(argvKey + NumberFormatter::format(i) + "]", args[i]); + } +} + + void Application::processOptions() { defineOptions(_options); @@ -295,21 +359,23 @@ void Application::processOptions() processor.setUnixStyle(_unixOptions); _args.erase(_args.begin()); ArgVec::iterator it = _args.begin(); - while (it != _args.end()) + while (it != _args.end() && !_stopOptionsProcessing) { std::string name; std::string value; if (processor.process(*it, name, value)) { handleOption(name, value); - _args.erase(it); + it = _args.erase(it); } else ++it; } + if (!_stopOptionsProcessing) + processor.checkRequired(); } -void Application::getApplicationPath(Foundation::Path& appPath) const +void Application::getApplicationPath(Poco::Path& appPath) const { #if defined(POCO_OS_FAMILY_UNIX) if (_command.find('/') != std::string::npos) @@ -331,19 +397,31 @@ void Application::getApplicationPath(Foundation::Path& appPath) const appPath = Path(Path::current(), _command); } #elif defined(POCO_OS_FAMILY_WINDOWS) - char path[1024]; - int n = GetModuleFileName(0, path, sizeof(path)); - if (n > 0) - appPath = path; - else - throw SystemException("Cannot get application file name."); + #if defined(POCO_WIN32_UTF8) + wchar_t path[1024]; + int n = GetModuleFileNameW(0, path, sizeof(path)/sizeof(wchar_t)); + if (n > 0) + { + std::string p; + Poco::UnicodeConverter::toUTF8(path, p); + appPath = p; + } + else throw SystemException("Cannot get application file name."); + #else + char path[1024]; + int n = GetModuleFileName(0, path, sizeof(path)); + if (n > 0) + appPath = path; + else + throw SystemException("Cannot get application file name."); + #endif #else appPath = _command; #endif } -bool Application::findFile(Foundation::Path& path) const +bool Application::findFile(Poco::Path& path) const { if (path.isAbsolute()) return true; @@ -395,6 +473,19 @@ void Application::defineOptions(OptionSet& options) void Application::handleOption(const std::string& name, const std::string& value) { + const Option& option = _options.getOption(name); + if (option.validator()) + { + option.validator()->validate(option, value); + } + if (!option.binding().empty()) + { + config().setString(option.binding(), value); + } + if (option.callback()) + { + option.callback()->invoke(name, value); + } } @@ -404,4 +495,4 @@ void Application::setLogger(Logger& logger) } -Util_END +} } // namespace Poco::Util diff --git a/Util/src/ConfigurationMapper.cpp b/Util/src/ConfigurationMapper.cpp index cbf6b208c..1d9c7b245 100644 --- a/Util/src/ConfigurationMapper.cpp +++ b/Util/src/ConfigurationMapper.cpp @@ -1,7 +1,7 @@ // // ConfigurationMapper.cpp // -// $Id: //poco/1.1.0/Util/src/ConfigurationMapper.cpp#2 $ +// $Id: //poco/1.2/Util/src/ConfigurationMapper.cpp#1 $ // // Library: Util // Package: Configuration @@ -34,10 +34,11 @@ // -#include "Util/ConfigurationMapper.h" +#include "Poco/Util/ConfigurationMapper.h" -Util_BEGIN +namespace Poco { +namespace Util { ConfigurationMapper::ConfigurationMapper(const std::string& fromPrefix, const std::string& toPrefix, AbstractConfiguration* pConfig): @@ -112,4 +113,4 @@ std::string ConfigurationMapper::translateKey(const std::string& key) const } -Util_END +} } // namespace Poco::Util diff --git a/Util/src/ConfigurationView.cpp b/Util/src/ConfigurationView.cpp index 17c8b271d..45336f4c9 100644 --- a/Util/src/ConfigurationView.cpp +++ b/Util/src/ConfigurationView.cpp @@ -1,7 +1,7 @@ // // ConfigurationView.cpp // -// $Id: //poco/1.1.0/Util/src/ConfigurationView.cpp#2 $ +// $Id: //poco/1.2/Util/src/ConfigurationView.cpp#1 $ // // Library: Util // Package: Configuration @@ -34,10 +34,11 @@ // -#include "Util/ConfigurationView.h" +#include "Poco/Util/ConfigurationView.h" -Util_BEGIN +namespace Poco { +namespace Util { ConfigurationView::ConfigurationView(const std::string& prefix, AbstractConfiguration* pConfig): @@ -86,4 +87,4 @@ std::string ConfigurationView::translateKey(const std::string& key) const } -Util_END +} } // namespace Poco::Util diff --git a/Util/src/FilesystemConfiguration.cpp b/Util/src/FilesystemConfiguration.cpp index 92ff86eca..e7c75162c 100644 --- a/Util/src/FilesystemConfiguration.cpp +++ b/Util/src/FilesystemConfiguration.cpp @@ -1,7 +1,7 @@ // // FilesystemConfiguration.cpp // -// $Id: //poco/1.1.0/Util/src/FilesystemConfiguration.cpp#2 $ +// $Id: //poco/1.2/Util/src/FilesystemConfiguration.cpp#1 $ // // Library: Util // Package: Configuration @@ -34,22 +34,23 @@ // -#include "Util/FilesystemConfiguration.h" -#include "Foundation/File.h" -#include "Foundation/DirectoryIterator.h" -#include "Foundation/StringTokenizer.h" -#include "Foundation/Exception.h" +#include "Poco/Util/FilesystemConfiguration.h" +#include "Poco/File.h" +#include "Poco/DirectoryIterator.h" +#include "Poco/StringTokenizer.h" +#include "Poco/Exception.h" #include -using Foundation::Path; -using Foundation::File; -using Foundation::DirectoryIterator; -using Foundation::StringTokenizer; -using Foundation::NotFoundException; +using Poco::Path; +using Poco::File; +using Poco::DirectoryIterator; +using Poco::StringTokenizer; +using Poco::NotFoundException; -Util_BEGIN +namespace Poco { +namespace Util { FilesystemConfiguration::FilesystemConfiguration(const std::string& path): @@ -128,4 +129,4 @@ Path FilesystemConfiguration::keyToPath(const std::string& key) const } -Util_END +} } // namespace Poco::Util diff --git a/Util/src/HelpFormatter.cpp b/Util/src/HelpFormatter.cpp index 35b0cd0c8..091ca7553 100644 --- a/Util/src/HelpFormatter.cpp +++ b/Util/src/HelpFormatter.cpp @@ -1,7 +1,7 @@ // // HelpFormatter.cpp // -// $Id: //poco/1.1.0/Util/src/HelpFormatter.cpp#2 $ +// $Id: //poco/1.2/Util/src/HelpFormatter.cpp#1 $ // // Library: Util // Package: Options @@ -34,12 +34,13 @@ // -#include "Util/HelpFormatter.h" -#include "Util/OptionSet.h" -#include "Util/Option.h" +#include "Poco/Util/HelpFormatter.h" +#include "Poco/Util/OptionSet.h" +#include "Poco/Util/Option.h" -Util_BEGIN +namespace Poco { +namespace Util { const int HelpFormatter::TAB_WIDTH = 4; @@ -305,4 +306,4 @@ std::string HelpFormatter::longPrefix() const } -Util_END +} } // namespace Poco::Util diff --git a/Util/src/IniFileConfiguration.cpp b/Util/src/IniFileConfiguration.cpp index ef1e7a904..f01b69629 100644 --- a/Util/src/IniFileConfiguration.cpp +++ b/Util/src/IniFileConfiguration.cpp @@ -1,7 +1,7 @@ // // IniFileConfiguration.cpp // -// $Id: //poco/1.1.0/Util/src/IniFileConfiguration.cpp#2 $ +// $Id: //poco/1.2/Util/src/IniFileConfiguration.cpp#1 $ // // Library: Util // Package: Configuration @@ -34,19 +34,20 @@ // -#include "Util/IniFileConfiguration.h" -#include "Foundation/Exception.h" -#include "Foundation/String.h" +#include "Poco/Util/IniFileConfiguration.h" +#include "Poco/Exception.h" +#include "Poco/String.h" #include #include #include -using Foundation::icompare; -using Foundation::trim; +using Poco::icompare; +using Poco::trim; -Util_BEGIN +namespace Poco { +namespace Util { IniFileConfiguration::IniFileConfiguration() @@ -88,7 +89,7 @@ void IniFileConfiguration::load(const std::string& path) if (istr.good()) load(istr); else - throw Foundation::OpenFileException(path); + throw Poco::OpenFileException(path); } @@ -106,7 +107,7 @@ bool IniFileConfiguration::getRaw(const std::string& key, std::string& value) co void IniFileConfiguration::setRaw(const std::string& key, const std::string& value) { - throw Foundation::NotImplementedException("Setting a property in an IniFileConfiguration"); + throw Poco::NotImplementedException("Setting a property in an IniFileConfiguration"); } @@ -181,4 +182,4 @@ void IniFileConfiguration::parseLine(std::istream& istr) } -Util_END +} } // namespace Poco::Util diff --git a/Util/src/IntValidator.cpp b/Util/src/IntValidator.cpp new file mode 100644 index 000000000..5553a2e0a --- /dev/null +++ b/Util/src/IntValidator.cpp @@ -0,0 +1,76 @@ +// +// IntValidator.cpp +// +// $Id: //poco/1.2/Util/src/IntValidator.cpp#1 $ +// +// Library: Util +// Package: Options +// Module: IntValidator +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#include "Poco/Util/IntValidator.h" +#include "Poco/Util/Option.h" +#include "Poco/Util/OptionException.h" +#include "Poco/NumberParser.h" +#include "Poco/Format.h" + + +using Poco::NumberParser; +using Poco::format; + + +namespace Poco { +namespace Util { + + +IntValidator::IntValidator(int min, int max): + _min(min), + _max(max) +{ +} + + +IntValidator::~IntValidator() +{ +} + + +void IntValidator::validate(const Option& option, const std::string& value) +{ + int n; + if (NumberParser::tryParse(value, n)) + { + if (n < _min || n > _max) + throw InvalidArgumentException(format("argument for %s must be in range %d to %d", option.fullName(), _min, _max)); + } + else throw InvalidArgumentException(format("argument for %s must be an integer", option.fullName())); +} + + +} } // namespace Poco::Util diff --git a/Util/src/LayeredConfiguration.cpp b/Util/src/LayeredConfiguration.cpp index 7bd403ad7..d7b8feebb 100644 --- a/Util/src/LayeredConfiguration.cpp +++ b/Util/src/LayeredConfiguration.cpp @@ -1,7 +1,7 @@ // // LayeredConfiguration.cpp // -// $Id: //poco/1.1.0/Util/src/LayeredConfiguration.cpp#2 $ +// $Id: //poco/1.2/Util/src/LayeredConfiguration.cpp#1 $ // // Library: Util // Package: Configuration @@ -34,16 +34,17 @@ // -#include "Util/LayeredConfiguration.h" -#include "Foundation/Exception.h" +#include "Poco/Util/LayeredConfiguration.h" +#include "Poco/Exception.h" #include -using Foundation::AutoPtr; -using Foundation::RuntimeException; +using Poco::AutoPtr; +using Poco::RuntimeException; -Util_BEGIN +namespace Poco { +namespace Util { LayeredConfiguration::LayeredConfiguration() @@ -123,4 +124,4 @@ void LayeredConfiguration::enumerate(const std::string& key, Keys& range) const } -Util_END +} } // namespace Poco::Util diff --git a/Util/src/LoggingConfigurator.cpp b/Util/src/LoggingConfigurator.cpp index c1f0e5a02..0165ffe75 100644 --- a/Util/src/LoggingConfigurator.cpp +++ b/Util/src/LoggingConfigurator.cpp @@ -1,7 +1,7 @@ // // LoggingConfigurator.cpp // -// $Id: //poco/1.1.0/Util/src/LoggingConfigurator.cpp#2 $ +// $Id: //poco/1.2/Util/src/LoggingConfigurator.cpp#1 $ // // Library: Util // Package: Configuration @@ -34,29 +34,30 @@ // -#include "Util/LoggingConfigurator.h" -#include "Util/AbstractConfiguration.h" -#include "Foundation/AutoPtr.h" -#include "Foundation/Channel.h" -#include "Foundation/FormattingChannel.h" -#include "Foundation/Formatter.h" -#include "Foundation/PatternFormatter.h" -#include "Foundation/Logger.h" -#include "Foundation/LoggingRegistry.h" -#include "Foundation/LoggingFactory.h" +#include "Poco/Util/LoggingConfigurator.h" +#include "Poco/Util/AbstractConfiguration.h" +#include "Poco/AutoPtr.h" +#include "Poco/Channel.h" +#include "Poco/FormattingChannel.h" +#include "Poco/Formatter.h" +#include "Poco/PatternFormatter.h" +#include "Poco/Logger.h" +#include "Poco/LoggingRegistry.h" +#include "Poco/LoggingFactory.h" -using Foundation::AutoPtr; -using Foundation::Formatter; -using Foundation::PatternFormatter; -using Foundation::Channel; -using Foundation::FormattingChannel; -using Foundation::Logger; -using Foundation::LoggingRegistry; -using Foundation::LoggingFactory; +using Poco::AutoPtr; +using Poco::Formatter; +using Poco::PatternFormatter; +using Poco::Channel; +using Poco::FormattingChannel; +using Poco::Logger; +using Poco::LoggingRegistry; +using Poco::LoggingFactory; -Util_BEGIN +namespace Poco { +namespace Util { LoggingConfigurator::LoggingConfigurator() @@ -195,4 +196,4 @@ void LoggingConfigurator::configureLogger(AbstractConfiguration* pConfig) } -Util_END +} } // namespace Poco::Util diff --git a/Util/src/LoggingSubsystem.cpp b/Util/src/LoggingSubsystem.cpp index 667bad361..eef3bd5da 100644 --- a/Util/src/LoggingSubsystem.cpp +++ b/Util/src/LoggingSubsystem.cpp @@ -1,7 +1,7 @@ // // LoggingSubsystem.cpp // -// $Id: //poco/1.1.0/Util/src/LoggingSubsystem.cpp#2 $ +// $Id: //poco/1.2/Util/src/LoggingSubsystem.cpp#1 $ // // Library: Util // Package: Application @@ -34,16 +34,17 @@ // -#include "Util/LoggingSubsystem.h" -#include "Util/LoggingConfigurator.h" -#include "Util/Application.h" -#include "Foundation/Logger.h" +#include "Poco/Util/LoggingSubsystem.h" +#include "Poco/Util/LoggingConfigurator.h" +#include "Poco/Util/Application.h" +#include "Poco/Logger.h" -using Foundation::Logger; +using Poco::Logger; -Util_BEGIN +namespace Poco { +namespace Util { LoggingSubsystem::LoggingSubsystem() @@ -76,4 +77,4 @@ void LoggingSubsystem::uninitialize() } -Util_END +} } // namespace Poco::Util diff --git a/Util/src/MapConfiguration.cpp b/Util/src/MapConfiguration.cpp index 38b18d3c7..4911aaa7e 100644 --- a/Util/src/MapConfiguration.cpp +++ b/Util/src/MapConfiguration.cpp @@ -1,7 +1,7 @@ // // MapConfiguration.cpp // -// $Id: //poco/1.1.0/Util/src/MapConfiguration.cpp#2 $ +// $Id: //poco/1.2/Util/src/MapConfiguration.cpp#1 $ // // Library: Util // Package: Configuration @@ -34,11 +34,12 @@ // -#include "Util/MapConfiguration.h" +#include "Poco/Util/MapConfiguration.h" #include -Util_BEGIN +namespace Poco { +namespace Util { MapConfiguration::MapConfiguration() @@ -113,4 +114,4 @@ MapConfiguration::iterator MapConfiguration::end() const } -Util_END +} } // namespace Poco::Util diff --git a/Util/src/Option.cpp b/Util/src/Option.cpp index 3e03fb08e..bbb786e20 100644 --- a/Util/src/Option.cpp +++ b/Util/src/Option.cpp @@ -1,7 +1,7 @@ // // Option.cpp // -// $Id: //poco/1.1.0/Util/src/Option.cpp#2 $ +// $Id: //poco/1.2/Util/src/Option.cpp#1 $ // // Library: Util // Package: Options @@ -34,21 +34,26 @@ // -#include "Util/Option.h" -#include "Util/OptionException.h" -#include "Foundation/String.h" +#include "Poco/Util/Option.h" +#include "Poco/Util/OptionException.h" +#include "Poco/Util/Validator.h" +#include "Poco/String.h" +#include -using Foundation::icompare; +using Poco::icompare; -Util_BEGIN +namespace Poco { +namespace Util { Option::Option(): _required(false), _repeatable(false), - _argRequired(false) + _argRequired(false), + _pValidator(0), + _pCallback(0) { } @@ -61,46 +66,59 @@ Option::Option(const Option& option): _repeatable(option._repeatable), _argName(option._argName), _argRequired(option._argRequired), - _group(option._group) + _group(option._group), + _binding(option._binding), + _pValidator(option._pValidator), + _pCallback(option._pCallback) { + if (_pValidator) _pValidator->duplicate(); + if (_pCallback) _pCallback = _pCallback->clone(); } Option::Option(const std::string& fullName, const std::string& shortName): - _fullName(fullName), _shortName(shortName), + _fullName(fullName), _required(false), _repeatable(false), - _argRequired(false) + _argRequired(false), + _pValidator(0), + _pCallback(0) { } Option::Option(const std::string& fullName, const std::string& shortName, const std::string& description, bool required): - _fullName(fullName), _shortName(shortName), + _fullName(fullName), _description(description), _required(required), _repeatable(false), - _argRequired(false) + _argRequired(false), + _pValidator(0), + _pCallback(0) { } Option::Option(const std::string& fullName, const std::string& shortName, const std::string& description, bool required, const std::string& argName, bool argOptional): - _fullName(fullName), _shortName(shortName), + _fullName(fullName), _description(description), _required(required), _repeatable(false), _argName(argName), - _argRequired(argOptional) + _argRequired(argOptional), + _pValidator(0), + _pCallback(0) { } Option::~Option() { + if (_pValidator) _pValidator->release(); + delete _pCallback; } @@ -108,18 +126,28 @@ Option& Option::operator = (const Option& option) { if (&option != this) { - _shortName = option._shortName; - _fullName = option._fullName; - _description = option._description; - _required = option._required; - _repeatable = option._repeatable; - _argName = option._argName; - _argRequired = option._argRequired; - _group = option._group; + Option tmp(option); + swap(tmp); } return *this; } + +void Option::swap(Option& option) +{ + std::swap(_shortName, option._shortName); + std::swap(_fullName, option._fullName); + std::swap(_description, option._description); + std::swap(_required, option._required); + std::swap(_repeatable, option._repeatable); + std::swap(_argName, option._argName); + std::swap(_argRequired, option._argRequired); + std::swap(_group, option._group); + std::swap(_binding, option._binding); + std::swap(_pValidator, option._pValidator); + std::swap(_pCallback, option._pCallback); +} + Option& Option::shortName(const std::string& name) { @@ -179,6 +207,29 @@ Option& Option::group(const std::string& group) } +Option& Option::binding(const std::string& propertyName) +{ + _binding = propertyName; + return *this; +} + + +Option& Option::callback(const AbstractOptionCallback& cb) +{ + _pCallback = cb.clone(); + return *this; +} + + +Option& Option::validator(Validator* pValidator) +{ + if (_pValidator) _pValidator->release(); + _pValidator = pValidator; + if (_pValidator) _pValidator->duplicate(); + return *this; +} + + bool Option::matchesShort(const std::string& option) const { return option.length() > 0 @@ -234,4 +285,4 @@ void Option::process(const std::string& option, std::string& arg) const } -Util_END +} } // namespace Poco::Util diff --git a/Util/src/OptionCallback.cpp b/Util/src/OptionCallback.cpp new file mode 100644 index 000000000..10b9b7c28 --- /dev/null +++ b/Util/src/OptionCallback.cpp @@ -0,0 +1,59 @@ +// +// OptionCallback.cpp +// +// $Id: //poco/1.2/Util/src/OptionCallback.cpp#1 $ +// +// Library: Util +// Package: Options +// Module: OptionCallback +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#include "Poco/Util/OptionCallback.h" + + +namespace Poco { +namespace Util { + + +AbstractOptionCallback::AbstractOptionCallback() +{ +} + + +AbstractOptionCallback::AbstractOptionCallback(const AbstractOptionCallback&) +{ +} + + +AbstractOptionCallback::~AbstractOptionCallback() +{ +} + + +} } // namespace Poco::Util diff --git a/Util/src/OptionException.cpp b/Util/src/OptionException.cpp index 7cd43c57c..c64dd4e66 100644 --- a/Util/src/OptionException.cpp +++ b/Util/src/OptionException.cpp @@ -1,7 +1,7 @@ // // OptionException.cpp // -// $Id: //poco/1.1.0/Util/src/OptionException.cpp#2 $ +// $Id: //poco/1.2/Util/src/OptionException.cpp#1 $ // // Library: Util // Package: Options @@ -34,21 +34,24 @@ // -#include "Util/OptionException.h" +#include "Poco/Util/OptionException.h" #include -Util_BEGIN +namespace Poco { +namespace Util { -POCO_IMPLEMENT_EXCEPTION(OptionException, Foundation::DataException, "Option exception") +POCO_IMPLEMENT_EXCEPTION(OptionException, Poco::DataException, "Option exception") POCO_IMPLEMENT_EXCEPTION(UnknownOptionException, OptionException, "Unknown option specified") POCO_IMPLEMENT_EXCEPTION(AmbiguousOptionException, OptionException, "Ambiguous option specified") +POCO_IMPLEMENT_EXCEPTION(MissingOptionException, OptionException, "Required option not specified") POCO_IMPLEMENT_EXCEPTION(MissingArgumentException, OptionException, "Missing option argument") +POCO_IMPLEMENT_EXCEPTION(InvalidArgumentException, OptionException, "Invalid option argument") POCO_IMPLEMENT_EXCEPTION(UnexpectedArgumentException, OptionException, "Unexpected option argument") POCO_IMPLEMENT_EXCEPTION(IncompatibleOptionsException, OptionException, "Incompatible options") POCO_IMPLEMENT_EXCEPTION(DuplicateOptionException, OptionException, "Option must not be given more than once") POCO_IMPLEMENT_EXCEPTION(EmptyOptionException, OptionException, "Empty option specified") -Util_END +} } // namespace Poco::Util diff --git a/Util/src/OptionProcessor.cpp b/Util/src/OptionProcessor.cpp index e97dc94b6..cd429028d 100644 --- a/Util/src/OptionProcessor.cpp +++ b/Util/src/OptionProcessor.cpp @@ -1,7 +1,7 @@ // // OptionProcessor.cpp // -// $Id: //poco/1.1.0/Util/src/OptionProcessor.cpp#2 $ +// $Id: //poco/1.2/Util/src/OptionProcessor.cpp#1 $ // // Library: Util // Package: Options @@ -34,13 +34,14 @@ // -#include "Util/OptionProcessor.h" -#include "Util/OptionSet.h" -#include "Util/Option.h" -#include "Util/OptionException.h" +#include "Poco/Util/OptionProcessor.h" +#include "Poco/Util/OptionSet.h" +#include "Poco/Util/Option.h" +#include "Poco/Util/OptionException.h" -Util_BEGIN +namespace Poco { +namespace Util { OptionProcessor::OptionProcessor(const OptionSet& options): @@ -75,6 +76,16 @@ bool OptionProcessor::process(const std::string& argument, std::string& optionNa } +void OptionProcessor::checkRequired() const +{ + for (OptionSet::Iterator it = _options.begin(); it != _options.end(); ++it) + { + if (it->required() && _specifiedOptions.find(it->fullName()) == _specifiedOptions.end()) + throw MissingOptionException(it->fullName()); + } +} + + bool OptionProcessor::processUnix(const std::string& argument, std::string& optionName, std::string& optionArg) { std::string::const_iterator it = argument.begin(); @@ -141,4 +152,4 @@ bool OptionProcessor::processCommon(const std::string& optionStr, bool isShort, } -Util_END +} } // namespace Poco::Util diff --git a/Util/src/OptionSet.cpp b/Util/src/OptionSet.cpp index f490255b1..ca81320b5 100644 --- a/Util/src/OptionSet.cpp +++ b/Util/src/OptionSet.cpp @@ -1,7 +1,7 @@ // // OptionSet.cpp // -// $Id: //poco/1.1.0/Util/src/OptionSet.cpp#2 $ +// $Id: //poco/1.2/Util/src/OptionSet.cpp#1 $ // // Library: Util // Package: Options @@ -34,12 +34,13 @@ // -#include "Util/OptionSet.h" -#include "Util/OptionException.h" -#include "Foundation/Exception.h" +#include "Poco/Util/OptionSet.h" +#include "Poco/Util/OptionException.h" +#include "Poco/Exception.h" -Util_BEGIN +namespace Poco { +namespace Util { OptionSet::OptionSet() @@ -123,4 +124,4 @@ OptionSet::Iterator OptionSet::end() const } -Util_END +} } // namespace Poco::Util diff --git a/Util/src/PropertyFileConfiguration.cpp b/Util/src/PropertyFileConfiguration.cpp index d2eaf0665..ab1323280 100644 --- a/Util/src/PropertyFileConfiguration.cpp +++ b/Util/src/PropertyFileConfiguration.cpp @@ -1,7 +1,7 @@ // // PropertyFileConfiguration.cpp // -// $Id: //poco/1.1.0/Util/src/PropertyFileConfiguration.cpp#2 $ +// $Id: //poco/1.2/Util/src/PropertyFileConfiguration.cpp#1 $ // // Library: Util // Package: Configuration @@ -34,17 +34,18 @@ // -#include "Util/PropertyFileConfiguration.h" -#include "Foundation/Exception.h" -#include "Foundation/String.h" +#include "Poco/Util/PropertyFileConfiguration.h" +#include "Poco/Exception.h" +#include "Poco/String.h" #include #include -using Foundation::trim; +using Poco::trim; -Util_BEGIN +namespace Poco { +namespace Util { PropertyFileConfiguration::PropertyFileConfiguration() @@ -85,7 +86,7 @@ void PropertyFileConfiguration::load(const std::string& path) if (istr.good()) load(istr); else - throw Foundation::OpenFileException(path); + throw Poco::OpenFileException(path); } @@ -108,9 +109,9 @@ void PropertyFileConfiguration::save(const std::string& path) const { save(ostr); ostr.flush(); - if (!ostr.good()) throw Foundation::WriteFileException(path); + if (!ostr.good()) throw Poco::WriteFileException(path); } - else throw Foundation::CreateFileException(path); + else throw Poco::CreateFileException(path); } @@ -176,4 +177,4 @@ int PropertyFileConfiguration::readChar(std::istream& istr) } -Util_END +} } // namespace Poco::Util diff --git a/Util/src/RegExpValidator.cpp b/Util/src/RegExpValidator.cpp new file mode 100644 index 000000000..14213516f --- /dev/null +++ b/Util/src/RegExpValidator.cpp @@ -0,0 +1,69 @@ +// +// RegExpValidator.cpp +// +// $Id: //poco/1.2/Util/src/RegExpValidator.cpp#1 $ +// +// Library: Util +// Package: Options +// Module: RegExpValidator +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#include "Poco/Util/RegExpValidator.h" +#include "Poco/Util/Option.h" +#include "Poco/Util/OptionException.h" +#include "Poco/RegularExpression.h" +#include "Poco/Format.h" + + +using Poco::format; + + +namespace Poco { +namespace Util { + + +RegExpValidator::RegExpValidator(const std::string& regexp): + _regexp(regexp) +{ +} + + +RegExpValidator::~RegExpValidator() +{ +} + + +void RegExpValidator::validate(const Option& option, const std::string& value) +{ + if (!RegularExpression::match(value, _regexp, RegularExpression::RE_ANCHORED | RegularExpression::RE_UTF8)) + throw InvalidArgumentException(format("argument for %s does not match regular expression %s", option.fullName(), _regexp)); +} + + +} } // namespace Poco::Util diff --git a/Util/src/ServerApplication.cpp b/Util/src/ServerApplication.cpp index c44fc0fc7..5c40092eb 100644 --- a/Util/src/ServerApplication.cpp +++ b/Util/src/ServerApplication.cpp @@ -1,7 +1,7 @@ // // ServerApplication.cpp // -// $Id: //poco/1.1.0/Util/src/ServerApplication.cpp#2 $ +// $Id: //poco/1.2/Util/src/ServerApplication.cpp#1 $ // // Library: Util // Package: Application @@ -34,14 +34,14 @@ // -#include "Util/ServerApplication.h" -#include "Util/Option.h" -#include "Util/OptionSet.h" -#include "Foundation/Exception.h" -#include "Foundation/Process.h" -#include "Foundation/NumberFormatter.h" -#include "Foundation/NamedEvent.h" -#include "Foundation/Logger.h" +#include "Poco/Util/ServerApplication.h" +#include "Poco/Util/Option.h" +#include "Poco/Util/OptionSet.h" +#include "Poco/Exception.h" +#include "Poco/Process.h" +#include "Poco/NumberFormatter.h" +#include "Poco/NamedEvent.h" +#include "Poco/Logger.h" #if defined(POCO_OS_FAMILY_UNIX) #include #include @@ -49,24 +49,28 @@ #include #include #elif defined(POCO_OS_FAMILY_WINDOWS) -#include "Util/WinService.h" +#include "Poco/Util/WinService.h" #include #include #endif +#if defined(POCO_WIN32_UTF8) +#include "Poco/UnicodeConverter.h" +#endif -using Foundation::NamedEvent; -using Foundation::Process; -using Foundation::NumberFormatter; -using Foundation::Exception; -using Foundation::SystemException; +using Poco::NamedEvent; +using Poco::Process; +using Poco::NumberFormatter; +using Poco::Exception; +using Poco::SystemException; -Util_BEGIN +namespace Poco { +namespace Util { #if defined(POCO_OS_FAMILY_WINDOWS) -Foundation::Event ServerApplication::_terminated; +Poco::Event ServerApplication::_terminated; SERVICE_STATUS ServerApplication::_serviceStatus; SERVICE_STATUS_HANDLE ServerApplication::_serviceStatusHandle = 0; #endif @@ -146,7 +150,11 @@ void ServerApplication::ServiceMain(DWORD argc, LPTSTR* argv) { ServerApplication& app = static_cast(Application::instance()); +#if defined(POCO_WIN32_UTF8) + _serviceStatusHandle = RegisterServiceCtrlHandlerW(L"", ServiceControlHandler); +#else _serviceStatusHandle = RegisterServiceCtrlHandler("", ServiceControlHandler); +#endif if (!_serviceStatusHandle) throw SystemException("cannot register service control handler"); @@ -161,7 +169,18 @@ void ServerApplication::ServiceMain(DWORD argc, LPTSTR* argv) try { +#if defined(POCO_WIN32_UTF8) + std::vector args; + for (DWORD i = 0; i < argc; ++i) + { + std::string arg; + Poco::UnicodeConverter::toUTF8(argv[i], arg); + args.push_back(arg); + } + app.init(args); +#else app.init(argc, argv); +#endif _serviceStatus.dwCurrentState = SERVICE_RUNNING; SetServiceStatus(_serviceStatusHandle, &_serviceStatus); int rc = app.run(); @@ -241,10 +260,54 @@ int ServerApplication::run(int argc, char** argv) } +#if defined(POCO_WIN32_UTF8) +int ServerApplication::run(int argc, wchar_t** argv) +{ + if (!hasConsole() && isService()) + { + config().setBool("application.runAsService", true); + return 0; + } + else + { + int rc = EXIT_OK; + try + { + init(argc, argv); + switch (_action) + { + case SRV_REGISTER: + registerService(); + rc = EXIT_OK; + break; + case SRV_UNREGISTER: + unregisterService(); + rc = EXIT_OK; + break; + default: + rc = run(); + uninitialize(); + } + } + catch (Exception& exc) + { + logger().log(exc); + rc = EXIT_SOFTWARE; + } + return rc; + } +} +#endif + + bool ServerApplication::isService() { SERVICE_TABLE_ENTRY svcDispatchTable[2]; +#if defined(POCO_WIN32_UTF8) + svcDispatchTable[0].lpServiceName = L""; +#else svcDispatchTable[0].lpServiceName = ""; +#endif svcDispatchTable[0].lpServiceProc = ServiceMain; svcDispatchTable[1].lpServiceName = NULL; svcDispatchTable[1].lpServiceProc = NULL; @@ -314,6 +377,8 @@ void ServerApplication::handleOption(const std::string& name, const std::string& _action = SRV_UNREGISTER; else if (name == "displayName") _displayName = value; + else + Application::handleOption(name, value); } @@ -411,6 +476,7 @@ void ServerApplication::handleOption(const std::string& name, const std::string& { config().setBool("application.runAsDaemon", true); } + else Application::handleOption(name, value); } @@ -496,10 +562,11 @@ void ServerApplication::defineOptions(OptionSet& options) void ServerApplication::handleOption(const std::string& name, const std::string& value) { + Application::handleOption(name, value); } #endif -Util_END +} } // namespace Poco::Util diff --git a/Util/src/Subsystem.cpp b/Util/src/Subsystem.cpp index c3f090674..f12307962 100644 --- a/Util/src/Subsystem.cpp +++ b/Util/src/Subsystem.cpp @@ -1,7 +1,7 @@ // // Subsystem.cpp // -// $Id: //poco/1.1.0/Util/src/Subsystem.cpp#2 $ +// $Id: //poco/1.2/Util/src/Subsystem.cpp#1 $ // // Library: Util // Package: Application @@ -34,10 +34,11 @@ // -#include "Util/Subsystem.h" +#include "Poco/Util/Subsystem.h" -Util_BEGIN +namespace Poco { +namespace Util { Subsystem::Subsystem() @@ -57,4 +58,4 @@ void Subsystem::reinitialize(Application& app) } -Util_END +} } // namespace Poco::Util diff --git a/Util/src/SystemConfiguration.cpp b/Util/src/SystemConfiguration.cpp index 8e8c31810..cc818c02e 100644 --- a/Util/src/SystemConfiguration.cpp +++ b/Util/src/SystemConfiguration.cpp @@ -1,7 +1,7 @@ // // SystemConfiguration.cpp // -// $Id: //poco/1.1.0/Util/src/SystemConfiguration.cpp#2 $ +// $Id: //poco/1.2/Util/src/SystemConfiguration.cpp#1 $ // // Library: Util // Package: Configuration @@ -34,17 +34,18 @@ // -#include "Util/SystemConfiguration.h" -#include "Foundation/Environment.h" -#include "Foundation/Path.h" -#include "Foundation/Exception.h" +#include "Poco/Util/SystemConfiguration.h" +#include "Poco/Environment.h" +#include "Poco/Path.h" +#include "Poco/Exception.h" -using Foundation::Environment; -using Foundation::Path; +using Poco::Environment; +using Poco::Path; -Util_BEGIN +namespace Poco { +namespace Util { const std::string SystemConfiguration::OSNAME = "system.osName"; @@ -93,7 +94,7 @@ bool SystemConfiguration::getRaw(const std::string& key, std::string& value) con void SystemConfiguration::setRaw(const std::string& key, const std::string& value) { - throw Foundation::InvalidAccessException("Attempt to modify a system property", key); + throw Poco::InvalidAccessException("Attempt to modify a system property", key); } @@ -128,4 +129,4 @@ bool SystemConfiguration::getEnv(const std::string& name, std::string& value) } -Util_END +} } // namespace Poco::Util diff --git a/Util/src/Validator.cpp b/Util/src/Validator.cpp new file mode 100644 index 000000000..e9ae56ff1 --- /dev/null +++ b/Util/src/Validator.cpp @@ -0,0 +1,54 @@ +// +// Validator.cpp +// +// $Id: //poco/1.2/Util/src/Validator.cpp#1 $ +// +// Library: Util +// Package: Options +// Module: Validator +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#include "Poco/Util/Validator.h" + + +namespace Poco { +namespace Util { + + +Validator::Validator() +{ +} + + +Validator::~Validator() +{ +} + + +} } // namespace Poco::Util diff --git a/Util/src/WinRegistryConfiguration.cpp b/Util/src/WinRegistryConfiguration.cpp new file mode 100644 index 000000000..4a5ecbf1e --- /dev/null +++ b/Util/src/WinRegistryConfiguration.cpp @@ -0,0 +1,134 @@ +// +// WinRegistryConfiguration.cpp +// +// $Id: //poco/1.2/Util/src/WinRegistryConfiguration.cpp#1 $ +// +// Library: Util +// Package: Windows +// Module: WinRegistryConfiguration +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#include "Poco/Util/WinRegistryConfiguration.h" +#include "Poco/Util/WinRegistryKey.h" +#include "Poco/NumberFormatter.h" +#include "Poco/NumberParser.h" + + +namespace Poco { +namespace Util { + + +WinRegistryConfiguration::WinRegistryConfiguration(const std::string& rootPath): _rootPath(rootPath) +{ + // rootPath must end with backslash + if (*(--_rootPath.end()) != '\\') + _rootPath.append("\\"); +} + + +WinRegistryConfiguration::~WinRegistryConfiguration() +{ +} + + +bool WinRegistryConfiguration::getRaw(const std::string& key, std::string& value) const +{ + std::string keyName; + std::string fullPath = _rootPath + ConvertToRegFormat(key, keyName); + WinRegistryKey aKey(fullPath); + WinRegistryKey::Type type = aKey.type(keyName); + bool ret = true; + + switch(type) + { + case WinRegistryKey::REGT_STRING: + value = aKey.getString(keyName); + break; + case WinRegistryKey::REGT_STRING_EXPAND: + value = aKey.getStringExpand(keyName); + break; + case WinRegistryKey::REGT_DWORD: + value = Poco::NumberFormatter::format(aKey.getInt(keyName)); + break; + default: + ret = false; + } + + return ret; +} + + +void WinRegistryConfiguration::setRaw(const std::string& key, const std::string& value) +{ + std::string keyName; + std::string fullPath = _rootPath+ConvertToRegFormat(key, keyName); + WinRegistryKey aKey(fullPath); + aKey.setString(keyName, value); +} + + +void WinRegistryConfiguration::enumerate(const std::string& key, Keys& range) const +{ + if (key.empty()) + { + // return all root level keys + range.push_back("HKEY_CLASSES_ROOT"); + range.push_back("HKEY_CURRENT_CONFIG"); + range.push_back("HKEY_CURRENT_USER"); + range.push_back("HKEY_LOCAL_MACHINE"); + range.push_back("HKEY_PERFORMANCE_DATA"); + range.push_back("HKEY_USERS"); + } + else + { + std::string keyName; + std::string fullPath = _rootPath+ConvertToRegFormat(key, keyName); + WinRegistryKey aKey(fullPath); + aKey.values(range); + aKey.subKeys(range); + } +} + + +std::string WinRegistryConfiguration::ConvertToRegFormat(const std::string& key, std::string& value) const +{ + std::size_t pos = key.rfind('.'); + if (pos == std::string::npos) + { + value = key; + return std::string(); + } + std::string prefix(key.substr(0,pos)); + value = key.substr(pos+1); + Poco::translateInPlace(prefix, ".", "\\"); + return prefix; +} + + +} } // namespace Poco::Util diff --git a/Util/src/WinRegistryKey.cpp b/Util/src/WinRegistryKey.cpp index cb50bbdca..3d5b32617 100644 --- a/Util/src/WinRegistryKey.cpp +++ b/Util/src/WinRegistryKey.cpp @@ -1,7 +1,7 @@ // // WinRegistryKey.cpp // -// $Id: //poco/1.1.0/Util/src/WinRegistryKey.cpp#2 $ +// $Id: //poco/1.2/Util/src/WinRegistryKey.cpp#1 $ // // Library: Util // Package: Windows @@ -34,16 +34,20 @@ // -#include "Util/WinRegistryKey.h" -#include "Foundation/Exception.h" +#include "Poco/Util/WinRegistryKey.h" +#include "Poco/Exception.h" +#if defined(POCO_WIN32_UTF8) +#include "Poco/UnicodeConverter.h" +#endif -using Foundation::SystemException; -using Foundation::NotFoundException; -using Foundation::InvalidArgumentException; +using Poco::SystemException; +using Poco::NotFoundException; +using Poco::InvalidArgumentException; -Util_BEGIN +namespace Poco { +namespace Util { WinRegistryKey::WinRegistryKey(const std::string& key): @@ -77,26 +81,55 @@ WinRegistryKey::~WinRegistryKey() void WinRegistryKey::setString(const std::string& name, const std::string& value) { open(); +#if defined(POCO_WIN32_UTF8) + std::wstring uname; + Poco::UnicodeConverter::toUTF16(name, uname); + std::wstring uvalue; + Poco::UnicodeConverter::toUTF16(value, uvalue); + if (RegSetValueExW(_hKey, uname.c_str(), 0, REG_SZ, (CONST BYTE*) uvalue.c_str(), (DWORD) (uvalue.size() + 1)*sizeof(wchar_t)) != ERROR_SUCCESS) + handleSetError(name); +#else if (RegSetValueEx(_hKey, name.c_str(), 0, REG_SZ, (CONST BYTE*) value.c_str(), (DWORD) value.size() + 1) != ERROR_SUCCESS) handleSetError(name); +#endif } -#include + std::string WinRegistryKey::getString(const std::string& name) { open(); DWORD type; DWORD size; +#if defined(POCO_WIN32_UTF8) + std::wstring uname; + Poco::UnicodeConverter::toUTF16(name, uname); + if (RegQueryValueExW(_hKey, uname.c_str(), NULL, &type, NULL, &size) != ERROR_SUCCESS || type != REG_SZ && type != REG_EXPAND_SZ) + throw NotFoundException(key(name)); + if (size > 0) + { + DWORD len = size/2; + wchar_t* buffer = new wchar_t[len + 1]; + RegQueryValueExW(_hKey, uname.c_str(), NULL, NULL, (BYTE*) buffer, &size); + buffer[len] = 0; + std::wstring uresult(buffer); + delete [] buffer; + std::string result; + Poco::UnicodeConverter::toUTF8(uresult, result); + return result; + } +#else if (RegQueryValueEx(_hKey, name.c_str(), NULL, &type, NULL, &size) != ERROR_SUCCESS || type != REG_SZ && type != REG_EXPAND_SZ) throw NotFoundException(key(name)); if (size > 0) { - char* buffer = new char[size]; + char* buffer = new char[size + 1]; RegQueryValueEx(_hKey, name.c_str(), NULL, NULL, (BYTE*) buffer, &size); - std::string result(buffer, size - 1); + buffer[size] = 0; + std::string result(buffer); delete [] buffer; return result; } +#endif return std::string(); } @@ -104,8 +137,17 @@ std::string WinRegistryKey::getString(const std::string& name) void WinRegistryKey::setStringExpand(const std::string& name, const std::string& value) { open(); +#if defined(POCO_WIN32_UTF8) + std::wstring uname; + Poco::UnicodeConverter::toUTF16(name, uname); + std::wstring uvalue; + Poco::UnicodeConverter::toUTF16(value, uvalue); + if (RegSetValueExW(_hKey, uname.c_str(), 0, REG_EXPAND_SZ, (CONST BYTE*) uvalue.c_str(), (DWORD) (uvalue.size() + 1)*sizeof(wchar_t)) != ERROR_SUCCESS) + handleSetError(name); +#else if (RegSetValueEx(_hKey, name.c_str(), 0, REG_EXPAND_SZ, (CONST BYTE*) value.c_str(), (DWORD) value.size() + 1) != ERROR_SUCCESS) handleSetError(name); +#endif } @@ -114,12 +156,35 @@ std::string WinRegistryKey::getStringExpand(const std::string& name) open(); DWORD type; DWORD size; +#if defined(POCO_WIN32_UTF8) + std::wstring uname; + Poco::UnicodeConverter::toUTF16(name, uname); + if (RegQueryValueEx(_hKey, uname.c_str(), NULL, &type, NULL, &size) != ERROR_SUCCESS || type != REG_SZ && type != REG_EXPAND_SZ) + throw NotFoundException(key(name)); + if (size > 0) + { + DWORD len = size/2; + wchar_t* buffer = new wchar_t[len + 1]; + RegQueryValueExW(_hKey, uname.c_str(), NULL, NULL, (BYTE*) buffer, &size); + buffer[len] = 0; + wchar_t temp; + DWORD expSize = ExpandEnvironmentStrings(buffer, &temp, 1); + wchar_t* expBuffer = new wchar_t[expSize]; + ExpandEnvironmentStringsW(buffer, expBuffer, expSize); + std::string result; + UnicodeConverter::toUTF8(expBuffer, result); + delete [] buffer; + delete [] expBuffer; + return result; + } +#else if (RegQueryValueEx(_hKey, name.c_str(), NULL, &type, NULL, &size) != ERROR_SUCCESS || type != REG_SZ && type != REG_EXPAND_SZ) throw NotFoundException(key(name)); if (size > 0) { - char* buffer = new char[size]; + char* buffer = new char[size + 1]; RegQueryValueEx(_hKey, name.c_str(), NULL, NULL, (BYTE*) buffer, &size); + buffer[size] = 0; char temp; DWORD expSize = ExpandEnvironmentStrings(buffer, &temp, 1); char* expBuffer = new char[expSize]; @@ -129,6 +194,7 @@ std::string WinRegistryKey::getStringExpand(const std::string& name) delete [] expBuffer; return result; } +#endif return std::string(); } @@ -137,8 +203,15 @@ void WinRegistryKey::setInt(const std::string& name, int value) { open(); DWORD data = value; +#if defined(POCO_WIN32_UTF8) + std::wstring uname; + Poco::UnicodeConverter::toUTF16(name, uname); + if (RegSetValueExW(_hKey, uname.c_str(), 0, REG_DWORD, (CONST BYTE*) &data, sizeof(data)) != ERROR_SUCCESS) + handleSetError(name); +#else if (RegSetValueEx(_hKey, name.c_str(), 0, REG_DWORD, (CONST BYTE*) &data, sizeof(data)) != ERROR_SUCCESS) handleSetError(name); +#endif } @@ -148,8 +221,15 @@ int WinRegistryKey::getInt(const std::string& name) DWORD type; DWORD data; DWORD size; +#if defined(POCO_WIN32_UTF8) + std::wstring uname; + Poco::UnicodeConverter::toUTF16(name, uname); + if (RegQueryValueExW(_hKey, uname.c_str(), NULL, &type, (BYTE*) &data, &size) != ERROR_SUCCESS || type != REG_DWORD) + throw NotFoundException(key(name)); +#else if (RegQueryValueEx(_hKey, name.c_str(), NULL, &type, (BYTE*) &data, &size) != ERROR_SUCCESS || type != REG_DWORD) throw NotFoundException(key(name)); +#endif return data; } @@ -157,32 +237,79 @@ int WinRegistryKey::getInt(const std::string& name) void WinRegistryKey::deleteValue(const std::string& name) { open(); +#if defined(POCO_WIN32_UTF8) + std::wstring uname; + Poco::UnicodeConverter::toUTF16(name, uname); + if (RegDeleteValueW(_hKey, uname.c_str()) != ERROR_SUCCESS) + throw NotFoundException(key(name)); +#else if (RegDeleteValue(_hKey, name.c_str()) != ERROR_SUCCESS) throw NotFoundException(key(name)); +#endif } void WinRegistryKey::deleteKey() { close(); +#if defined(POCO_WIN32_UTF8) + std::wstring usubKey; + Poco::UnicodeConverter::toUTF16(_subKey, usubKey); + if (RegDeleteKeyW(_hRootKey, usubKey.c_str()) != ERROR_SUCCESS) + throw NotFoundException(key()); +#else if (RegDeleteKey(_hRootKey, _subKey.c_str()) != ERROR_SUCCESS) throw NotFoundException(key()); +#endif } bool WinRegistryKey::exists() { open(); - char name[256]; DWORD size; +#if defined(POCO_WIN32_UTF8) + wchar_t name[256]; + return RegEnumValueW(_hKey, 0, name, &size, NULL, NULL, NULL, NULL) == ERROR_SUCCESS; +#else + char name[256]; return RegEnumValue(_hKey, 0, name, &size, NULL, NULL, NULL, NULL) == ERROR_SUCCESS; +#endif +} + + +WinRegistryKey::Type WinRegistryKey::type(const std::string& name) +{ + open(); + DWORD type = REG_NONE; + DWORD size; +#if defined(POCO_WIN32_UTF8) + std::wstring uname; + Poco::UnicodeConverter::toUTF16(name, uname); + if (RegQueryValueExW(_hKey, uname.c_str(), NULL, &type, NULL, &size) != ERROR_SUCCESS) + throw NotFoundException(key(name)); +#else + if (RegQueryValueEx(_hKey, name.c_str(), NULL, &type, NULL, &size) != ERROR_SUCCESS) + throw NotFoundException(key(name)); +#endif + if (type != REG_SZ && type != REG_EXPAND_SZ && type != REG_DWORD) + throw NotFoundException(key(name)+": type not supported"); + + Type aType = (Type)type; + return aType; } bool WinRegistryKey::exists(const std::string& name) { open(); +#if defined(POCO_WIN32_UTF8) + std::wstring uname; + Poco::UnicodeConverter::toUTF16(name, uname); + return RegQueryValueExW(_hKey, uname.c_str(), NULL, NULL, NULL, NULL) == ERROR_SUCCESS; +#else return RegQueryValueEx(_hKey, name.c_str(), NULL, NULL, NULL, NULL) == ERROR_SUCCESS; +#endif } @@ -190,8 +317,15 @@ void WinRegistryKey::open() { if (!_hKey) { +#if defined(POCO_WIN32_UTF8) + std::wstring usubKey; + Poco::UnicodeConverter::toUTF16(_subKey, usubKey); + if (RegCreateKeyEx(_hRootKey, usubKey.c_str(), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ | KEY_WRITE, NULL, &_hKey, NULL) != ERROR_SUCCESS) + throw SystemException("Cannot open registry key: ", key()); +#else if (RegCreateKeyEx(_hRootKey, _subKey.c_str(), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ | KEY_WRITE, NULL, &_hKey, NULL) != ERROR_SUCCESS) throw SystemException("Cannot open registry key: ", key()); +#endif } } @@ -267,4 +401,83 @@ void WinRegistryKey::handleSetError(const std::string& name) } -Util_END +void WinRegistryKey::subKeys(WinRegistryKey::Keys& keys) +{ + open(); + + DWORD subKeyCount = 0; + DWORD valueCount = 0; + + if (RegQueryInfoKey(_hKey, NULL, NULL, NULL, &subKeyCount, NULL, NULL, &valueCount, NULL, NULL, NULL, NULL) != ERROR_SUCCESS) + return; + +#if defined(POCO_WIN32_UTF8) + wchar_t buf[256]; + DWORD bufSize = sizeof(buf)/sizeof(wchar_t); + for (DWORD i = 0; i< subKeyCount; ++i) + { + if (RegEnumKeyExW(_hKey, i, buf, &bufSize, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) + { + std::wstring uname(buf); + std::string name; + Poco::UnicodeConverter::toUTF8(uname, name); + keys.push_back(name); + } + bufSize = sizeof(buf)/sizeof(wchar_t); + } +#else + char buf[256]; + DWORD bufSize = sizeof(buf); + for (DWORD i = 0; i< subKeyCount; ++i) + { + if (RegEnumKeyEx(_hKey, i, buf, &bufSize, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) + { + std::string name(buf); + keys.push_back(name); + } + bufSize = sizeof(buf); + } +#endif +} + + +void WinRegistryKey::values(WinRegistryKey::Values& vals) +{ + open(); + + DWORD valueCount = 0; + + if (RegQueryInfoKey(_hKey, NULL, NULL, NULL, NULL, NULL, NULL, &valueCount, NULL, NULL, NULL, NULL) != ERROR_SUCCESS) + return ; + +#if defined(POCO_WIN32_UTF8) + wchar_t buf[256]; + DWORD bufSize = sizeof(buf)/sizeof(wchar_t); + for (DWORD i = 0; i< valueCount; ++i) + { + if (RegEnumValueW(_hKey, i, buf, &bufSize, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) + { + std::wstring uname(buf); + std::string name; + Poco::UnicodeConverter::toUTF8(uname, name); + vals.push_back(name); + } + bufSize = sizeof(buf)/sizeof(wchar_t); + } +#else + char buf[256]; + DWORD bufSize = sizeof(buf); + for (DWORD i = 0; i< valueCount; ++i) + { + if (RegEnumValue(_hKey, i, buf, &bufSize, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) + { + std::string name(buf); + vals.push_back(name); + } + bufSize = sizeof(buf); + } +#endif +} + + +} } // namespace Poco::Util diff --git a/Util/src/WinService.cpp b/Util/src/WinService.cpp index a97fee1b5..03de22b91 100644 --- a/Util/src/WinService.cpp +++ b/Util/src/WinService.cpp @@ -1,7 +1,7 @@ // // WinService.cpp // -// $Id: //poco/1.1.0/Util/src/WinService.cpp#2 $ +// $Id: //poco/1.2/Util/src/WinService.cpp#1 $ // // Library: Util // Package: Windows @@ -34,18 +34,22 @@ // -#include "Util/WinService.h" -#include "Foundation/Thread.h" -#include "Foundation/Exception.h" +#include "Poco/Util/WinService.h" +#include "Poco/Thread.h" +#include "Poco/Exception.h" +#if defined(POCO_WIN32_UTF8) +#include "Poco/UnicodeConverter.h" +#endif -using Foundation::Thread; -using Foundation::SystemException; -using Foundation::NotFoundException; -using Foundation::OutOfMemoryException; +using Poco::Thread; +using Poco::SystemException; +using Poco::NotFoundException; +using Poco::OutOfMemoryException; -Util_BEGIN +namespace Poco { +namespace Util { const int WinService::STARTUP_TIMEOUT = 30000; @@ -76,7 +80,13 @@ const std::string& WinService::name() const std::string WinService::displayName() const { LPQUERY_SERVICE_CONFIG pSvcConfig = config(); +#if defined(POCO_WIN32_UTF8) + std::wstring udispName(pSvcConfig->lpDisplayName); + std::string dispName; + Poco::UnicodeConverter::toUTF8(udispName, dispName); +#else std::string dispName(pSvcConfig->lpDisplayName); +#endif LocalFree(pSvcConfig); return dispName; } @@ -85,7 +95,13 @@ std::string WinService::displayName() const std::string WinService::path() const { LPQUERY_SERVICE_CONFIG pSvcConfig = config(); +#if defined(POCO_WIN32_UTF8) + std::wstring upath(pSvcConfig->lpBinaryPathName); + std::string path; + UnicodeConverter::toUTF8(upath, path); +#else std::string path(pSvcConfig->lpBinaryPathName); +#endif LocalFree(pSvcConfig); return path; } @@ -94,6 +110,24 @@ std::string WinService::path() const void WinService::registerService(const std::string& path, const std::string& displayName) { close(); +#if defined(POCO_WIN32_UTF8) + std::wstring uname; + Poco::UnicodeConverter::toUTF16(_name, uname); + std::wstring udisplayName; + Poco::UnicodeConverter::toUTF16(displayName, udisplayName); + std::wstring upath; + Poco::UnicodeConverter::toUTF16(path, upath); + _svcHandle = CreateService( + _scmHandle, + uname.c_str(), + udisplayName.c_str(), + SERVICE_ALL_ACCESS, + SERVICE_WIN32_OWN_PROCESS, + SERVICE_DEMAND_START, + SERVICE_ERROR_NORMAL, + upath.c_str(), + NULL, NULL, NULL, NULL, NULL); +#else _svcHandle = CreateService( _scmHandle, _name.c_str(), @@ -104,6 +138,7 @@ void WinService::registerService(const std::string& path, const std::string& dis SERVICE_ERROR_NORMAL, path.c_str(), NULL, NULL, NULL, NULL, NULL); +#endif if (!_svcHandle) throw SystemException("cannot register service", _name); } @@ -230,7 +265,13 @@ void WinService::open() const bool WinService::tryOpen() const { +#if defined(POCO_WIN32_UTF8) + std::wstring uname; + Poco::UnicodeConverter::toUTF16(_name, uname); + _svcHandle = OpenService(_scmHandle, uname.c_str(), SERVICE_ALL_ACCESS); +#else _svcHandle = OpenService(_scmHandle, _name.c_str(), SERVICE_ALL_ACCESS); +#endif return _svcHandle != 0; } @@ -273,4 +314,4 @@ LPQUERY_SERVICE_CONFIG WinService::config() const } -Util_END +} } // namespace Poco::Util diff --git a/Util/src/XMLConfiguration.cpp b/Util/src/XMLConfiguration.cpp index 40b750945..f963011eb 100644 --- a/Util/src/XMLConfiguration.cpp +++ b/Util/src/XMLConfiguration.cpp @@ -1,7 +1,7 @@ // // XMLConfiguration.cpp // -// $Id: //poco/1.1.0/Util/src/XMLConfiguration.cpp#2 $ +// $Id: //poco/1.2/Util/src/XMLConfiguration.cpp#1 $ // // Library: Util // Package: Configuration @@ -34,18 +34,19 @@ // -#include "Util/XMLConfiguration.h" -#include "SAX/InputSource.h" -#include "DOM/DOMParser.h" -#include "DOM/Element.h" -#include "DOM/Attr.h" -#include "Foundation/Exception.h" -#include "Foundation/NumberParser.h" -#include "Foundation/NumberFormatter.h" +#include "Poco/Util/XMLConfiguration.h" +#include "Poco/SAX/InputSource.h" +#include "Poco/DOM/DOMParser.h" +#include "Poco/DOM/Element.h" +#include "Poco/DOM/Attr.h" +#include "Poco/Exception.h" +#include "Poco/NumberParser.h" +#include "Poco/NumberFormatter.h" #include -Util_BEGIN +namespace Poco { +namespace Util { XMLConfiguration::XMLConfiguration() @@ -53,7 +54,7 @@ XMLConfiguration::XMLConfiguration() } -XMLConfiguration::XMLConfiguration(XML::InputSource* pInputSource) +XMLConfiguration::XMLConfiguration(Poco::XML::InputSource* pInputSource) { load(pInputSource); } @@ -71,13 +72,13 @@ XMLConfiguration::XMLConfiguration(const std::string& path) } -XMLConfiguration::XMLConfiguration(const XML::Document* pDocument) +XMLConfiguration::XMLConfiguration(const Poco::XML::Document* pDocument) { load(pDocument); } -XMLConfiguration::XMLConfiguration(const XML::Node* pNode) +XMLConfiguration::XMLConfiguration(const Poco::XML::Node* pNode) { load(pNode); } @@ -88,60 +89,60 @@ XMLConfiguration::~XMLConfiguration() } -void XMLConfiguration::load(XML::InputSource* pInputSource) +void XMLConfiguration::load(Poco::XML::InputSource* pInputSource) { poco_check_ptr (pInputSource); - XML::DOMParser parser; - parser.setFeature(XML::XMLReader::FEATURE_NAMESPACES, false); - parser.setFeature(XML::DOMParser::FEATURE_WHITESPACE, true); - XML::AutoPtr pDoc = parser.parse(pInputSource); + Poco::XML::DOMParser parser; + parser.setFeature(Poco::XML::XMLReader::FEATURE_NAMESPACES, false); + parser.setFeature(Poco::XML::DOMParser::FEATURE_WHITESPACE, true); + Poco::XML::AutoPtr pDoc = parser.parse(pInputSource); load(pDoc); } void XMLConfiguration::load(std::istream& istr) { - XML::InputSource src(istr); + Poco::XML::InputSource src(istr); load(&src); } void XMLConfiguration::load(const std::string& path) { - XML::InputSource src(path); + Poco::XML::InputSource src(path); load(&src); } -void XMLConfiguration::load(const XML::Document* pDocument) +void XMLConfiguration::load(const Poco::XML::Document* pDocument) { poco_check_ptr (pDocument); - _pDocument = XML::AutoPtr(const_cast(pDocument), true); - _pRoot = XML::AutoPtr(pDocument->documentElement(), true); + _pDocument = Poco::XML::AutoPtr(const_cast(pDocument), true); + _pRoot = Poco::XML::AutoPtr(pDocument->documentElement(), true); } -void XMLConfiguration::load(const XML::Node* pNode) +void XMLConfiguration::load(const Poco::XML::Node* pNode) { poco_check_ptr (pNode); - if (pNode->nodeType() == XML::Node::DOCUMENT_NODE) + if (pNode->nodeType() == Poco::XML::Node::DOCUMENT_NODE) { - load(static_cast(pNode)); + load(static_cast(pNode)); } else { - _pDocument = XML::AutoPtr(pNode->ownerDocument(), true); - _pRoot = XML::AutoPtr(const_cast(pNode), true); + _pDocument = Poco::XML::AutoPtr(pNode->ownerDocument(), true); + _pRoot = Poco::XML::AutoPtr(const_cast(pNode), true); } } bool XMLConfiguration::getRaw(const std::string& key, std::string& value) const { - const XML::Node* pNode = findNode(key); + const Poco::XML::Node* pNode = findNode(key); if (pNode) { value = pNode->innerText(); @@ -153,22 +154,22 @@ bool XMLConfiguration::getRaw(const std::string& key, std::string& value) const void XMLConfiguration::setRaw(const std::string& key, const std::string& value) { - throw Foundation::NotImplementedException("Setting a property in an XMLConfiguration"); + throw Poco::NotImplementedException("Setting a property in an XMLConfiguration"); } void XMLConfiguration::enumerate(const std::string& key, Keys& range) const { - using Foundation::NumberFormatter; + using Poco::NumberFormatter; std::multiset keys; - const XML::Node* pNode = findNode(key); + const Poco::XML::Node* pNode = findNode(key); if (pNode) { - const XML::Node* pChild = pNode->firstChild(); + const Poco::XML::Node* pChild = pNode->firstChild(); while (pChild) { - if (pChild->nodeType() == XML::Node::ELEMENT_NODE) + if (pChild->nodeType() == Poco::XML::Node::ELEMENT_NODE) { const std::string& nodeName = pChild->nodeName(); int n = (int) keys.count(nodeName); @@ -184,14 +185,14 @@ void XMLConfiguration::enumerate(const std::string& key, Keys& range) const } -const XML::Node* XMLConfiguration::findNode(const std::string& key) const +const Poco::XML::Node* XMLConfiguration::findNode(const std::string& key) const { std::string::const_iterator it = key.begin(); return findNode(it, key.end(), _pRoot); } -const XML::Node* XMLConfiguration::findNode(std::string::const_iterator& it, const std::string::const_iterator& end, const XML::Node* pNode) +const Poco::XML::Node* XMLConfiguration::findNode(std::string::const_iterator& it, const std::string::const_iterator& end, const Poco::XML::Node* pNode) { if (pNode && it != end) { @@ -211,7 +212,7 @@ const XML::Node* XMLConfiguration::findNode(std::string::const_iterator& it, con std::string index; while (it != end && *it != ']') index += *it++; if (it != end) ++it; - return findNode(it, end, findElement(Foundation::NumberParser::parse(index), pNode)); + return findNode(it, end, findElement(Poco::NumberParser::parse(index), pNode)); } } else @@ -226,12 +227,12 @@ const XML::Node* XMLConfiguration::findNode(std::string::const_iterator& it, con } -const XML::Node* XMLConfiguration::findElement(const std::string& name, const XML::Node* pNode) +const Poco::XML::Node* XMLConfiguration::findElement(const std::string& name, const Poco::XML::Node* pNode) { - const XML::Node* pChild = pNode->firstChild(); + const Poco::XML::Node* pChild = pNode->firstChild(); while (pChild) { - if (pChild->nodeType() == XML::Node::ELEMENT_NODE && pChild->nodeName() == name) + if (pChild->nodeType() == Poco::XML::Node::ELEMENT_NODE && pChild->nodeName() == name) return pChild; pChild = pChild->nextSibling(); } @@ -239,9 +240,9 @@ const XML::Node* XMLConfiguration::findElement(const std::string& name, const XM } -const XML::Node* XMLConfiguration::findElement(int index, const XML::Node* pNode) +const Poco::XML::Node* XMLConfiguration::findElement(int index, const Poco::XML::Node* pNode) { - const XML::Node* pRefNode = pNode; + const Poco::XML::Node* pRefNode = pNode; if (index > 0) { pNode = pNode->nextSibling(); @@ -258,9 +259,9 @@ const XML::Node* XMLConfiguration::findElement(int index, const XML::Node* pNode } -const XML::Node* XMLConfiguration::findAttribute(const std::string& name, const XML::Node* pNode) +const Poco::XML::Node* XMLConfiguration::findAttribute(const std::string& name, const Poco::XML::Node* pNode) { - const XML::Element* pElem = dynamic_cast(pNode); + const Poco::XML::Element* pElem = dynamic_cast(pNode); if (pElem) return pElem->getAttributeNode(name); else @@ -268,4 +269,4 @@ const XML::Node* XMLConfiguration::findAttribute(const std::string& name, const } -Util_END +} } // namespace Poco::Util diff --git a/Util/testsuite/Makefile b/Util/testsuite/Makefile index 44af651f3..65aa74088 100644 --- a/Util/testsuite/Makefile +++ b/Util/testsuite/Makefile @@ -1,7 +1,7 @@ # # Makefile # -# $Id: //poco/1.1.0/Util/testsuite/Makefile#1 $ +# $Id: //poco/1.2/Util/testsuite/Makefile#1 $ # # Makefile for Poco Util testsuite # @@ -15,10 +15,10 @@ objects = AbstractConfigurationTest ConfigurationTestSuite \ OptionProcessorTest OptionSetTest OptionTest \ OptionsTestSuite PropertyFileConfigurationTest \ SystemConfigurationTest UtilTestSuite XMLConfigurationTest \ - FilesystemConfigurationTest + FilesystemConfigurationTest ValidatorTest target = testrunner target_version = 1 -target_libs = PocoUtil PocoFoundation PocoXML CppUnit +target_libs = PocoUtil PocoXML PocoFoundation CppUnit include $(POCO_BASE)/build/rules/exec diff --git a/Util/testsuite/TestSuite.vmsbuild b/Util/testsuite/TestSuite.vmsbuild index b6d2e79f8..67ff187ee 100644 --- a/Util/testsuite/TestSuite.vmsbuild +++ b/Util/testsuite/TestSuite.vmsbuild @@ -1,7 +1,7 @@ # # TestSuite.vmsbuild # -# $Id: //poco/1.1.0/Util/testsuite/TestSuite.vmsbuild#1 $ +# $Id: //poco/1.2/Util/testsuite/TestSuite.vmsbuild#1 $ # EXE=TestRunner AbstractConfigurationTest diff --git a/Util/testsuite/TestSuite_vs71.vcproj b/Util/testsuite/TestSuite_vs71.vcproj index 2763f8827..7223a370d 100644 --- a/Util/testsuite/TestSuite_vs71.vcproj +++ b/Util/testsuite/TestSuite_vs71.vcproj @@ -278,6 +278,9 @@ + + + + + + @@ -315,6 +324,9 @@ + + diff --git a/Util/testsuite/TestSuite_vs80.vcproj b/Util/testsuite/TestSuite_vs80.vcproj index dc73bacea..db9a56219 100644 --- a/Util/testsuite/TestSuite_vs80.vcproj +++ b/Util/testsuite/TestSuite_vs80.vcproj @@ -373,6 +373,10 @@ RelativePath=".\src\OptionTest.h" > + + + + + + @@ -417,6 +429,10 @@ + + diff --git a/Util/testsuite/src/AbstractConfigurationTest.cpp b/Util/testsuite/src/AbstractConfigurationTest.cpp index 9e391ec4b..3955b9ea8 100644 --- a/Util/testsuite/src/AbstractConfigurationTest.cpp +++ b/Util/testsuite/src/AbstractConfigurationTest.cpp @@ -1,7 +1,7 @@ // // AbstractConfigurationTest.cpp // -// $Id: //poco/1.1.0/Util/testsuite/src/AbstractConfigurationTest.cpp#2 $ +// $Id: //poco/1.2/Util/testsuite/src/AbstractConfigurationTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,15 +33,15 @@ #include "AbstractConfigurationTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Util/MapConfiguration.h" -#include "Foundation/AutoPtr.h" -#include "Foundation/Exception.h" +#include "Poco/Util/MapConfiguration.h" +#include "Poco/AutoPtr.h" +#include "Poco/Exception.h" #include -using Util::AbstractConfiguration; -using Util::MapConfiguration; -using Foundation::AutoPtr; +using Poco::Util::AbstractConfiguration; +using Poco::Util::MapConfiguration; +using Poco::AutoPtr; AbstractConfigurationTest::AbstractConfigurationTest(const std::string& name): CppUnit::TestCase(name) @@ -82,7 +82,7 @@ void AbstractConfigurationTest::testGetString() std::string res = pConf->getString("foo"); fail("nonexistent property - must throw"); } - catch (Foundation::NotFoundException&) + catch (Poco::NotFoundException&) { } @@ -108,7 +108,7 @@ void AbstractConfigurationTest::testGetInt() int x = pConf->getInt("prop1"); fail("not a number - must throw"); } - catch (Foundation::SyntaxException&) + catch (Poco::SyntaxException&) { } @@ -130,7 +130,7 @@ void AbstractConfigurationTest::testGetDouble() double x = pConf->getDouble("prop1"); fail("not a number - must throw"); } - catch (Foundation::SyntaxException&) + catch (Poco::SyntaxException&) { } @@ -158,7 +158,7 @@ void AbstractConfigurationTest::testGetBool() bool x = pConf->getBool("prop1"); fail("not a boolean - must throw"); } - catch (Foundation::SyntaxException&) + catch (Poco::SyntaxException&) { } @@ -181,7 +181,7 @@ void AbstractConfigurationTest::testExpand() std::string s = pConf->getString("ref3"); fail("circular reference - must throw"); } - catch (Foundation::CircularReferenceException&) + catch (Poco::CircularReferenceException&) { } diff --git a/Util/testsuite/src/AbstractConfigurationTest.h b/Util/testsuite/src/AbstractConfigurationTest.h index bb065eff1..f85c4bbbe 100644 --- a/Util/testsuite/src/AbstractConfigurationTest.h +++ b/Util/testsuite/src/AbstractConfigurationTest.h @@ -1,7 +1,7 @@ // // AbstractConfigurationTest.h // -// $Id: //poco/1.1.0/Util/testsuite/src/AbstractConfigurationTest.h#2 $ +// $Id: //poco/1.2/Util/testsuite/src/AbstractConfigurationTest.h#1 $ // // Definition of the AbstractConfigurationTest class. // @@ -36,13 +36,9 @@ #define AbstractConfigurationTest_INCLUDED -#ifndef Util_Util_INCLUDED -#include "Util/Util.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Util/Util.h" #include "CppUnit/TestCase.h" -#endif -#include "Util/AbstractConfiguration.h" +#include "Poco/Util/AbstractConfiguration.h" class AbstractConfigurationTest: public CppUnit::TestCase @@ -69,7 +65,7 @@ public: static CppUnit::Test* suite(); private: - Util::AbstractConfiguration* createConfiguration() const; + Poco::Util::AbstractConfiguration* createConfiguration() const; }; diff --git a/Util/testsuite/src/ConfigurationMapperTest.cpp b/Util/testsuite/src/ConfigurationMapperTest.cpp index 4c724f325..654cbb3cb 100644 --- a/Util/testsuite/src/ConfigurationMapperTest.cpp +++ b/Util/testsuite/src/ConfigurationMapperTest.cpp @@ -1,7 +1,7 @@ // // ConfigurationMapperTest.cpp // -// $Id: //poco/1.1.0/Util/testsuite/src/ConfigurationMapperTest.cpp#2 $ +// $Id: //poco/1.2/Util/testsuite/src/ConfigurationMapperTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,17 +33,17 @@ #include "ConfigurationMapperTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Util/ConfigurationMapper.h" -#include "Util/MapConfiguration.h" -#include "Foundation/AutoPtr.h" -#include "Foundation/Exception.h" +#include "Poco/Util/ConfigurationMapper.h" +#include "Poco/Util/MapConfiguration.h" +#include "Poco/AutoPtr.h" +#include "Poco/Exception.h" #include -using Util::AbstractConfiguration; -using Util::ConfigurationMapper; -using Util::MapConfiguration; -using Foundation::AutoPtr; +using Poco::Util::AbstractConfiguration; +using Poco::Util::ConfigurationMapper; +using Poco::Util::MapConfiguration; +using Poco::AutoPtr; ConfigurationMapperTest::ConfigurationMapperTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Util/testsuite/src/ConfigurationMapperTest.h b/Util/testsuite/src/ConfigurationMapperTest.h index ec3c7e6f5..0dd82c082 100644 --- a/Util/testsuite/src/ConfigurationMapperTest.h +++ b/Util/testsuite/src/ConfigurationMapperTest.h @@ -1,7 +1,7 @@ // // ConfigurationMapperTest.h // -// $Id: //poco/1.1.0/Util/testsuite/src/ConfigurationMapperTest.h#2 $ +// $Id: //poco/1.2/Util/testsuite/src/ConfigurationMapperTest.h#1 $ // // Definition of the ConfigurationMapperTest class. // @@ -36,13 +36,9 @@ #define ConfigurationMapperTest_INCLUDED -#ifndef Util_Util_INCLUDED -#include "Util/Util.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Util/Util.h" #include "CppUnit/TestCase.h" -#endif -#include "Util/AbstractConfiguration.h" +#include "Poco/Util/AbstractConfiguration.h" class ConfigurationMapperTest: public CppUnit::TestCase @@ -62,7 +58,7 @@ public: static CppUnit::Test* suite(); private: - Util::AbstractConfiguration* createConfiguration() const; + Poco::Util::AbstractConfiguration* createConfiguration() const; }; diff --git a/Util/testsuite/src/ConfigurationTestSuite.cpp b/Util/testsuite/src/ConfigurationTestSuite.cpp index ec6b02492..2cdc28fb3 100644 --- a/Util/testsuite/src/ConfigurationTestSuite.cpp +++ b/Util/testsuite/src/ConfigurationTestSuite.cpp @@ -1,7 +1,7 @@ // // ConfigurationTestSuite.cpp // -// $Id: //poco/1.1.0/Util/testsuite/src/ConfigurationTestSuite.cpp#2 $ +// $Id: //poco/1.2/Util/testsuite/src/ConfigurationTestSuite.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. diff --git a/Util/testsuite/src/ConfigurationTestSuite.h b/Util/testsuite/src/ConfigurationTestSuite.h index 9874307fe..6b3c7a6a1 100644 --- a/Util/testsuite/src/ConfigurationTestSuite.h +++ b/Util/testsuite/src/ConfigurationTestSuite.h @@ -1,7 +1,7 @@ // // ConfigurationTestSuite.h // -// $Id: //poco/1.1.0/Util/testsuite/src/ConfigurationTestSuite.h#2 $ +// $Id: //poco/1.2/Util/testsuite/src/ConfigurationTestSuite.h#1 $ // // Definition of the ConfigurationTestSuite class. // @@ -36,9 +36,7 @@ #define ConfigurationTestSuite_INCLUDED -#ifndef CppUnit_TestSuite_INCLUDED #include "CppUnit/TestSuite.h" -#endif class ConfigurationTestSuite diff --git a/Util/testsuite/src/ConfigurationViewTest.cpp b/Util/testsuite/src/ConfigurationViewTest.cpp index d21206a8d..cdb551080 100644 --- a/Util/testsuite/src/ConfigurationViewTest.cpp +++ b/Util/testsuite/src/ConfigurationViewTest.cpp @@ -1,7 +1,7 @@ // // ConfigurationViewTest.cpp // -// $Id: //poco/1.1.0/Util/testsuite/src/ConfigurationViewTest.cpp#2 $ +// $Id: //poco/1.2/Util/testsuite/src/ConfigurationViewTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,15 +33,15 @@ #include "ConfigurationViewTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Util/MapConfiguration.h" -#include "Foundation/AutoPtr.h" -#include "Foundation/Exception.h" +#include "Poco/Util/MapConfiguration.h" +#include "Poco/AutoPtr.h" +#include "Poco/Exception.h" #include -using Util::AbstractConfiguration; -using Util::MapConfiguration; -using Foundation::AutoPtr; +using Poco::Util::AbstractConfiguration; +using Poco::Util::MapConfiguration; +using Poco::AutoPtr; ConfigurationViewTest::ConfigurationViewTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Util/testsuite/src/ConfigurationViewTest.h b/Util/testsuite/src/ConfigurationViewTest.h index 7fb6ff331..fe2f565ce 100644 --- a/Util/testsuite/src/ConfigurationViewTest.h +++ b/Util/testsuite/src/ConfigurationViewTest.h @@ -1,7 +1,7 @@ // // ConfigurationViewTest.h // -// $Id: //poco/1.1.0/Util/testsuite/src/ConfigurationViewTest.h#2 $ +// $Id: //poco/1.2/Util/testsuite/src/ConfigurationViewTest.h#1 $ // // Definition of the ConfigurationViewTest class. // @@ -36,13 +36,9 @@ #define ConfigurationViewTest_INCLUDED -#ifndef Util_Util_INCLUDED -#include "Util/Util.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Util/Util.h" #include "CppUnit/TestCase.h" -#endif -#include "Util/AbstractConfiguration.h" +#include "Poco/Util/AbstractConfiguration.h" class ConfigurationViewTest: public CppUnit::TestCase @@ -59,7 +55,7 @@ public: static CppUnit::Test* suite(); private: - Util::AbstractConfiguration* createConfiguration() const; + Poco::Util::AbstractConfiguration* createConfiguration() const; }; diff --git a/Util/testsuite/src/Driver.cpp b/Util/testsuite/src/Driver.cpp index 0cd38e92d..a8fd113a1 100644 --- a/Util/testsuite/src/Driver.cpp +++ b/Util/testsuite/src/Driver.cpp @@ -1,7 +1,7 @@ // // Driver.cpp // -// $Id: //poco/1.1.0/Util/testsuite/src/Driver.cpp#2 $ +// $Id: //poco/1.2/Util/testsuite/src/Driver.cpp#1 $ // // Console-based test driver for Poco Util. // diff --git a/Util/testsuite/src/FilesystemConfigurationTest.cpp b/Util/testsuite/src/FilesystemConfigurationTest.cpp index bfcbc8623..d12c8f9e8 100644 --- a/Util/testsuite/src/FilesystemConfigurationTest.cpp +++ b/Util/testsuite/src/FilesystemConfigurationTest.cpp @@ -1,7 +1,7 @@ // // FilesystemConfigurationTest.cpp // -// $Id: //poco/1.1.0/Util/testsuite/src/FilesystemConfigurationTest.cpp#2 $ +// $Id: //poco/1.2/Util/testsuite/src/FilesystemConfigurationTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,14 +33,14 @@ #include "FilesystemConfigurationTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Util/FilesystemConfiguration.h" -#include "Foundation/AutoPtr.h" +#include "Poco/Util/FilesystemConfiguration.h" +#include "Poco/AutoPtr.h" #include -using Util::FilesystemConfiguration; -using Util::AbstractConfiguration; -using Foundation::AutoPtr; +using Poco::Util::FilesystemConfiguration; +using Poco::Util::AbstractConfiguration; +using Poco::AutoPtr; FilesystemConfigurationTest::FilesystemConfigurationTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Util/testsuite/src/FilesystemConfigurationTest.h b/Util/testsuite/src/FilesystemConfigurationTest.h index 03abda6fb..0d3728b87 100644 --- a/Util/testsuite/src/FilesystemConfigurationTest.h +++ b/Util/testsuite/src/FilesystemConfigurationTest.h @@ -1,7 +1,7 @@ // // FilesystemConfigurationTest.h // -// $Id: //poco/1.1.0/Util/testsuite/src/FilesystemConfigurationTest.h#2 $ +// $Id: //poco/1.2/Util/testsuite/src/FilesystemConfigurationTest.h#1 $ // // Definition of the FilesystemConfigurationTest class. // @@ -36,12 +36,8 @@ #define FilesystemConfigurationTest_INCLUDED -#ifndef Util_Util_INCLUDED -#include "Util/Util.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Util/Util.h" #include "CppUnit/TestCase.h" -#endif class FilesystemConfigurationTest: public CppUnit::TestCase diff --git a/Util/testsuite/src/HelpFormatterTest.cpp b/Util/testsuite/src/HelpFormatterTest.cpp index 434809973..ac7b0aec0 100644 --- a/Util/testsuite/src/HelpFormatterTest.cpp +++ b/Util/testsuite/src/HelpFormatterTest.cpp @@ -1,7 +1,7 @@ // // HelpFormatterTest.cpp // -// $Id: //poco/1.1.0/Util/testsuite/src/HelpFormatterTest.cpp#2 $ +// $Id: //poco/1.2/Util/testsuite/src/HelpFormatterTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,15 +33,15 @@ #include "HelpFormatterTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Util/Option.h" -#include "Util/OptionSet.h" -#include "Util/HelpFormatter.h" +#include "Poco/Util/Option.h" +#include "Poco/Util/OptionSet.h" +#include "Poco/Util/HelpFormatter.h" #include -using Util::Option; -using Util::OptionSet; -using Util::HelpFormatter; +using Poco::Util::Option; +using Poco::Util::OptionSet; +using Poco::Util::HelpFormatter; HelpFormatterTest::HelpFormatterTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Util/testsuite/src/HelpFormatterTest.h b/Util/testsuite/src/HelpFormatterTest.h index 84803b59d..ab654be12 100644 --- a/Util/testsuite/src/HelpFormatterTest.h +++ b/Util/testsuite/src/HelpFormatterTest.h @@ -1,7 +1,7 @@ // // HelpFormatterTest.h // -// $Id: //poco/1.1.0/Util/testsuite/src/HelpFormatterTest.h#2 $ +// $Id: //poco/1.2/Util/testsuite/src/HelpFormatterTest.h#1 $ // // Definition of the HelpFormatterTest class. // @@ -36,12 +36,8 @@ #define HelpFormatterTest_INCLUDED -#ifndef Util_Util_INCLUDED -#include "Util/Util.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Util/Util.h" #include "CppUnit/TestCase.h" -#endif class HelpFormatterTest: public CppUnit::TestCase diff --git a/Util/testsuite/src/IniFileConfigurationTest.cpp b/Util/testsuite/src/IniFileConfigurationTest.cpp index 1f28e2a2a..bb416a658 100644 --- a/Util/testsuite/src/IniFileConfigurationTest.cpp +++ b/Util/testsuite/src/IniFileConfigurationTest.cpp @@ -1,7 +1,7 @@ // // IniFileConfigurationTest.cpp // -// $Id: //poco/1.1.0/Util/testsuite/src/IniFileConfigurationTest.cpp#2 $ +// $Id: //poco/1.2/Util/testsuite/src/IniFileConfigurationTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,18 +33,18 @@ #include "IniFileConfigurationTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Util/IniFileConfiguration.h" -#include "Foundation/AutoPtr.h" -#include "Foundation/Exception.h" +#include "Poco/Util/IniFileConfiguration.h" +#include "Poco/AutoPtr.h" +#include "Poco/Exception.h" #include #include -using Util::IniFileConfiguration; -using Util::AbstractConfiguration; -using Foundation::AutoPtr; -using Foundation::NotImplementedException; -using Foundation::NotFoundException; +using Poco::Util::IniFileConfiguration; +using Poco::Util::AbstractConfiguration; +using Poco::AutoPtr; +using Poco::NotImplementedException; +using Poco::NotFoundException; IniFileConfigurationTest::IniFileConfigurationTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Util/testsuite/src/IniFileConfigurationTest.h b/Util/testsuite/src/IniFileConfigurationTest.h index 577ba74e5..f3c4208a5 100644 --- a/Util/testsuite/src/IniFileConfigurationTest.h +++ b/Util/testsuite/src/IniFileConfigurationTest.h @@ -1,7 +1,7 @@ // // IniFileConfigurationTest.h // -// $Id: //poco/1.1.0/Util/testsuite/src/IniFileConfigurationTest.h#2 $ +// $Id: //poco/1.2/Util/testsuite/src/IniFileConfigurationTest.h#1 $ // // Definition of the IniFileConfigurationTest class. // @@ -36,12 +36,8 @@ #define IniFileConfigurationTest_INCLUDED -#ifndef Util_Util_INCLUDED -#include "Util/Util.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Util/Util.h" #include "CppUnit/TestCase.h" -#endif class IniFileConfigurationTest: public CppUnit::TestCase diff --git a/Util/testsuite/src/LayeredConfigurationTest.cpp b/Util/testsuite/src/LayeredConfigurationTest.cpp index 49d39196e..a01a02ca1 100644 --- a/Util/testsuite/src/LayeredConfigurationTest.cpp +++ b/Util/testsuite/src/LayeredConfigurationTest.cpp @@ -1,7 +1,7 @@ // // LayeredConfigurationTest.cpp // -// $Id: //poco/1.1.0/Util/testsuite/src/LayeredConfigurationTest.cpp#2 $ +// $Id: //poco/1.2/Util/testsuite/src/LayeredConfigurationTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,19 +33,19 @@ #include "LayeredConfigurationTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Util/LayeredConfiguration.h" -#include "Util/MapConfiguration.h" -#include "Foundation/AutoPtr.h" -#include "Foundation/Exception.h" +#include "Poco/Util/LayeredConfiguration.h" +#include "Poco/Util/MapConfiguration.h" +#include "Poco/AutoPtr.h" +#include "Poco/Exception.h" #include -using Util::AbstractConfiguration; -using Util::LayeredConfiguration; -using Util::MapConfiguration; -using Foundation::AutoPtr; -using Foundation::NotFoundException; -using Foundation::RuntimeException; +using Poco::Util::AbstractConfiguration; +using Poco::Util::LayeredConfiguration; +using Poco::Util::MapConfiguration; +using Poco::AutoPtr; +using Poco::NotFoundException; +using Poco::RuntimeException; LayeredConfigurationTest::LayeredConfigurationTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Util/testsuite/src/LayeredConfigurationTest.h b/Util/testsuite/src/LayeredConfigurationTest.h index 1a0fd433a..48c0224a9 100644 --- a/Util/testsuite/src/LayeredConfigurationTest.h +++ b/Util/testsuite/src/LayeredConfigurationTest.h @@ -1,7 +1,7 @@ // // LayeredConfigurationTest.h // -// $Id: //poco/1.1.0/Util/testsuite/src/LayeredConfigurationTest.h#2 $ +// $Id: //poco/1.2/Util/testsuite/src/LayeredConfigurationTest.h#1 $ // // Definition of the LayeredConfigurationTest class. // @@ -36,12 +36,8 @@ #define LayeredConfigurationTest_INCLUDED -#ifndef Util_Util_INCLUDED -#include "Util/Util.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Util/Util.h" #include "CppUnit/TestCase.h" -#endif class LayeredConfigurationTest: public CppUnit::TestCase diff --git a/Util/testsuite/src/LoggingConfiguratorTest.cpp b/Util/testsuite/src/LoggingConfiguratorTest.cpp index 15dc97f7b..7e3809d00 100644 --- a/Util/testsuite/src/LoggingConfiguratorTest.cpp +++ b/Util/testsuite/src/LoggingConfiguratorTest.cpp @@ -1,7 +1,7 @@ // // LoggingConfiguratorTest.cpp // -// $Id: //poco/1.1.0/Util/testsuite/src/LoggingConfiguratorTest.cpp#2 $ +// $Id: //poco/1.2/Util/testsuite/src/LoggingConfiguratorTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,32 +33,32 @@ #include "LoggingConfiguratorTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Util/LoggingConfigurator.h" -#include "Util/PropertyFileConfiguration.h" -#include "Foundation/LoggingRegistry.h" -#include "Foundation/ConsoleChannel.h" -#include "Foundation/FileChannel.h" -#include "Foundation/SplitterChannel.h" -#include "Foundation/FormattingChannel.h" -#include "Foundation/PatternFormatter.h" -#include "Foundation/Logger.h" -#include "Foundation/Message.h" -#include "Foundation/AutoPtr.h" +#include "Poco/Util/LoggingConfigurator.h" +#include "Poco/Util/PropertyFileConfiguration.h" +#include "Poco/LoggingRegistry.h" +#include "Poco/ConsoleChannel.h" +#include "Poco/FileChannel.h" +#include "Poco/SplitterChannel.h" +#include "Poco/FormattingChannel.h" +#include "Poco/PatternFormatter.h" +#include "Poco/Logger.h" +#include "Poco/Message.h" +#include "Poco/AutoPtr.h" #include -using Util::LoggingConfigurator; -using Util::PropertyFileConfiguration; -using Foundation::LoggingRegistry; -using Foundation::Channel; -using Foundation::ConsoleChannel; -using Foundation::FileChannel; -using Foundation::SplitterChannel; -using Foundation::FormattingChannel; -using Foundation::PatternFormatter; -using Foundation::Logger; -using Foundation::Message; -using Foundation::AutoPtr; +using Poco::Util::LoggingConfigurator; +using Poco::Util::PropertyFileConfiguration; +using Poco::LoggingRegistry; +using Poco::Channel; +using Poco::ConsoleChannel; +using Poco::FileChannel; +using Poco::SplitterChannel; +using Poco::FormattingChannel; +using Poco::PatternFormatter; +using Poco::Logger; +using Poco::Message; +using Poco::AutoPtr; LoggingConfiguratorTest::LoggingConfiguratorTest(const std::string& name): CppUnit::TestCase(name) @@ -163,7 +163,7 @@ void LoggingConfiguratorTest::testBadConfiguration1() configurator.configure(pConfig); fail("bad configuration - must throw"); } - catch (Foundation::Exception&) + catch (Poco::Exception&) { } } @@ -206,7 +206,7 @@ void LoggingConfiguratorTest::testBadConfiguration2() configurator.configure(pConfig); fail("bad configuration - must throw"); } - catch (Foundation::Exception&) + catch (Poco::Exception&) { } } @@ -249,7 +249,7 @@ void LoggingConfiguratorTest::testBadConfiguration3() configurator.configure(pConfig); fail("bad configuration - must throw"); } - catch (Foundation::Exception&) + catch (Poco::Exception&) { } } @@ -293,7 +293,7 @@ void LoggingConfiguratorTest::testBadConfiguration4() configurator.configure(pConfig); fail("bad configuration - must throw"); } - catch (Foundation::Exception&) + catch (Poco::Exception&) { } } diff --git a/Util/testsuite/src/LoggingConfiguratorTest.h b/Util/testsuite/src/LoggingConfiguratorTest.h index ba8131b32..512113997 100644 --- a/Util/testsuite/src/LoggingConfiguratorTest.h +++ b/Util/testsuite/src/LoggingConfiguratorTest.h @@ -1,7 +1,7 @@ // // LoggingConfiguratorTest.h // -// $Id: //poco/1.1.0/Util/testsuite/src/LoggingConfiguratorTest.h#2 $ +// $Id: //poco/1.2/Util/testsuite/src/LoggingConfiguratorTest.h#1 $ // // Definition of the LoggingConfiguratorTest class. // @@ -36,12 +36,8 @@ #define LoggingConfiguratorTest_INCLUDED -#ifndef Util_Util_INCLUDED -#include "Util/Util.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Util/Util.h" #include "CppUnit/TestCase.h" -#endif class LoggingConfiguratorTest: public CppUnit::TestCase diff --git a/Util/testsuite/src/MapConfigurationTest.cpp b/Util/testsuite/src/MapConfigurationTest.cpp index 2789748cd..127bc04b9 100644 --- a/Util/testsuite/src/MapConfigurationTest.cpp +++ b/Util/testsuite/src/MapConfigurationTest.cpp @@ -1,7 +1,7 @@ // // MapConfigurationTest.cpp // -// $Id: //poco/1.1.0/Util/testsuite/src/MapConfigurationTest.cpp#2 $ +// $Id: //poco/1.2/Util/testsuite/src/MapConfigurationTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,12 +33,12 @@ #include "MapConfigurationTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Util/MapConfiguration.h" -#include "Foundation/AutoPtr.h" +#include "Poco/Util/MapConfiguration.h" +#include "Poco/AutoPtr.h" -using Util::MapConfiguration; -using Foundation::AutoPtr; +using Poco::Util::MapConfiguration; +using Poco::AutoPtr; MapConfigurationTest::MapConfigurationTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Util/testsuite/src/MapConfigurationTest.h b/Util/testsuite/src/MapConfigurationTest.h index 71d3a6131..daf06e291 100644 --- a/Util/testsuite/src/MapConfigurationTest.h +++ b/Util/testsuite/src/MapConfigurationTest.h @@ -1,7 +1,7 @@ // // MapConfigurationTest.h // -// $Id: //poco/1.1.0/Util/testsuite/src/MapConfigurationTest.h#2 $ +// $Id: //poco/1.2/Util/testsuite/src/MapConfigurationTest.h#1 $ // // Definition of the MapConfigurationTest class. // @@ -36,12 +36,8 @@ #define MapConfigurationTest_INCLUDED -#ifndef Util_Util_INCLUDED -#include "Util/Util.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Util/Util.h" #include "CppUnit/TestCase.h" -#endif class MapConfigurationTest: public CppUnit::TestCase diff --git a/Util/testsuite/src/OptionProcessorTest.cpp b/Util/testsuite/src/OptionProcessorTest.cpp index b8fe0ad64..9edb8c420 100644 --- a/Util/testsuite/src/OptionProcessorTest.cpp +++ b/Util/testsuite/src/OptionProcessorTest.cpp @@ -1,7 +1,7 @@ // // OptionProcessorTest.cpp // -// $Id: //poco/1.1.0/Util/testsuite/src/OptionProcessorTest.cpp#2 $ +// $Id: //poco/1.2/Util/testsuite/src/OptionProcessorTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,15 +33,15 @@ #include "OptionProcessorTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Util/Option.h" -#include "Util/OptionSet.h" -#include "Util/OptionProcessor.h" -#include "Util/OptionException.h" +#include "Poco/Util/Option.h" +#include "Poco/Util/OptionSet.h" +#include "Poco/Util/OptionProcessor.h" +#include "Poco/Util/OptionException.h" -using Util::Option; -using Util::OptionSet; -using Util::OptionProcessor; +using Poco::Util::Option; +using Poco::Util::OptionSet; +using Poco::Util::OptionProcessor; OptionProcessorTest::OptionProcessorTest(const std::string& name): CppUnit::TestCase(name) @@ -128,7 +128,7 @@ void OptionProcessorTest::testUnix() p1.process("--output:file", name, value); fail("duplicate - must throw"); } - catch (Util::DuplicateOptionException&) + catch (Poco::Util::DuplicateOptionException&) { } @@ -141,7 +141,7 @@ void OptionProcessorTest::testUnix() p1.process("--optimize", name, value); fail("incompatible - must throw"); } - catch (Util::IncompatibleOptionsException&) + catch (Poco::Util::IncompatibleOptionsException&) { } @@ -150,7 +150,7 @@ void OptionProcessorTest::testUnix() p1.process("-x", name, value); fail("unknown option - must throw"); } - catch (Util::UnknownOptionException&) + catch (Poco::Util::UnknownOptionException&) { } @@ -159,7 +159,7 @@ void OptionProcessorTest::testUnix() p1.process("--in", name, value); fail("ambiguous option - must throw"); } - catch (Util::AmbiguousOptionException&) + catch (Poco::Util::AmbiguousOptionException&) { } } @@ -240,7 +240,7 @@ void OptionProcessorTest::testDefault() p1.process("/output:file", name, value); fail("duplicate - must throw"); } - catch (Util::DuplicateOptionException&) + catch (Poco::Util::DuplicateOptionException&) { } @@ -253,7 +253,7 @@ void OptionProcessorTest::testDefault() p1.process("/OPT", name, value); fail("incompatible - must throw"); } - catch (Util::IncompatibleOptionsException&) + catch (Poco::Util::IncompatibleOptionsException&) { } @@ -262,7 +262,7 @@ void OptionProcessorTest::testDefault() p1.process("/x", name, value); fail("unknown option - must throw"); } - catch (Util::UnknownOptionException&) + catch (Poco::Util::UnknownOptionException&) { } @@ -271,12 +271,38 @@ void OptionProcessorTest::testDefault() p1.process("/in", name, value); fail("ambiguous option - must throw"); } - catch (Util::AmbiguousOptionException&) + catch (Poco::Util::AmbiguousOptionException&) { } } +void OptionProcessorTest::testRequired() +{ + OptionSet set; + set.addOption( + Option("option", "o") + .required(true) + .repeatable(true)); + + OptionProcessor p1(set); + std::string name; + std::string value; + + try + { + p1.checkRequired(); + fail("no options specified - must throw"); + } + catch (Poco::Util::MissingOptionException&) + { + } + + assert (p1.process("-o", name, value)); + p1.checkRequired(); +} + + void OptionProcessorTest::setUp() { } @@ -293,6 +319,7 @@ CppUnit::Test* OptionProcessorTest::suite() CppUnit_addTest(pSuite, OptionProcessorTest, testUnix); CppUnit_addTest(pSuite, OptionProcessorTest, testDefault); + CppUnit_addTest(pSuite, OptionProcessorTest, testRequired); return pSuite; } diff --git a/Util/testsuite/src/OptionProcessorTest.h b/Util/testsuite/src/OptionProcessorTest.h index 408c0edab..5408e45f3 100644 --- a/Util/testsuite/src/OptionProcessorTest.h +++ b/Util/testsuite/src/OptionProcessorTest.h @@ -1,7 +1,7 @@ // // OptionProcessorTest.h // -// $Id: //poco/1.1.0/Util/testsuite/src/OptionProcessorTest.h#2 $ +// $Id: //poco/1.2/Util/testsuite/src/OptionProcessorTest.h#1 $ // // Definition of the OptionProcessorTest class. // @@ -36,12 +36,8 @@ #define OptionProcessorTest_INCLUDED -#ifndef Util_Util_INCLUDED -#include "Util/Util.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Util/Util.h" #include "CppUnit/TestCase.h" -#endif class OptionProcessorTest: public CppUnit::TestCase @@ -52,6 +48,7 @@ public: void testUnix(); void testDefault(); + void testRequired(); void setUp(); void tearDown(); diff --git a/Util/testsuite/src/OptionSetTest.cpp b/Util/testsuite/src/OptionSetTest.cpp index 66ac45c82..4bc3c313b 100644 --- a/Util/testsuite/src/OptionSetTest.cpp +++ b/Util/testsuite/src/OptionSetTest.cpp @@ -1,7 +1,7 @@ // // OptionSetTest.cpp // -// $Id: //poco/1.1.0/Util/testsuite/src/OptionSetTest.cpp#2 $ +// $Id: //poco/1.2/Util/testsuite/src/OptionSetTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,13 +33,13 @@ #include "OptionSetTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Util/OptionSet.h" -#include "Util/Option.h" -#include "Util/OptionException.h" +#include "Poco/Util/OptionSet.h" +#include "Poco/Util/Option.h" +#include "Poco/Util/OptionException.h" -using Util::OptionSet; -using Util::Option; +using Poco::Util::OptionSet; +using Poco::Util::Option; OptionSetTest::OptionSetTest(const std::string& name): CppUnit::TestCase(name) @@ -102,7 +102,7 @@ void OptionSetTest::testOptionSet() set.getOption("in"); fail("ambiguous - must throw"); } - catch (Util::AmbiguousOptionException&) + catch (Poco::Util::AmbiguousOptionException&) { } @@ -111,7 +111,7 @@ void OptionSetTest::testOptionSet() set.getOption("i"); fail("ambiguous - must throw"); } - catch (Util::AmbiguousOptionException&) + catch (Poco::Util::AmbiguousOptionException&) { } } diff --git a/Util/testsuite/src/OptionSetTest.h b/Util/testsuite/src/OptionSetTest.h index e2c6bee4c..c78dfc3bd 100644 --- a/Util/testsuite/src/OptionSetTest.h +++ b/Util/testsuite/src/OptionSetTest.h @@ -1,7 +1,7 @@ // // OptionSetTest.h // -// $Id: //poco/1.1.0/Util/testsuite/src/OptionSetTest.h#2 $ +// $Id: //poco/1.2/Util/testsuite/src/OptionSetTest.h#1 $ // // Definition of the OptionSetTest class. // @@ -36,12 +36,8 @@ #define OptionSetTest_INCLUDED -#ifndef Util_Util_INCLUDED -#include "Util/Util.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Util/Util.h" #include "CppUnit/TestCase.h" -#endif class OptionSetTest: public CppUnit::TestCase diff --git a/Util/testsuite/src/OptionTest.cpp b/Util/testsuite/src/OptionTest.cpp index fb53548aa..bbaf8c9c8 100644 --- a/Util/testsuite/src/OptionTest.cpp +++ b/Util/testsuite/src/OptionTest.cpp @@ -1,7 +1,7 @@ // // OptionTest.cpp // -// $Id: //poco/1.1.0/Util/testsuite/src/OptionTest.cpp#2 $ +// $Id: //poco/1.2/Util/testsuite/src/OptionTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,11 +33,11 @@ #include "OptionTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Util/Option.h" -#include "Util/OptionException.h" +#include "Poco/Util/Option.h" +#include "Poco/Util/OptionException.h" -using Util::Option; +using Poco::Util::Option; OptionTest::OptionTest(const std::string& name): CppUnit::TestCase(name) @@ -183,7 +183,7 @@ void OptionTest::testProcess1() incOpt.process("I", arg); fail("argument required - must throw"); } - catch (Util::MissingArgumentException&) + catch (Poco::Util::MissingArgumentException&) { } @@ -192,7 +192,7 @@ void OptionTest::testProcess1() incOpt.process("Include", arg); fail("argument required - must throw"); } - catch (Util::MissingArgumentException&) + catch (Poco::Util::MissingArgumentException&) { } @@ -201,7 +201,7 @@ void OptionTest::testProcess1() incOpt.process("Llib", arg); fail("wrong option - must throw"); } - catch (Util::UnknownOptionException&) + catch (Poco::Util::UnknownOptionException&) { } @@ -220,7 +220,7 @@ void OptionTest::testProcess1() vrbOpt.process("v2", arg); fail("no argument expected - must throw"); } - catch (Util::UnexpectedArgumentException&) + catch (Poco::Util::UnexpectedArgumentException&) { } @@ -229,7 +229,7 @@ void OptionTest::testProcess1() vrbOpt.process("verbose:2", arg); fail("no argument expected - must throw"); } - catch (Util::UnexpectedArgumentException&) + catch (Poco::Util::UnexpectedArgumentException&) { } @@ -276,7 +276,7 @@ void OptionTest::testProcess2() incOpt.process("Iinclude", arg); fail("unknown option - must throw"); } - catch (Util::UnknownOptionException&) + catch (Poco::Util::UnknownOptionException&) { } @@ -285,7 +285,7 @@ void OptionTest::testProcess2() incOpt.process("I", arg); fail("argument required - must throw"); } - catch (Util::MissingArgumentException&) + catch (Poco::Util::MissingArgumentException&) { } @@ -294,7 +294,7 @@ void OptionTest::testProcess2() incOpt.process("Include", arg); fail("argument required - must throw"); } - catch (Util::MissingArgumentException&) + catch (Poco::Util::MissingArgumentException&) { } @@ -303,7 +303,7 @@ void OptionTest::testProcess2() incOpt.process("Llib", arg); fail("wrong option - must throw"); } - catch (Util::UnknownOptionException&) + catch (Poco::Util::UnknownOptionException&) { } @@ -322,7 +322,7 @@ void OptionTest::testProcess2() vrbOpt.process("v2", arg); fail("no argument expected - must throw"); } - catch (Util::UnknownOptionException&) + catch (Poco::Util::UnknownOptionException&) { } @@ -331,7 +331,7 @@ void OptionTest::testProcess2() vrbOpt.process("verbose:2", arg); fail("no argument expected - must throw"); } - catch (Util::UnexpectedArgumentException&) + catch (Poco::Util::UnexpectedArgumentException&) { } } diff --git a/Util/testsuite/src/OptionTest.h b/Util/testsuite/src/OptionTest.h index 173b59ca6..0f444d488 100644 --- a/Util/testsuite/src/OptionTest.h +++ b/Util/testsuite/src/OptionTest.h @@ -1,7 +1,7 @@ // // OptionTest.h // -// $Id: //poco/1.1.0/Util/testsuite/src/OptionTest.h#2 $ +// $Id: //poco/1.2/Util/testsuite/src/OptionTest.h#1 $ // // Definition of the OptionTest class. // @@ -36,12 +36,8 @@ #define OptionTest_INCLUDED -#ifndef Util_Util_INCLUDED -#include "Util/Util.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Util/Util.h" #include "CppUnit/TestCase.h" -#endif class OptionTest: public CppUnit::TestCase diff --git a/Util/testsuite/src/OptionsTestSuite.cpp b/Util/testsuite/src/OptionsTestSuite.cpp index 7d8c78534..c75153a28 100644 --- a/Util/testsuite/src/OptionsTestSuite.cpp +++ b/Util/testsuite/src/OptionsTestSuite.cpp @@ -1,7 +1,7 @@ // // OptionsTestSuite.cpp // -// $Id: //poco/1.1.0/Util/testsuite/src/OptionsTestSuite.cpp#2 $ +// $Id: //poco/1.2/Util/testsuite/src/OptionsTestSuite.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -35,6 +35,7 @@ #include "OptionSetTest.h" #include "HelpFormatterTest.h" #include "OptionProcessorTest.h" +#include "ValidatorTest.h" CppUnit::Test* OptionsTestSuite::suite() @@ -45,6 +46,7 @@ CppUnit::Test* OptionsTestSuite::suite() pSuite->addTest(OptionSetTest::suite()); pSuite->addTest(HelpFormatterTest::suite()); pSuite->addTest(OptionProcessorTest::suite()); + pSuite->addTest(ValidatorTest::suite()); return pSuite; } diff --git a/Util/testsuite/src/OptionsTestSuite.h b/Util/testsuite/src/OptionsTestSuite.h index e5d2b47d2..a0865fc1d 100644 --- a/Util/testsuite/src/OptionsTestSuite.h +++ b/Util/testsuite/src/OptionsTestSuite.h @@ -1,7 +1,7 @@ // // OptionsTestSuite.h // -// $Id: //poco/1.1.0/Util/testsuite/src/OptionsTestSuite.h#2 $ +// $Id: //poco/1.2/Util/testsuite/src/OptionsTestSuite.h#1 $ // // Definition of the OptionsTestSuite class. // @@ -36,9 +36,7 @@ #define OptionsTestSuite_INCLUDED -#ifndef CppUnit_TestSuite_INCLUDED #include "CppUnit/TestSuite.h" -#endif class OptionsTestSuite diff --git a/Util/testsuite/src/PropertyFileConfigurationTest.cpp b/Util/testsuite/src/PropertyFileConfigurationTest.cpp index 9e0887814..bf85690cc 100644 --- a/Util/testsuite/src/PropertyFileConfigurationTest.cpp +++ b/Util/testsuite/src/PropertyFileConfigurationTest.cpp @@ -1,7 +1,7 @@ // // PropertyFileConfigurationTest.cpp // -// $Id: //poco/1.1.0/Util/testsuite/src/PropertyFileConfigurationTest.cpp#2 $ +// $Id: //poco/1.2/Util/testsuite/src/PropertyFileConfigurationTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,17 +33,17 @@ #include "PropertyFileConfigurationTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Util/PropertyFileConfiguration.h" -#include "Foundation/AutoPtr.h" -#include "Foundation/Exception.h" +#include "Poco/Util/PropertyFileConfiguration.h" +#include "Poco/AutoPtr.h" +#include "Poco/Exception.h" #include #include -using Util::PropertyFileConfiguration; -using Util::AbstractConfiguration; -using Foundation::AutoPtr; -using Foundation::NotFoundException; +using Poco::Util::PropertyFileConfiguration; +using Poco::Util::AbstractConfiguration; +using Poco::AutoPtr; +using Poco::NotFoundException; PropertyFileConfigurationTest::PropertyFileConfigurationTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Util/testsuite/src/PropertyFileConfigurationTest.h b/Util/testsuite/src/PropertyFileConfigurationTest.h index e01471744..6996a406e 100644 --- a/Util/testsuite/src/PropertyFileConfigurationTest.h +++ b/Util/testsuite/src/PropertyFileConfigurationTest.h @@ -1,7 +1,7 @@ // // PropertyFileConfigurationTest.h // -// $Id: //poco/1.1.0/Util/testsuite/src/PropertyFileConfigurationTest.h#2 $ +// $Id: //poco/1.2/Util/testsuite/src/PropertyFileConfigurationTest.h#1 $ // // Definition of the PropertyFileConfigurationTest class. // @@ -36,12 +36,8 @@ #define PropertyFileConfigurationTest_INCLUDED -#ifndef Util_Util_INCLUDED -#include "Util/Util.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Util/Util.h" #include "CppUnit/TestCase.h" -#endif class PropertyFileConfigurationTest: public CppUnit::TestCase diff --git a/Util/testsuite/src/SystemConfigurationTest.cpp b/Util/testsuite/src/SystemConfigurationTest.cpp index 14c9b2380..c45a7d14a 100644 --- a/Util/testsuite/src/SystemConfigurationTest.cpp +++ b/Util/testsuite/src/SystemConfigurationTest.cpp @@ -1,7 +1,7 @@ // // SystemConfigurationTest.cpp // -// $Id: //poco/1.1.0/Util/testsuite/src/SystemConfigurationTest.cpp#2 $ +// $Id: //poco/1.2/Util/testsuite/src/SystemConfigurationTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,21 +33,21 @@ #include "SystemConfigurationTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Util/SystemConfiguration.h" -#include "Foundation/AutoPtr.h" -#include "Foundation/Exception.h" -#include "Foundation/Environment.h" -#include "Foundation/Path.h" +#include "Poco/Util/SystemConfiguration.h" +#include "Poco/AutoPtr.h" +#include "Poco/Exception.h" +#include "Poco/Environment.h" +#include "Poco/Path.h" #include -using Util::SystemConfiguration; -using Util::AbstractConfiguration; -using Foundation::AutoPtr; -using Foundation::Environment; -using Foundation::Path; -using Foundation::InvalidAccessException; -using Foundation::NotFoundException; +using Poco::Util::SystemConfiguration; +using Poco::Util::AbstractConfiguration; +using Poco::AutoPtr; +using Poco::Environment; +using Poco::Path; +using Poco::InvalidAccessException; +using Poco::NotFoundException; SystemConfigurationTest::SystemConfigurationTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Util/testsuite/src/SystemConfigurationTest.h b/Util/testsuite/src/SystemConfigurationTest.h index 1888d675f..5cc75f0a9 100644 --- a/Util/testsuite/src/SystemConfigurationTest.h +++ b/Util/testsuite/src/SystemConfigurationTest.h @@ -1,7 +1,7 @@ // // SystemConfigurationTest.h // -// $Id: //poco/1.1.0/Util/testsuite/src/SystemConfigurationTest.h#2 $ +// $Id: //poco/1.2/Util/testsuite/src/SystemConfigurationTest.h#1 $ // // Definition of the SystemConfigurationTest class. // @@ -36,12 +36,8 @@ #define SystemConfigurationTest_INCLUDED -#ifndef Util_Util_INCLUDED -#include "Util/Util.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Util/Util.h" #include "CppUnit/TestCase.h" -#endif class SystemConfigurationTest: public CppUnit::TestCase diff --git a/Util/testsuite/src/UtilTestSuite.cpp b/Util/testsuite/src/UtilTestSuite.cpp index e5ddf3af2..80bed7383 100644 --- a/Util/testsuite/src/UtilTestSuite.cpp +++ b/Util/testsuite/src/UtilTestSuite.cpp @@ -1,7 +1,7 @@ // // UtilTestSuite.cpp // -// $Id: //poco/1.1.0/Util/testsuite/src/UtilTestSuite.cpp#2 $ +// $Id: //poco/1.2/Util/testsuite/src/UtilTestSuite.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. diff --git a/Util/testsuite/src/UtilTestSuite.h b/Util/testsuite/src/UtilTestSuite.h index 0baa72d8a..ae3d9dc54 100644 --- a/Util/testsuite/src/UtilTestSuite.h +++ b/Util/testsuite/src/UtilTestSuite.h @@ -1,7 +1,7 @@ // // UtilTestSuite.h // -// $Id: //poco/1.1.0/Util/testsuite/src/UtilTestSuite.h#2 $ +// $Id: //poco/1.2/Util/testsuite/src/UtilTestSuite.h#1 $ // // Definition of the UtilTestSuite class. // @@ -36,9 +36,7 @@ #define UtilTestSuite_INCLUDED -#ifndef CppUnit_TestSuite_INCLUDED #include "CppUnit/TestSuite.h" -#endif class UtilTestSuite diff --git a/Util/testsuite/src/ValidatorTest.cpp b/Util/testsuite/src/ValidatorTest.cpp new file mode 100644 index 000000000..6a9c0c554 --- /dev/null +++ b/Util/testsuite/src/ValidatorTest.cpp @@ -0,0 +1,177 @@ +// +// ValidatorTest.cpp +// +// $Id: //poco/1.2/Util/testsuite/src/ValidatorTest.cpp#1 $ +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#include "ValidatorTest.h" +#include "CppUnit/TestCaller.h" +#include "CppUnit/TestSuite.h" +#include "Poco/Util/RegExpValidator.h" +#include "Poco/Util/IntValidator.h" +#include "Poco/Util/Option.h" +#include "Poco/Util/OptionException.h" +#include "Poco/AutoPtr.h" + + +using Poco::Util::Validator; +using Poco::Util::RegExpValidator; +using Poco::Util::IntValidator; +using Poco::Util::Option; +using Poco::Util::InvalidArgumentException; +using Poco::AutoPtr; + + +ValidatorTest::ValidatorTest(const std::string& name): CppUnit::TestCase(name) +{ +} + + +ValidatorTest::~ValidatorTest() +{ +} + + +void ValidatorTest::testRegExpValidator() +{ + Option option("option", "o"); + AutoPtr pVal(new RegExpValidator("[0-9]+")); + + pVal->validate(option, "0"); + pVal->validate(option, "12345"); + + try + { + pVal->validate(option, " 234"); + fail("does not match - must throw"); + } + catch (InvalidArgumentException& exc) + { + std::string s(exc.message()); + assert (s == "argument for option does not match regular expression [0-9]+"); + } + + try + { + pVal->validate(option, "234asdf"); + fail("does not match - must throw"); + } + catch (InvalidArgumentException& exc) + { + std::string s(exc.message()); + assert (s == "argument for option does not match regular expression [0-9]+"); + } + + try + { + pVal->validate(option, "abc"); + fail("does not match - must throw"); + } + catch (InvalidArgumentException& exc) + { + std::string s(exc.message()); + assert (s == "argument for option does not match regular expression [0-9]+"); + } + + try + { + pVal->validate(option, ""); + fail("does not match - must throw"); + } + catch (InvalidArgumentException& exc) + { + std::string s(exc.message()); + assert (s == "argument for option does not match regular expression [0-9]+"); + } +} + + +void ValidatorTest::testIntValidator() +{ + Option option("option", "o"); + AutoPtr pVal(new IntValidator(0, 100)); + + pVal->validate(option, "0"); + pVal->validate(option, "100"); + pVal->validate(option, "55"); + + try + { + pVal->validate(option, "-1"); + fail("out of range - must throw"); + } + catch (InvalidArgumentException& exc) + { + std::string s(exc.message()); + assert (s == "argument for option must be in range 0 to 100"); + } + + try + { + pVal->validate(option, "101"); + fail("out of range - must throw"); + } + catch (InvalidArgumentException& exc) + { + std::string s(exc.message()); + assert (s == "argument for option must be in range 0 to 100"); + } + + try + { + pVal->validate(option, "asdf"); + fail("not a number - must throw"); + } + catch (InvalidArgumentException& exc) + { + std::string s(exc.message()); + assert (s == "argument for option must be an integer"); + } +} + + +void ValidatorTest::setUp() +{ +} + + +void ValidatorTest::tearDown() +{ +} + + +CppUnit::Test* ValidatorTest::suite() +{ + CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("ValidatorTest"); + + CppUnit_addTest(pSuite, ValidatorTest, testRegExpValidator); + CppUnit_addTest(pSuite, ValidatorTest, testIntValidator); + + return pSuite; +} diff --git a/Util/testsuite/src/ValidatorTest.h b/Util/testsuite/src/ValidatorTest.h new file mode 100644 index 000000000..3b31d4aed --- /dev/null +++ b/Util/testsuite/src/ValidatorTest.h @@ -0,0 +1,61 @@ +// +// ValidatorTest.h +// +// $Id: //poco/1.2/Util/testsuite/src/ValidatorTest.h#1 $ +// +// Definition of the ValidatorTest class. +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef ValidatorTest_INCLUDED +#define ValidatorTest_INCLUDED + + +#include "Poco/Util/Util.h" +#include "CppUnit/TestCase.h" + + +class ValidatorTest: public CppUnit::TestCase +{ +public: + ValidatorTest(const std::string& name); + ~ValidatorTest(); + + void testRegExpValidator(); + void testIntValidator(); + + void setUp(); + void tearDown(); + + static CppUnit::Test* suite(); + +private: +}; + + +#endif // ValidatorTest_INCLUDED diff --git a/Util/testsuite/src/WinConfigurationTest.cpp b/Util/testsuite/src/WinConfigurationTest.cpp new file mode 100644 index 000000000..e45ee3334 --- /dev/null +++ b/Util/testsuite/src/WinConfigurationTest.cpp @@ -0,0 +1,87 @@ +// +// WinConfigurationTest.cpp +// +// $Id: //poco/1.2/Util/testsuite/src/WinConfigurationTest.cpp#1 $ +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#include "WinConfigurationTest.h" +#include "CppUnit/TestCaller.h" +#include "CppUnit/TestSuite.h" +#include "Poco/Util/WinRegistryConfiguration.h" +#include "Poco/Environment.h" +#include "Poco/AutoPtr.h" + + +using Poco::Util::WinRegistryConfiguration; +using Poco::Environment; +using Poco::AutoPtr; + + +WinConfigurationTest::WinConfigurationTest(const std::string& name): CppUnit::TestCase(name) +{ +} + + +WinConfigurationTest::~WinConfigurationTest() +{ +} + + +void WinConfigurationTest::testConfiguration() +{ + AutoPtr reg = new WinRegistryConfiguration("HKEY_CURRENT_USER\\Software\\Applied Informatics\\Test"); + reg->setString("name1", "value1"); + assert (reg->getString("name1") == "value1"); + reg->setInt("name1", 1); // overwrite should also change type + assert (reg->getInt("name1") == 1); + reg->setString("name2", "value2"); + assert (reg->getString("name2") == "value2"); + assert (reg->hasProperty("name1")); + assert (reg->hasProperty("name2")); +} + + +void WinConfigurationTest::setUp() +{ +} + + +void WinConfigurationTest::tearDown() +{ +} + + +CppUnit::Test* WinConfigurationTest::suite() +{ + CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("WinConfigurationTest"); + + CppUnit_addTest(pSuite, WinConfigurationTest, testConfiguration); + + return pSuite; +} diff --git a/Util/testsuite/src/WinConfigurationTest.h b/Util/testsuite/src/WinConfigurationTest.h new file mode 100644 index 000000000..655368eba --- /dev/null +++ b/Util/testsuite/src/WinConfigurationTest.h @@ -0,0 +1,60 @@ +// +// WinConfigurationTest.h +// +// $Id: //poco/1.2/Util/testsuite/src/WinConfigurationTest.h#1 $ +// +// Definition of the WinConfigurationTest class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef WinConfigurationTest_INCLUDED +#define WinConfigurationTest_INCLUDED + + +#include "Poco/Util/Util.h" +#include "CppUnit/TestCase.h" + + +class WinConfigurationTest: public CppUnit::TestCase +{ +public: + WinConfigurationTest(const std::string& name); + ~WinConfigurationTest(); + + void testConfiguration(); + + void setUp(); + void tearDown(); + + static CppUnit::Test* suite(); + +private: +}; + + +#endif // WinConfigurationTest_INCLUDED diff --git a/Util/testsuite/src/WinDriver.cpp b/Util/testsuite/src/WinDriver.cpp index df36d316b..6e530c4e3 100644 --- a/Util/testsuite/src/WinDriver.cpp +++ b/Util/testsuite/src/WinDriver.cpp @@ -1,7 +1,7 @@ // // WinDriver.cpp // -// $Id: //poco/1.1.0/Util/testsuite/src/WinDriver.cpp#2 $ +// $Id: //poco/1.2/Util/testsuite/src/WinDriver.cpp#1 $ // // Windows test driver for Poco Util. // diff --git a/Util/testsuite/src/WinRegistryTest.cpp b/Util/testsuite/src/WinRegistryTest.cpp index 155f192fa..9185a8d63 100644 --- a/Util/testsuite/src/WinRegistryTest.cpp +++ b/Util/testsuite/src/WinRegistryTest.cpp @@ -1,7 +1,7 @@ // // WinRegistryTest.cpp // -// $Id: //poco/1.1.0/Util/testsuite/src/WinRegistryTest.cpp#2 $ +// $Id: //poco/1.2/Util/testsuite/src/WinRegistryTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,12 +33,12 @@ #include "WinRegistryTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Util/WinRegistryKey.h" -#include "Foundation/Environment.h" +#include "Poco/Util/WinRegistryKey.h" +#include "Poco/Environment.h" -using Util::WinRegistryKey; -using Foundation::Environment; +using Poco::Util::WinRegistryKey; +using Poco::Environment; WinRegistryTest::WinRegistryTest(const std::string& name): CppUnit::TestCase(name) @@ -54,6 +54,7 @@ WinRegistryTest::~WinRegistryTest() void WinRegistryTest::testRegistry() { WinRegistryKey regKey("HKEY_CURRENT_USER\\Software\\Applied Informatics\\Test"); + regKey.deleteKey(); regKey.setString("name1", "value1"); assert (regKey.getString("name1") == "value1"); regKey.setString("name1", "Value1"); @@ -63,7 +64,14 @@ void WinRegistryTest::testRegistry() assert (regKey.exists("name1")); assert (regKey.exists("name2")); assert (regKey.exists()); - + + WinRegistryKey::Values vals; + regKey.values(vals); + assert (vals.size() == 2); + assert (vals[0] == "name1" || vals[0] == "name2"); + assert (vals[1] == "name1" || vals[1] == "name2"); + assert (vals[0] != vals[1]); + Environment::set("FOO", "bar"); regKey.setStringExpand("name3", "%FOO%"); assert (regKey.getStringExpand("name3") == "bar"); diff --git a/Util/testsuite/src/WinRegistryTest.h b/Util/testsuite/src/WinRegistryTest.h index 16c8fd993..6ec4e885f 100644 --- a/Util/testsuite/src/WinRegistryTest.h +++ b/Util/testsuite/src/WinRegistryTest.h @@ -1,7 +1,7 @@ // // WinRegistryTest.h // -// $Id: //poco/1.1.0/Util/testsuite/src/WinRegistryTest.h#2 $ +// $Id: //poco/1.2/Util/testsuite/src/WinRegistryTest.h#1 $ // // Definition of the WinRegistryTest class. // @@ -36,12 +36,8 @@ #define WinRegistryTest_INCLUDED -#ifndef Util_Util_INCLUDED -#include "Util/Util.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Util/Util.h" #include "CppUnit/TestCase.h" -#endif class WinRegistryTest: public CppUnit::TestCase diff --git a/Util/testsuite/src/WindowsTestSuite.cpp b/Util/testsuite/src/WindowsTestSuite.cpp index 72baa243a..a00cd22c7 100644 --- a/Util/testsuite/src/WindowsTestSuite.cpp +++ b/Util/testsuite/src/WindowsTestSuite.cpp @@ -1,7 +1,7 @@ // // WindowsTestSuite.cpp // -// $Id: //poco/1.1.0/Util/testsuite/src/WindowsTestSuite.cpp#2 $ +// $Id: //poco/1.2/Util/testsuite/src/WindowsTestSuite.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -32,6 +32,7 @@ #include "WindowsTestSuite.h" #include "WinRegistryTest.h" +#include "WinConfigurationTest.h" CppUnit::Test* WindowsTestSuite::suite() @@ -39,6 +40,7 @@ CppUnit::Test* WindowsTestSuite::suite() CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("WindowsTestSuite"); pSuite->addTest(WinRegistryTest::suite()); + pSuite->addTest(WinConfigurationTest::suite()); return pSuite; } diff --git a/Util/testsuite/src/WindowsTestSuite.h b/Util/testsuite/src/WindowsTestSuite.h index e70db800a..99d6db198 100644 --- a/Util/testsuite/src/WindowsTestSuite.h +++ b/Util/testsuite/src/WindowsTestSuite.h @@ -1,7 +1,7 @@ // // WindowsTestSuite.h // -// $Id: //poco/1.1.0/Util/testsuite/src/WindowsTestSuite.h#2 $ +// $Id: //poco/1.2/Util/testsuite/src/WindowsTestSuite.h#1 $ // // Definition of the WindowsTestSuite class. // @@ -36,9 +36,7 @@ #define WindowsTestSuite_INCLUDED -#ifndef CppUnit_TestSuite_INCLUDED #include "CppUnit/TestSuite.h" -#endif class WindowsTestSuite diff --git a/Util/testsuite/src/XMLConfigurationTest.cpp b/Util/testsuite/src/XMLConfigurationTest.cpp index 1974d2eef..339d142d7 100644 --- a/Util/testsuite/src/XMLConfigurationTest.cpp +++ b/Util/testsuite/src/XMLConfigurationTest.cpp @@ -1,7 +1,7 @@ // // XMLConfigurationTest.cpp // -// $Id: //poco/1.1.0/Util/testsuite/src/XMLConfigurationTest.cpp#2 $ +// $Id: //poco/1.2/Util/testsuite/src/XMLConfigurationTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,18 +33,18 @@ #include "XMLConfigurationTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "Util/XMLConfiguration.h" -#include "Foundation/AutoPtr.h" -#include "Foundation/Exception.h" +#include "Poco/Util/XMLConfiguration.h" +#include "Poco/AutoPtr.h" +#include "Poco/Exception.h" #include #include -using Util::XMLConfiguration; -using Util::AbstractConfiguration; -using Foundation::AutoPtr; -using Foundation::NotImplementedException; -using Foundation::NotFoundException; +using Poco::Util::XMLConfiguration; +using Poco::Util::AbstractConfiguration; +using Poco::AutoPtr; +using Poco::NotImplementedException; +using Poco::NotFoundException; XMLConfigurationTest::XMLConfigurationTest(const std::string& name): CppUnit::TestCase(name) diff --git a/Util/testsuite/src/XMLConfigurationTest.h b/Util/testsuite/src/XMLConfigurationTest.h index 53f1ac442..f33505b1b 100644 --- a/Util/testsuite/src/XMLConfigurationTest.h +++ b/Util/testsuite/src/XMLConfigurationTest.h @@ -1,7 +1,7 @@ // // XMLConfigurationTest.h // -// $Id: //poco/1.1.0/Util/testsuite/src/XMLConfigurationTest.h#2 $ +// $Id: //poco/1.2/Util/testsuite/src/XMLConfigurationTest.h#1 $ // // Definition of the XMLConfigurationTest class. // @@ -36,12 +36,8 @@ #define XMLConfigurationTest_INCLUDED -#ifndef Util_Util_INCLUDED -#include "Util/Util.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/Util/Util.h" #include "CppUnit/TestCase.h" -#endif class XMLConfigurationTest: public CppUnit::TestCase diff --git a/VERSION b/VERSION index 8d0ec7b2e..f73629fd6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.1.2 (2006-07-11) +1.2.0 (2006-08-29) diff --git a/XML/Makefile b/XML/Makefile index f0245a364..8563f3b11 100644 --- a/XML/Makefile +++ b/XML/Makefile @@ -1,7 +1,7 @@ # # Makefile # -# $Id: //poco/1.1.0/XML/Makefile#1 $ +# $Id: //poco/1.2/XML/Makefile#1 $ # # Makefile for Poco XML # @@ -23,9 +23,9 @@ objects = AbstractContainerNode AbstractNode Attr AttrMap Attributes \ ParserEngine ProcessingInstruction SAXException SAXParser Text \ TreeWalker WhitespaceFilter XMLException XMLFilter XMLFilterImpl XMLReader \ XMLString XMLWriter xmlparse xmlrole xmltok - + target = PocoXML -target_version = 1 +target_version = $(LIBVERSION) target_libs = PocoFoundation include $(POCO_BASE)/build/rules/lib diff --git a/XML/XML.vmsbuild b/XML/XML.vmsbuild index 6ba1135e9..195436f4f 100644 --- a/XML/XML.vmsbuild +++ b/XML/XML.vmsbuild @@ -1,7 +1,7 @@ # # XML.vmsbuild # -# $Id: //poco/1.1.0/XML/XML.vmsbuild#1 $ +# $Id: //poco/1.2/XML/XML.vmsbuild#1 $ # DEF=HAVE_EXPAT_CONFIG_H,XML_NS,XML_DTD LIB=PocoXML diff --git a/XML/XML_vs71.vcproj b/XML/XML_vs71.vcproj index 083ba1ba5..101564cd7 100644 --- a/XML/XML_vs71.vcproj +++ b/XML/XML_vs71.vcproj @@ -147,31 +147,31 @@ Name="Header Files" Filter=""> + RelativePath=".\include\Poco\XML\Name.h"> + RelativePath=".\include\Poco\XML\NamePool.h"> + RelativePath=".\include\Poco\XML\NamespaceStrategy.h"> + RelativePath=".\include\Poco\XML\ParserEngine.h"> + RelativePath=".\include\Poco\XML\XML.h"> + RelativePath=".\include\Poco\XML\XMLException.h"> + RelativePath=".\include\Poco\XML\XMLStream.h"> + RelativePath=".\include\Poco\XML\XMLString.h"> + RelativePath=".\include\Poco\XML\XMLWriter.h"> + RelativePath=".\include\Poco\SAX\Attributes.h"> + RelativePath=".\include\Poco\SAX\AttributesImpl.h"> + RelativePath=".\include\Poco\SAX\ContentHandler.h"> + RelativePath=".\include\Poco\SAX\DeclHandler.h"> + RelativePath=".\include\Poco\SAX\DefaultHandler.h"> + RelativePath=".\include\Poco\SAX\DTDHandler.h"> + RelativePath=".\include\Poco\SAX\EntityResolver.h"> + RelativePath=".\include\Poco\SAX\EntityResolverImpl.h"> + RelativePath=".\include\Poco\SAX\ErrorHandler.h"> + RelativePath=".\include\Poco\SAX\InputSource.h"> + RelativePath=".\include\Poco\SAX\LexicalHandler.h"> + RelativePath=".\include\Poco\SAX\Locator.h"> + RelativePath=".\include\Poco\SAX\LocatorImpl.h"> + RelativePath=".\include\Poco\SAX\NamespaceSupport.h"> + RelativePath=".\include\Poco\SAX\SAXException.h"> + RelativePath=".\include\Poco\SAX\SAXParser.h"> + RelativePath=".\include\Poco\SAX\WhitespaceFilter.h"> + RelativePath=".\include\Poco\SAX\XMLFilter.h"> + RelativePath=".\include\Poco\SAX\XMLFilterImpl.h"> + RelativePath=".\include\Poco\SAX\XMLReader.h"> + RelativePath=".\include\Poco\DOM\AbstractContainerNode.h"> + RelativePath=".\include\Poco\DOM\AbstractNode.h"> + RelativePath=".\include\Poco\DOM\Attr.h"> + RelativePath=".\include\Poco\DOM\AttrMap.h"> + RelativePath=".\include\Poco\DOM\AutoPtr.h"> + RelativePath=".\include\Poco\DOM\CDATASection.h"> + RelativePath=".\include\Poco\DOM\CharacterData.h"> + RelativePath=".\include\Poco\DOM\ChildNodesList.h"> + RelativePath=".\include\Poco\DOM\Comment.h"> + RelativePath=".\include\Poco\DOM\Document.h"> + RelativePath=".\include\Poco\DOM\DocumentEvent.h"> + RelativePath=".\include\Poco\DOM\DocumentFragment.h"> + RelativePath=".\include\Poco\DOM\DocumentType.h"> + RelativePath=".\include\Poco\DOM\DOMBuilder.h"> + RelativePath=".\include\Poco\DOM\DOMException.h"> + RelativePath=".\include\Poco\DOM\DOMImplementation.h"> + RelativePath=".\include\Poco\DOM\DOMObject.h"> + RelativePath=".\include\Poco\DOM\DOMParser.h"> + RelativePath=".\include\Poco\DOM\DOMSerializer.h"> + RelativePath=".\include\Poco\DOM\DOMWriter.h"> + RelativePath=".\include\Poco\DOM\DTDMap.h"> + RelativePath=".\include\Poco\DOM\Element.h"> + RelativePath=".\include\Poco\DOM\ElementsByTagNameList.h"> + RelativePath=".\include\Poco\DOM\Entity.h"> + RelativePath=".\include\Poco\DOM\EntityReference.h"> + RelativePath=".\include\Poco\DOM\Event.h"> + RelativePath=".\include\Poco\DOM\EventDispatcher.h"> + RelativePath=".\include\Poco\DOM\EventException.h"> + RelativePath=".\include\Poco\DOM\EventListener.h"> + RelativePath=".\include\Poco\DOM\EventTarget.h"> + RelativePath=".\include\Poco\DOM\MutationEvent.h"> + RelativePath=".\include\Poco\DOM\NamedNodeMap.h"> + RelativePath=".\include\Poco\DOM\Node.h"> + RelativePath=".\include\Poco\DOM\NodeFilter.h"> + RelativePath=".\include\Poco\DOM\NodeIterator.h"> + RelativePath=".\include\Poco\DOM\NodeList.h"> + RelativePath=".\include\Poco\DOM\Notation.h"> + RelativePath=".\include\Poco\DOM\ProcessingInstruction.h"> + RelativePath=".\include\Poco\DOM\Text.h"> + RelativePath=".\include\Poco\DOM\TreeWalker.h"> + RelativePath=".\include\Poco\XML\expat.h"> + RelativePath=".\include\Poco\XML\expat_external.h"> @@ -286,83 +286,83 @@ Name="Header Files" > @@ -458,163 +458,163 @@ Name="Header Files" > @@ -786,11 +786,11 @@ Name="Header Files" > diff --git a/XML/include/DOM/AbstractContainerNode.h b/XML/include/Poco/DOM/AbstractContainerNode.h similarity index 89% rename from XML/include/DOM/AbstractContainerNode.h rename to XML/include/Poco/DOM/AbstractContainerNode.h index 3588a1148..f262e888e 100644 --- a/XML/include/DOM/AbstractContainerNode.h +++ b/XML/include/Poco/DOM/AbstractContainerNode.h @@ -1,7 +1,7 @@ // // AbstractContainerNode.h // -// $Id: //poco/1.1.0/XML/include/DOM/AbstractContainerNode.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/DOM/AbstractContainerNode.h#1 $ // // Library: XML // Package: DOM @@ -40,15 +40,12 @@ #define DOM_AbstractContainerNode_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef DOM_AbstractNode_INCLUDED -#include "DOM/AbstractNode.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/DOM/AbstractNode.h" -XML_BEGIN +namespace Poco { +namespace XML { class XML_API AbstractContainerNode: public AbstractNode @@ -83,7 +80,7 @@ private: }; -XML_END +} } // namespace Poco::XML #endif // DOM_AbstractContainerNode_INCLUDED diff --git a/XML/include/DOM/AbstractNode.h b/XML/include/Poco/DOM/AbstractNode.h similarity index 90% rename from XML/include/DOM/AbstractNode.h rename to XML/include/Poco/DOM/AbstractNode.h index 02e3eefa1..a94458125 100644 --- a/XML/include/DOM/AbstractNode.h +++ b/XML/include/Poco/DOM/AbstractNode.h @@ -1,7 +1,7 @@ // // AbstractNode.h // -// $Id: //poco/1.1.0/XML/include/DOM/AbstractNode.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/DOM/AbstractNode.h#1 $ // // Library: XML // Package: DOM @@ -40,21 +40,14 @@ #define DOM_AbstractNode_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef DOM_Node_INCLUDED -#include "DOM/Node.h" -#endif -#ifndef DOM_MutationEvent_INCLUDED -#include "DOM/MutationEvent.h" -#endif -#ifndef XML_XMLString_INCLUDED -#include "XML/XMLString.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/DOM/Node.h" +#include "Poco/DOM/MutationEvent.h" +#include "Poco/XML/XMLString.h" -XML_BEGIN +namespace Poco { +namespace XML { class AbstractContainerNode; @@ -145,7 +138,7 @@ private: }; -XML_END +} } // namespace Poco::XML #endif // DOM_AbstractNode_INCLUDED diff --git a/XML/include/DOM/Attr.h b/XML/include/Poco/DOM/Attr.h similarity index 93% rename from XML/include/DOM/Attr.h rename to XML/include/Poco/DOM/Attr.h index febbcd9c2..b5384be9b 100644 --- a/XML/include/DOM/Attr.h +++ b/XML/include/Poco/DOM/Attr.h @@ -1,7 +1,7 @@ // // Attr.h // -// $Id: //poco/1.1.0/XML/include/DOM/Attr.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/DOM/Attr.h#1 $ // // Library: XML // Package: DOM @@ -40,21 +40,14 @@ #define DOM_Attr_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef DOM_AbstractNode_INCLUDED -#include "DOM/AbstractNode.h" -#endif -#ifndef DOM_Element_INCLUDED -#include "DOM/Element.h" -#endif -#ifndef XML_Name_INCLUDED -#include "XML/Name.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/DOM/AbstractNode.h" +#include "Poco/DOM/Element.h" +#include "Poco/XML/Name.h" -XML_BEGIN +namespace Poco { +namespace XML { class XML_API Attr: public AbstractNode @@ -149,6 +142,9 @@ public: XMLString prefix() const; const XMLString& localName() const; + // Non-standard extensions + XMLString innerText() const; + protected: Attr(Document* pOwnerDocument, Element* pOwnerElement, const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname, const XMLString& value, bool specified = true); Attr(Document* pOwnerDocument, const Attr& attr); @@ -200,7 +196,7 @@ inline Element* Attr::ownerElement() const } -XML_END +} } // namespace Poco::XML #endif // DOM_Attr_INCLUDED diff --git a/XML/include/DOM/AttrMap.h b/XML/include/Poco/DOM/AttrMap.h similarity index 89% rename from XML/include/DOM/AttrMap.h rename to XML/include/Poco/DOM/AttrMap.h index 697e599ee..2c671f3f3 100644 --- a/XML/include/DOM/AttrMap.h +++ b/XML/include/Poco/DOM/AttrMap.h @@ -1,7 +1,7 @@ // // AttrMap.h // -// $Id: //poco/1.1.0/XML/include/DOM/AttrMap.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/DOM/AttrMap.h#1 $ // // Library: XML // Package: DOM @@ -40,15 +40,12 @@ #define DOM_AttrMap_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef DOM_NamedNodeMap_INCLUDED -#include "DOM/NamedNodeMap.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/DOM/NamedNodeMap.h" -XML_BEGIN +namespace Poco { +namespace XML { class Element; @@ -84,7 +81,7 @@ private: }; -XML_END +} } // namespace Poco::XML #endif // DOM_AttrMap_INCLUDED diff --git a/XML/include/DOM/AutoPtr.h b/XML/include/Poco/DOM/AutoPtr.h similarity index 82% rename from XML/include/DOM/AutoPtr.h rename to XML/include/Poco/DOM/AutoPtr.h index 6554e6876..999e7106e 100644 --- a/XML/include/DOM/AutoPtr.h +++ b/XML/include/Poco/DOM/AutoPtr.h @@ -1,13 +1,13 @@ // // AutoPtr.h // -// $Id: //poco/1.1.0/XML/include/DOM/AutoPtr.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/DOM/AutoPtr.h#1 $ // // Library: XML // Package: DOM // Module: DOM // -// Import Foundation::AutoPtr into the XML namespace. +// Import Poco::AutoPtr into the XML namespace. // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -40,21 +40,18 @@ #define DOM_DOMAutoPtr_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef Foundation_AutoPtr_INCLUDED -#include "Foundation/AutoPtr.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/AutoPtr.h" -XML_BEGIN +namespace Poco { +namespace XML { -using Foundation::AutoPtr; +using Poco::AutoPtr; -XML_END +} } // namespace Poco::XML #endif // DOM_DOMAutoPtr_INCLUDED diff --git a/XML/include/DOM/CDATASection.h b/XML/include/Poco/DOM/CDATASection.h similarity index 93% rename from XML/include/DOM/CDATASection.h rename to XML/include/Poco/DOM/CDATASection.h index be1d3b5d1..9b29b76d1 100644 --- a/XML/include/DOM/CDATASection.h +++ b/XML/include/Poco/DOM/CDATASection.h @@ -1,7 +1,7 @@ // // CDATASection.h // -// $Id: //poco/1.1.0/XML/include/DOM/CDATASection.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/DOM/CDATASection.h#1 $ // // Library: XML // Package: DOM @@ -40,15 +40,12 @@ #define DOM_CDATASection_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef DOM_Text_INCLUDED -#include "DOM/Text.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/DOM/Text.h" -XML_BEGIN +namespace Poco { +namespace XML { class XML_API CDATASection: public Text @@ -103,7 +100,7 @@ private: }; -XML_END +} } // namespace Poco::XML #endif // DOM_CDATASection_INCLUDED diff --git a/XML/include/DOM/CharacterData.h b/XML/include/Poco/DOM/CharacterData.h similarity index 91% rename from XML/include/DOM/CharacterData.h rename to XML/include/Poco/DOM/CharacterData.h index 0d534c192..fdff2995a 100644 --- a/XML/include/DOM/CharacterData.h +++ b/XML/include/Poco/DOM/CharacterData.h @@ -1,7 +1,7 @@ // // CharacterData.h // -// $Id: //poco/1.1.0/XML/include/DOM/CharacterData.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/DOM/CharacterData.h#1 $ // // Library: XML // Package: DOM @@ -40,18 +40,13 @@ #define DOM_CharacterData_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef DOM_AbstractNode_INCLUDED -#include "DOM/AbstractNode.h" -#endif -#ifndef XML_XMLString_INCLUDED -#include "XML/XMLString.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/DOM/AbstractNode.h" +#include "Poco/XML/XMLString.h" -XML_BEGIN +namespace Poco { +namespace XML { class XML_API CharacterData: public AbstractNode @@ -144,7 +139,7 @@ inline unsigned long CharacterData::length() const } -XML_END +} } // namespace Poco::XML #endif // DOM_CharacterData_INCLUDED diff --git a/XML/include/DOM/ChildNodesList.h b/XML/include/Poco/DOM/ChildNodesList.h similarity index 88% rename from XML/include/DOM/ChildNodesList.h rename to XML/include/Poco/DOM/ChildNodesList.h index 26df0d55e..ea5c30d93 100644 --- a/XML/include/DOM/ChildNodesList.h +++ b/XML/include/Poco/DOM/ChildNodesList.h @@ -1,7 +1,7 @@ // // ChildNodesList.h // -// $Id: //poco/1.1.0/XML/include/DOM/ChildNodesList.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/DOM/ChildNodesList.h#1 $ // // Library: XML // Package: DOM @@ -40,15 +40,12 @@ #define DOM_ChildNodesList_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef DOM_NodeList_INCLUDED -#include "DOM/NodeList.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/DOM/NodeList.h" -XML_BEGIN +namespace Poco { +namespace XML { class XML_API ChildNodesList: public NodeList @@ -74,7 +71,7 @@ private: }; -XML_END +} } // namespace Poco::XML #endif // DOM_ChildNodesList_INCLUDED diff --git a/XML/include/DOM/Comment.h b/XML/include/Poco/DOM/Comment.h similarity index 87% rename from XML/include/DOM/Comment.h rename to XML/include/Poco/DOM/Comment.h index 662be67b2..869574f7e 100644 --- a/XML/include/DOM/Comment.h +++ b/XML/include/Poco/DOM/Comment.h @@ -1,7 +1,7 @@ // // Comment.h // -// $Id: //poco/1.1.0/XML/include/DOM/Comment.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/DOM/Comment.h#1 $ // // Library: XML // Package: DOM @@ -40,18 +40,13 @@ #define DOM_Comment_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef DOM_CharacterData_INCLUDED -#include "DOM/CharacterData.h" -#endif -#ifndef XML_XMLString_INCLUDED -#include "XML/XMLString.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/DOM/CharacterData.h" +#include "Poco/XML/XMLString.h" -XML_BEGIN +namespace Poco { +namespace XML { class XML_API Comment: public CharacterData @@ -79,7 +74,7 @@ private: }; -XML_END +} } // namespace Poco::XML #endif // DOM_Comment_INCLUDED diff --git a/XML/include/DOM/DOMBuilder.h b/XML/include/Poco/DOM/DOMBuilder.h similarity index 88% rename from XML/include/DOM/DOMBuilder.h rename to XML/include/Poco/DOM/DOMBuilder.h index 457421f54..3a14a2745 100644 --- a/XML/include/DOM/DOMBuilder.h +++ b/XML/include/Poco/DOM/DOMBuilder.h @@ -1,7 +1,7 @@ // // DOMBuilder.h // -// $Id: //poco/1.1.0/XML/include/DOM/DOMBuilder.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/DOM/DOMBuilder.h#1 $ // // Library: XML // Package: DOM @@ -40,24 +40,15 @@ #define DOM_DOMBuilder_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef SAX_ContentHandler_INCLUDED -#include "SAX/ContentHandler.h" -#endif -#ifndef SAX_LexicalHandler_INCLUDED -#include "SAX/LexicalHandler.h" -#endif -#ifndef SAX_DTDHandler_INCLUDED -#include "SAX/DTDHandler.h" -#endif -#ifndef XML_XMLString_INCLUDED -#include "XML/XMLString.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/SAX/ContentHandler.h" +#include "Poco/SAX/LexicalHandler.h" +#include "Poco/SAX/DTDHandler.h" +#include "Poco/XML/XMLString.h" -XML_BEGIN +namespace Poco { +namespace XML { class XMLReader; @@ -134,7 +125,7 @@ private: }; -XML_END +} } // namespace Poco::XML #endif // DOM_DOMBuilder_INCLUDED diff --git a/XML/include/DOM/DOMException.h b/XML/include/Poco/DOM/DOMException.h similarity index 91% rename from XML/include/DOM/DOMException.h rename to XML/include/Poco/DOM/DOMException.h index 64dd4d731..4422adc5e 100644 --- a/XML/include/DOM/DOMException.h +++ b/XML/include/Poco/DOM/DOMException.h @@ -1,7 +1,7 @@ // // DOMException.h // -// $Id: //poco/1.1.0/XML/include/DOM/DOMException.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/DOM/DOMException.h#1 $ // // Library: XML // Package: DOM @@ -40,15 +40,12 @@ #define DOM_DOMException_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef XML_XMLException_INCLUDED -#include "XML/XMLException.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLException.h" -XML_BEGIN +namespace Poco { +namespace XML { class XML_API DOMException: public XMLException @@ -101,11 +98,16 @@ public: const char* className() const throw(); /// Returns the name of the exception class. + Poco::Exception* clone() const; + /// Creates an exact copy of the exception. + + void rethrow() const; + /// (Re)Throws the exception. + unsigned short code() const; /// Returns the DOM exception code. protected: - Foundation::Exception* clone() const; static const std::string& message(unsigned short code); private: @@ -126,7 +128,7 @@ inline unsigned short DOMException::code() const } -XML_END +} } // namespace Poco::XML #endif // DOM_DOMException_INCLUDED diff --git a/XML/include/DOM/DOMImplementation.h b/XML/include/Poco/DOM/DOMImplementation.h similarity index 91% rename from XML/include/DOM/DOMImplementation.h rename to XML/include/Poco/DOM/DOMImplementation.h index c7e699ccb..d4d60fe1c 100644 --- a/XML/include/DOM/DOMImplementation.h +++ b/XML/include/Poco/DOM/DOMImplementation.h @@ -1,7 +1,7 @@ // // DOMImplementation.h // -// $Id: //poco/1.1.0/XML/include/DOM/DOMImplementation.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/DOM/DOMImplementation.h#1 $ // // Library: XML // Package: DOM @@ -40,15 +40,12 @@ #define DOM_DOMImplementation_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef XML_XMLString_INCLUDED -#include "XML/XMLString.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" -XML_BEGIN +namespace Poco { +namespace XML { class DocumentType; @@ -99,7 +96,7 @@ private: }; -XML_END +} } // namespace Poco::XML #endif // DOM_DOMImplementation_INCLUDED diff --git a/XML/include/DOM/DOMObject.h b/XML/include/Poco/DOM/DOMObject.h similarity index 92% rename from XML/include/DOM/DOMObject.h rename to XML/include/Poco/DOM/DOMObject.h index 3c2c3d46b..6809a559f 100644 --- a/XML/include/DOM/DOMObject.h +++ b/XML/include/Poco/DOM/DOMObject.h @@ -1,7 +1,7 @@ // // DOMObject.h // -// $Id: //poco/1.1.0/XML/include/DOM/DOMObject.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/DOM/DOMObject.h#1 $ // // Library: XML // Package: DOM @@ -40,12 +40,11 @@ #define DOM_DOMObject_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif +#include "Poco/XML/XML.h" -XML_BEGIN +namespace Poco { +namespace XML { class XML_API DOMObject @@ -120,7 +119,7 @@ inline void DOMObject::release() const } -XML_END +} } // namespace Poco::XML #endif // DOM_DOMObject_INCLUDED diff --git a/XML/include/DOM/DOMParser.h b/XML/include/Poco/DOM/DOMParser.h similarity index 90% rename from XML/include/DOM/DOMParser.h rename to XML/include/Poco/DOM/DOMParser.h index f6bb768a6..f09a70124 100644 --- a/XML/include/DOM/DOMParser.h +++ b/XML/include/Poco/DOM/DOMParser.h @@ -1,7 +1,7 @@ // // DOMParser.h // -// $Id: //poco/1.1.0/XML/include/DOM/DOMParser.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/DOM/DOMParser.h#1 $ // // Library: XML // Package: DOM @@ -40,15 +40,12 @@ #define DOM_DOMParser_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef SAX_SAXParser_INCLUDED -#include "SAX/SAXParser.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/SAX/SAXParser.h" -XML_BEGIN +namespace Poco { +namespace XML { class NamePool; @@ -79,7 +76,7 @@ public: /// the parser if no encoding is specified in /// the XML document. - void addEncoding(const XMLString& name, Foundation::TextEncoding* pEncoding); + void addEncoding(const XMLString& name, Poco::TextEncoding* pEncoding); /// Adds an encoding to the parser. void setFeature(const XMLString& name, bool state); @@ -123,7 +120,7 @@ private: }; -XML_END +} } // namespace Poco::XML #endif // DOM_DOMParser_INCLUDED diff --git a/XML/include/DOM/DOMSerializer.h b/XML/include/Poco/DOM/DOMSerializer.h similarity index 92% rename from XML/include/DOM/DOMSerializer.h rename to XML/include/Poco/DOM/DOMSerializer.h index 3a14d9a05..589bddb2c 100644 --- a/XML/include/DOM/DOMSerializer.h +++ b/XML/include/Poco/DOM/DOMSerializer.h @@ -1,7 +1,7 @@ // // DOMSerializer.h // -// $Id: //poco/1.1.0/XML/include/DOM/DOMSerializer.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/DOM/DOMSerializer.h#1 $ // // Library: XML // Package: DOM @@ -38,15 +38,12 @@ #define DOM_DOMSerializer_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef SAX_XMLReader_INCLUDED -#include "SAX/XMLReader.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/SAX/XMLReader.h" -XML_BEGIN +namespace Poco { +namespace XML { class Node; @@ -137,7 +134,7 @@ private: }; -XML_END +} } // namespace Poco::XML #endif // DOM_DOMSerializer_INCLUDED diff --git a/XML/include/DOM/DOMWriter.h b/XML/include/Poco/DOM/DOMWriter.h similarity index 81% rename from XML/include/DOM/DOMWriter.h rename to XML/include/Poco/DOM/DOMWriter.h index ab0346ef2..ac2fcbda8 100644 --- a/XML/include/DOM/DOMWriter.h +++ b/XML/include/Poco/DOM/DOMWriter.h @@ -1,7 +1,7 @@ // // DOMWriter.h // -// $Id: //poco/1.1.0/XML/include/DOM/DOMWriter.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/DOM/DOMWriter.h#1 $ // // Library: XML // Package: DOM @@ -40,21 +40,14 @@ #define DOM_DOMWriter_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef XML_XMLString_INCLUDED -#include "XML/XMLString.h" -#endif -#ifndef XML_XMLStream_INCLUDED -#include "XML/XMLStream.h" -#endif -#ifndef Foundation_TextEncoding_INCLUDED -#include "Foundation/TextEncoding.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" +#include "Poco/XML/XMLStream.h" +#include "Poco/TextEncoding.h" -XML_BEGIN +namespace Poco { +namespace XML { class Node; @@ -73,7 +66,7 @@ public: ~DOMWriter(); /// Destroys a DOMWriter. - void setEncoding(const std::string& encodingName, Foundation::TextEncoding& textEncoding); + void setEncoding(const std::string& encodingName, Poco::TextEncoding& textEncoding); /// Sets the encoding, which will be reflected in the written XML declaration. const XMLString& getEncoding() const; @@ -104,10 +97,10 @@ public: /// using a standard file output stream (std::ofstream). private: - XMLString _encodingName; - Foundation::TextEncoding* _pTextEncoding; - int _options; - std::string _newLine; + XMLString _encodingName; + Poco::TextEncoding* _pTextEncoding; + int _options; + std::string _newLine; }; @@ -132,7 +125,7 @@ inline const std::string& DOMWriter::getNewLine() const } -XML_END +} } // namespace Poco::XML #endif // DOM_DOMWriter_INCLUDED diff --git a/XML/include/DOM/DTDMap.h b/XML/include/Poco/DOM/DTDMap.h similarity index 89% rename from XML/include/DOM/DTDMap.h rename to XML/include/Poco/DOM/DTDMap.h index 1d51c4ce3..56a23da1d 100644 --- a/XML/include/DOM/DTDMap.h +++ b/XML/include/Poco/DOM/DTDMap.h @@ -1,7 +1,7 @@ // // DTDMap.h // -// $Id: //poco/1.1.0/XML/include/DOM/DTDMap.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/DOM/DTDMap.h#1 $ // // Library: XML // Package: DOM @@ -40,15 +40,12 @@ #define DOM_DTDMap_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef DOM_NamedNodeMap_INCLUDED -#include "DOM/NamedNodeMap.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/DOM/NamedNodeMap.h" -XML_BEGIN +namespace Poco { +namespace XML { class DocumentType; @@ -86,7 +83,7 @@ private: }; -XML_END +} } // namespace Poco::XML #endif // DOM_DTDMap_INCLUDED diff --git a/XML/include/DOM/Document.h b/XML/include/Poco/DOM/Document.h similarity index 92% rename from XML/include/DOM/Document.h rename to XML/include/Poco/DOM/Document.h index 886131905..8bd081f74 100644 --- a/XML/include/DOM/Document.h +++ b/XML/include/Poco/DOM/Document.h @@ -1,7 +1,7 @@ // // Document.h // -// $Id: //poco/1.1.0/XML/include/DOM/Document.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/DOM/Document.h#1 $ // // Library: XML // Package: DOM @@ -40,27 +40,16 @@ #define DOM_Document_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef DOM_AbstractContainerNode_INCLUDED -#include "DOM/AbstractContainerNode.h" -#endif -#ifndef DOM_DocumentEvent_INCLUDED -#include "DOM/DocumentEvent.h" -#endif -#ifndef XML_XMLString_INCLUDED -#include "XML/XMLString.h" -#endif -#ifndef XML_NamePool_INCLUDED -#include "XML/NamePool.h" -#endif -#ifndef Foundation_AutoReleasePool_INCLUDED -#include "Foundation/AutoReleasePool.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/DOM/AbstractContainerNode.h" +#include "Poco/DOM/DocumentEvent.h" +#include "Poco/XML/XMLString.h" +#include "Poco/XML/NamePool.h" +#include "Poco/AutoReleasePool.h" -XML_BEGIN +namespace Poco { +namespace XML { class NamePool; @@ -91,7 +80,7 @@ class XML_API Document: public AbstractContainerNode, public DocumentEvent /// context they were created. { public: - typedef Foundation::AutoReleasePool AutoReleasePool; + typedef Poco::AutoReleasePool AutoReleasePool; Document(NamePool* pNamePool = 0); /// Creates a new document. If pNamePool == 0, the document @@ -289,7 +278,7 @@ inline DocumentType* Document::getDoctype() } -XML_END +} } // namespace Poco::XML #endif // DOM_Document_INCLUDED diff --git a/XML/include/DOM/DocumentEvent.h b/XML/include/Poco/DOM/DocumentEvent.h similarity index 92% rename from XML/include/DOM/DocumentEvent.h rename to XML/include/Poco/DOM/DocumentEvent.h index 12def4d4f..bc69916c9 100644 --- a/XML/include/DOM/DocumentEvent.h +++ b/XML/include/Poco/DOM/DocumentEvent.h @@ -1,7 +1,7 @@ // // DocumentEvent.h // -// $Id: //poco/1.1.0/XML/include/DOM/DocumentEvent.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/DOM/DocumentEvent.h#1 $ // // Library: XML // Package: DOM @@ -40,15 +40,12 @@ #define DOM_DocumentEvent_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef XML_XMLString_INCLUDED -#include "XML/XMLString.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" -XML_BEGIN +namespace Poco { +namespace XML { class Event; @@ -84,7 +81,7 @@ protected: }; -XML_END +} } // namespace Poco::XML #endif // DOM_DocumentEvent_INCLUDED diff --git a/XML/include/DOM/DocumentFragment.h b/XML/include/Poco/DOM/DocumentFragment.h similarity index 91% rename from XML/include/DOM/DocumentFragment.h rename to XML/include/Poco/DOM/DocumentFragment.h index c07736982..d1959c637 100644 --- a/XML/include/DOM/DocumentFragment.h +++ b/XML/include/Poco/DOM/DocumentFragment.h @@ -1,7 +1,7 @@ // // DocumentFragment.h // -// $Id: //poco/1.1.0/XML/include/DOM/DocumentFragment.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/DOM/DocumentFragment.h#1 $ // // Library: XML // Package: DOM @@ -40,18 +40,13 @@ #define DOM_DocumentFragment_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef DOM_AbstractContainerNode_INCLUDED -#include "DOM/AbstractContainerNode.h" -#endif -#ifndef XML_XMLString_INCLUDED -#include "XML/XMLString.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/DOM/AbstractContainerNode.h" +#include "Poco/XML/XMLString.h" -XML_BEGIN +namespace Poco { +namespace XML { class XML_API DocumentFragment: public AbstractContainerNode @@ -105,7 +100,7 @@ private: }; -XML_END +} } // namespace Poco::XML #endif // DOM_DocumentFragment_INCLUDED diff --git a/XML/include/DOM/DocumentType.h b/XML/include/Poco/DOM/DocumentType.h similarity index 92% rename from XML/include/DOM/DocumentType.h rename to XML/include/Poco/DOM/DocumentType.h index 08343d4df..615b327ed 100644 --- a/XML/include/DOM/DocumentType.h +++ b/XML/include/Poco/DOM/DocumentType.h @@ -1,7 +1,7 @@ // // DocumentType.h // -// $Id: //poco/1.1.0/XML/include/DOM/DocumentType.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/DOM/DocumentType.h#1 $ // // Library: XML // Package: DOM @@ -40,15 +40,12 @@ #define DOM_DocumentType_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef DOM_AbstractContainerNode_INCLUDED -#include "DOM/AbstractContainerNode.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/DOM/AbstractContainerNode.h" -XML_BEGIN +namespace Poco { +namespace XML { class NamedNodeMap; @@ -144,7 +141,7 @@ inline const XMLString& DocumentType::systemId() const } -XML_END +} } // namespace Poco::XML #endif // DOM_DocumentType_INCLUDED diff --git a/XML/include/DOM/Element.h b/XML/include/Poco/DOM/Element.h similarity index 94% rename from XML/include/DOM/Element.h rename to XML/include/Poco/DOM/Element.h index 10e278cb4..08ade05f9 100644 --- a/XML/include/DOM/Element.h +++ b/XML/include/Poco/DOM/Element.h @@ -1,7 +1,7 @@ // // Element.h // -// $Id: //poco/1.1.0/XML/include/DOM/Element.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/DOM/Element.h#1 $ // // Library: XML // Package: DOM @@ -40,18 +40,13 @@ #define DOM_Element_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef DOM_AbstractContainerNode_INCLUDED -#include "DOM/AbstractContainerNode.h" -#endif -#ifndef XML_Name_INCLUDED -#include "XML/Name.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/DOM/AbstractContainerNode.h" +#include "Poco/XML/Name.h" -XML_BEGIN +namespace Poco { +namespace XML { class Attr; @@ -169,6 +164,8 @@ public: bool hasAttributes() const; // Non-standard extensions + XMLString innerText() const; + Element* getChildElement(const XMLString& name) const; /// Returns the first child element with the given name, or null /// if such an element does not exist. @@ -215,7 +212,7 @@ inline const XMLString& Element::tagName() const } -XML_END +} } // namespace Poco::XML #endif // DOM_Element_INCLUDED diff --git a/XML/include/DOM/ElementsByTagNameList.h b/XML/include/Poco/DOM/ElementsByTagNameList.h similarity index 88% rename from XML/include/DOM/ElementsByTagNameList.h rename to XML/include/Poco/DOM/ElementsByTagNameList.h index 25dc2e67f..d3183a677 100644 --- a/XML/include/DOM/ElementsByTagNameList.h +++ b/XML/include/Poco/DOM/ElementsByTagNameList.h @@ -1,7 +1,7 @@ // // ElementsByTagNameList.h // -// $Id: //poco/1.1.0/XML/include/DOM/ElementsByTagNameList.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/DOM/ElementsByTagNameList.h#1 $ // // Library: XML // Package: DOM @@ -40,18 +40,13 @@ #define DOM_ElementsByTagNameList_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef DOM_NodeList_INCLUDED -#include "DOM/NodeList.h" -#endif -#ifndef XML_XMLString_INCLUDED -#include "XML/XMLString.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/DOM/NodeList.h" +#include "Poco/XML/XMLString.h" -XML_BEGIN +namespace Poco { +namespace XML { class XML_API ElementsByTagNameList: public NodeList @@ -105,7 +100,7 @@ protected: }; -XML_END +} } // namespace Poco::XML #endif // DOM_ElementsByTagNameList_INCLUDED diff --git a/XML/include/DOM/Entity.h b/XML/include/Poco/DOM/Entity.h similarity index 91% rename from XML/include/DOM/Entity.h rename to XML/include/Poco/DOM/Entity.h index 644b214b6..16be440c7 100644 --- a/XML/include/DOM/Entity.h +++ b/XML/include/Poco/DOM/Entity.h @@ -1,7 +1,7 @@ // // Entity.h // -// $Id: //poco/1.1.0/XML/include/DOM/Entity.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/DOM/Entity.h#1 $ // // Library: XML // Package: DOM @@ -40,18 +40,13 @@ #define DOM_Entity_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef DOM_AbstractContainerNode_INCLUDED -#include "DOM/AbstractContainerNode.h" -#endif -#ifndef XML_XMLString_INCLUDED -#include "XML/XMLString.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/DOM/AbstractContainerNode.h" +#include "Poco/XML/XMLString.h" -XML_BEGIN +namespace Poco { +namespace XML { class XML_API Entity: public AbstractContainerNode @@ -147,7 +142,7 @@ inline const XMLString& Entity::notationName() const } -XML_END +} } // namespace Poco::XML #endif // DOM_Entity_INCLUDED diff --git a/XML/include/DOM/EntityReference.h b/XML/include/Poco/DOM/EntityReference.h similarity index 90% rename from XML/include/DOM/EntityReference.h rename to XML/include/Poco/DOM/EntityReference.h index 92e4c4442..230cda3ad 100644 --- a/XML/include/DOM/EntityReference.h +++ b/XML/include/Poco/DOM/EntityReference.h @@ -1,7 +1,7 @@ // // EntityReference.h // -// $Id: //poco/1.1.0/XML/include/DOM/EntityReference.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/DOM/EntityReference.h#1 $ // // Library: XML // Package: DOM @@ -40,18 +40,13 @@ #define DOM_EntityReference_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef DOM_AbstractNode_INCLUDED -#include "DOM/AbstractNode.h" -#endif -#ifndef XML_XMLString_INCLUDED -#include "XML/XMLString.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/DOM/AbstractNode.h" +#include "Poco/XML/XMLString.h" -XML_BEGIN +namespace Poco { +namespace XML { class XML_API EntityReference: public AbstractNode @@ -94,7 +89,7 @@ private: }; -XML_END +} } // namespace Poco::XML #endif // DOM_EntityReference_INCLUDED diff --git a/XML/include/DOM/Event.h b/XML/include/Poco/DOM/Event.h similarity index 92% rename from XML/include/DOM/Event.h rename to XML/include/Poco/DOM/Event.h index 8e0928a84..8fa2191e3 100644 --- a/XML/include/DOM/Event.h +++ b/XML/include/Poco/DOM/Event.h @@ -1,7 +1,7 @@ // // Event.h // -// $Id: //poco/1.1.0/XML/include/DOM/Event.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/DOM/Event.h#1 $ // // Library: XML // Package: DOM @@ -40,18 +40,13 @@ #define DOM_Event_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef XML_XMLString_INCLUDED -#include "XML/XMLString.h" -#endif -#ifndef DOM_DOMObject_INCLUDED -#include "DOM/DOMObject.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" +#include "Poco/DOM/DOMObject.h" -XML_BEGIN +namespace Poco { +namespace XML { class EventTarget; @@ -97,7 +92,7 @@ public: /// prevented. If the default action can be prevented the value is /// true, else the value is false. - Foundation::UInt64 timeStamp() const; + Poco::UInt64 timeStamp() const; /// Used to specify the time (in milliseconds relative to the epoch) at /// which the event was created. Due to the fact that some /// systems may not provide this information the value of timeStamp may @@ -212,7 +207,7 @@ inline bool Event::cancelable() const } -inline Foundation::UInt64 Event::timeStamp() const +inline Poco::UInt64 Event::timeStamp() const { return 0; } @@ -230,7 +225,7 @@ inline bool Event::isStopped() const } -XML_END +} } // namespace Poco::XML #endif // DOM_Event_INCLUDED diff --git a/XML/include/DOM/EventDispatcher.h b/XML/include/Poco/DOM/EventDispatcher.h similarity index 90% rename from XML/include/DOM/EventDispatcher.h rename to XML/include/Poco/DOM/EventDispatcher.h index c130a37b9..fc75dc57d 100644 --- a/XML/include/DOM/EventDispatcher.h +++ b/XML/include/Poco/DOM/EventDispatcher.h @@ -1,7 +1,7 @@ // // EventDispatcher.h // -// $Id: //poco/1.1.0/XML/include/DOM/EventDispatcher.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/DOM/EventDispatcher.h#1 $ // // Library: XML // Package: DOM @@ -40,19 +40,13 @@ #define DOM_EventDispatcher_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef XML_XMLString_INCLUDED -#include "XML/XMLString.h" -#endif -#ifndef STD_LIST_INCLUDED +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" #include -#define STD_LIST_INCLUDED -#endif -XML_BEGIN +namespace Poco { +namespace XML { class Event; @@ -119,7 +113,7 @@ private: }; -XML_END +} } // namespace Poco::XML #endif // DOM_EventDispatcher_INCLUDED diff --git a/XML/include/DOM/EventException.h b/XML/include/Poco/DOM/EventException.h similarity index 89% rename from XML/include/DOM/EventException.h rename to XML/include/Poco/DOM/EventException.h index 26adcc4de..935a5d586 100644 --- a/XML/include/DOM/EventException.h +++ b/XML/include/Poco/DOM/EventException.h @@ -1,7 +1,7 @@ // // EventException.h // -// $Id: //poco/1.1.0/XML/include/DOM/EventException.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/DOM/EventException.h#1 $ // // Library: XML // Package: DOM @@ -40,15 +40,12 @@ #define DOM_EventException_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef XML_XMLException_INCLUDED -#include "XML/XMLException.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLException.h" -XML_BEGIN +namespace Poco { +namespace XML { class XML_API EventException: public XMLException @@ -84,7 +81,7 @@ public: /// Returns the Event exception code. protected: - Foundation::Exception* clone() const; + Poco::Exception* clone() const; private: EventException(); @@ -100,7 +97,7 @@ inline unsigned short EventException::code() const } -XML_END +} } // namespace Poco::XML #endif // DOM_EventException_INCLUDED diff --git a/XML/include/DOM/EventListener.h b/XML/include/Poco/DOM/EventListener.h similarity index 90% rename from XML/include/DOM/EventListener.h rename to XML/include/Poco/DOM/EventListener.h index b3250409a..25987fd0f 100644 --- a/XML/include/DOM/EventListener.h +++ b/XML/include/Poco/DOM/EventListener.h @@ -1,7 +1,7 @@ // // EventListener.h // -// $Id: //poco/1.1.0/XML/include/DOM/EventListener.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/DOM/EventListener.h#1 $ // // Library: XML // Package: DOM @@ -40,15 +40,12 @@ #define DOM_EventListener_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef XML_XMLString_INCLUDED -#include "XML/XMLString.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" -XML_BEGIN +namespace Poco { +namespace XML { class Event; @@ -76,7 +73,7 @@ protected: }; -XML_END +} } // namespace Poco::XML #endif // DOM_EventListener_INCLUDED diff --git a/XML/include/DOM/EventTarget.h b/XML/include/Poco/DOM/EventTarget.h similarity index 91% rename from XML/include/DOM/EventTarget.h rename to XML/include/Poco/DOM/EventTarget.h index fcdf8f0ec..e76fa9094 100644 --- a/XML/include/DOM/EventTarget.h +++ b/XML/include/Poco/DOM/EventTarget.h @@ -1,7 +1,7 @@ // // EventTarget.h // -// $Id: //poco/1.1.0/XML/include/DOM/EventTarget.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/DOM/EventTarget.h#1 $ // // Library: XML // Package: DOM @@ -40,18 +40,13 @@ #define DOM_EventTarget_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef DOM_DOMObject_INCLUDED -#include "DOM/DOMObject.h" -#endif -#ifndef XML_XMLString_INCLUDED -#include "XML/XMLString.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/DOM/DOMObject.h" +#include "Poco/XML/XMLString.h" -XML_BEGIN +namespace Poco { +namespace XML { class EventListener; @@ -97,7 +92,7 @@ protected: }; -XML_END +} } // namespace Poco::XML #endif // DOM_EventTarget_INCLUDED diff --git a/XML/include/DOM/MutationEvent.h b/XML/include/Poco/DOM/MutationEvent.h similarity index 93% rename from XML/include/DOM/MutationEvent.h rename to XML/include/Poco/DOM/MutationEvent.h index 83413f788..d1af7fd3f 100644 --- a/XML/include/DOM/MutationEvent.h +++ b/XML/include/Poco/DOM/MutationEvent.h @@ -1,7 +1,7 @@ // // MutationEvent.h // -// $Id: //poco/1.1.0/XML/include/DOM/MutationEvent.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/DOM/MutationEvent.h#1 $ // // Library: XML // Package: DOM @@ -40,15 +40,12 @@ #define DOM_MutationEvent_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef DOM_Event_INCLUDED -#include "DOM/Event.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/DOM/Event.h" -XML_BEGIN +namespace Poco { +namespace XML { class Node; @@ -162,7 +159,7 @@ inline MutationEvent::AttrChangeType MutationEvent::attrChange() const } -XML_END +} } // namespace Poco::XML #endif // DOM_MutationEvent_INCLUDED diff --git a/XML/include/DOM/NamedNodeMap.h b/XML/include/Poco/DOM/NamedNodeMap.h similarity index 91% rename from XML/include/DOM/NamedNodeMap.h rename to XML/include/Poco/DOM/NamedNodeMap.h index 3b85dbb60..79de6b7fb 100644 --- a/XML/include/DOM/NamedNodeMap.h +++ b/XML/include/Poco/DOM/NamedNodeMap.h @@ -1,7 +1,7 @@ // // NamedNodeMap.h // -// $Id: //poco/1.1.0/XML/include/DOM/NamedNodeMap.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/DOM/NamedNodeMap.h#1 $ // // Library: XML // Package: DOM @@ -40,18 +40,13 @@ #define DOM_NamedNodeMap_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef DOM_DOMObject_INCLUDED -#include "DOM/DOMObject.h" -#endif -#ifndef XML_XMLString_INCLUDED -#include "XML/XMLString.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/DOM/DOMObject.h" +#include "Poco/XML/XMLString.h" -XML_BEGIN +namespace Poco { +namespace XML { class Node; @@ -114,7 +109,7 @@ protected: }; -XML_END +} } // namespace Poco::XML #endif // DOM_NamedNodeMap_INCLUDED diff --git a/XML/include/DOM/Node.h b/XML/include/Poco/DOM/Node.h similarity index 95% rename from XML/include/DOM/Node.h rename to XML/include/Poco/DOM/Node.h index e2f3372cc..544352919 100644 --- a/XML/include/DOM/Node.h +++ b/XML/include/Poco/DOM/Node.h @@ -1,7 +1,7 @@ // // Node.h // -// $Id: //poco/1.1.0/XML/include/DOM/Node.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/DOM/Node.h#1 $ // // Library: XML // Package: DOM @@ -40,18 +40,13 @@ #define DOM_Node_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef DOM_EventTarget_INCLUDED -#include "DOM/EventTarget.h" -#endif -#ifndef XML_XMLString_INCLUDED -#include "XML/XMLString.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/DOM/EventTarget.h" +#include "Poco/XML/XMLString.h" -XML_BEGIN +namespace Poco { +namespace XML { class NamedNodeMap; @@ -254,7 +249,7 @@ inline const XMLString& Node::nodeValue() const } -XML_END +} } // namespace Poco::XML #endif // DOM_Node_INCLUDED diff --git a/XML/include/DOM/NodeFilter.h b/XML/include/Poco/DOM/NodeFilter.h similarity index 94% rename from XML/include/DOM/NodeFilter.h rename to XML/include/Poco/DOM/NodeFilter.h index e48680e3d..90a078cdf 100644 --- a/XML/include/DOM/NodeFilter.h +++ b/XML/include/Poco/DOM/NodeFilter.h @@ -1,7 +1,7 @@ // // NodeFilter.h // -// $Id: //poco/1.1.0/XML/include/DOM/NodeFilter.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/DOM/NodeFilter.h#1 $ // // Library: XML // Package: DOM @@ -40,15 +40,12 @@ #define DOM_NodeFilter_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef XML_XMLString_INCLUDED -#include "XML/XMLString.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" -XML_BEGIN +namespace Poco { +namespace XML { class Node; @@ -165,7 +162,7 @@ protected: }; -XML_END +} } // namespace Poco::XML #endif // DOM_NodeFilter_INCLUDED diff --git a/XML/include/DOM/NodeIterator.h b/XML/include/Poco/DOM/NodeIterator.h similarity index 94% rename from XML/include/DOM/NodeIterator.h rename to XML/include/Poco/DOM/NodeIterator.h index 106c96e80..09aebd53f 100644 --- a/XML/include/DOM/NodeIterator.h +++ b/XML/include/Poco/DOM/NodeIterator.h @@ -1,7 +1,7 @@ // // NodeIterator.h // -// $Id: //poco/1.1.0/XML/include/DOM/NodeIterator.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/DOM/NodeIterator.h#1 $ // // Library: XML // Package: DOM @@ -40,12 +40,11 @@ #define DOM_NodeIterator_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif +#include "Poco/XML/XML.h" -XML_BEGIN +namespace Poco { +namespace XML { class Node; @@ -184,7 +183,7 @@ inline bool NodeIterator::expandEntityReferences() const } -XML_END +} } // namespace Poco::XML #endif // DOM_NodeIterator_INCLUDED diff --git a/XML/include/DOM/NodeList.h b/XML/include/Poco/DOM/NodeList.h similarity index 90% rename from XML/include/DOM/NodeList.h rename to XML/include/Poco/DOM/NodeList.h index ccb796501..caab3971e 100644 --- a/XML/include/DOM/NodeList.h +++ b/XML/include/Poco/DOM/NodeList.h @@ -1,7 +1,7 @@ // // NodeList.h // -// $Id: //poco/1.1.0/XML/include/DOM/NodeList.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/DOM/NodeList.h#1 $ // // Library: XML // Package: DOM @@ -40,15 +40,12 @@ #define DOM_NodeList_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef DOM_DOMObject_INCLUDED -#include "DOM/DOMObject.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/DOM/DOMObject.h" -XML_BEGIN +namespace Poco { +namespace XML { class Node; @@ -80,7 +77,7 @@ protected: }; -XML_END +} } // namespace Poco::XML #endif // DOM_NodeList_INCLUDED diff --git a/XML/include/DOM/Notation.h b/XML/include/Poco/DOM/Notation.h similarity index 89% rename from XML/include/DOM/Notation.h rename to XML/include/Poco/DOM/Notation.h index 088010841..545f5f243 100644 --- a/XML/include/DOM/Notation.h +++ b/XML/include/Poco/DOM/Notation.h @@ -1,7 +1,7 @@ // // Notation.h // -// $Id: //poco/1.1.0/XML/include/DOM/Notation.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/DOM/Notation.h#1 $ // // Library: XML // Package: DOM @@ -40,18 +40,13 @@ #define DOM_Notation_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef DOM_AbstractNode_INCLUDED -#include "DOM/AbstractNode.h" -#endif -#ifndef XML_XMLString_INCLUDED -#include "XML/XMLString.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/DOM/AbstractNode.h" +#include "Poco/XML/XMLString.h" -XML_BEGIN +namespace Poco { +namespace XML { class XML_API Notation: public AbstractNode @@ -114,7 +109,7 @@ inline const XMLString& Notation::systemId() const } -XML_END +} } // namespace Poco::XML #endif // DOM_Notation_INCLUDED diff --git a/XML/include/DOM/ProcessingInstruction.h b/XML/include/Poco/DOM/ProcessingInstruction.h similarity index 89% rename from XML/include/DOM/ProcessingInstruction.h rename to XML/include/Poco/DOM/ProcessingInstruction.h index 9362fc72f..57ff7bf5c 100644 --- a/XML/include/DOM/ProcessingInstruction.h +++ b/XML/include/Poco/DOM/ProcessingInstruction.h @@ -1,7 +1,7 @@ // // ProcessingInstruction.h // -// $Id: //poco/1.1.0/XML/include/DOM/ProcessingInstruction.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/DOM/ProcessingInstruction.h#1 $ // // Library: XML // Package: DOM @@ -40,18 +40,13 @@ #define DOM_ProcessingInstruction_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef DOM_AbstractNode_INCLUDED -#include "DOM/AbstractNode.h" -#endif -#ifndef XML_XMLString_INCLUDED -#include "XML/XMLString.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/DOM/AbstractNode.h" +#include "Poco/XML/XMLString.h" -XML_BEGIN +namespace Poco { +namespace XML { class XML_API ProcessingInstruction: public AbstractNode @@ -120,7 +115,7 @@ inline const XMLString& ProcessingInstruction::getData() const } -XML_END +} } // namespace Poco::XML #endif // DOM_ProcessingInstruction_INCLUDED diff --git a/XML/include/DOM/Text.h b/XML/include/Poco/DOM/Text.h similarity index 90% rename from XML/include/DOM/Text.h rename to XML/include/Poco/DOM/Text.h index 50e3fefc3..446ebfa18 100644 --- a/XML/include/DOM/Text.h +++ b/XML/include/Poco/DOM/Text.h @@ -1,7 +1,7 @@ // // Text.h // -// $Id: //poco/1.1.0/XML/include/DOM/Text.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/DOM/Text.h#1 $ // // Library: XML // Package: DOM @@ -40,18 +40,13 @@ #define DOM_Text_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef DOM_CharacterData_INCLUDED -#include "DOM/CharacterData.h" -#endif -#ifndef XML_XMLString_INCLUDED -#include "XML/XMLString.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/DOM/CharacterData.h" +#include "Poco/XML/XMLString.h" -XML_BEGIN +namespace Poco { +namespace XML { class XML_API Text: public CharacterData @@ -83,6 +78,9 @@ public: const XMLString& nodeName() const; unsigned short nodeType() const; + // Non-standard extensions + XMLString innerText() const; + protected: Text(Document* pOwnerDocument, const XMLString& data); Text(Document* pOwnerDocument, const Text& text); @@ -97,7 +95,7 @@ private: }; -XML_END +} } // namespace Poco::XML #endif // DOM_Text_INCLUDED diff --git a/XML/include/DOM/TreeWalker.h b/XML/include/Poco/DOM/TreeWalker.h similarity index 95% rename from XML/include/DOM/TreeWalker.h rename to XML/include/Poco/DOM/TreeWalker.h index 6ccb24598..cdd9bd9fc 100644 --- a/XML/include/DOM/TreeWalker.h +++ b/XML/include/Poco/DOM/TreeWalker.h @@ -1,7 +1,7 @@ // // TreeWalker.h // -// $Id: //poco/1.1.0/XML/include/DOM/TreeWalker.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/DOM/TreeWalker.h#1 $ // // Library: XML // Package: DOM @@ -40,15 +40,12 @@ #define DOM_TreeWalker_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef XML_XMLString_INCLUDED -#include "XML/XMLString.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" -XML_BEGIN +namespace Poco { +namespace XML { class Node; @@ -230,7 +227,7 @@ inline Node* TreeWalker::getCurrentNode() const } -XML_END +} } // namespace Poco::XML #endif // DOM_TreeWalker_INCLUDED diff --git a/XML/include/SAX/Attributes.h b/XML/include/Poco/SAX/Attributes.h similarity index 94% rename from XML/include/SAX/Attributes.h rename to XML/include/Poco/SAX/Attributes.h index 2058910b1..a6de38302 100644 --- a/XML/include/SAX/Attributes.h +++ b/XML/include/Poco/SAX/Attributes.h @@ -1,7 +1,7 @@ // // Attributes.h // -// $Id: //poco/1.1.0/XML/include/SAX/Attributes.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/SAX/Attributes.h#1 $ // // Library: XML // Package: SAX @@ -40,15 +40,12 @@ #define SAX_Attributes_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef XML_XMLString_INCLUDED -#include "XML/XMLString.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" -XML_BEGIN +namespace Poco { +namespace XML { class XML_API Attributes @@ -139,7 +136,7 @@ protected: }; -XML_END +} } // namespace Poco::XML #endif // SAX_Attributes_INCLUDED diff --git a/XML/include/SAX/AttributesImpl.h b/XML/include/Poco/SAX/AttributesImpl.h similarity index 93% rename from XML/include/SAX/AttributesImpl.h rename to XML/include/Poco/SAX/AttributesImpl.h index fedbf6828..e8742728f 100644 --- a/XML/include/SAX/AttributesImpl.h +++ b/XML/include/Poco/SAX/AttributesImpl.h @@ -1,7 +1,7 @@ // // AttributesImpl.h // -// $Id: //poco/1.1.0/XML/include/SAX/AttributesImpl.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/SAX/AttributesImpl.h#1 $ // // Library: XML // Package: SAX @@ -40,19 +40,13 @@ #define SAX_AttributesImpl_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef SAX_Attributes_INCLUDED -#include "SAX/Attributes.h" -#endif -#ifndef STD_VECTOR_INCLUDED +#include "Poco/XML/XML.h" +#include "Poco/SAX/Attributes.h" #include -#define STD_VECTOR_INCLUDED -#endif -XML_BEGIN +namespace Poco { +namespace XML { class XML_API AttributesImpl: public Attributes @@ -194,7 +188,7 @@ inline AttributesImpl::iterator AttributesImpl::end() const } -XML_END +} } // namespace Poco::XML #endif // SAX_AttributesImpl_INCLUDED diff --git a/XML/include/SAX/ContentHandler.h b/XML/include/Poco/SAX/ContentHandler.h similarity index 96% rename from XML/include/SAX/ContentHandler.h rename to XML/include/Poco/SAX/ContentHandler.h index 2b7ee9c93..73dbbf356 100644 --- a/XML/include/SAX/ContentHandler.h +++ b/XML/include/Poco/SAX/ContentHandler.h @@ -1,7 +1,7 @@ // // ContentHandler.h // -// $Id: //poco/1.1.0/XML/include/SAX/ContentHandler.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/SAX/ContentHandler.h#1 $ // // Library: XML // Package: SAX @@ -40,15 +40,12 @@ #define SAX_ContentHandler_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef XML_XMLString_INCLUDED -#include "XML/XMLString.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" -XML_BEGIN +namespace Poco { +namespace XML { class Locator; @@ -258,7 +255,7 @@ protected: }; -XML_END +} } // namespace Poco::XML #endif // SAX_ContentHandler_INCLUDED diff --git a/XML/include/SAX/DTDHandler.h b/XML/include/Poco/SAX/DTDHandler.h similarity index 93% rename from XML/include/SAX/DTDHandler.h rename to XML/include/Poco/SAX/DTDHandler.h index 038ad9b07..e66d2ed8c 100644 --- a/XML/include/SAX/DTDHandler.h +++ b/XML/include/Poco/SAX/DTDHandler.h @@ -1,7 +1,7 @@ // // DTDHandler.h // -// $Id: //poco/1.1.0/XML/include/SAX/DTDHandler.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/SAX/DTDHandler.h#1 $ // // Library: XML // Package: SAX @@ -40,15 +40,12 @@ #define SAX_DTDHandler_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef XML_XMLString_INCLUDED -#include "XML/XMLString.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" -XML_BEGIN +namespace Poco { +namespace XML { class XML_API DTDHandler @@ -105,7 +102,7 @@ protected: }; -XML_END +} } // namespace Poco::XML #endif // SAX_DTDHandler_INCLUDED diff --git a/XML/include/SAX/DeclHandler.h b/XML/include/Poco/SAX/DeclHandler.h similarity index 93% rename from XML/include/SAX/DeclHandler.h rename to XML/include/Poco/SAX/DeclHandler.h index 8d2ad181d..385224bbf 100644 --- a/XML/include/SAX/DeclHandler.h +++ b/XML/include/Poco/SAX/DeclHandler.h @@ -1,7 +1,7 @@ // // DeclHandler.h // -// $Id: //poco/1.1.0/XML/include/SAX/DeclHandler.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/SAX/DeclHandler.h#1 $ // // Library: XML // Package: SAX @@ -40,15 +40,12 @@ #define SAX_DeclHandler_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef XML_XMLString_INCLUDED -#include "XML/XMLString.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" -XML_BEGIN +namespace Poco { +namespace XML { class XML_API DeclHandler @@ -110,7 +107,7 @@ protected: }; -XML_END +} } // namespace Poco::XML #endif // SAX_DeclHandler_INCLUDED diff --git a/XML/include/SAX/DefaultHandler.h b/XML/include/Poco/SAX/DefaultHandler.h similarity index 87% rename from XML/include/SAX/DefaultHandler.h rename to XML/include/Poco/SAX/DefaultHandler.h index 223caf604..8cb0a205a 100644 --- a/XML/include/SAX/DefaultHandler.h +++ b/XML/include/Poco/SAX/DefaultHandler.h @@ -1,7 +1,7 @@ // // DefaultHandler.h // -// $Id: //poco/1.1.0/XML/include/SAX/DefaultHandler.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/SAX/DefaultHandler.h#1 $ // // Library: XML // Package: SAX @@ -40,24 +40,15 @@ #define SAX_DefaultHandler_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef SAX_EntityResolver_INCLUDED -#include "SAX/EntityResolver.h" -#endif -#ifndef SAX_DTDHandler_INCLUDED -#include "SAX/DTDHandler.h" -#endif -#ifndef SAX_ContentHandler_INCLUDED -#include "SAX/ContentHandler.h" -#endif -#ifndef SAX_ErrorHandler_INCLUDED -#include "SAX/ErrorHandler.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/SAX/EntityResolver.h" +#include "Poco/SAX/DTDHandler.h" +#include "Poco/SAX/ContentHandler.h" +#include "Poco/SAX/ErrorHandler.h" -XML_BEGIN +namespace Poco { +namespace XML { class XML_API DefaultHandler: public EntityResolver, public DTDHandler, public ContentHandler, public ErrorHandler @@ -108,7 +99,7 @@ public: }; -XML_END +} } // namespace Poco::XML #endif // SAX_DefaultHandler_INCLUDED diff --git a/XML/include/SAX/EntityResolver.h b/XML/include/Poco/SAX/EntityResolver.h similarity index 93% rename from XML/include/SAX/EntityResolver.h rename to XML/include/Poco/SAX/EntityResolver.h index 8effce208..618df3946 100644 --- a/XML/include/SAX/EntityResolver.h +++ b/XML/include/Poco/SAX/EntityResolver.h @@ -1,7 +1,7 @@ // // EntityResolver.h // -// $Id: //poco/1.1.0/XML/include/SAX/EntityResolver.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/SAX/EntityResolver.h#1 $ // // Library: XML // Package: SAX @@ -40,15 +40,12 @@ #define SAX_EntityResolver_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef XML_XMLString_INCLUDED -#include "XML/XMLString.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" -XML_BEGIN +namespace Poco { +namespace XML { class InputSource; @@ -105,7 +102,7 @@ protected: }; -XML_END +} } // namespace Poco::XML #endif // SAX_EntityResolver_INCLUDED diff --git a/XML/include/SAX/EntityResolverImpl.h b/XML/include/Poco/SAX/EntityResolverImpl.h similarity index 83% rename from XML/include/SAX/EntityResolverImpl.h rename to XML/include/Poco/SAX/EntityResolverImpl.h index 947102f24..8acc999bd 100644 --- a/XML/include/SAX/EntityResolverImpl.h +++ b/XML/include/Poco/SAX/EntityResolverImpl.h @@ -1,7 +1,7 @@ // // EntityResolverImpl.h // -// $Id: //poco/1.1.0/XML/include/SAX/EntityResolverImpl.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/SAX/EntityResolverImpl.h#1 $ // // Library: XML // Package: SAX @@ -40,21 +40,14 @@ #define SAX_EntityResolverImpl_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef XML_XMLString_INCLUDED -#include "XML/XMLString.h" -#endif -#ifndef SAX_EntityResolver_INCLUDED -#include "SAX/EntityResolver.h" -#endif -#ifndef Foundation_URIStreamOpener_INCLUDED -#include "Foundation/URIStreamOpener.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" +#include "Poco/SAX/EntityResolver.h" +#include "Poco/URIStreamOpener.h" -XML_BEGIN +namespace Poco { +namespace XML { class XML_API EntityResolverImpl: public EntityResolver @@ -73,7 +66,7 @@ public: /// Creates an EntityResolverImpl that uses the default /// URIStreamOpener. - EntityResolverImpl(const Foundation::URIStreamOpener& opener); + EntityResolverImpl(const Poco::URIStreamOpener& opener); /// Creates an EntityResolverImpl that uses the given /// URIStreamOpener. @@ -97,11 +90,11 @@ private: EntityResolverImpl(const EntityResolverImpl&); EntityResolverImpl& operator = (const EntityResolverImpl&); - const Foundation::URIStreamOpener& _opener; + const Poco::URIStreamOpener& _opener; }; -XML_END +} } // namespace Poco::XML #endif // SAX_EntityResolverImpl_INCLUDED diff --git a/XML/include/SAX/ErrorHandler.h b/XML/include/Poco/SAX/ErrorHandler.h similarity index 94% rename from XML/include/SAX/ErrorHandler.h rename to XML/include/Poco/SAX/ErrorHandler.h index c53c97bea..2adb224a6 100644 --- a/XML/include/SAX/ErrorHandler.h +++ b/XML/include/Poco/SAX/ErrorHandler.h @@ -1,7 +1,7 @@ // // ErrorHandler.h // -// $Id: //poco/1.1.0/XML/include/SAX/ErrorHandler.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/SAX/ErrorHandler.h#1 $ // // Library: XML // Package: SAX @@ -40,12 +40,11 @@ #define SAX_ErrorHandler_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif +#include "Poco/XML/XML.h" -XML_BEGIN +namespace Poco { +namespace XML { class SAXException; @@ -109,7 +108,7 @@ protected: }; -XML_END +} } // namespace Poco::XML #endif // SAX_ErrorHandler_INCLUDED diff --git a/XML/include/SAX/InputSource.h b/XML/include/Poco/SAX/InputSource.h similarity index 93% rename from XML/include/SAX/InputSource.h rename to XML/include/Poco/SAX/InputSource.h index 340bf35bf..368bbedfb 100644 --- a/XML/include/SAX/InputSource.h +++ b/XML/include/Poco/SAX/InputSource.h @@ -1,7 +1,7 @@ // // InputSource.h // -// $Id: //poco/1.1.0/XML/include/SAX/InputSource.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/SAX/InputSource.h#1 $ // // Library: XML // Package: SAX @@ -40,18 +40,13 @@ #define SAX_InputSource_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef XML_XMLString_INCLUDED -#include "XML/XMLString.h" -#endif -#ifndef XML_XMLStream_INCLUDED -#include "XML/XMLStream.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" +#include "Poco/XML/XMLStream.h" -XML_BEGIN +namespace Poco { +namespace XML { class XML_API InputSource @@ -190,7 +185,7 @@ inline XMLCharInputStream* InputSource::getCharacterStream() const } -XML_END +} } // namespace Poco::XML #endif // SAX_InputSource_INCLUDED diff --git a/XML/include/SAX/LexicalHandler.h b/XML/include/Poco/SAX/LexicalHandler.h similarity index 94% rename from XML/include/SAX/LexicalHandler.h rename to XML/include/Poco/SAX/LexicalHandler.h index c6dadeebb..cfbbabd96 100644 --- a/XML/include/SAX/LexicalHandler.h +++ b/XML/include/Poco/SAX/LexicalHandler.h @@ -1,7 +1,7 @@ // // LexicalHandler.h // -// $Id: //poco/1.1.0/XML/include/SAX/LexicalHandler.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/SAX/LexicalHandler.h#1 $ // // Library: XML // Package: SAX @@ -40,15 +40,12 @@ #define SAX_LexicalHandler_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef XML_XMLString_INCLUDED -#include "XML/XMLString.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" -XML_BEGIN +namespace Poco { +namespace XML { class XML_API LexicalHandler @@ -144,7 +141,7 @@ protected: }; -XML_END +} } // namespace Poco::XML #endif // SAX_LexicalHandler_INCLUDED diff --git a/XML/include/SAX/Locator.h b/XML/include/Poco/SAX/Locator.h similarity index 94% rename from XML/include/SAX/Locator.h rename to XML/include/Poco/SAX/Locator.h index 1f9b2fa9c..a9aa7deee 100644 --- a/XML/include/SAX/Locator.h +++ b/XML/include/Poco/SAX/Locator.h @@ -1,7 +1,7 @@ // // Locator.h // -// $Id: //poco/1.1.0/XML/include/SAX/Locator.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/SAX/Locator.h#1 $ // // Library: XML // Package: SAX @@ -40,15 +40,12 @@ #define SAX_Locator_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef XML_XMLString_INCLUDED -#include "XML/XMLString.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" -XML_BEGIN +namespace Poco { +namespace XML { class XML_API Locator @@ -122,7 +119,7 @@ protected: }; -XML_END +} } // namespace Poco::XML #endif // SAX_Locator_INCLUDED diff --git a/XML/include/SAX/LocatorImpl.h b/XML/include/Poco/SAX/LocatorImpl.h similarity index 89% rename from XML/include/SAX/LocatorImpl.h rename to XML/include/Poco/SAX/LocatorImpl.h index b5c30d846..c80545b33 100644 --- a/XML/include/SAX/LocatorImpl.h +++ b/XML/include/Poco/SAX/LocatorImpl.h @@ -1,7 +1,7 @@ // // LocatorImpl.h // -// $Id: //poco/1.1.0/XML/include/SAX/LocatorImpl.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/SAX/LocatorImpl.h#1 $ // // Library: XML // Package: SAX @@ -40,18 +40,13 @@ #define SAX_LocatorImpl_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef SAX_Locator_INCLUDED -#include "SAX/Locator.h" -#endif -#ifndef XMLString_INCLUDED -#include "XML/XMLString.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/SAX/Locator.h" +#include "Poco/XML/XMLString.h" -XML_BEGIN +namespace Poco { +namespace XML { class XML_API LocatorImpl: public Locator @@ -109,7 +104,7 @@ private: }; -XML_END +} } // namespace Poco::XML #endif // SAX_LocatorImpl_INCLUDED diff --git a/XML/include/SAX/NamespaceSupport.h b/XML/include/Poco/SAX/NamespaceSupport.h similarity index 93% rename from XML/include/SAX/NamespaceSupport.h rename to XML/include/Poco/SAX/NamespaceSupport.h index 09e83796b..10f610b8c 100644 --- a/XML/include/SAX/NamespaceSupport.h +++ b/XML/include/Poco/SAX/NamespaceSupport.h @@ -1,7 +1,7 @@ // // NamespaceSupport.h // -// $Id: //poco/1.1.0/XML/include/SAX/NamespaceSupport.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/SAX/NamespaceSupport.h#1 $ // // Library: XML // Package: SAX @@ -40,27 +40,15 @@ #define SAX_NamespaceSupport_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef XML_XMLString_INCLUDED -#include "XML/XMLString.h" -#endif -#ifndef STD_SET_INCLUDED +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" #include -#define STD_SET_INCLUDED -#endif -#ifndef STD_MAP_INCLUDED #include -#define STD_MAP_INCLUDED -#endif -#ifndef STD_VECTOR_INCLUDED #include -#define STD_VECTOR_INCLUDED -#endif -XML_BEGIN +namespace Poco { +namespace XML { class XML_API NamespaceSupport @@ -223,7 +211,7 @@ private: }; -XML_END +} } // namespace Poco::XML #endif // SAX_NamespaceSupport_INCLUDED diff --git a/XML/include/SAX/SAXException.h b/XML/include/Poco/SAX/SAXException.h similarity index 91% rename from XML/include/SAX/SAXException.h rename to XML/include/Poco/SAX/SAXException.h index 2e42ea426..f2f74967a 100644 --- a/XML/include/SAX/SAXException.h +++ b/XML/include/Poco/SAX/SAXException.h @@ -1,7 +1,7 @@ // // SAXException.h // -// $Id: //poco/1.1.0/XML/include/SAX/SAXException.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/SAX/SAXException.h#1 $ // // Library: XML // Package: SAX @@ -40,18 +40,13 @@ #define SAX_SAXException_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef XML_XMLException_INCLUDED -#include "XML/XMLException.h" -#endif -#ifndef XML_XMLString_INCLUDED -#include "XML/XMLString.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLException.h" +#include "Poco/XML/XMLString.h" -XML_BEGIN +namespace Poco { +namespace XML { POCO_DECLARE_EXCEPTION(XML_API, SAXException, XMLException) @@ -103,7 +98,7 @@ public: SAXParseException(const std::string& msg, const Locator& loc); /// Create a new SAXParseException from a message and a Locator. - SAXParseException(const std::string& msg, const Locator& loc, const Foundation::Exception& exc); + SAXParseException(const std::string& msg, const Locator& loc, const Poco::Exception& exc); /// Wrap an existing exception in a SAXParseException. SAXParseException(const std::string& msg, const XMLString& publicId, const XMLString& systemId, int lineNumber, int columnNumber); @@ -114,7 +109,7 @@ public: /// For example, if the system identifier is a URL (including relative filename), /// the caller must resolve it fully before creating the exception. - SAXParseException(const std::string& msg, const XMLString& publicId, const XMLString& systemId, int lineNumber, int columnNumber, const Foundation::Exception& exc); + SAXParseException(const std::string& msg, const XMLString& publicId, const XMLString& systemId, int lineNumber, int columnNumber, const Poco::Exception& exc); /// Create a new SAXParseException. /// /// This constructor is most useful for parser writers. @@ -136,7 +131,13 @@ public: const char* className() const throw(); /// Returns the name of the exception class. - + + Poco::Exception* clone() const; + /// Creates an exact copy of the exception. + + void rethrow() const; + /// (Re)Throws the exception. + const XMLString& getPublicId() const; /// Get the public identifier of the entity where the exception occurred. @@ -152,7 +153,6 @@ public: /// The first column in a line is position 1. protected: - Foundation::Exception* clone() const; static std::string buildMessage(const std::string& msg, const XMLString& publicId, const XMLString& systemId, int lineNumber, int columnNumber); private: @@ -192,7 +192,7 @@ inline int SAXParseException::getColumnNumber() const } -XML_END +} } // namespace Poco::XML #endif // SAX_SAXException_INCLUDED diff --git a/XML/include/SAX/SAXParser.h b/XML/include/Poco/SAX/SAXParser.h similarity index 88% rename from XML/include/SAX/SAXParser.h rename to XML/include/Poco/SAX/SAXParser.h index b355f9a8e..86befd075 100644 --- a/XML/include/SAX/SAXParser.h +++ b/XML/include/Poco/SAX/SAXParser.h @@ -1,7 +1,7 @@ // // SAXParser.h // -// $Id: //poco/1.1.0/XML/include/SAX/SAXParser.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/SAX/SAXParser.h#1 $ // // Library: XML // Package: SAX @@ -40,18 +40,13 @@ #define SAX_SAXParser_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef SAX_XMLReader_INCLUDED -#include "SAX/XMLReader.h" -#endif -#ifndef XML_ParserEngine_INCLUDED -#include "XML/ParserEngine.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/SAX/XMLReader.h" +#include "Poco/XML/ParserEngine.h" -XML_BEGIN +namespace Poco { +namespace XML { class XML_API SAXParser: public XMLReader @@ -84,7 +79,7 @@ public: /// the parser if no encoding is specified in /// the XML document. - void addEncoding(const XMLString& name, Foundation::TextEncoding* pEncoding); + void addEncoding(const XMLString& name, Poco::TextEncoding* pEncoding); /// Adds an encoding to the parser. /// XMLReader @@ -117,7 +112,7 @@ private: }; -XML_END +} } // namespace Poco::XML #endif // SAX_SAXParser_INCLUDED diff --git a/XML/include/SAX/WhitespaceFilter.h b/XML/include/Poco/SAX/WhitespaceFilter.h similarity index 89% rename from XML/include/SAX/WhitespaceFilter.h rename to XML/include/Poco/SAX/WhitespaceFilter.h index 31aeca937..1146ea517 100644 --- a/XML/include/SAX/WhitespaceFilter.h +++ b/XML/include/Poco/SAX/WhitespaceFilter.h @@ -1,7 +1,7 @@ // // WhitespaceFilter.h // -// $Id: //poco/1.1.0/XML/include/SAX/WhitespaceFilter.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/SAX/WhitespaceFilter.h#1 $ // // Library: XML // Package: SAX @@ -40,18 +40,13 @@ #define SAX_WhitespaceFilter_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef SAX_XMLFilterImpl_INCLUDED -#include "SAX/XMLFilterImpl.h" -#endif -#ifndef SAX_LexicalHandler_INCLUDED -#include "SAX/LexicalHandler.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/SAX/XMLFilterImpl.h" +#include "Poco/SAX/LexicalHandler.h" -XML_BEGIN +namespace Poco { +namespace XML { class XML_API WhitespaceFilter: public XMLFilterImpl, public LexicalHandler @@ -102,7 +97,7 @@ private: }; -XML_END +} } // namespace Poco::XML #endif // SAX_WhitespaceFilter_INCLUDED diff --git a/XML/include/SAX/XMLFilter.h b/XML/include/Poco/SAX/XMLFilter.h similarity index 91% rename from XML/include/SAX/XMLFilter.h rename to XML/include/Poco/SAX/XMLFilter.h index 9b79a59f1..e191bbb43 100644 --- a/XML/include/SAX/XMLFilter.h +++ b/XML/include/Poco/SAX/XMLFilter.h @@ -1,7 +1,7 @@ // // XMLFilter.h // -// $Id: //poco/1.1.0/XML/include/SAX/XMLFilter.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/SAX/XMLFilter.h#1 $ // // Library: XML // Package: SAX @@ -40,15 +40,12 @@ #define SAX_XMLFilter_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef SAX_XMLReader_INCLUDED -#include "SAX/XMLReader.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/SAX/XMLReader.h" -XML_BEGIN +namespace Poco { +namespace XML { class XML_API XMLFilter: public XMLReader @@ -80,7 +77,7 @@ protected: }; -XML_END +} } // namespace Poco::XML #endif // SAX_XMLFilter_INCLUDED diff --git a/XML/include/SAX/XMLFilterImpl.h b/XML/include/Poco/SAX/XMLFilterImpl.h similarity index 89% rename from XML/include/SAX/XMLFilterImpl.h rename to XML/include/Poco/SAX/XMLFilterImpl.h index 20cb579a6..6c2154a84 100644 --- a/XML/include/SAX/XMLFilterImpl.h +++ b/XML/include/Poco/SAX/XMLFilterImpl.h @@ -1,7 +1,7 @@ // // XMLFilterImpl.h // -// $Id: //poco/1.1.0/XML/include/SAX/XMLFilterImpl.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/SAX/XMLFilterImpl.h#1 $ // // Library: XML // Package: SAX @@ -40,27 +40,16 @@ #define SAX_XMLFilterImpl_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef SAX_XMLFilter_INCLUDED -#include "SAX/XMLFilter.h" -#endif -#ifndef SAX_EntityResolver_INCLUDED -#include "SAX/EntityResolver.h" -#endif -#ifndef SAX_DTDHandler_INCLUDED -#include "SAX/DTDHandler.h" -#endif -#ifndef SAX_ContentHandler_INCLUDED -#include "SAX/ContentHandler.h" -#endif -#ifndef SAX_ErrorHandler_INCLUDED -#include "SAX/ErrorHandler.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/SAX/XMLFilter.h" +#include "Poco/SAX/EntityResolver.h" +#include "Poco/SAX/DTDHandler.h" +#include "Poco/SAX/ContentHandler.h" +#include "Poco/SAX/ErrorHandler.h" -XML_BEGIN +namespace Poco { +namespace XML { class XML_API XMLFilterImpl: public XMLFilter, public EntityResolver, public DTDHandler, public ContentHandler, public ErrorHandler @@ -158,7 +147,7 @@ inline XMLReader* XMLFilterImpl::parent() const } -XML_END +} } // namespace Poco::XML #endif // SAX_XMLFilterImpl_INCLUDED diff --git a/XML/include/SAX/XMLReader.h b/XML/include/Poco/SAX/XMLReader.h similarity index 95% rename from XML/include/SAX/XMLReader.h rename to XML/include/Poco/SAX/XMLReader.h index bc25a788d..a29318a68 100644 --- a/XML/include/SAX/XMLReader.h +++ b/XML/include/Poco/SAX/XMLReader.h @@ -1,7 +1,7 @@ // // XMLReader.h // -// $Id: //poco/1.1.0/XML/include/SAX/XMLReader.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/SAX/XMLReader.h#1 $ // // Library: XML // Package: SAX @@ -40,15 +40,12 @@ #define SAX_XMLReader_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef XML_XMLString_INCLUDED -#include "XML/XMLString.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" -XML_BEGIN +namespace Poco { +namespace XML { class EntityResolver; @@ -220,7 +217,7 @@ protected: }; -XML_END +} } // namespace Poco::XML #endif // SAX_XMLReader_INCLUDED diff --git a/XML/include/XML/Name.h b/XML/include/Poco/XML/Name.h similarity index 92% rename from XML/include/XML/Name.h rename to XML/include/Poco/XML/Name.h index 97399d0a0..afa1802a7 100644 --- a/XML/include/XML/Name.h +++ b/XML/include/Poco/XML/Name.h @@ -1,7 +1,7 @@ // // Name.h // -// $Id: //poco/1.1.0/XML/include/XML/Name.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/XML/Name.h#1 $ // // Library: XML // Package: XML @@ -40,15 +40,12 @@ #define XML_Name_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef XML_XMLString_INCLUDED -#include "XML/XMLString.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" -XML_BEGIN +namespace Poco { +namespace XML { class XML_API Name @@ -157,7 +154,7 @@ inline void swap(Name& n1, Name& n2) } -XML_END +} } // namespace Poco::XML #endif // XML_Name_INCLUDED diff --git a/XML/include/XML/NamePool.h b/XML/include/Poco/XML/NamePool.h similarity index 89% rename from XML/include/XML/NamePool.h rename to XML/include/Poco/XML/NamePool.h index 60733281b..d7b547e56 100644 --- a/XML/include/XML/NamePool.h +++ b/XML/include/Poco/XML/NamePool.h @@ -1,7 +1,7 @@ // // NamePool.h // -// $Id: //poco/1.1.0/XML/include/XML/NamePool.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/XML/NamePool.h#1 $ // // Library: XML // Package: XML @@ -40,18 +40,13 @@ #define XML_NamePool_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef XML_XMLString_INCLUDED -#include "XML/XMLString.h" -#endif -#ifndef XML_Name_INCLUDED -#include "XML/Name.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" +#include "Poco/XML/Name.h" -XML_BEGIN +namespace Poco { +namespace XML { class NamePoolItem; @@ -95,7 +90,7 @@ private: }; -XML_END +} } // namespace Poco::XML #endif // XML_NamePool_INCLUDED diff --git a/XML/include/XML/NamespaceStrategy.h b/XML/include/Poco/XML/NamespaceStrategy.h similarity index 90% rename from XML/include/XML/NamespaceStrategy.h rename to XML/include/Poco/XML/NamespaceStrategy.h index d3be7b1b3..ef0a7f711 100644 --- a/XML/include/XML/NamespaceStrategy.h +++ b/XML/include/Poco/XML/NamespaceStrategy.h @@ -1,7 +1,7 @@ // // NamespaceStrategy.h // -// $Id: //poco/1.1.0/XML/include/XML/NamespaceStrategy.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/XML/NamespaceStrategy.h#1 $ // // Library: XML // Package: XML @@ -40,18 +40,13 @@ #define XML_NamespaceStrategy_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef XML_XMLString_INCLUDED -#include "XML/XMLString.h" -#endif -#ifndef SAX_NamespaceSupport_INCLUDED -#include "SAX/NamespaceSupport.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" +#include "Poco/SAX/NamespaceSupport.h" -XML_BEGIN +namespace Poco { +namespace XML { class ContentHandler; @@ -122,7 +117,7 @@ public: }; -XML_END +} } // namespace Poco::XML #endif // XML_NamespaceStrategy_INCLUDED diff --git a/XML/include/XML/ParserEngine.h b/XML/include/Poco/XML/ParserEngine.h similarity index 91% rename from XML/include/XML/ParserEngine.h rename to XML/include/Poco/XML/ParserEngine.h index d6294173f..39e174ba1 100644 --- a/XML/include/XML/ParserEngine.h +++ b/XML/include/Poco/XML/ParserEngine.h @@ -1,7 +1,7 @@ // // ParserEngine.h // -// $Id: //poco/1.1.0/XML/include/XML/ParserEngine.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/XML/ParserEngine.h#1 $ // // Library: XML // Package: XML @@ -39,35 +39,18 @@ #define XML_ParserEngine_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef Expat_INCLUDED -#include "XML/expat.h" -#endif -#ifndef XML_XMLString_INCLUDED -#include "XML/XMLString.h" -#endif -#ifndef XML_XMLStream_INCLUDED -#include "XML/XMLStream.h" -#endif -#ifndef SAX_Locator_INCLUDED -#include "SAX/Locator.h" -#endif -#ifndef Foundation_TextEncoding_INCLUDED -#include "Foundation/TextEncoding.h" -#endif -#ifndef STD_MAP_INCLUDED +#include "Poco/XML/XML.h" +#include "Poco/XML/expat.h" +#include "Poco/XML/XMLString.h" +#include "Poco/XML/XMLStream.h" +#include "Poco/SAX/Locator.h" +#include "Poco/TextEncoding.h" #include -#define STD_MAP_INCLUDED -#endif -#ifndef STD_VECTOR_INCLUDED #include -#define STD_VECTOR_INCLUDED -#endif -XML_BEGIN +namespace Poco { +namespace XML { class InputSource; @@ -107,7 +90,7 @@ public: const XMLString& getEncoding() const; /// Returns the encoding used by expat. - void addEncoding(const XMLString& name, Foundation::TextEncoding* pEncoding); + void addEncoding(const XMLString& name, Poco::TextEncoding* pEncoding); /// Adds an encoding to the parser. void setNamespaceStrategy(NamespaceStrategy* pStrategy); @@ -256,7 +239,7 @@ protected: static int convert(void *data, const char *s); private: - typedef std::map EncodingMap; + typedef std::map EncodingMap; typedef std::vector ContextStack; XML_Parser _parser; @@ -351,7 +334,7 @@ inline ErrorHandler* ParserEngine::getErrorHandler() const } -XML_END +} } // namespace Poco::XML #endif // XML_ParserEngine_INCLUDED diff --git a/XML/include/XML/XML.h b/XML/include/Poco/XML/XML.h similarity index 86% rename from XML/include/XML/XML.h rename to XML/include/Poco/XML/XML.h index d073e39bc..bb3e4b703 100644 --- a/XML/include/XML/XML.h +++ b/XML/include/Poco/XML/XML.h @@ -1,7 +1,7 @@ // // XML.h // -// $Id: //poco/1.1.0/XML/include/XML/XML.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/XML/XML.h#1 $ // // Library: XML // Package: XML @@ -42,16 +42,7 @@ #define XML_XML_INCLUDED -#ifndef Foundation_Foundation_INCLUDED -#include "Foundation/Foundation.h" -#endif - - -// -// Macros to declare the namespace -// -#define XML_BEGIN namespace XML { -#define XML_END } +#include "Poco/Foundation.h" // @@ -62,7 +53,7 @@ // XML_API functions as being imported from a DLL, wheras this DLL sees symbols // defined with this macro as being exported. // -#if (defined(_WIN32) || defined(__CYGWIN__)) && defined(POCO_DLL) +#if defined(_WIN32) && defined(POCO_DLL) #if defined(XML_EXPORTS) #define XML_API __declspec(dllexport) #else diff --git a/XML/include/XML/XMLException.h b/XML/include/Poco/XML/XMLException.h similarity index 83% rename from XML/include/XML/XMLException.h rename to XML/include/Poco/XML/XMLException.h index 56cfd3d8a..eff57efd8 100644 --- a/XML/include/XML/XMLException.h +++ b/XML/include/Poco/XML/XMLException.h @@ -1,7 +1,7 @@ // // XMLException.h // -// $Id: //poco/1.1.0/XML/include/XML/XMLException.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/XML/XMLException.h#1 $ // // Library: XML // Package: XML @@ -40,23 +40,20 @@ #define XML_XMLException_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef Foundation_Exception_INCLUDED -#include "Foundation/Exception.h" -#endif +#include "Poco/XML/XML.h" +#include "Poco/Exception.h" -XML_BEGIN +namespace Poco { +namespace XML { -POCO_DECLARE_EXCEPTION(XML_API, XMLException, Foundation::RuntimeException) +POCO_DECLARE_EXCEPTION(XML_API, XMLException, Poco::RuntimeException) /// The base class for all XML-related exceptions like SAXException /// and DOMException. -XML_END +} } // namespace Poco::XML #endif // XML_XMLException_INCLUDED diff --git a/XML/include/XML/XMLStream.h b/XML/include/Poco/XML/XMLStream.h similarity index 89% rename from XML/include/XML/XMLStream.h rename to XML/include/Poco/XML/XMLStream.h index 04e81c4ca..017ca0c11 100644 --- a/XML/include/XML/XMLStream.h +++ b/XML/include/Poco/XML/XMLStream.h @@ -1,7 +1,7 @@ // // XMLStream.h // -// $Id: //poco/1.1.0/XML/include/XML/XMLStream.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/XML/XMLStream.h#1 $ // // Library: XML // Package: XML @@ -40,20 +40,13 @@ #define XML_XMLStream_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef STD_ISTREAM_INCLUDED +#include "Poco/XML/XML.h" #include -#define STD_ISTREAM_INCLUDED -#endif -#ifndef STD_OSTREAM_INCLUDED #include -#define STD_OSTREAM_INCLUDED -#endif -XML_BEGIN +namespace Poco { +namespace XML { // The byte input stream is always a narrow stream. @@ -94,7 +87,7 @@ typedef std::ostream XMLByteOutputStream; #endif -XML_END +} } // namespace Poco::XML #endif // XML_XMLStream_INCLUDED diff --git a/XML/include/XML/XMLString.h b/XML/include/Poco/XML/XMLString.h similarity index 92% rename from XML/include/XML/XMLString.h rename to XML/include/Poco/XML/XMLString.h index 64d3c9d5f..d54262a5b 100644 --- a/XML/include/XML/XMLString.h +++ b/XML/include/Poco/XML/XMLString.h @@ -1,7 +1,7 @@ // // XMLString.h // -// $Id: //poco/1.1.0/XML/include/XML/XMLString.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/XML/XMLString.h#1 $ // // Library: XML // Package: XML @@ -40,12 +40,11 @@ #define XML_XMLString_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif +#include "Poco/XML/XML.h" -XML_BEGIN +namespace Poco { +namespace XML { // @@ -100,7 +99,7 @@ XML_BEGIN #endif -XML_END +} } // namespace Poco::XML #endif // XML_XMLString_INCLUDED diff --git a/XML/include/XML/XMLWriter.h b/XML/include/Poco/XML/XMLWriter.h similarity index 88% rename from XML/include/XML/XMLWriter.h rename to XML/include/Poco/XML/XMLWriter.h index e38c236a5..50bc7698f 100644 --- a/XML/include/XML/XMLWriter.h +++ b/XML/include/Poco/XML/XMLWriter.h @@ -1,7 +1,7 @@ // // XMLWriter.h // -// $Id: //poco/1.1.0/XML/include/XML/XMLWriter.h#2 $ +// $Id: //poco/1.2/XML/include/Poco/XML/XMLWriter.h#1 $ // // Library: XML // Package: XML @@ -40,47 +40,22 @@ #define XML_XMLWriter_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef SAX_ContentHandler_INCLUDED -#include "SAX/ContentHandler.h" -#endif -#ifndef SAX_LexicalHandler_INCLUDED -#include "SAX/LexicalHandler.h" -#endif -#ifndef SAX_DTDHandler_INCLUDED -#include "SAX/DTDHandler.h" -#endif -#ifndef SAX_NamespaceSupport_INCLUDED -#include "SAX/NamespaceSupport.h" -#endif -#ifndef XML_XMLString_INCLUDED -#include "XML/XMLString.h" -#endif -#ifndef XML_XMLStream_INCLUDED -#include "XML/XMLStream.h" -#endif -#ifndef XML_Name_INCLUDED -#include "XML/Name.h" -#endif -#ifndef Foundation_TextEncoding_INCLUDED -#include "Foundation/TextEncoding.h" -#endif -#ifndef Foundation_StreamConverter_INCLUDED -#include "Foundation/StreamConverter.h" -#endif -#ifndef STD_VECTOR_INCLUDED +#include "Poco/XML/XML.h" +#include "Poco/SAX/ContentHandler.h" +#include "Poco/SAX/LexicalHandler.h" +#include "Poco/SAX/DTDHandler.h" +#include "Poco/SAX/NamespaceSupport.h" +#include "Poco/XML/XMLString.h" +#include "Poco/XML/XMLStream.h" +#include "Poco/XML/Name.h" +#include "Poco/TextEncoding.h" +#include "Poco/StreamConverter.h" #include -#define STD_VECTOR_INCLUDED -#endif -#ifndef STD_MAP_INCLUDED #include -#define STD_MAP_INCLUDED -#endif -XML_BEGIN +namespace Poco { +namespace XML { class Locator; @@ -120,14 +95,14 @@ public: /// /// The resulting stream will be UTF-8 encoded. - XMLWriter(XMLByteOutputStream& str, int options, const std::string& encodingName, Foundation::TextEncoding& textEncoding); + XMLWriter(XMLByteOutputStream& str, int options, const std::string& encodingName, Poco::TextEncoding& textEncoding); /// Creates the XMLWriter and sets the specified options. /// /// The encoding is reflected in the XML declaration. /// The caller is responsible for that the given encodingName matches with /// the given textEncoding. - XMLWriter(XMLByteOutputStream& str, int options, const std::string& encodingName, Foundation::TextEncoding* pTextEncoding); + XMLWriter(XMLByteOutputStream& str, int options, const std::string& encodingName, Poco::TextEncoding* pTextEncoding); /// Creates the XMLWriter and sets the specified options. /// /// The encoding is reflected in the XML declaration. @@ -313,9 +288,9 @@ private: }; typedef std::vector ElementStack; - Foundation::OutputStreamConverter* _pTextConverter; - Foundation::TextEncoding* _pInEncoding; - Foundation::TextEncoding* _pOutEncoding; + Poco::OutputStreamConverter* _pTextConverter; + Poco::TextEncoding* _pInEncoding; + Poco::TextEncoding* _pOutEncoding; int _options; std::string _encoding; std::string _newLine; @@ -350,7 +325,7 @@ private: }; -XML_END +} } // namespace Poco::XML #endif // XML_XMLWriter_INCLUDED diff --git a/XML/include/XML/expat.h b/XML/include/Poco/XML/expat.h similarity index 100% rename from XML/include/XML/expat.h rename to XML/include/Poco/XML/expat.h diff --git a/XML/include/XML/expat_external.h b/XML/include/Poco/XML/expat_external.h similarity index 100% rename from XML/include/XML/expat_external.h rename to XML/include/Poco/XML/expat_external.h diff --git a/XML/samples/DOMParser/DOMParser.vmsbuild b/XML/samples/DOMParser/DOMParser.vmsbuild index 568d016ab..02c589337 100644 --- a/XML/samples/DOMParser/DOMParser.vmsbuild +++ b/XML/samples/DOMParser/DOMParser.vmsbuild @@ -1,7 +1,7 @@ # # sample.vmsbuild # -# $Id: //poco/1.1.0/XML/samples/DOMParser/DOMParser.vmsbuild#1 $ +# $Id: //poco/1.2/XML/samples/DOMParser/DOMParser.vmsbuild#1 $ # EXE=DOMParser DOMParser diff --git a/XML/samples/DOMParser/Makefile b/XML/samples/DOMParser/Makefile index 0ef30b8e5..e25649397 100644 --- a/XML/samples/DOMParser/Makefile +++ b/XML/samples/DOMParser/Makefile @@ -1,7 +1,7 @@ # # Makefile # -# $Id: //poco/1.1.0/XML/samples/DOMParser/Makefile#1 $ +# $Id: //poco/1.2/XML/samples/DOMParser/Makefile#1 $ # # Makefile for Poco DOMParser # @@ -12,6 +12,6 @@ objects = DOMParser target = DOMParser target_version = 1 -target_libs = PocoFoundation PocoXML +target_libs = PocoXML PocoFoundation include $(POCO_BASE)/build/rules/exec diff --git a/XML/samples/DOMParser/src/DOMParser.cpp b/XML/samples/DOMParser/src/DOMParser.cpp index 911729663..fa5f5e085 100644 --- a/XML/samples/DOMParser/src/DOMParser.cpp +++ b/XML/samples/DOMParser/src/DOMParser.cpp @@ -1,7 +1,7 @@ // // DOMParser.cpp // -// $Id: //poco/1.1.0/XML/samples/DOMParser/src/DOMParser.cpp#2 $ +// $Id: //poco/1.2/XML/samples/DOMParser/src/DOMParser.cpp#1 $ // // This sample demonstrates the DOMParser, AutoPtr and // NodeIterator classes. @@ -33,24 +33,24 @@ // -#include "DOM/DOMParser.h" -#include "DOM/Document.h" -#include "DOM/NodeIterator.h" -#include "DOM/NodeFilter.h" -#include "DOM/AutoPtr.h" -#include "SAX/InputSource.h" -#include "Foundation/Exception.h" +#include "Poco/DOM/DOMParser.h" +#include "Poco/DOM/Document.h" +#include "Poco/DOM/NodeIterator.h" +#include "Poco/DOM/NodeFilter.h" +#include "Poco/DOM/AutoPtr.h" +#include "Poco/SAX/InputSource.h" +#include "Poco/Exception.h" #include -using XML::DOMParser; -using XML::InputSource; -using XML::Document; -using XML::NodeIterator; -using XML::NodeFilter; -using XML::Node; -using XML::AutoPtr; -using Foundation::Exception; +using Poco::XML::DOMParser; +using Poco::XML::InputSource; +using Poco::XML::Document; +using Poco::XML::NodeIterator; +using Poco::XML::NodeFilter; +using Poco::XML::Node; +using Poco::XML::AutoPtr; +using Poco::Exception; int main(int argc, char** argv) diff --git a/XML/samples/DOMWriter/DOMWriter.vmsbuild b/XML/samples/DOMWriter/DOMWriter.vmsbuild index 1722fd9c3..42d3b8645 100644 --- a/XML/samples/DOMWriter/DOMWriter.vmsbuild +++ b/XML/samples/DOMWriter/DOMWriter.vmsbuild @@ -1,7 +1,7 @@ # # sample.vmsbuild # -# $Id: //poco/1.1.0/XML/samples/DOMWriter/DOMWriter.vmsbuild#1 $ +# $Id: //poco/1.2/XML/samples/DOMWriter/DOMWriter.vmsbuild#1 $ # EXE=DOMWriter DOMWriter diff --git a/XML/samples/DOMWriter/Makefile b/XML/samples/DOMWriter/Makefile index cf9a46f62..d5fbe4bc7 100644 --- a/XML/samples/DOMWriter/Makefile +++ b/XML/samples/DOMWriter/Makefile @@ -1,7 +1,7 @@ # # Makefile # -# $Id: //poco/1.1.0/XML/samples/DOMWriter/Makefile#1 $ +# $Id: //poco/1.2/XML/samples/DOMWriter/Makefile#1 $ # # Makefile for Poco DOMWriter # @@ -12,6 +12,6 @@ objects = DOMWriter target = DOMWriter target_version = 1 -target_libs = PocoFoundation PocoXML +target_libs = PocoXML PocoFoundation include $(POCO_BASE)/build/rules/exec diff --git a/XML/samples/DOMWriter/src/DOMWriter.cpp b/XML/samples/DOMWriter/src/DOMWriter.cpp index 77c77bf6d..cee3347f0 100644 --- a/XML/samples/DOMWriter/src/DOMWriter.cpp +++ b/XML/samples/DOMWriter/src/DOMWriter.cpp @@ -1,7 +1,7 @@ // // DOMWriter.cpp // -// $Id: //poco/1.1.0/XML/samples/DOMWriter/src/DOMWriter.cpp#2 $ +// $Id: //poco/1.2/XML/samples/DOMWriter/src/DOMWriter.cpp#1 $ // // This sample demonstrates the DOMWriter class and how to // build DOM documents in memory. @@ -33,21 +33,21 @@ // -#include "DOM/Document.h" -#include "DOM/Element.h" -#include "DOM/Text.h" -#include "DOM/AutoPtr.h" -#include "DOM/DOMWriter.h" -#include "XML/XMLWriter.h" +#include "Poco/DOM/Document.h" +#include "Poco/DOM/Element.h" +#include "Poco/DOM/Text.h" +#include "Poco/DOM/AutoPtr.h" +#include "Poco/DOM/DOMWriter.h" +#include "Poco/XML/XMLWriter.h" #include -using XML::Document; -using XML::Element; -using XML::Text; -using XML::AutoPtr; -using XML::DOMWriter; -using XML::XMLWriter; +using Poco::XML::Document; +using Poco::XML::Element; +using Poco::XML::Text; +using Poco::XML::AutoPtr; +using Poco::XML::DOMWriter; +using Poco::XML::XMLWriter; int main(int argc, char** argv) diff --git a/XML/samples/Makefile b/XML/samples/Makefile index f6e9ad8fe..1948acba4 100644 --- a/XML/samples/Makefile +++ b/XML/samples/Makefile @@ -1,12 +1,14 @@ # # Makefile # -# $Id: //poco/1.1.0/XML/samples/Makefile#1 $ +# $Id: //poco/1.2/XML/samples/Makefile#1 $ # # Makefile for Poco XML Samples # -.DEFAULT all: +.PHONY: projects +clean all: projects +projects: $(MAKE) -C DOMParser $(MAKECMDGOALS) $(MAKE) -C DOMWriter $(MAKECMDGOALS) $(MAKE) -C PrettyPrint $(MAKECMDGOALS) diff --git a/XML/samples/PrettyPrint/Makefile b/XML/samples/PrettyPrint/Makefile index dd124ba19..aac8f55ca 100644 --- a/XML/samples/PrettyPrint/Makefile +++ b/XML/samples/PrettyPrint/Makefile @@ -1,7 +1,7 @@ # # Makefile # -# $Id: //poco/1.1.0/XML/samples/PrettyPrint/Makefile#1 $ +# $Id: //poco/1.2/XML/samples/PrettyPrint/Makefile#1 $ # # Makefile for Poco PrettyPrint # @@ -12,6 +12,6 @@ objects = PrettyPrint target = PrettyPrint target_version = 1 -target_libs = PocoFoundation PocoXML +target_libs = PocoXML PocoFoundation include $(POCO_BASE)/build/rules/exec diff --git a/XML/samples/PrettyPrint/PrettyPrint.vmsbuild b/XML/samples/PrettyPrint/PrettyPrint.vmsbuild index 68ae9d0b2..89ebf7039 100644 --- a/XML/samples/PrettyPrint/PrettyPrint.vmsbuild +++ b/XML/samples/PrettyPrint/PrettyPrint.vmsbuild @@ -1,7 +1,7 @@ # # sample.vmsbuild # -# $Id: //poco/1.1.0/XML/samples/PrettyPrint/PrettyPrint.vmsbuild#1 $ +# $Id: //poco/1.2/XML/samples/PrettyPrint/PrettyPrint.vmsbuild#1 $ # EXE=PrettyPrint PrettyPrint diff --git a/XML/samples/PrettyPrint/src/PrettyPrint.cpp b/XML/samples/PrettyPrint/src/PrettyPrint.cpp index 7308fc6e9..3d9f0f210 100644 --- a/XML/samples/PrettyPrint/src/PrettyPrint.cpp +++ b/XML/samples/PrettyPrint/src/PrettyPrint.cpp @@ -1,7 +1,7 @@ // // PrettyPrint.cpp // -// $Id: //poco/1.1.0/XML/samples/PrettyPrint/src/PrettyPrint.cpp#2 $ +// $Id: //poco/1.2/XML/samples/PrettyPrint/src/PrettyPrint.cpp#1 $ // // This sample demonstrates the SAXParser, WhitespaceFilter, // InputSource and XMLWriter classes. @@ -33,20 +33,20 @@ // -#include "SAX/SAXParser.h" -#include "SAX/WhitespaceFilter.h" -#include "SAX/InputSource.h" -#include "XML/XMLWriter.h" -#include "Foundation/Exception.h" +#include "Poco/SAX/SAXParser.h" +#include "Poco/SAX/WhitespaceFilter.h" +#include "Poco/SAX/InputSource.h" +#include "Poco/XML/XMLWriter.h" +#include "Poco/Exception.h" #include -using XML::SAXParser; -using XML::XMLReader; -using XML::WhitespaceFilter; -using XML::InputSource; -using XML::XMLWriter; -using Foundation::Exception; +using Poco::XML::SAXParser; +using Poco::XML::XMLReader; +using Poco::XML::WhitespaceFilter; +using Poco::XML::InputSource; +using Poco::XML::XMLWriter; +using Poco::Exception; int main(int argc, char** argv) @@ -61,7 +61,7 @@ int main(int argc, char** argv) filter.setContentHandler(&writer); filter.setDTDHandler(&writer); - filter.setProperty(XMLReader::PROPERTY_LEXICAL_HANDLER, static_cast(&writer)); + filter.setProperty(XMLReader::PROPERTY_LEXICAL_HANDLER, static_cast(&writer)); try { diff --git a/XML/samples/SAXParser/Makefile b/XML/samples/SAXParser/Makefile index a8a4a1fb1..6674a3844 100644 --- a/XML/samples/SAXParser/Makefile +++ b/XML/samples/SAXParser/Makefile @@ -1,7 +1,7 @@ # # Makefile # -# $Id: //poco/1.1.0/XML/samples/SAXParser/Makefile#1 $ +# $Id: //poco/1.2/XML/samples/SAXParser/Makefile#1 $ # # Makefile for Poco SAXParser # @@ -12,6 +12,6 @@ objects = SAXParser target = SAXParser target_version = 1 -target_libs = PocoFoundation PocoXML +target_libs = PocoXML PocoFoundation include $(POCO_BASE)/build/rules/exec diff --git a/XML/samples/SAXParser/SAXParser.vmsbuild b/XML/samples/SAXParser/SAXParser.vmsbuild index a5949f8f6..f2a71beaf 100644 --- a/XML/samples/SAXParser/SAXParser.vmsbuild +++ b/XML/samples/SAXParser/SAXParser.vmsbuild @@ -1,7 +1,7 @@ # # sample.vmsbuild # -# $Id: //poco/1.1.0/XML/samples/SAXParser/SAXParser.vmsbuild#1 $ +# $Id: //poco/1.2/XML/samples/SAXParser/SAXParser.vmsbuild#1 $ # EXE=SAXParser SAXParser diff --git a/XML/samples/SAXParser/src/SAXParser.cpp b/XML/samples/SAXParser/src/SAXParser.cpp index d2125befa..b3fa87d5e 100644 --- a/XML/samples/SAXParser/src/SAXParser.cpp +++ b/XML/samples/SAXParser/src/SAXParser.cpp @@ -1,7 +1,7 @@ // // SAXParser.cpp // -// $Id: //poco/1.1.0/XML/samples/SAXParser/src/SAXParser.cpp#2 $ +// $Id: //poco/1.2/XML/samples/SAXParser/src/SAXParser.cpp#1 $ // // This sample demonstrates the SAXParser class. // @@ -32,23 +32,23 @@ // -#include "SAX/SAXParser.h" -#include "SAX/ContentHandler.h" -#include "SAX/LexicalHandler.h" -#include "SAX/Attributes.h" -#include "SAX/Locator.h" -#include "Foundation/Exception.h" +#include "Poco/SAX/SAXParser.h" +#include "Poco/SAX/ContentHandler.h" +#include "Poco/SAX/LexicalHandler.h" +#include "Poco/SAX/Attributes.h" +#include "Poco/SAX/Locator.h" +#include "Poco/Exception.h" #include -using XML::SAXParser; -using XML::XMLReader; -using XML::XMLString; -using XML::XMLChar; -using XML::ContentHandler; -using XML::LexicalHandler; -using XML::Attributes; -using XML::Locator; +using Poco::XML::SAXParser; +using Poco::XML::XMLReader; +using Poco::XML::XMLString; +using Poco::XML::XMLChar; +using Poco::XML::ContentHandler; +using Poco::XML::LexicalHandler; +using Poco::XML::Attributes; +using Poco::XML::Locator; class MyHandler: public ContentHandler, public LexicalHandler @@ -205,7 +205,7 @@ int main(int argc, char** argv) { parser.parse(argv[1]); } - catch (Foundation::Exception& e) + catch (Poco::Exception& e) { std::cerr << e.displayText() << std::endl; return 2; diff --git a/XML/src/AbstractContainerNode.cpp b/XML/src/AbstractContainerNode.cpp index a301b07fa..129a1f342 100644 --- a/XML/src/AbstractContainerNode.cpp +++ b/XML/src/AbstractContainerNode.cpp @@ -1,7 +1,7 @@ // // AbstractContainerNode.cpp // -// $Id: //poco/1.1.0/XML/src/AbstractContainerNode.cpp#2 $ +// $Id: //poco/1.2/XML/src/AbstractContainerNode.cpp#1 $ // // Library: XML // Package: DOM @@ -34,12 +34,13 @@ // -#include "DOM/AbstractContainerNode.h" -#include "DOM/Document.h" -#include "DOM/DOMException.h" +#include "Poco/DOM/AbstractContainerNode.h" +#include "Poco/DOM/Document.h" +#include "Poco/DOM/DOMException.h" -XML_BEGIN +namespace Poco { +namespace XML { AbstractContainerNode::AbstractContainerNode(Document* pOwnerDocument): @@ -321,4 +322,4 @@ bool AbstractContainerNode::hasAttributes() const } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/AbstractNode.cpp b/XML/src/AbstractNode.cpp index 1547543e1..7411d7a43 100644 --- a/XML/src/AbstractNode.cpp +++ b/XML/src/AbstractNode.cpp @@ -1,7 +1,7 @@ // // AbstractNode.cpp // -// $Id: //poco/1.1.0/XML/src/AbstractNode.cpp#2 $ +// $Id: //poco/1.2/XML/src/AbstractNode.cpp#1 $ // // Library: XML // Package: DOM @@ -34,19 +34,20 @@ // -#include "DOM/AbstractNode.h" -#include "DOM/Document.h" -#include "DOM/ChildNodesList.h" -#include "DOM/EventDispatcher.h" -#include "DOM/DOMException.h" -#include "DOM/EventException.h" -#include "DOM/DOMImplementation.h" -#include "DOM/Attr.h" -#include "XML/Name.h" -#include "DOM/AutoPtr.h" +#include "Poco/DOM/AbstractNode.h" +#include "Poco/DOM/Document.h" +#include "Poco/DOM/ChildNodesList.h" +#include "Poco/DOM/EventDispatcher.h" +#include "Poco/DOM/DOMException.h" +#include "Poco/DOM/EventException.h" +#include "Poco/DOM/DOMImplementation.h" +#include "Poco/DOM/Attr.h" +#include "Poco/XML/Name.h" +#include "Poco/DOM/AutoPtr.h" -XML_BEGIN +namespace Poco { +namespace XML { const XMLString AbstractNode::NODE_NAME = toXMLString("#node"); @@ -232,14 +233,7 @@ bool AbstractNode::hasAttributes() const XMLString AbstractNode::innerText() const { - XMLString result = nodeValue(); - Node* pChild = firstChild(); - while (pChild) - { - result.append(pChild->innerText()); - pChild = pChild->nextSibling(); - } - return result; + return EMPTY_STRING; } @@ -380,4 +374,4 @@ void AbstractNode::setOwnerDocument(Document* pOwnerDocument) } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/Attr.cpp b/XML/src/Attr.cpp index 2349553f8..2d38168b8 100644 --- a/XML/src/Attr.cpp +++ b/XML/src/Attr.cpp @@ -1,7 +1,7 @@ // // Attr.cpp // -// $Id: //poco/1.1.0/XML/src/Attr.cpp#2 $ +// $Id: //poco/1.2/XML/src/Attr.cpp#1 $ // // Library: XML // Package: DOM @@ -34,12 +34,13 @@ // -#include "DOM/Attr.h" -#include "DOM/Document.h" -#include "XML/NamePool.h" +#include "Poco/DOM/Attr.h" +#include "Poco/DOM/Document.h" +#include "Poco/XML/NamePool.h" -XML_BEGIN +namespace Poco { +namespace XML { Attr::Attr(Document* pOwnerDocument, Element* pOwnerElement, const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname, const XMLString& value, bool specified): @@ -139,10 +140,16 @@ const XMLString& Attr::localName() const } +XMLString Attr::innerText() const +{ + return nodeValue(); +} + + Node* Attr::copyNode(bool deep, Document* pOwnerDocument) const { return new Attr(pOwnerDocument, *this); } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/AttrMap.cpp b/XML/src/AttrMap.cpp index b7536c299..440c3600e 100644 --- a/XML/src/AttrMap.cpp +++ b/XML/src/AttrMap.cpp @@ -1,7 +1,7 @@ // // AttrMap.cpp // -// $Id: //poco/1.1.0/XML/src/AttrMap.cpp#2 $ +// $Id: //poco/1.2/XML/src/AttrMap.cpp#1 $ // // Library: XML // Package: DOM @@ -34,14 +34,15 @@ // -#include "DOM/AttrMap.h" -#include "DOM/Attr.h" -#include "DOM/Element.h" -#include "DOM/Document.h" -#include "DOM/DOMException.h" +#include "Poco/DOM/AttrMap.h" +#include "Poco/DOM/Attr.h" +#include "Poco/DOM/Element.h" +#include "Poco/DOM/Document.h" +#include "Poco/DOM/DOMException.h" -XML_BEGIN +namespace Poco { +namespace XML { AttrMap::AttrMap(Element* pElement): @@ -140,5 +141,5 @@ void AttrMap::autoRelease() } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/Attributes.cpp b/XML/src/Attributes.cpp index dbc11a1ff..7be44edc8 100644 --- a/XML/src/Attributes.cpp +++ b/XML/src/Attributes.cpp @@ -1,7 +1,7 @@ // // Attributes.cpp // -// $Id: //poco/1.1.0/XML/src/Attributes.cpp#2 $ +// $Id: //poco/1.2/XML/src/Attributes.cpp#1 $ // // Library: XML // Package: SAX @@ -34,10 +34,11 @@ // -#include "SAX/Attributes.h" +#include "Poco/SAX/Attributes.h" -XML_BEGIN +namespace Poco { +namespace XML { Attributes::~Attributes() @@ -45,4 +46,4 @@ Attributes::~Attributes() } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/AttributesImpl.cpp b/XML/src/AttributesImpl.cpp index b0feabd6f..1d69b9ddf 100644 --- a/XML/src/AttributesImpl.cpp +++ b/XML/src/AttributesImpl.cpp @@ -1,7 +1,7 @@ // // AttributesImpl.cpp // -// $Id: //poco/1.1.0/XML/src/AttributesImpl.cpp#2 $ +// $Id: //poco/1.2/XML/src/AttributesImpl.cpp#1 $ // // Library: XML // Package: SAX @@ -34,10 +34,11 @@ // -#include "SAX/AttributesImpl.h" +#include "Poco/SAX/AttributesImpl.h" -XML_BEGIN +namespace Poco { +namespace XML { AttributesImpl::AttributesImpl() @@ -51,6 +52,12 @@ AttributesImpl::AttributesImpl(const Attributes& attributes) } +AttributesImpl::AttributesImpl(const AttributesImpl& attributes) +{ + setAttributes(attributes); +} + + AttributesImpl::~AttributesImpl() { } @@ -389,4 +396,4 @@ AttributesImpl::Attribute* AttributesImpl::find(const XMLString& namespaceURI, c } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/CDATASection.cpp b/XML/src/CDATASection.cpp index 4ea6a0f1c..cccfeb390 100644 --- a/XML/src/CDATASection.cpp +++ b/XML/src/CDATASection.cpp @@ -1,7 +1,7 @@ // // CDATASection.cpp // -// $Id: //poco/1.1.0/XML/src/CDATASection.cpp#2 $ +// $Id: //poco/1.2/XML/src/CDATASection.cpp#1 $ // // Library: XML // Package: DOM @@ -34,12 +34,13 @@ // -#include "DOM/CDATASection.h" -#include "DOM/Document.h" -#include "DOM/DOMException.h" +#include "Poco/DOM/CDATASection.h" +#include "Poco/DOM/Document.h" +#include "Poco/DOM/DOMException.h" -XML_BEGIN +namespace Poco { +namespace XML { const XMLString CDATASection::NODE_NAME = toXMLString("#cdata-section"); @@ -92,4 +93,4 @@ Node* CDATASection::copyNode(bool deep, Document* pOwnerDocument) const } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/CharacterData.cpp b/XML/src/CharacterData.cpp index 0ca25dc22..77b630fbf 100644 --- a/XML/src/CharacterData.cpp +++ b/XML/src/CharacterData.cpp @@ -1,7 +1,7 @@ // // CharacterData.cpp // -// $Id: //poco/1.1.0/XML/src/CharacterData.cpp#2 $ +// $Id: //poco/1.2/XML/src/CharacterData.cpp#1 $ // // Library: XML // Package: DOM @@ -34,12 +34,13 @@ // -#include "DOM/CharacterData.h" -#include "DOM/DOMException.h" -#include "Foundation/String.h" +#include "Poco/DOM/CharacterData.h" +#include "Poco/DOM/DOMException.h" +#include "Poco/String.h" -XML_BEGIN +namespace Poco { +namespace XML { CharacterData::CharacterData(Document* pOwnerDocument, const XMLString& data): @@ -133,8 +134,8 @@ void CharacterData::setNodeValue(const XMLString& value) XMLString CharacterData::trimmedData() const { - return Foundation::trim(_data); + return Poco::trim(_data); } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/ChildNodesList.cpp b/XML/src/ChildNodesList.cpp index 4a68ff97b..4938d040e 100644 --- a/XML/src/ChildNodesList.cpp +++ b/XML/src/ChildNodesList.cpp @@ -1,7 +1,7 @@ // // ChildNodesList.cpp // -// $Id: //poco/1.1.0/XML/src/ChildNodesList.cpp#2 $ +// $Id: //poco/1.2/XML/src/ChildNodesList.cpp#1 $ // // Library: XML // Package: DOM @@ -34,12 +34,13 @@ // -#include "DOM/ChildNodesList.h" -#include "DOM/Node.h" -#include "DOM/Document.h" +#include "Poco/DOM/ChildNodesList.h" +#include "Poco/DOM/Node.h" +#include "Poco/DOM/Document.h" -XML_BEGIN +namespace Poco { +namespace XML { ChildNodesList::ChildNodesList(const Node* pParent): @@ -88,4 +89,4 @@ void ChildNodesList::autoRelease() } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/Comment.cpp b/XML/src/Comment.cpp index 4daab7ffd..2a95e47ef 100644 --- a/XML/src/Comment.cpp +++ b/XML/src/Comment.cpp @@ -1,7 +1,7 @@ // // Comment.cpp // -// $Id: //poco/1.1.0/XML/src/Comment.cpp#2 $ +// $Id: //poco/1.2/XML/src/Comment.cpp#1 $ // // Library: XML // Package: DOM @@ -34,10 +34,11 @@ // -#include "DOM/Comment.h" +#include "Poco/DOM/Comment.h" -XML_BEGIN +namespace Poco { +namespace XML { const XMLString Comment::NODE_NAME = toXMLString("#comment"); @@ -78,4 +79,4 @@ Node* Comment::copyNode(bool deep, Document* pOwnerDocument) const } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/ContentHandler.cpp b/XML/src/ContentHandler.cpp index e8b20607a..19677f465 100644 --- a/XML/src/ContentHandler.cpp +++ b/XML/src/ContentHandler.cpp @@ -1,7 +1,7 @@ // // ContentHandler.cpp // -// $Id: //poco/1.1.0/XML/src/ContentHandler.cpp#2 $ +// $Id: //poco/1.2/XML/src/ContentHandler.cpp#1 $ // // Library: XML // Package: SAX @@ -34,10 +34,11 @@ // -#include "SAX/ContentHandler.h" +#include "Poco/SAX/ContentHandler.h" -XML_BEGIN +namespace Poco { +namespace XML { ContentHandler::~ContentHandler() @@ -45,4 +46,4 @@ ContentHandler::~ContentHandler() } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/DOMBuilder.cpp b/XML/src/DOMBuilder.cpp index 37cfb3332..b07c9b936 100644 --- a/XML/src/DOMBuilder.cpp +++ b/XML/src/DOMBuilder.cpp @@ -1,7 +1,7 @@ // // DOMBuilder.cpp // -// $Id: //poco/1.1.0/XML/src/DOMBuilder.cpp#2 $ +// $Id: //poco/1.2/XML/src/DOMBuilder.cpp#1 $ // // Library: XML // Package: DOM @@ -34,25 +34,26 @@ // -#include "DOM/DOMBuilder.h" -#include "DOM/Document.h" -#include "DOM/DocumentType.h" -#include "DOM/CharacterData.h" -#include "DOM/Text.h" -#include "DOM/Comment.h" -#include "DOM/CDATASection.h" -#include "DOM/Element.h" -#include "DOM/Attr.h" -#include "DOM/Entity.h" -#include "DOM/EntityReference.h" -#include "DOM/Notation.h" -#include "DOM/ProcessingInstruction.h" -#include "DOM/AutoPtr.h" -#include "SAX/XMLReader.h" -#include "SAX/AttributesImpl.h" +#include "Poco/DOM/DOMBuilder.h" +#include "Poco/DOM/Document.h" +#include "Poco/DOM/DocumentType.h" +#include "Poco/DOM/CharacterData.h" +#include "Poco/DOM/Text.h" +#include "Poco/DOM/Comment.h" +#include "Poco/DOM/CDATASection.h" +#include "Poco/DOM/Element.h" +#include "Poco/DOM/Attr.h" +#include "Poco/DOM/Entity.h" +#include "Poco/DOM/EntityReference.h" +#include "Poco/DOM/Notation.h" +#include "Poco/DOM/ProcessingInstruction.h" +#include "Poco/DOM/AutoPtr.h" +#include "Poco/SAX/XMLReader.h" +#include "Poco/SAX/AttributesImpl.h" -XML_BEGIN +namespace Poco { +namespace XML { const XMLString DOMBuilder::EMPTY_STRING; @@ -310,4 +311,4 @@ void DOMBuilder::comment(const XMLChar ch[], int start, int length) } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/DOMException.cpp b/XML/src/DOMException.cpp index 472754bbf..6cea3face 100644 --- a/XML/src/DOMException.cpp +++ b/XML/src/DOMException.cpp @@ -1,7 +1,7 @@ // // DOMException.cpp // -// $Id: //poco/1.1.0/XML/src/DOMException.cpp#2 $ +// $Id: //poco/1.2/XML/src/DOMException.cpp#1 $ // // Library: XML // Package: DOM @@ -34,11 +34,12 @@ // -#include "DOM/DOMException.h" +#include "Poco/DOM/DOMException.h" #include -XML_BEGIN +namespace Poco { +namespace XML { const std::string DOMException::MESSAGES[_NUMBER_OF_MESSAGES] = @@ -104,12 +105,18 @@ const char* DOMException::className() const throw() } -Foundation::Exception* DOMException::clone() const +Poco::Exception* DOMException::clone() const { return new DOMException(*this); } +void DOMException::rethrow() const +{ + throw *this; +} + + const std::string& DOMException::message(unsigned short code) { if (code >= 1 && code < _NUMBER_OF_MESSAGES) @@ -119,4 +126,4 @@ const std::string& DOMException::message(unsigned short code) } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/DOMImplementation.cpp b/XML/src/DOMImplementation.cpp index 2dc9b2a1b..67d8a2a89 100644 --- a/XML/src/DOMImplementation.cpp +++ b/XML/src/DOMImplementation.cpp @@ -1,7 +1,7 @@ // // DOMImplementation.cpp // -// $Id: //poco/1.1.0/XML/src/DOMImplementation.cpp#2 $ +// $Id: //poco/1.2/XML/src/DOMImplementation.cpp#1 $ // // Library: XML // Package: DOM @@ -34,15 +34,16 @@ // -#include "DOM/DOMImplementation.h" -#include "DOM/DocumentType.h" -#include "DOM/Document.h" -#include "DOM/Element.h" -#include "Foundation/String.h" -#include "Foundation/SingletonHolder.h" +#include "Poco/DOM/DOMImplementation.h" +#include "Poco/DOM/DocumentType.h" +#include "Poco/DOM/Document.h" +#include "Poco/DOM/Element.h" +#include "Poco/String.h" +#include "Poco/SingletonHolder.h" -XML_BEGIN +namespace Poco { +namespace XML { const XMLString DOMImplementation::FEATURE_XML = toXMLString("xml"); @@ -64,7 +65,7 @@ DOMImplementation::~DOMImplementation() bool DOMImplementation::hasFeature(const XMLString& feature, const XMLString& version) const { - XMLString lcFeature = Foundation::toLower(feature); + XMLString lcFeature = Poco::toLower(feature); return lcFeature == FEATURE_XML && version == "1.0" || lcFeature == FEATURE_CORE && version == "2.0" || lcFeature == FEATURE_EVENTS && version == "2.0" || @@ -92,9 +93,9 @@ Document* DOMImplementation::createDocument(const XMLString& namespaceURI, const const DOMImplementation& DOMImplementation::instance() { - static Foundation::SingletonHolder sh; + static Poco::SingletonHolder sh; return *sh.get(); } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/DOMObject.cpp b/XML/src/DOMObject.cpp index d3332627a..57c4e1624 100644 --- a/XML/src/DOMObject.cpp +++ b/XML/src/DOMObject.cpp @@ -1,7 +1,7 @@ // // DOMObject.cpp // -// $Id: //poco/1.1.0/XML/src/DOMObject.cpp#2 $ +// $Id: //poco/1.2/XML/src/DOMObject.cpp#1 $ // // Library: XML // Package: DOM @@ -34,10 +34,11 @@ // -#include "DOM/DOMObject.h" +#include "Poco/DOM/DOMObject.h" -XML_BEGIN +namespace Poco { +namespace XML { DOMObject::DOMObject(): _rc(1) @@ -50,4 +51,4 @@ DOMObject::~DOMObject() } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/DOMParser.cpp b/XML/src/DOMParser.cpp index e19d736a4..bb431f7fc 100644 --- a/XML/src/DOMParser.cpp +++ b/XML/src/DOMParser.cpp @@ -1,7 +1,7 @@ // // DOMParser.cpp // -// $Id: //poco/1.1.0/XML/src/DOMParser.cpp#2 $ +// $Id: //poco/1.2/XML/src/DOMParser.cpp#1 $ // // Library: XML // Package: DOM @@ -34,15 +34,16 @@ // -#include "DOM/DOMParser.h" -#include "DOM/DOMBuilder.h" -#include "SAX/WhitespaceFilter.h" -#include "SAX/InputSource.h" -#include "XML/NamePool.h" +#include "Poco/DOM/DOMParser.h" +#include "Poco/DOM/DOMBuilder.h" +#include "Poco/SAX/WhitespaceFilter.h" +#include "Poco/SAX/InputSource.h" +#include "Poco/XML/NamePool.h" #include -XML_BEGIN +namespace Poco { +namespace XML { const XMLString DOMParser::FEATURE_WHITESPACE = toXMLString("http://www.appinf.com/features/no-whitespace-in-element-content"); @@ -74,7 +75,7 @@ const XMLString& DOMParser::getEncoding() const } -void DOMParser::addEncoding(const XMLString& name, Foundation::TextEncoding* pEncoding) +void DOMParser::addEncoding(const XMLString& name, Poco::TextEncoding* pEncoding) { _saxParser.addEncoding(name, pEncoding); } @@ -150,4 +151,4 @@ void DOMParser::setEntityResolver(EntityResolver* pEntityResolver) } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/DOMSerializer.cpp b/XML/src/DOMSerializer.cpp index 38f04d1c8..32f374972 100644 --- a/XML/src/DOMSerializer.cpp +++ b/XML/src/DOMSerializer.cpp @@ -1,7 +1,7 @@ // // DOMSerializer.cpp // -// $Id: //poco/1.1.0/XML/src/DOMSerializer.cpp#2 $ +// $Id: //poco/1.2/XML/src/DOMSerializer.cpp#1 $ // // Library: XML // Package: DOM @@ -34,30 +34,31 @@ // -#include "DOM/DOMSerializer.h" -#include "DOM/Document.h" -#include "DOM/DocumentType.h" -#include "DOM/DocumentFragment.h" -#include "DOM/Element.h" -#include "DOM/Attr.h" -#include "DOM/Text.h" -#include "DOM/CDATASection.h" -#include "DOM/Comment.h" -#include "DOM/ProcessingInstruction.h" -#include "DOM/Entity.h" -#include "DOM/Notation.h" -#include "DOM/NamedNodeMap.h" -#include "DOM/AutoPtr.h" -#include "SAX/EntityResolver.h" -#include "SAX/DTDHandler.h" -#include "SAX/ContentHandler.h" -#include "SAX/LexicalHandler.h" -#include "SAX/AttributesImpl.h" -#include "SAX/ErrorHandler.h" -#include "SAX/SAXException.h" +#include "Poco/DOM/DOMSerializer.h" +#include "Poco/DOM/Document.h" +#include "Poco/DOM/DocumentType.h" +#include "Poco/DOM/DocumentFragment.h" +#include "Poco/DOM/Element.h" +#include "Poco/DOM/Attr.h" +#include "Poco/DOM/Text.h" +#include "Poco/DOM/CDATASection.h" +#include "Poco/DOM/Comment.h" +#include "Poco/DOM/ProcessingInstruction.h" +#include "Poco/DOM/Entity.h" +#include "Poco/DOM/Notation.h" +#include "Poco/DOM/NamedNodeMap.h" +#include "Poco/DOM/AutoPtr.h" +#include "Poco/SAX/EntityResolver.h" +#include "Poco/SAX/DTDHandler.h" +#include "Poco/SAX/ContentHandler.h" +#include "Poco/SAX/LexicalHandler.h" +#include "Poco/SAX/AttributesImpl.h" +#include "Poco/SAX/ErrorHandler.h" +#include "Poco/SAX/SAXException.h" -XML_BEGIN +namespace Poco { +namespace XML { const XMLString DOMSerializer::CDATA = toXMLString("CDATA"); @@ -335,4 +336,4 @@ void DOMSerializer::handleEntity(const Entity* pEntity) const } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/DOMWriter.cpp b/XML/src/DOMWriter.cpp index 48ca141de..682ba97d2 100644 --- a/XML/src/DOMWriter.cpp +++ b/XML/src/DOMWriter.cpp @@ -1,7 +1,7 @@ // // DOMWriter.cpp // -// $Id: //poco/1.1.0/XML/src/DOMWriter.cpp#2 $ +// $Id: //poco/1.2/XML/src/DOMWriter.cpp#1 $ // // Library: XML // Package: DOM @@ -35,19 +35,20 @@ -#include "DOM/DOMWriter.h" -#include "XML/XMLWriter.h" -#include "DOM/Document.h" -#include "DOM/DocumentFragment.h" -#include "DOM/DocumentType.h" -#include "DOM/DOMException.h" -#include "DOM/DOMSerializer.h" -#include "SAX/LexicalHandler.h" -#include "XML/XMLException.h" +#include "Poco/DOM/DOMWriter.h" +#include "Poco/XML/XMLWriter.h" +#include "Poco/DOM/Document.h" +#include "Poco/DOM/DocumentFragment.h" +#include "Poco/DOM/DocumentType.h" +#include "Poco/DOM/DOMException.h" +#include "Poco/DOM/DOMSerializer.h" +#include "Poco/SAX/LexicalHandler.h" +#include "Poco/XML/XMLException.h" #include -XML_BEGIN +namespace Poco { +namespace XML { DOMWriter::DOMWriter(): @@ -62,7 +63,7 @@ DOMWriter::~DOMWriter() } -void DOMWriter::setEncoding(const XMLString& encodingName, Foundation::TextEncoding& textEncoding) +void DOMWriter::setEncoding(const XMLString& encodingName, Poco::TextEncoding& textEncoding) { _encodingName = encodingName; _pTextEncoding = &textEncoding; @@ -106,9 +107,9 @@ void DOMWriter::writeNode(const XMLString& systemId, const Node* pNode) if (ostr.good()) writeNode(ostr, pNode); else - throw Foundation::CreateFileException(systemId); + throw Poco::CreateFileException(systemId); } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/DTDHandler.cpp b/XML/src/DTDHandler.cpp index e88259e91..4b8f9c7a9 100644 --- a/XML/src/DTDHandler.cpp +++ b/XML/src/DTDHandler.cpp @@ -1,7 +1,7 @@ // // DTDHandler.cpp // -// $Id: //poco/1.1.0/XML/src/DTDHandler.cpp#2 $ +// $Id: //poco/1.2/XML/src/DTDHandler.cpp#1 $ // // Library: XML // Package: SAX @@ -34,10 +34,11 @@ // -#include "SAX/DTDHandler.h" +#include "Poco/SAX/DTDHandler.h" -XML_BEGIN +namespace Poco { +namespace XML { DTDHandler::~DTDHandler() @@ -45,4 +46,4 @@ DTDHandler::~DTDHandler() } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/DTDMap.cpp b/XML/src/DTDMap.cpp index eaa56f7b0..1fd8b9a32 100644 --- a/XML/src/DTDMap.cpp +++ b/XML/src/DTDMap.cpp @@ -1,7 +1,7 @@ // // DTDMap.cpp // -// $Id: //poco/1.1.0/XML/src/DTDMap.cpp#2 $ +// $Id: //poco/1.2/XML/src/DTDMap.cpp#1 $ // // Library: XML // Package: DOM @@ -34,13 +34,14 @@ // -#include "DOM/DTDMap.h" -#include "DOM/DocumentType.h" -#include "DOM/Document.h" -#include "DOM/DOMException.h" +#include "Poco/DOM/DTDMap.h" +#include "Poco/DOM/DocumentType.h" +#include "Poco/DOM/Document.h" +#include "Poco/DOM/DOMException.h" -XML_BEGIN +namespace Poco { +namespace XML { DTDMap::DTDMap(const DocumentType* pDocumentType, unsigned short type): @@ -135,4 +136,4 @@ void DTDMap::autoRelease() } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/DeclHandler.cpp b/XML/src/DeclHandler.cpp index e9675ea5a..53acd6107 100644 --- a/XML/src/DeclHandler.cpp +++ b/XML/src/DeclHandler.cpp @@ -1,7 +1,7 @@ // // DeclHandler.cpp // -// $Id: //poco/1.1.0/XML/src/DeclHandler.cpp#2 $ +// $Id: //poco/1.2/XML/src/DeclHandler.cpp#1 $ // // Library: XML // Package: SAX @@ -34,10 +34,11 @@ // -#include "SAX/DeclHandler.h" +#include "Poco/SAX/DeclHandler.h" -XML_BEGIN +namespace Poco { +namespace XML { DeclHandler::~DeclHandler() @@ -45,4 +46,4 @@ DeclHandler::~DeclHandler() } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/DefaultHandler.cpp b/XML/src/DefaultHandler.cpp index 01e2d2835..afd5efebf 100644 --- a/XML/src/DefaultHandler.cpp +++ b/XML/src/DefaultHandler.cpp @@ -1,7 +1,7 @@ // // DefaultHandler.cpp // -// $Id: //poco/1.1.0/XML/src/DefaultHandler.cpp#2 $ +// $Id: //poco/1.2/XML/src/DefaultHandler.cpp#1 $ // // Library: XML // Package: SAX @@ -34,10 +34,11 @@ // -#include "SAX/DefaultHandler.h" +#include "Poco/SAX/DefaultHandler.h" -XML_BEGIN +namespace Poco { +namespace XML { DefaultHandler::DefaultHandler() @@ -141,4 +142,4 @@ void DefaultHandler::fatalError(const SAXException& exc) } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/Document.cpp b/XML/src/Document.cpp index 0f39f8bea..4f0ed9633 100644 --- a/XML/src/Document.cpp +++ b/XML/src/Document.cpp @@ -1,7 +1,7 @@ // // Document.cpp // -// $Id: //poco/1.1.0/XML/src/Document.cpp#2 $ +// $Id: //poco/1.2/XML/src/Document.cpp#1 $ // // Library: XML // Package: DOM @@ -34,26 +34,27 @@ // -#include "DOM/Document.h" -#include "DOM/DocumentType.h" -#include "DOM/DOMImplementation.h" -#include "DOM/Element.h" -#include "DOM/Attr.h" -#include "DOM/DocumentFragment.h" -#include "DOM/Text.h" -#include "DOM/Comment.h" -#include "DOM/CDATASection.h" -#include "DOM/ProcessingInstruction.h" -#include "DOM/EntityReference.h" -#include "DOM/DOMException.h" -#include "DOM/ElementsByTagNameList.h" -#include "DOM/Entity.h" -#include "DOM/Notation.h" -#include "XML/Name.h" -#include "XML/NamePool.h" +#include "Poco/DOM/Document.h" +#include "Poco/DOM/DocumentType.h" +#include "Poco/DOM/DOMImplementation.h" +#include "Poco/DOM/Element.h" +#include "Poco/DOM/Attr.h" +#include "Poco/DOM/DocumentFragment.h" +#include "Poco/DOM/Text.h" +#include "Poco/DOM/Comment.h" +#include "Poco/DOM/CDATASection.h" +#include "Poco/DOM/ProcessingInstruction.h" +#include "Poco/DOM/EntityReference.h" +#include "Poco/DOM/DOMException.h" +#include "Poco/DOM/ElementsByTagNameList.h" +#include "Poco/DOM/Entity.h" +#include "Poco/DOM/Notation.h" +#include "Poco/XML/Name.h" +#include "Poco/XML/NamePool.h" -XML_BEGIN +namespace Poco { +namespace XML { const XMLString Document::NODE_NAME = toXMLString("#document"); @@ -305,4 +306,4 @@ Notation* Document::createNotation(const XMLString& name, const XMLString& publi } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/DocumentEvent.cpp b/XML/src/DocumentEvent.cpp index e6de8f040..480363c79 100644 --- a/XML/src/DocumentEvent.cpp +++ b/XML/src/DocumentEvent.cpp @@ -1,7 +1,7 @@ // // DocumentEvent.cpp // -// $Id: //poco/1.1.0/XML/src/DocumentEvent.cpp#2 $ +// $Id: //poco/1.2/XML/src/DocumentEvent.cpp#1 $ // // Library: XML // Package: DOM @@ -34,10 +34,11 @@ // -#include "DOM/DocumentEvent.h" +#include "Poco/DOM/DocumentEvent.h" -XML_BEGIN +namespace Poco { +namespace XML { DocumentEvent::~DocumentEvent() @@ -45,4 +46,4 @@ DocumentEvent::~DocumentEvent() } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/DocumentFragment.cpp b/XML/src/DocumentFragment.cpp index 6ab29fc37..1d6f67fbb 100644 --- a/XML/src/DocumentFragment.cpp +++ b/XML/src/DocumentFragment.cpp @@ -1,7 +1,7 @@ // // DocumentFragment.cpp // -// $Id: //poco/1.1.0/XML/src/DocumentFragment.cpp#2 $ +// $Id: //poco/1.2/XML/src/DocumentFragment.cpp#1 $ // // Library: XML // Package: DOM @@ -34,10 +34,11 @@ // -#include "DOM/DocumentFragment.h" +#include "Poco/DOM/DocumentFragment.h" -XML_BEGIN +namespace Poco { +namespace XML { const XMLString DocumentFragment::NODE_NAME = toXMLString("#document-fragment"); @@ -88,4 +89,4 @@ Node* DocumentFragment::copyNode(bool deep, Document* pOwnerDocument) const } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/DocumentType.cpp b/XML/src/DocumentType.cpp index 89ab70069..bfbac96f2 100644 --- a/XML/src/DocumentType.cpp +++ b/XML/src/DocumentType.cpp @@ -1,7 +1,7 @@ // // DocumentType.cpp // -// $Id: //poco/1.1.0/XML/src/DocumentType.cpp#2 $ +// $Id: //poco/1.2/XML/src/DocumentType.cpp#1 $ // // Library: XML // Package: DOM @@ -34,13 +34,14 @@ // -#include "DOM/DocumentType.h" -#include "DOM/Document.h" -#include "DOM/DTDMap.h" -#include "DOM/DOMException.h" +#include "Poco/DOM/DocumentType.h" +#include "Poco/DOM/Document.h" +#include "Poco/DOM/DTDMap.h" +#include "Poco/DOM/DOMException.h" -XML_BEGIN +namespace Poco { +namespace XML { DocumentType::DocumentType(Document* pOwner, const XMLString& name, const XMLString& publicId, const XMLString& systemId): @@ -102,4 +103,4 @@ Node* DocumentType::copyNode(bool deep, Document* pOwnerDocument) const } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/Element.cpp b/XML/src/Element.cpp index 255d50e99..6d68fa3ed 100644 --- a/XML/src/Element.cpp +++ b/XML/src/Element.cpp @@ -1,7 +1,7 @@ // // Element.cpp // -// $Id: //poco/1.1.0/XML/src/Element.cpp#2 $ +// $Id: //poco/1.2/XML/src/Element.cpp#1 $ // // Library: XML // Package: DOM @@ -34,16 +34,17 @@ // -#include "DOM/Element.h" -#include "DOM/Document.h" -#include "DOM/Attr.h" -#include "DOM/DOMException.h" -#include "DOM/ElementsByTagNameList.h" -#include "DOM/Text.h" -#include "DOM/AttrMap.h" +#include "Poco/DOM/Element.h" +#include "Poco/DOM/Document.h" +#include "Poco/DOM/Attr.h" +#include "Poco/DOM/DOMException.h" +#include "Poco/DOM/ElementsByTagNameList.h" +#include "Poco/DOM/Text.h" +#include "Poco/DOM/AttrMap.h" -XML_BEGIN +namespace Poco { +namespace XML { Element::Element(Document* pOwnerDocument, const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname): @@ -332,6 +333,19 @@ bool Element::hasAttributes() const } +XMLString Element::innerText() const +{ + XMLString result; + Node* pChild = firstChild(); + while (pChild) + { + result.append(pChild->innerText()); + pChild = pChild->nextSibling(); + } + return result; +} + + Element* Element::getChildElement(const XMLString& name) const { Node* pNode = firstChild(); @@ -390,5 +404,5 @@ Node* Element::copyNode(bool deep, Document* pOwnerDocument) const } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/ElementsByTagNameList.cpp b/XML/src/ElementsByTagNameList.cpp index 05a989083..d8b4606a4 100644 --- a/XML/src/ElementsByTagNameList.cpp +++ b/XML/src/ElementsByTagNameList.cpp @@ -1,7 +1,7 @@ // // ElementsByTagNameList.cpp // -// $Id: //poco/1.1.0/XML/src/ElementsByTagNameList.cpp#2 $ +// $Id: //poco/1.2/XML/src/ElementsByTagNameList.cpp#1 $ // // Library: XML // Package: DOM @@ -34,12 +34,13 @@ // -#include "DOM/ElementsByTagNameList.h" -#include "DOM/Node.h" -#include "DOM/Document.h" +#include "Poco/DOM/ElementsByTagNameList.h" +#include "Poco/DOM/Node.h" +#include "Poco/DOM/Document.h" -XML_BEGIN +namespace Poco { +namespace XML { ElementsByTagNameList::ElementsByTagNameList(const Node* pParent, const XMLString& name): @@ -166,4 +167,4 @@ void ElementsByTagNameListNS::autoRelease() } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/Entity.cpp b/XML/src/Entity.cpp index 307c62611..ef80804cc 100644 --- a/XML/src/Entity.cpp +++ b/XML/src/Entity.cpp @@ -1,7 +1,7 @@ // // Entity.cpp // -// $Id: //poco/1.1.0/XML/src/Entity.cpp#2 $ +// $Id: //poco/1.2/XML/src/Entity.cpp#1 $ // // Library: XML // Package: DOM @@ -34,10 +34,11 @@ // -#include "DOM/Entity.h" +#include "Poco/DOM/Entity.h" -XML_BEGIN +namespace Poco { +namespace XML { const XMLString Entity::NODE_NAME = toXMLString("#entity"); @@ -86,4 +87,4 @@ Node* Entity::copyNode(bool deep, Document* pOwnerDocument) const } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/EntityReference.cpp b/XML/src/EntityReference.cpp index f4da90a0c..612c92fab 100644 --- a/XML/src/EntityReference.cpp +++ b/XML/src/EntityReference.cpp @@ -1,7 +1,7 @@ // // EntityReference.cpp // -// $Id: //poco/1.1.0/XML/src/EntityReference.cpp#2 $ +// $Id: //poco/1.2/XML/src/EntityReference.cpp#1 $ // // Library: XML // Package: DOM @@ -34,10 +34,11 @@ // -#include "DOM/EntityReference.h" +#include "Poco/DOM/EntityReference.h" -XML_BEGIN +namespace Poco { +namespace XML { EntityReference::EntityReference(Document* pOwnerDocument, const XMLString& name): @@ -77,4 +78,4 @@ Node* EntityReference::copyNode(bool deep, Document* pOwnerDocument) const } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/EntityResolver.cpp b/XML/src/EntityResolver.cpp index 9c962aa7a..736b06556 100644 --- a/XML/src/EntityResolver.cpp +++ b/XML/src/EntityResolver.cpp @@ -1,7 +1,7 @@ // // EntityResolver.cpp // -// $Id: //poco/1.1.0/XML/src/EntityResolver.cpp#2 $ +// $Id: //poco/1.2/XML/src/EntityResolver.cpp#1 $ // // Library: XML // Package: SAX @@ -34,10 +34,11 @@ // -#include "SAX/EntityResolver.h" +#include "Poco/SAX/EntityResolver.h" -XML_BEGIN +namespace Poco { +namespace XML { EntityResolver::~EntityResolver() @@ -45,4 +46,4 @@ EntityResolver::~EntityResolver() } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/EntityResolverImpl.cpp b/XML/src/EntityResolverImpl.cpp index 8f9e1831f..3179dd4fa 100644 --- a/XML/src/EntityResolverImpl.cpp +++ b/XML/src/EntityResolverImpl.cpp @@ -1,7 +1,7 @@ // // EntityResolverImpl.cpp // -// $Id: //poco/1.1.0/XML/src/EntityResolverImpl.cpp#2 $ +// $Id: //poco/1.2/XML/src/EntityResolverImpl.cpp#1 $ // // Library: XML // Package: SAX @@ -34,24 +34,25 @@ // -#include "SAX/EntityResolverImpl.h" -#include "SAX/InputSource.h" -#include "XML/XMLString.h" -#include "Foundation/URI.h" -#include "Foundation/Path.h" -#include "Foundation/Exception.h" +#include "Poco/SAX/EntityResolverImpl.h" +#include "Poco/SAX/InputSource.h" +#include "Poco/XML/XMLString.h" +#include "Poco/URI.h" +#include "Poco/Path.h" +#include "Poco/Exception.h" #include -using Foundation::URIStreamOpener; -using Foundation::URI; -using Foundation::Path; -using Foundation::Exception; -using Foundation::IOException; -using Foundation::OpenFileException; +using Poco::URIStreamOpener; +using Poco::URI; +using Poco::Path; +using Poco::Exception; +using Poco::IOException; +using Poco::OpenFileException; -XML_BEGIN +namespace Poco { +namespace XML { EntityResolverImpl::EntityResolverImpl(): @@ -97,4 +98,4 @@ std::istream* EntityResolverImpl::resolveSystemId(const XMLString& systemId) } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/ErrorHandler.cpp b/XML/src/ErrorHandler.cpp index c15bcbdb9..7a2d19ce6 100644 --- a/XML/src/ErrorHandler.cpp +++ b/XML/src/ErrorHandler.cpp @@ -1,7 +1,7 @@ // // ErrorHandler.cpp // -// $Id: //poco/1.1.0/XML/src/ErrorHandler.cpp#2 $ +// $Id: //poco/1.2/XML/src/ErrorHandler.cpp#1 $ // // Library: XML // Package: SAX @@ -34,10 +34,11 @@ // -#include "SAX/ErrorHandler.h" +#include "Poco/SAX/ErrorHandler.h" -XML_BEGIN +namespace Poco { +namespace XML { ErrorHandler::~ErrorHandler() @@ -45,4 +46,4 @@ ErrorHandler::~ErrorHandler() } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/Event.cpp b/XML/src/Event.cpp index 6e36ec7e0..9ce005a7b 100644 --- a/XML/src/Event.cpp +++ b/XML/src/Event.cpp @@ -1,7 +1,7 @@ // // Event.cpp // -// $Id: //poco/1.1.0/XML/src/Event.cpp#2 $ +// $Id: //poco/1.2/XML/src/Event.cpp#1 $ // // Library: XML // Package: DOM @@ -34,11 +34,12 @@ // -#include "DOM/Event.h" -#include "DOM/Document.h" +#include "Poco/DOM/Event.h" +#include "Poco/DOM/Document.h" -XML_BEGIN +namespace Poco { +namespace XML { Event::Event(Document* pOwnerDocument, const XMLString& type): @@ -120,4 +121,4 @@ void Event::autoRelease() } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/EventDispatcher.cpp b/XML/src/EventDispatcher.cpp index 2c368f992..e0b0a82fe 100644 --- a/XML/src/EventDispatcher.cpp +++ b/XML/src/EventDispatcher.cpp @@ -1,7 +1,7 @@ // // EventDispatcher.cpp // -// $Id: //poco/1.1.0/XML/src/EventDispatcher.cpp#2 $ +// $Id: //poco/1.2/XML/src/EventDispatcher.cpp#1 $ // // Library: XML // Package: DOM @@ -34,9 +34,9 @@ // -#include "DOM/EventDispatcher.h" -#include "DOM/Event.h" -#include "DOM/EventListener.h" +#include "Poco/DOM/EventDispatcher.h" +#include "Poco/DOM/Event.h" +#include "Poco/DOM/EventListener.h" namespace @@ -61,7 +61,8 @@ namespace } -XML_BEGIN +namespace Poco { +namespace XML { EventDispatcher::EventDispatcher(): @@ -164,4 +165,4 @@ void EventDispatcher::bubbleEvent(Event* evt) } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/EventException.cpp b/XML/src/EventException.cpp index 17368d8fe..91f094aa7 100644 --- a/XML/src/EventException.cpp +++ b/XML/src/EventException.cpp @@ -1,7 +1,7 @@ // // EventException.cpp // -// $Id: //poco/1.1.0/XML/src/EventException.cpp#2 $ +// $Id: //poco/1.2/XML/src/EventException.cpp#1 $ // // Library: XML // Package: DOM @@ -34,11 +34,12 @@ // -#include "DOM/EventException.h" +#include "Poco/DOM/EventException.h" #include -XML_BEGIN +namespace Poco { +namespace XML { EventException::EventException(int code): @@ -77,10 +78,10 @@ const char* EventException::className() const throw() } -Foundation::Exception* EventException::clone() const +Poco::Exception* EventException::clone() const { return new EventException(*this); } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/EventListener.cpp b/XML/src/EventListener.cpp index 3a071d7b6..817005fc3 100644 --- a/XML/src/EventListener.cpp +++ b/XML/src/EventListener.cpp @@ -1,7 +1,7 @@ // // EventListener.cpp // -// $Id: //poco/1.1.0/XML/src/EventListener.cpp#2 $ +// $Id: //poco/1.2/XML/src/EventListener.cpp#1 $ // // Library: XML // Package: DOM @@ -34,10 +34,11 @@ // -#include "DOM/EventListener.h" +#include "Poco/DOM/EventListener.h" -XML_BEGIN +namespace Poco { +namespace XML { EventListener::~EventListener() @@ -45,4 +46,4 @@ EventListener::~EventListener() } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/EventTarget.cpp b/XML/src/EventTarget.cpp index 6f81c88c9..a9d7f0b58 100644 --- a/XML/src/EventTarget.cpp +++ b/XML/src/EventTarget.cpp @@ -1,7 +1,7 @@ // // EventTarget.cpp // -// $Id: //poco/1.1.0/XML/src/EventTarget.cpp#2 $ +// $Id: //poco/1.2/XML/src/EventTarget.cpp#1 $ // // Library: XML // Package: DOM @@ -34,10 +34,11 @@ // -#include "DOM/EventTarget.h" +#include "Poco/DOM/EventTarget.h" -XML_BEGIN +namespace Poco { +namespace XML { EventTarget::~EventTarget() @@ -45,4 +46,4 @@ EventTarget::~EventTarget() } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/InputSource.cpp b/XML/src/InputSource.cpp index 266298459..aab858d72 100644 --- a/XML/src/InputSource.cpp +++ b/XML/src/InputSource.cpp @@ -1,7 +1,7 @@ // // InputSource.cpp // -// $Id: //poco/1.1.0/XML/src/InputSource.cpp#2 $ +// $Id: //poco/1.2/XML/src/InputSource.cpp#1 $ // // Library: XML // Package: SAX @@ -34,10 +34,11 @@ // -#include "SAX/InputSource.h" +#include "Poco/SAX/InputSource.h" -XML_BEGIN +namespace Poco { +namespace XML { InputSource::InputSource(): @@ -97,5 +98,5 @@ void InputSource::setCharacterStream(XMLCharInputStream& cistr) } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/LexicalHandler.cpp b/XML/src/LexicalHandler.cpp index 9cca7a38e..6cdefd41f 100644 --- a/XML/src/LexicalHandler.cpp +++ b/XML/src/LexicalHandler.cpp @@ -1,7 +1,7 @@ // // LexicalHandler.cpp // -// $Id: //poco/1.1.0/XML/src/LexicalHandler.cpp#2 $ +// $Id: //poco/1.2/XML/src/LexicalHandler.cpp#1 $ // // Library: XML // Package: SAX @@ -34,10 +34,11 @@ // -#include "SAX/LexicalHandler.h" +#include "Poco/SAX/LexicalHandler.h" -XML_BEGIN +namespace Poco { +namespace XML { LexicalHandler::~LexicalHandler() @@ -45,4 +46,4 @@ LexicalHandler::~LexicalHandler() } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/Locator.cpp b/XML/src/Locator.cpp index 84ab48f5b..0316e5d3a 100644 --- a/XML/src/Locator.cpp +++ b/XML/src/Locator.cpp @@ -1,7 +1,7 @@ // // Locator.cpp // -// $Id: //poco/1.1.0/XML/src/Locator.cpp#2 $ +// $Id: //poco/1.2/XML/src/Locator.cpp#1 $ // // Library: XML // Package: SAX @@ -34,10 +34,11 @@ // -#include "SAX/Locator.h" +#include "Poco/SAX/Locator.h" -XML_BEGIN +namespace Poco { +namespace XML { Locator::~Locator() @@ -45,4 +46,4 @@ Locator::~Locator() } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/LocatorImpl.cpp b/XML/src/LocatorImpl.cpp index 422231f4d..40477eda6 100644 --- a/XML/src/LocatorImpl.cpp +++ b/XML/src/LocatorImpl.cpp @@ -1,7 +1,7 @@ // // LocatorImpl.cpp // -// $Id: //poco/1.1.0/XML/src/LocatorImpl.cpp#2 $ +// $Id: //poco/1.2/XML/src/LocatorImpl.cpp#1 $ // // Library: XML // Package: SAX @@ -34,10 +34,11 @@ // -#include "SAX/LocatorImpl.h" +#include "Poco/SAX/LocatorImpl.h" -XML_BEGIN +namespace Poco { +namespace XML { LocatorImpl::LocatorImpl() @@ -122,4 +123,4 @@ void LocatorImpl::setColumnNumber(int columnNumber) } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/MutationEvent.cpp b/XML/src/MutationEvent.cpp index 708418d95..03998cae6 100644 --- a/XML/src/MutationEvent.cpp +++ b/XML/src/MutationEvent.cpp @@ -1,7 +1,7 @@ // // MutationEvent.cpp // -// $Id: //poco/1.1.0/XML/src/MutationEvent.cpp#2 $ +// $Id: //poco/1.2/XML/src/MutationEvent.cpp#1 $ // // Library: XML // Package: DOM @@ -34,10 +34,11 @@ // -#include "DOM/MutationEvent.h" +#include "Poco/DOM/MutationEvent.h" -XML_BEGIN +namespace Poco { +namespace XML { const XMLString MutationEvent::DOMSubtreeModified = toXMLString("DOMSubtreeModified"); @@ -94,4 +95,4 @@ void MutationEvent::initMutationEvent(const XMLString& type, bool canBubble, boo } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/Name.cpp b/XML/src/Name.cpp index e699c86b8..a60dad5d0 100644 --- a/XML/src/Name.cpp +++ b/XML/src/Name.cpp @@ -1,7 +1,7 @@ // // Name.cpp // -// $Id: //poco/1.1.0/XML/src/Name.cpp#2 $ +// $Id: //poco/1.2/XML/src/Name.cpp#1 $ // // Library: XML // Package: XML @@ -34,11 +34,12 @@ // -#include "XML/Name.h" +#include "Poco/XML/Name.h" #include -XML_BEGIN +namespace Poco { +namespace XML { const XMLString Name::EMPTY_NAME; @@ -188,4 +189,4 @@ XMLString Name::prefix(const XMLString& qname) } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/NamePool.cpp b/XML/src/NamePool.cpp index 27eb06917..30daa380d 100644 --- a/XML/src/NamePool.cpp +++ b/XML/src/NamePool.cpp @@ -1,7 +1,7 @@ // // NamePool.cpp // -// $Id: //poco/1.1.0/XML/src/NamePool.cpp#2 $ +// $Id: //poco/1.2/XML/src/NamePool.cpp#1 $ // // Library: XML // Package: XML @@ -34,11 +34,12 @@ // -#include "XML/NamePool.h" -#include "Foundation/Exception.h" +#include "Poco/XML/NamePool.h" +#include "Poco/Exception.h" -XML_BEGIN +namespace Poco { +namespace XML { class NamePoolItem @@ -116,7 +117,7 @@ const Name& NamePool::insert(const XMLString& qname, const XMLString& namespaceU while (!_pItems[n].set(qname, namespaceURI, localName) && i++ < _size) n = (n + 1) % _size; - if (i > _size) throw Foundation::PoolOverflowException("XML name pool"); + if (i > _size) throw Poco::PoolOverflowException("XML name pool"); return _pItems[n].get(); } @@ -144,4 +145,4 @@ unsigned long NamePool::hash(const XMLString& qname, const XMLString& namespaceU } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/NamedNodeMap.cpp b/XML/src/NamedNodeMap.cpp index 80c243a93..8cc0d4b11 100644 --- a/XML/src/NamedNodeMap.cpp +++ b/XML/src/NamedNodeMap.cpp @@ -1,7 +1,7 @@ // // NamedNodeMap.cpp // -// $Id: //poco/1.1.0/XML/src/NamedNodeMap.cpp#2 $ +// $Id: //poco/1.2/XML/src/NamedNodeMap.cpp#1 $ // // Library: XML // Package: DOM @@ -34,10 +34,11 @@ // -#include "DOM/NamedNodeMap.h" +#include "Poco/DOM/NamedNodeMap.h" -XML_BEGIN +namespace Poco { +namespace XML { NamedNodeMap::~NamedNodeMap() @@ -45,4 +46,4 @@ NamedNodeMap::~NamedNodeMap() } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/NamespaceStrategy.cpp b/XML/src/NamespaceStrategy.cpp index f74aa68b7..047c488a0 100644 --- a/XML/src/NamespaceStrategy.cpp +++ b/XML/src/NamespaceStrategy.cpp @@ -1,7 +1,7 @@ // // NamespaceStrategy.cpp // -// $Id: //poco/1.1.0/XML/src/NamespaceStrategy.cpp#2 $ +// $Id: //poco/1.2/XML/src/NamespaceStrategy.cpp#1 $ // // Library: XML // Package: XML @@ -34,14 +34,15 @@ // -#include "XML/NamespaceStrategy.h" -#include "SAX/AttributesImpl.h" -#include "SAX/ContentHandler.h" -#include "XML/XMLException.h" -#include "XML/Name.h" +#include "Poco/XML/NamespaceStrategy.h" +#include "Poco/SAX/AttributesImpl.h" +#include "Poco/SAX/ContentHandler.h" +#include "Poco/XML/XMLException.h" +#include "Poco/XML/Name.h" -XML_BEGIN +namespace Poco { +namespace XML { const XMLString NamespaceStrategy::NOTHING; @@ -207,4 +208,4 @@ void NamespacePrefixesStrategy::endElement(const XMLChar* name, ContentHandler* } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/NamespaceSupport.cpp b/XML/src/NamespaceSupport.cpp index 27aa66a0f..cb4f5c98a 100644 --- a/XML/src/NamespaceSupport.cpp +++ b/XML/src/NamespaceSupport.cpp @@ -1,7 +1,7 @@ // // NamespaceSupport.cpp // -// $Id: //poco/1.1.0/XML/src/NamespaceSupport.cpp#2 $ +// $Id: //poco/1.2/XML/src/NamespaceSupport.cpp#1 $ // // Library: XML // Package: SAX @@ -34,11 +34,12 @@ // -#include "SAX/NamespaceSupport.h" -#include "XML/Name.h" +#include "Poco/SAX/NamespaceSupport.h" +#include "Poco/XML/Name.h" -XML_BEGIN +namespace Poco { +namespace XML { const XMLString NamespaceSupport::EMPTY_STRING; @@ -205,4 +206,4 @@ void NamespaceSupport::reset() } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/Node.cpp b/XML/src/Node.cpp index ed88512ad..a8216f616 100644 --- a/XML/src/Node.cpp +++ b/XML/src/Node.cpp @@ -1,7 +1,7 @@ // // Node.cpp // -// $Id: //poco/1.1.0/XML/src/Node.cpp#2 $ +// $Id: //poco/1.2/XML/src/Node.cpp#1 $ // // Library: XML // Package: DOM @@ -34,10 +34,11 @@ // -#include "DOM/Node.h" +#include "Poco/DOM/Node.h" -XML_BEGIN +namespace Poco { +namespace XML { Node::~Node() @@ -45,4 +46,4 @@ Node::~Node() } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/NodeFilter.cpp b/XML/src/NodeFilter.cpp index 4b1209a83..2959afdd5 100644 --- a/XML/src/NodeFilter.cpp +++ b/XML/src/NodeFilter.cpp @@ -1,7 +1,7 @@ // // NodeFilter.cpp // -// $Id: //poco/1.1.0/XML/src/NodeFilter.cpp#2 $ +// $Id: //poco/1.2/XML/src/NodeFilter.cpp#1 $ // // Library: XML // Package: DOM @@ -34,10 +34,11 @@ // -#include "DOM/NodeFilter.h" +#include "Poco/DOM/NodeFilter.h" -XML_BEGIN +namespace Poco { +namespace XML { NodeFilter::~NodeFilter() @@ -45,4 +46,4 @@ NodeFilter::~NodeFilter() } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/NodeIterator.cpp b/XML/src/NodeIterator.cpp index c12aaf0a9..5cd76f189 100644 --- a/XML/src/NodeIterator.cpp +++ b/XML/src/NodeIterator.cpp @@ -1,7 +1,7 @@ // // NodeIterator.cpp // -// $Id: //poco/1.1.0/XML/src/NodeIterator.cpp#2 $ +// $Id: //poco/1.2/XML/src/NodeIterator.cpp#1 $ // // Library: XML // Package: DOM @@ -34,13 +34,14 @@ // -#include "DOM/NodeIterator.h" -#include "DOM/AbstractNode.h" -#include "DOM/NodeFilter.h" -#include "DOM/DOMException.h" +#include "Poco/DOM/NodeIterator.h" +#include "Poco/DOM/AbstractNode.h" +#include "Poco/DOM/NodeFilter.h" +#include "Poco/DOM/DOMException.h" -XML_BEGIN +namespace Poco { +namespace XML { NodeIterator::NodeIterator(Node* root, unsigned long whatToShow, NodeFilter* pFilter): @@ -194,4 +195,4 @@ Node* NodeIterator::last() } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/NodeList.cpp b/XML/src/NodeList.cpp index 43d8ec368..a92a08820 100644 --- a/XML/src/NodeList.cpp +++ b/XML/src/NodeList.cpp @@ -1,7 +1,7 @@ // // NodeList.cpp // -// $Id: //poco/1.1.0/XML/src/NodeList.cpp#2 $ +// $Id: //poco/1.2/XML/src/NodeList.cpp#1 $ // // Library: XML // Package: DOM @@ -34,10 +34,11 @@ // -#include "DOM/NodeList.h" +#include "Poco/DOM/NodeList.h" -XML_BEGIN +namespace Poco { +namespace XML { NodeList::~NodeList() @@ -45,4 +46,4 @@ NodeList::~NodeList() } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/Notation.cpp b/XML/src/Notation.cpp index 40d93f260..73a04c6da 100644 --- a/XML/src/Notation.cpp +++ b/XML/src/Notation.cpp @@ -1,7 +1,7 @@ // // Notation.cpp // -// $Id: //poco/1.1.0/XML/src/Notation.cpp#2 $ +// $Id: //poco/1.2/XML/src/Notation.cpp#1 $ // // Library: XML // Package: DOM @@ -34,10 +34,11 @@ // -#include "DOM/Notation.h" +#include "Poco/DOM/Notation.h" -XML_BEGIN +namespace Poco { +namespace XML { Notation::Notation(Document* pOwnerDocument, const XMLString& name, const XMLString& publicId, const XMLString& systemId): @@ -81,4 +82,4 @@ Node* Notation::copyNode(bool deep, Document* pOwnerDocument) const } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/ParserEngine.cpp b/XML/src/ParserEngine.cpp index e420bb829..eee773218 100644 --- a/XML/src/ParserEngine.cpp +++ b/XML/src/ParserEngine.cpp @@ -1,7 +1,7 @@ // // ParserEngine.cpp // -// $Id: //poco/1.1.0/XML/src/ParserEngine.cpp#2 $ +// $Id: //poco/1.2/XML/src/ParserEngine.cpp#1 $ // // Library: XML // Package: XML @@ -34,29 +34,30 @@ // -#include "XML/ParserEngine.h" -#include "XML/NamespaceStrategy.h" -#include "XML/XMLException.h" -#include "SAX/EntityResolver.h" -#include "SAX/EntityResolverImpl.h" -#include "SAX/DTDHandler.h" -#include "SAX/DeclHandler.h" -#include "SAX/ContentHandler.h" -#include "SAX/LexicalHandler.h" -#include "SAX/ErrorHandler.h" -#include "SAX/InputSource.h" -#include "SAX/Locator.h" -#include "SAX/LocatorImpl.h" -#include "SAX/SAXException.h" -#include "Foundation/URI.h" +#include "Poco/XML/ParserEngine.h" +#include "Poco/XML/NamespaceStrategy.h" +#include "Poco/XML/XMLException.h" +#include "Poco/SAX/EntityResolver.h" +#include "Poco/SAX/EntityResolverImpl.h" +#include "Poco/SAX/DTDHandler.h" +#include "Poco/SAX/DeclHandler.h" +#include "Poco/SAX/ContentHandler.h" +#include "Poco/SAX/LexicalHandler.h" +#include "Poco/SAX/ErrorHandler.h" +#include "Poco/SAX/InputSource.h" +#include "Poco/SAX/Locator.h" +#include "Poco/SAX/LocatorImpl.h" +#include "Poco/SAX/SAXException.h" +#include "Poco/URI.h" #include -using Foundation::URI; -using Foundation::TextEncoding; +using Poco::URI; +using Poco::TextEncoding; -XML_BEGIN +namespace Poco { +namespace XML { class ContextLocator: public Locator @@ -527,7 +528,7 @@ void ParserEngine::handleError(int errorNo) if (_pErrorHandler) _pErrorHandler->error(exc); throw; } - catch (Foundation::Exception& exc) + catch (Poco::Exception& exc) { if (_pErrorHandler) _pErrorHandler->fatalError(SAXParseException("Fatal error", locator(), exc)); throw; @@ -828,4 +829,4 @@ int ParserEngine::convert(void* data, const char* s) } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/ProcessingInstruction.cpp b/XML/src/ProcessingInstruction.cpp index 54c1f9425..dd8443031 100644 --- a/XML/src/ProcessingInstruction.cpp +++ b/XML/src/ProcessingInstruction.cpp @@ -1,7 +1,7 @@ // // ProcessingInstruction.cpp // -// $Id: //poco/1.1.0/XML/src/ProcessingInstruction.cpp#2 $ +// $Id: //poco/1.2/XML/src/ProcessingInstruction.cpp#1 $ // // Library: XML // Package: DOM @@ -34,10 +34,11 @@ // -#include "DOM/ProcessingInstruction.h" +#include "Poco/DOM/ProcessingInstruction.h" -XML_BEGIN +namespace Poco { +namespace XML { ProcessingInstruction::ProcessingInstruction(Document* pOwnerDocument, const XMLString& target, const XMLString& data): @@ -97,4 +98,4 @@ Node* ProcessingInstruction::copyNode(bool deep, Document* pOwnerDocument) const } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/SAXException.cpp b/XML/src/SAXException.cpp index 550aca506..7cd6f629d 100644 --- a/XML/src/SAXException.cpp +++ b/XML/src/SAXException.cpp @@ -1,7 +1,7 @@ // // SAXException.cpp // -// $Id: //poco/1.1.0/XML/src/SAXException.cpp#2 $ +// $Id: //poco/1.2/XML/src/SAXException.cpp#1 $ // // Library: XML // Package: SAX @@ -34,13 +34,14 @@ // -#include "SAX/SAXException.h" -#include "SAX/Locator.h" +#include "Poco/SAX/SAXException.h" +#include "Poco/SAX/Locator.h" #include #include -XML_BEGIN +namespace Poco { +namespace XML { POCO_IMPLEMENT_EXCEPTION(SAXException, XMLException, "SAX Exception") @@ -58,7 +59,7 @@ SAXParseException::SAXParseException(const std::string& msg, const Locator& loc) } -SAXParseException::SAXParseException(const std::string& msg, const Locator& loc, const Foundation::Exception& exc): +SAXParseException::SAXParseException(const std::string& msg, const Locator& loc, const Poco::Exception& exc): SAXException(buildMessage(msg, loc.getPublicId(), loc.getSystemId(), loc.getLineNumber(), loc.getColumnNumber()), exc), _publicId(loc.getPublicId()), _systemId(loc.getSystemId()), @@ -78,7 +79,7 @@ SAXParseException::SAXParseException(const std::string& msg, const XMLString& pu } -SAXParseException::SAXParseException(const std::string& msg, const XMLString& publicId, const XMLString& systemId, int lineNumber, int columnNumber, const Foundation::Exception& exc): +SAXParseException::SAXParseException(const std::string& msg, const XMLString& publicId, const XMLString& systemId, int lineNumber, int columnNumber, const Poco::Exception& exc): SAXException(buildMessage(msg, publicId, systemId, lineNumber, columnNumber), exc), _publicId(publicId), _systemId(systemId), @@ -129,12 +130,18 @@ const char* SAXParseException::className() const throw() } -Foundation::Exception* SAXParseException::clone() const +Poco::Exception* SAXParseException::clone() const { return new SAXParseException(*this); } +void SAXParseException::rethrow() const +{ + throw *this; +} + + std::string SAXParseException::buildMessage(const std::string& msg, const XMLString& publicId, const XMLString& systemId, int lineNumber, int columnNumber) { std::ostringstream result; @@ -150,4 +157,4 @@ std::string SAXParseException::buildMessage(const std::string& msg, const XMLStr } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/SAXParser.cpp b/XML/src/SAXParser.cpp index 8c02adc09..425c14ed9 100644 --- a/XML/src/SAXParser.cpp +++ b/XML/src/SAXParser.cpp @@ -1,7 +1,7 @@ // // SAXParser.cpp // -// $Id: //poco/1.1.0/XML/src/SAXParser.cpp#2 $ +// $Id: //poco/1.2/XML/src/SAXParser.cpp#1 $ // // Library: XML // Package: SAX @@ -34,15 +34,16 @@ // -#include "SAX/SAXParser.h" -#include "SAX/SAXException.h" -#include "SAX/EntityResolverImpl.h" -#include "SAX/InputSource.h" -#include "XML/NamespaceStrategy.h" +#include "Poco/SAX/SAXParser.h" +#include "Poco/SAX/SAXException.h" +#include "Poco/SAX/EntityResolverImpl.h" +#include "Poco/SAX/InputSource.h" +#include "Poco/XML/NamespaceStrategy.h" #include -XML_BEGIN +namespace Poco { +namespace XML { SAXParser::SAXParser(): @@ -77,7 +78,7 @@ const XMLString& SAXParser::getEncoding() const } -void SAXParser::addEncoding(const XMLString& name, Foundation::TextEncoding* pEncoding) +void SAXParser::addEncoding(const XMLString& name, Poco::TextEncoding* pEncoding) { _engine.addEncoding(name, pEncoding); } @@ -244,4 +245,4 @@ void SAXParser::setupParse() } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/Text.cpp b/XML/src/Text.cpp index 729abbc3a..dcede941c 100644 --- a/XML/src/Text.cpp +++ b/XML/src/Text.cpp @@ -1,7 +1,7 @@ // // Text.cpp // -// $Id: //poco/1.1.0/XML/src/Text.cpp#2 $ +// $Id: //poco/1.2/XML/src/Text.cpp#1 $ // // Library: XML // Package: DOM @@ -34,12 +34,13 @@ // -#include "DOM/Text.h" -#include "DOM/Document.h" -#include "DOM/DOMException.h" +#include "Poco/DOM/Text.h" +#include "Poco/DOM/Document.h" +#include "Poco/DOM/DOMException.h" -XML_BEGIN +namespace Poco { +namespace XML { const XMLString Text::NODE_NAME = toXMLString("#text"); @@ -86,10 +87,16 @@ unsigned short Text::nodeType() const } +XMLString Text::innerText() const +{ + return nodeValue(); +} + + Node* Text::copyNode(bool deep, Document* pOwnerDocument) const { return new Text(pOwnerDocument, *this); } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/TreeWalker.cpp b/XML/src/TreeWalker.cpp index 27b71e871..f71b823be 100644 --- a/XML/src/TreeWalker.cpp +++ b/XML/src/TreeWalker.cpp @@ -1,7 +1,7 @@ // // TreeWalker.cpp // -// $Id: //poco/1.1.0/XML/src/TreeWalker.cpp#2 $ +// $Id: //poco/1.2/XML/src/TreeWalker.cpp#1 $ // // Library: XML // Package: DOM @@ -34,12 +34,13 @@ // -#include "DOM/TreeWalker.h" -#include "DOM/Node.h" -#include "DOM/NodeFilter.h" +#include "Poco/DOM/TreeWalker.h" +#include "Poco/DOM/Node.h" +#include "Poco/DOM/NodeFilter.h" -XML_BEGIN +namespace Poco { +namespace XML { TreeWalker::TreeWalker(Node* root, unsigned long whatToShow, NodeFilter* pFilter): @@ -245,4 +246,4 @@ Node* TreeWalker::previous(Node* pNode) const } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/WhitespaceFilter.cpp b/XML/src/WhitespaceFilter.cpp index 8b3f48573..743c725ad 100644 --- a/XML/src/WhitespaceFilter.cpp +++ b/XML/src/WhitespaceFilter.cpp @@ -1,7 +1,7 @@ // // WhitespaceFilter.cpp // -// $Id: //poco/1.1.0/XML/src/WhitespaceFilter.cpp#2 $ +// $Id: //poco/1.2/XML/src/WhitespaceFilter.cpp#1 $ // // Library: XML // Package: SAX @@ -34,11 +34,12 @@ // -#include "SAX/WhitespaceFilter.h" -#include "SAX/SAXException.h" +#include "Poco/SAX/WhitespaceFilter.h" +#include "Poco/SAX/SAXException.h" -XML_BEGIN +namespace Poco { +namespace XML { WhitespaceFilter::WhitespaceFilter(): @@ -230,4 +231,4 @@ void WhitespaceFilter::setupParse() } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/XMLException.cpp b/XML/src/XMLException.cpp index 097030c98..c9f2675f7 100644 --- a/XML/src/XMLException.cpp +++ b/XML/src/XMLException.cpp @@ -1,7 +1,7 @@ // // XMLException.cpp // -// $Id: //poco/1.1.0/XML/src/XMLException.cpp#2 $ +// $Id: //poco/1.2/XML/src/XMLException.cpp#1 $ // // Library: XML // Package: XML @@ -34,17 +34,18 @@ // -#include "XML/XMLException.h" +#include "Poco/XML/XMLException.h" #include -using Foundation::RuntimeException; +using Poco::RuntimeException; -XML_BEGIN +namespace Poco { +namespace XML { POCO_IMPLEMENT_EXCEPTION(XMLException, RuntimeException, "XML Exception") -XML_END +} } // namespace Poco::XML diff --git a/XML/src/XMLFilter.cpp b/XML/src/XMLFilter.cpp index af9f69a33..ef9d3848d 100644 --- a/XML/src/XMLFilter.cpp +++ b/XML/src/XMLFilter.cpp @@ -1,7 +1,7 @@ // // XMLFilter.cpp // -// $Id: //poco/1.1.0/XML/src/XMLFilter.cpp#2 $ +// $Id: //poco/1.2/XML/src/XMLFilter.cpp#1 $ // // Library: XML // Package: SAX @@ -34,10 +34,11 @@ // -#include "SAX/XMLFilter.h" +#include "Poco/SAX/XMLFilter.h" -XML_BEGIN +namespace Poco { +namespace XML { XMLFilter::~XMLFilter() @@ -45,4 +46,4 @@ XMLFilter::~XMLFilter() } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/XMLFilterImpl.cpp b/XML/src/XMLFilterImpl.cpp index b19a05a13..747941fa2 100644 --- a/XML/src/XMLFilterImpl.cpp +++ b/XML/src/XMLFilterImpl.cpp @@ -1,7 +1,7 @@ // // XMLFilterImpl.cpp // -// $Id: //poco/1.1.0/XML/src/XMLFilterImpl.cpp#2 $ +// $Id: //poco/1.2/XML/src/XMLFilterImpl.cpp#1 $ // // Library: XML // Package: SAX @@ -34,11 +34,12 @@ // -#include "SAX/XMLFilterImpl.h" -#include "SAX/SAXException.h" +#include "Poco/SAX/XMLFilterImpl.h" +#include "Poco/SAX/SAXException.h" -XML_BEGIN +namespace Poco { +namespace XML { XMLFilterImpl::XMLFilterImpl(): @@ -324,4 +325,4 @@ void XMLFilterImpl::setupParse() } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/XMLReader.cpp b/XML/src/XMLReader.cpp index 7cfbfaa47..0f7a4665f 100644 --- a/XML/src/XMLReader.cpp +++ b/XML/src/XMLReader.cpp @@ -1,7 +1,7 @@ // // XMLReader.cpp // -// $Id: //poco/1.1.0/XML/src/XMLReader.cpp#2 $ +// $Id: //poco/1.2/XML/src/XMLReader.cpp#1 $ // // Library: XML // Package: SAX @@ -34,10 +34,11 @@ // -#include "SAX/XMLReader.h" +#include "Poco/SAX/XMLReader.h" -XML_BEGIN +namespace Poco { +namespace XML { const XMLString XMLReader::FEATURE_VALIDATION = toXMLString("http://xml.org/sax/features/validation"); @@ -55,4 +56,4 @@ XMLReader::~XMLReader() } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/XMLString.cpp b/XML/src/XMLString.cpp index b5525e852..9ef5e6d0f 100644 --- a/XML/src/XMLString.cpp +++ b/XML/src/XMLString.cpp @@ -1,7 +1,7 @@ // // XMLString.cpp // -// $Id: //poco/1.1.0/XML/src/XMLString.cpp#2 $ +// $Id: //poco/1.2/XML/src/XMLString.cpp#1 $ // // Library: XML // Package: XML @@ -34,7 +34,7 @@ // -#include "XML/XMLString.h" +#include "Poco/XML/XMLString.h" #if defined(XML_UNICODE_WCHAR_T) @@ -42,7 +42,8 @@ #endif -XML_BEGIN +namespace Poco { +namespace XML { #if defined(XML_UNICODE_WCHAR_T) @@ -82,4 +83,4 @@ XMLString toXMLString(const std::string& str) #endif // XML_UNICODE_WCHAR_T -XML_END +} } // namespace Poco::XML diff --git a/XML/src/XMLWriter.cpp b/XML/src/XMLWriter.cpp index 0aba490ae..bfc382948 100644 --- a/XML/src/XMLWriter.cpp +++ b/XML/src/XMLWriter.cpp @@ -1,7 +1,7 @@ // // XMLWriter.cpp // -// $Id: //poco/1.1.0/XML/src/XMLWriter.cpp#2 $ +// $Id: //poco/1.2/XML/src/XMLWriter.cpp#1 $ // // Library: XML // Package: XML @@ -34,15 +34,16 @@ // -#include "XML/XMLWriter.h" -#include "XML/XMLString.h" -#include "XML/XMLException.h" -#include "SAX/AttributesImpl.h" -#include "Foundation/UTF8Encoding.h" +#include "Poco/XML/XMLWriter.h" +#include "Poco/XML/XMLString.h" +#include "Poco/XML/XMLException.h" +#include "Poco/SAX/AttributesImpl.h" +#include "Poco/UTF8Encoding.h" #include -XML_BEGIN +namespace Poco { +namespace XML { const std::string XMLWriter::NEWLINE_DEFAULT; @@ -68,16 +69,16 @@ const std::string XMLWriter::MARKUP_END_CDATA = "]]>"; #if defined(XML_UNICODE_WCHAR_T) - #define NATIVE_ENCODING Foundation::UTF16Encoding + #define NATIVE_ENCODING Poco::UTF16Encoding #else - #define NATIVE_ENCODING Foundation::UTF8Encoding + #define NATIVE_ENCODING Poco::UTF8Encoding #endif XMLWriter::XMLWriter(XMLByteOutputStream& str, int options): _pTextConverter(0), _pInEncoding(new NATIVE_ENCODING), - _pOutEncoding(new Foundation::UTF8Encoding), + _pOutEncoding(new Poco::UTF8Encoding), _options(options), _encoding("UTF-8"), _depth(-1), @@ -90,12 +91,12 @@ XMLWriter::XMLWriter(XMLByteOutputStream& str, int options): _unclosedStartTag(false), _prefix(0) { - _pTextConverter = new Foundation::OutputStreamConverter(str, *_pInEncoding, *_pOutEncoding); + _pTextConverter = new Poco::OutputStreamConverter(str, *_pInEncoding, *_pOutEncoding); setNewLine(NEWLINE_DEFAULT); } -XMLWriter::XMLWriter(XMLByteOutputStream& str, int options, const std::string& encodingName, Foundation::TextEncoding& textEncoding): +XMLWriter::XMLWriter(XMLByteOutputStream& str, int options, const std::string& encodingName, Poco::TextEncoding& textEncoding): _pTextConverter(0), _pInEncoding(new NATIVE_ENCODING), _pOutEncoding(0), @@ -111,12 +112,12 @@ XMLWriter::XMLWriter(XMLByteOutputStream& str, int options, const std::string& e _unclosedStartTag(false), _prefix(0) { - _pTextConverter = new Foundation::OutputStreamConverter(str, *_pInEncoding, textEncoding); + _pTextConverter = new Poco::OutputStreamConverter(str, *_pInEncoding, textEncoding); setNewLine(NEWLINE_DEFAULT); } -XMLWriter::XMLWriter(XMLByteOutputStream& str, int options, const std::string& encodingName, Foundation::TextEncoding* pTextEncoding): +XMLWriter::XMLWriter(XMLByteOutputStream& str, int options, const std::string& encodingName, Poco::TextEncoding* pTextEncoding): _pTextConverter(0), _pInEncoding(new NATIVE_ENCODING), _pOutEncoding(0), @@ -134,13 +135,13 @@ XMLWriter::XMLWriter(XMLByteOutputStream& str, int options, const std::string& e { if (pTextEncoding) { - _pTextConverter = new Foundation::OutputStreamConverter(str, *_pInEncoding, *pTextEncoding); + _pTextConverter = new Poco::OutputStreamConverter(str, *_pInEncoding, *pTextEncoding); } else { _encoding = "UTF-8"; - _pOutEncoding = new Foundation::UTF8Encoding; - _pTextConverter = new Foundation::OutputStreamConverter(str, *_pInEncoding, *_pOutEncoding); + _pOutEncoding = new Poco::UTF8Encoding; + _pTextConverter = new Poco::OutputStreamConverter(str, *_pInEncoding, *_pOutEncoding); } setNewLine(NEWLINE_DEFAULT); } @@ -300,7 +301,7 @@ void XMLWriter::emptyElement(const XMLString& namespaceURI, const XMLString& loc void XMLWriter::characters(const XMLChar ch[], int start, int length) { if (_unclosedStartTag) closeStartTag(); - _contentWritten = length > 0; + _contentWritten = _contentWritten || length > 0; if (_inCDATA) { while (length-- > 0) writeXML(ch[start++]); @@ -340,6 +341,8 @@ void XMLWriter::characters(const XMLString& str) void XMLWriter::rawCharacters(const XMLString& str) { + if (_unclosedStartTag) closeStartTag(); + _contentWritten = _contentWritten || !str.empty(); writeXML(str); } @@ -650,6 +653,13 @@ void XMLWriter::declareAttributeNamespaces(const Attributes& attributes) XMLString splitLocalName; Name::split(qname, prefix, splitLocalName); if (prefix.empty()) prefix = _namespaces.getPrefix(namespaceURI); + if (prefix.empty() && !namespaceURI.empty() && !_namespaces.isMapped(namespaceURI)) + { + prefix = newPrefix(); + _namespaces.declarePrefix(prefix, namespaceURI); + } + + const XMLString& uri = _namespaces.getURI(prefix); if ((uri.empty() || uri != namespaceURI) && !namespaceURI.empty()) { @@ -796,4 +806,4 @@ XMLString XMLWriter::newPrefix() } -XML_END +} } // namespace Poco::XML diff --git a/XML/src/expat_config.h b/XML/src/expat_config.h index 4f605c5f1..b547b070c 100644 --- a/XML/src/expat_config.h +++ b/XML/src/expat_config.h @@ -1,7 +1,7 @@ // // expat_config.h // -// $Id: //poco/1.1.0/XML/src/expat_config.h#2 $ +// $Id: //poco/1.2/XML/src/expat_config.h#1 $ // // Poco XML specific configuration for expat. // @@ -36,9 +36,7 @@ #define EXPAT_CONFIG_H -#ifndef Foundation_Platform_INCLUDED -#include "Foundation/Platform.h" -#endif +#include "Poco/Platform.h" #include diff --git a/XML/src/xmlparse.cpp b/XML/src/xmlparse.cpp index 06a5a643c..4a09829e3 100644 --- a/XML/src/xmlparse.cpp +++ b/XML/src/xmlparse.cpp @@ -18,7 +18,7 @@ #include "expat_config.h" #endif /* ndef COMPILED_FROM_DSP */ -#include "XML/expat.h" +#include "Poco/XML/expat.h" #ifdef XML_UNICODE #define XML_ENCODE_MAX XML_UTF16_ENCODE_MAX diff --git a/XML/src/xmlrole.c b/XML/src/xmlrole.c index fc942d831..bcfd8e424 100644 --- a/XML/src/xmlrole.c +++ b/XML/src/xmlrole.c @@ -16,7 +16,7 @@ #endif #endif /* ndef COMPILED_FROM_DSP */ -#include "XML/expat_external.h" +#include "Poco/XML/expat_external.h" #include "internal.h" #include "xmlrole.h" #include "ascii.h" diff --git a/XML/src/xmltok.c b/XML/src/xmltok.c index b144a4c95..9dbc4ae97 100644 --- a/XML/src/xmltok.c +++ b/XML/src/xmltok.c @@ -16,7 +16,7 @@ #endif #endif /* ndef COMPILED_FROM_DSP */ -#include "XML/expat_external.h" +#include "Poco/XML/expat_external.h" #include "internal.h" #include "xmltok.h" #include "nametab.h" diff --git a/XML/testsuite/Makefile b/XML/testsuite/Makefile index bff971679..23adf06d0 100644 --- a/XML/testsuite/Makefile +++ b/XML/testsuite/Makefile @@ -1,7 +1,7 @@ # # Makefile # -# $Id: //poco/1.1.0/XML/testsuite/Makefile#1 $ +# $Id: //poco/1.2/XML/testsuite/Makefile#1 $ # # Makefile for Poco XML testsuite # diff --git a/XML/testsuite/TestSuite.vmsbuild b/XML/testsuite/TestSuite.vmsbuild index c9219c052..04bf96ad0 100644 --- a/XML/testsuite/TestSuite.vmsbuild +++ b/XML/testsuite/TestSuite.vmsbuild @@ -1,7 +1,7 @@ # # TestSuite.vmsbuild # -# $Id: //poco/1.1.0/XML/testsuite/TestSuite.vmsbuild#1 $ +# $Id: //poco/1.2/XML/testsuite/TestSuite.vmsbuild#1 $ # EXE=TestRunner AttributesImplTest diff --git a/XML/testsuite/src/AttributesImplTest.cpp b/XML/testsuite/src/AttributesImplTest.cpp index 3fc26a9ef..d110d9adf 100644 --- a/XML/testsuite/src/AttributesImplTest.cpp +++ b/XML/testsuite/src/AttributesImplTest.cpp @@ -1,7 +1,7 @@ // // AttributesImplTest.cpp // -// $Id: //poco/1.1.0/XML/testsuite/src/AttributesImplTest.cpp#2 $ +// $Id: //poco/1.2/XML/testsuite/src/AttributesImplTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,10 +33,10 @@ #include "AttributesImplTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "SAX/AttributesImpl.h" +#include "Poco/SAX/AttributesImpl.h" -using XML::AttributesImpl; +using Poco::XML::AttributesImpl; AttributesImplTest::AttributesImplTest(const std::string& name): CppUnit::TestCase(name) diff --git a/XML/testsuite/src/AttributesImplTest.h b/XML/testsuite/src/AttributesImplTest.h index 6b49d3fc8..067927025 100644 --- a/XML/testsuite/src/AttributesImplTest.h +++ b/XML/testsuite/src/AttributesImplTest.h @@ -1,7 +1,7 @@ // // AttributesImplTest.h // -// $Id: //poco/1.1.0/XML/testsuite/src/AttributesImplTest.h#2 $ +// $Id: //poco/1.2/XML/testsuite/src/AttributesImplTest.h#1 $ // // Definition of the AttributesImplTest class. // @@ -36,12 +36,8 @@ #define AttributesImplTest_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/XML/XML.h" #include "CppUnit/TestCase.h" -#endif class AttributesImplTest: public CppUnit::TestCase diff --git a/XML/testsuite/src/ChildNodesTest.cpp b/XML/testsuite/src/ChildNodesTest.cpp index 91de0322b..62834e747 100644 --- a/XML/testsuite/src/ChildNodesTest.cpp +++ b/XML/testsuite/src/ChildNodesTest.cpp @@ -1,7 +1,7 @@ // // ChildNodesTest.cpp // -// $Id: //poco/1.1.0/XML/testsuite/src/ChildNodesTest.cpp#2 $ +// $Id: //poco/1.2/XML/testsuite/src/ChildNodesTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,17 +33,17 @@ #include "ChildNodesTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "DOM/Document.h" -#include "DOM/Element.h" -#include "DOM/NodeList.h" -#include "DOM/AutoPtr.h" +#include "Poco/DOM/Document.h" +#include "Poco/DOM/Element.h" +#include "Poco/DOM/NodeList.h" +#include "Poco/DOM/AutoPtr.h" -using XML::Element; -using XML::Document; -using XML::NodeList; -using XML::Node; -using XML::AutoPtr; +using Poco::XML::Element; +using Poco::XML::Document; +using Poco::XML::NodeList; +using Poco::XML::Node; +using Poco::XML::AutoPtr; ChildNodesTest::ChildNodesTest(const std::string& name): CppUnit::TestCase(name) diff --git a/XML/testsuite/src/ChildNodesTest.h b/XML/testsuite/src/ChildNodesTest.h index 30e22e306..632fbf8b7 100644 --- a/XML/testsuite/src/ChildNodesTest.h +++ b/XML/testsuite/src/ChildNodesTest.h @@ -1,7 +1,7 @@ // // ChildNodesTest.h // -// $Id: //poco/1.1.0/XML/testsuite/src/ChildNodesTest.h#2 $ +// $Id: //poco/1.2/XML/testsuite/src/ChildNodesTest.h#1 $ // // Definition of the ChildNodesTest class. // @@ -36,12 +36,8 @@ #define ChildNodesTest_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/XML/XML.h" #include "CppUnit/TestCase.h" -#endif class ChildNodesTest: public CppUnit::TestCase diff --git a/XML/testsuite/src/DOMTestSuite.cpp b/XML/testsuite/src/DOMTestSuite.cpp index d3fc2fc21..55f5f40e2 100644 --- a/XML/testsuite/src/DOMTestSuite.cpp +++ b/XML/testsuite/src/DOMTestSuite.cpp @@ -1,7 +1,7 @@ // // DOMTestSuite.cpp // -// $Id: //poco/1.1.0/XML/testsuite/src/DOMTestSuite.cpp#2 $ +// $Id: //poco/1.2/XML/testsuite/src/DOMTestSuite.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. diff --git a/XML/testsuite/src/DOMTestSuite.h b/XML/testsuite/src/DOMTestSuite.h index 5551758a2..e683ecba6 100644 --- a/XML/testsuite/src/DOMTestSuite.h +++ b/XML/testsuite/src/DOMTestSuite.h @@ -1,7 +1,7 @@ // // DOMTestSuite.h // -// $Id: //poco/1.1.0/XML/testsuite/src/DOMTestSuite.h#2 $ +// $Id: //poco/1.2/XML/testsuite/src/DOMTestSuite.h#1 $ // // Definition of the DOMTestSuite class. // @@ -36,9 +36,7 @@ #define DOMTestSuite_INCLUDED -#ifndef CppUnit_TestSuite_INCLUDED #include "CppUnit/TestSuite.h" -#endif class DOMTestSuite diff --git a/XML/testsuite/src/DocumentTest.cpp b/XML/testsuite/src/DocumentTest.cpp index 0517853b6..eb67fdd0b 100644 --- a/XML/testsuite/src/DocumentTest.cpp +++ b/XML/testsuite/src/DocumentTest.cpp @@ -1,7 +1,7 @@ // // DocumentTest.cpp // -// $Id: //poco/1.1.0/XML/testsuite/src/DocumentTest.cpp#2 $ +// $Id: //poco/1.2/XML/testsuite/src/DocumentTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,22 +33,22 @@ #include "DocumentTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "DOM/Document.h" -#include "DOM/Element.h" -#include "DOM/Text.h" -#include "DOM/NodeList.h" -#include "DOM/AutoPtr.h" -#include "DOM/DOMException.h" +#include "Poco/DOM/Document.h" +#include "Poco/DOM/Element.h" +#include "Poco/DOM/Text.h" +#include "Poco/DOM/NodeList.h" +#include "Poco/DOM/AutoPtr.h" +#include "Poco/DOM/DOMException.h" -using XML::Element; -using XML::Document; -using XML::Text; -using XML::Node; -using XML::NodeList; -using XML::AutoPtr; -using XML::XMLString; -using XML::DOMException; +using Poco::XML::Element; +using Poco::XML::Document; +using Poco::XML::Text; +using Poco::XML::Node; +using Poco::XML::NodeList; +using Poco::XML::AutoPtr; +using Poco::XML::XMLString; +using Poco::XML::DOMException; DocumentTest::DocumentTest(const std::string& name): CppUnit::TestCase(name) diff --git a/XML/testsuite/src/DocumentTest.h b/XML/testsuite/src/DocumentTest.h index a560b3dde..a7b91cbcd 100644 --- a/XML/testsuite/src/DocumentTest.h +++ b/XML/testsuite/src/DocumentTest.h @@ -1,7 +1,7 @@ // // DocumentTest.h // -// $Id: //poco/1.1.0/XML/testsuite/src/DocumentTest.h#2 $ +// $Id: //poco/1.2/XML/testsuite/src/DocumentTest.h#1 $ // // Definition of the DocumentTest class. // @@ -36,12 +36,8 @@ #define DocumentTest_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/XML/XML.h" #include "CppUnit/TestCase.h" -#endif class DocumentTest: public CppUnit::TestCase diff --git a/XML/testsuite/src/DocumentTypeTest.cpp b/XML/testsuite/src/DocumentTypeTest.cpp index 1b3f1c9ff..6d59ff6a0 100644 --- a/XML/testsuite/src/DocumentTypeTest.cpp +++ b/XML/testsuite/src/DocumentTypeTest.cpp @@ -1,7 +1,7 @@ // // DocumentTypeTest.cpp // -// $Id: //poco/1.1.0/XML/testsuite/src/DocumentTypeTest.cpp#2 $ +// $Id: //poco/1.2/XML/testsuite/src/DocumentTypeTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,22 +33,22 @@ #include "DocumentTypeTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "DOM/DocumentType.h" -#include "DOM/Document.h" -#include "DOM/Notation.h" -#include "DOM/Entity.h" -#include "DOM/DOMImplementation.h" -#include "DOM/NamedNodeMap.h" -#include "DOM/AutoPtr.h" +#include "Poco/DOM/DocumentType.h" +#include "Poco/DOM/Document.h" +#include "Poco/DOM/Notation.h" +#include "Poco/DOM/Entity.h" +#include "Poco/DOM/DOMImplementation.h" +#include "Poco/DOM/NamedNodeMap.h" +#include "Poco/DOM/AutoPtr.h" -using XML::DocumentType; -using XML::Document; -using XML::Entity; -using XML::Notation; -using XML::DOMImplementation; -using XML::NamedNodeMap; -using XML::AutoPtr; +using Poco::XML::DocumentType; +using Poco::XML::Document; +using Poco::XML::Entity; +using Poco::XML::Notation; +using Poco::XML::DOMImplementation; +using Poco::XML::NamedNodeMap; +using Poco::XML::AutoPtr; DocumentTypeTest::DocumentTypeTest(const std::string& name): CppUnit::TestCase(name) diff --git a/XML/testsuite/src/DocumentTypeTest.h b/XML/testsuite/src/DocumentTypeTest.h index 5038fe57f..e120e37cc 100644 --- a/XML/testsuite/src/DocumentTypeTest.h +++ b/XML/testsuite/src/DocumentTypeTest.h @@ -1,7 +1,7 @@ // // DocumentTypeTest.h // -// $Id: //poco/1.1.0/XML/testsuite/src/DocumentTypeTest.h#2 $ +// $Id: //poco/1.2/XML/testsuite/src/DocumentTypeTest.h#1 $ // // Definition of the DocumentTypeTest class. // @@ -36,12 +36,8 @@ #define DocumentTypeTest_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/XML/XML.h" #include "CppUnit/TestCase.h" -#endif class DocumentTypeTest: public CppUnit::TestCase diff --git a/XML/testsuite/src/Driver.cpp b/XML/testsuite/src/Driver.cpp index 4d1346dd5..773848a06 100644 --- a/XML/testsuite/src/Driver.cpp +++ b/XML/testsuite/src/Driver.cpp @@ -1,7 +1,7 @@ // // Driver.cpp // -// $Id: //poco/1.1.0/XML/testsuite/src/Driver.cpp#2 $ +// $Id: //poco/1.2/XML/testsuite/src/Driver.cpp#1 $ // // Console-based test driver for Poco XML. // diff --git a/XML/testsuite/src/ElementTest.cpp b/XML/testsuite/src/ElementTest.cpp index f38715bbb..fbec04529 100644 --- a/XML/testsuite/src/ElementTest.cpp +++ b/XML/testsuite/src/ElementTest.cpp @@ -1,7 +1,7 @@ // // ElementTest.cpp // -// $Id: //poco/1.1.0/XML/testsuite/src/ElementTest.cpp#2 $ +// $Id: //poco/1.2/XML/testsuite/src/ElementTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,24 +33,24 @@ #include "ElementTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "DOM/Document.h" -#include "DOM/Element.h" -#include "DOM/Attr.h" -#include "DOM/Text.h" -#include "DOM/NamedNodeMap.h" -#include "DOM/NodeList.h" -#include "DOM/AutoPtr.h" +#include "Poco/DOM/Document.h" +#include "Poco/DOM/Element.h" +#include "Poco/DOM/Attr.h" +#include "Poco/DOM/Text.h" +#include "Poco/DOM/NamedNodeMap.h" +#include "Poco/DOM/NodeList.h" +#include "Poco/DOM/AutoPtr.h" -using XML::Element; -using XML::Document; -using XML::Attr; -using XML::Text; -using XML::Node; -using XML::NamedNodeMap; -using XML::NodeList; -using XML::AutoPtr; -using XML::XMLString; +using Poco::XML::Element; +using Poco::XML::Document; +using Poco::XML::Attr; +using Poco::XML::Text; +using Poco::XML::Node; +using Poco::XML::NamedNodeMap; +using Poco::XML::NodeList; +using Poco::XML::AutoPtr; +using Poco::XML::XMLString; ElementTest::ElementTest(const std::string& name): CppUnit::TestCase(name) diff --git a/XML/testsuite/src/ElementTest.h b/XML/testsuite/src/ElementTest.h index 26f863566..cf8e5df15 100644 --- a/XML/testsuite/src/ElementTest.h +++ b/XML/testsuite/src/ElementTest.h @@ -1,7 +1,7 @@ // // ElementTest.h // -// $Id: //poco/1.1.0/XML/testsuite/src/ElementTest.h#2 $ +// $Id: //poco/1.2/XML/testsuite/src/ElementTest.h#1 $ // // Definition of the ElementTest class. // @@ -36,12 +36,8 @@ #define ElementTest_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/XML/XML.h" #include "CppUnit/TestCase.h" -#endif class ElementTest: public CppUnit::TestCase diff --git a/XML/testsuite/src/EventTest.cpp b/XML/testsuite/src/EventTest.cpp index d03736427..dcc2864a2 100644 --- a/XML/testsuite/src/EventTest.cpp +++ b/XML/testsuite/src/EventTest.cpp @@ -1,7 +1,7 @@ // // EventTest.cpp // -// $Id: //poco/1.1.0/XML/testsuite/src/EventTest.cpp#2 $ +// $Id: //poco/1.2/XML/testsuite/src/EventTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,26 +33,26 @@ #include "EventTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "DOM/Event.h" -#include "DOM/MutationEvent.h" -#include "DOM/EventListener.h" -#include "DOM/Document.h" -#include "DOM/Element.h" -#include "DOM/Attr.h" -#include "DOM/Text.h" -#include "DOM/AutoPtr.h" +#include "Poco/DOM/Event.h" +#include "Poco/DOM/MutationEvent.h" +#include "Poco/DOM/EventListener.h" +#include "Poco/DOM/Document.h" +#include "Poco/DOM/Element.h" +#include "Poco/DOM/Attr.h" +#include "Poco/DOM/Text.h" +#include "Poco/DOM/AutoPtr.h" -using XML::Event; -using XML::MutationEvent; -using XML::EventListener; -using XML::Element; -using XML::Document; -using XML::Attr; -using XML::Text; -using XML::Node; -using XML::AutoPtr; -using XML::XMLString; +using Poco::XML::Event; +using Poco::XML::MutationEvent; +using Poco::XML::EventListener; +using Poco::XML::Element; +using Poco::XML::Document; +using Poco::XML::Attr; +using Poco::XML::Text; +using Poco::XML::Node; +using Poco::XML::AutoPtr; +using Poco::XML::XMLString; class TestEventListener: public EventListener diff --git a/XML/testsuite/src/EventTest.h b/XML/testsuite/src/EventTest.h index 934ad94db..d0216d0fb 100644 --- a/XML/testsuite/src/EventTest.h +++ b/XML/testsuite/src/EventTest.h @@ -1,7 +1,7 @@ // // EventTest.h // -// $Id: //poco/1.1.0/XML/testsuite/src/EventTest.h#2 $ +// $Id: //poco/1.2/XML/testsuite/src/EventTest.h#1 $ // // Definition of the EventTest class. // @@ -36,12 +36,8 @@ #define EventTest_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/XML/XML.h" #include "CppUnit/TestCase.h" -#endif class EventTest: public CppUnit::TestCase diff --git a/XML/testsuite/src/NamePoolTest.cpp b/XML/testsuite/src/NamePoolTest.cpp index db52b3855..a79cf72dd 100644 --- a/XML/testsuite/src/NamePoolTest.cpp +++ b/XML/testsuite/src/NamePoolTest.cpp @@ -1,7 +1,7 @@ // // NamePoolTest.cpp // -// $Id: //poco/1.1.0/XML/testsuite/src/NamePoolTest.cpp#2 $ +// $Id: //poco/1.2/XML/testsuite/src/NamePoolTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,14 +33,14 @@ #include "NamePoolTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "XML/NamePool.h" -#include "XML/Name.h" -#include "DOM/AutoPtr.h" +#include "Poco/XML/NamePool.h" +#include "Poco/XML/Name.h" +#include "Poco/DOM/AutoPtr.h" -using XML::NamePool; -using XML::Name; -using XML::AutoPtr; +using Poco::XML::NamePool; +using Poco::XML::Name; +using Poco::XML::AutoPtr; NamePoolTest::NamePoolTest(const std::string& name): CppUnit::TestCase(name) diff --git a/XML/testsuite/src/NamePoolTest.h b/XML/testsuite/src/NamePoolTest.h index 74c5a47e7..d9abe7598 100644 --- a/XML/testsuite/src/NamePoolTest.h +++ b/XML/testsuite/src/NamePoolTest.h @@ -1,7 +1,7 @@ // // NamePoolTest.h // -// $Id: //poco/1.1.0/XML/testsuite/src/NamePoolTest.h#2 $ +// $Id: //poco/1.2/XML/testsuite/src/NamePoolTest.h#1 $ // // Definition of the NamePoolTest class. // @@ -36,12 +36,8 @@ #define NamePoolTest_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/XML/XML.h" #include "CppUnit/TestCase.h" -#endif class NamePoolTest: public CppUnit::TestCase diff --git a/XML/testsuite/src/NameTest.cpp b/XML/testsuite/src/NameTest.cpp index 71d58e5b5..1d40b9a92 100644 --- a/XML/testsuite/src/NameTest.cpp +++ b/XML/testsuite/src/NameTest.cpp @@ -1,7 +1,7 @@ // // NameTest.cpp // -// $Id: //poco/1.1.0/XML/testsuite/src/NameTest.cpp#2 $ +// $Id: //poco/1.2/XML/testsuite/src/NameTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,10 +33,10 @@ #include "NameTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "XML/Name.h" +#include "Poco/XML/Name.h" -using XML::Name; +using Poco::XML::Name; NameTest::NameTest(const std::string& name): CppUnit::TestCase(name) diff --git a/XML/testsuite/src/NameTest.h b/XML/testsuite/src/NameTest.h index 1472b8b38..d772d61ed 100644 --- a/XML/testsuite/src/NameTest.h +++ b/XML/testsuite/src/NameTest.h @@ -1,7 +1,7 @@ // // NameTest.h // -// $Id: //poco/1.1.0/XML/testsuite/src/NameTest.h#2 $ +// $Id: //poco/1.2/XML/testsuite/src/NameTest.h#1 $ // // Definition of the NameTest class. // @@ -36,12 +36,8 @@ #define NameTest_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/XML/XML.h" #include "CppUnit/TestCase.h" -#endif class NameTest: public CppUnit::TestCase diff --git a/XML/testsuite/src/NamespaceSupportTest.cpp b/XML/testsuite/src/NamespaceSupportTest.cpp index 436f727de..e5b9f6f61 100644 --- a/XML/testsuite/src/NamespaceSupportTest.cpp +++ b/XML/testsuite/src/NamespaceSupportTest.cpp @@ -1,7 +1,7 @@ // // NamespaceSupportTest.cpp // -// $Id: //poco/1.1.0/XML/testsuite/src/NamespaceSupportTest.cpp#2 $ +// $Id: //poco/1.2/XML/testsuite/src/NamespaceSupportTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,10 +33,10 @@ #include "NamespaceSupportTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "SAX/NamespaceSupport.h" +#include "Poco/SAX/NamespaceSupport.h" -using XML::NamespaceSupport; +using Poco::XML::NamespaceSupport; NamespaceSupportTest::NamespaceSupportTest(const std::string& name): CppUnit::TestCase(name) diff --git a/XML/testsuite/src/NamespaceSupportTest.h b/XML/testsuite/src/NamespaceSupportTest.h index e5c6269e6..080043629 100644 --- a/XML/testsuite/src/NamespaceSupportTest.h +++ b/XML/testsuite/src/NamespaceSupportTest.h @@ -1,7 +1,7 @@ // // NamespaceSupportTest.h // -// $Id: //poco/1.1.0/XML/testsuite/src/NamespaceSupportTest.h#2 $ +// $Id: //poco/1.2/XML/testsuite/src/NamespaceSupportTest.h#1 $ // // Definition of the NamespaceSupportTest class. // @@ -36,12 +36,8 @@ #define NamespaceSupportTest_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/XML/XML.h" #include "CppUnit/TestCase.h" -#endif class NamespaceSupportTest: public CppUnit::TestCase diff --git a/XML/testsuite/src/NodeIteratorTest.cpp b/XML/testsuite/src/NodeIteratorTest.cpp index a5dda09ac..ad951f93c 100644 --- a/XML/testsuite/src/NodeIteratorTest.cpp +++ b/XML/testsuite/src/NodeIteratorTest.cpp @@ -1,7 +1,7 @@ // // NodeIteratorTest.cpp // -// $Id: //poco/1.1.0/XML/testsuite/src/NodeIteratorTest.cpp#2 $ +// $Id: //poco/1.2/XML/testsuite/src/NodeIteratorTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,22 +33,22 @@ #include "NodeIteratorTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "DOM/NodeIterator.h" -#include "DOM/NodeFilter.h" -#include "DOM/Document.h" -#include "DOM/Element.h" -#include "DOM/Text.h" -#include "DOM/AutoPtr.h" +#include "Poco/DOM/NodeIterator.h" +#include "Poco/DOM/NodeFilter.h" +#include "Poco/DOM/Document.h" +#include "Poco/DOM/Element.h" +#include "Poco/DOM/Text.h" +#include "Poco/DOM/AutoPtr.h" -using XML::NodeIterator; -using XML::NodeFilter; -using XML::Element; -using XML::Document; -using XML::Text; -using XML::Node; -using XML::AutoPtr; -using XML::XMLString; +using Poco::XML::NodeIterator; +using Poco::XML::NodeFilter; +using Poco::XML::Element; +using Poco::XML::Document; +using Poco::XML::Text; +using Poco::XML::Node; +using Poco::XML::AutoPtr; +using Poco::XML::XMLString; namespace diff --git a/XML/testsuite/src/NodeIteratorTest.h b/XML/testsuite/src/NodeIteratorTest.h index 1aca782da..5173df9c2 100644 --- a/XML/testsuite/src/NodeIteratorTest.h +++ b/XML/testsuite/src/NodeIteratorTest.h @@ -1,7 +1,7 @@ // // NodeIteratorTest.h // -// $Id: //poco/1.1.0/XML/testsuite/src/NodeIteratorTest.h#2 $ +// $Id: //poco/1.2/XML/testsuite/src/NodeIteratorTest.h#1 $ // // Definition of the NodeIteratorTest class. // @@ -36,12 +36,8 @@ #define NodeIteratorTest_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/XML/XML.h" #include "CppUnit/TestCase.h" -#endif class NodeIteratorTest: public CppUnit::TestCase diff --git a/XML/testsuite/src/NodeTest.cpp b/XML/testsuite/src/NodeTest.cpp index 657046ace..09e55d1e5 100644 --- a/XML/testsuite/src/NodeTest.cpp +++ b/XML/testsuite/src/NodeTest.cpp @@ -1,7 +1,7 @@ // // NodeTest.cpp // -// $Id: //poco/1.1.0/XML/testsuite/src/NodeTest.cpp#2 $ +// $Id: //poco/1.2/XML/testsuite/src/NodeTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,17 +33,17 @@ #include "NodeTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "DOM/Document.h" -#include "DOM/Element.h" -#include "DOM/DocumentFragment.h" -#include "DOM/AutoPtr.h" +#include "Poco/DOM/Document.h" +#include "Poco/DOM/Element.h" +#include "Poco/DOM/DocumentFragment.h" +#include "Poco/DOM/AutoPtr.h" -using XML::Element; -using XML::Document; -using XML::DocumentFragment; -using XML::Node; -using XML::AutoPtr; +using Poco::XML::Element; +using Poco::XML::Document; +using Poco::XML::DocumentFragment; +using Poco::XML::Node; +using Poco::XML::AutoPtr; NodeTest::NodeTest(const std::string& name): CppUnit::TestCase(name) diff --git a/XML/testsuite/src/NodeTest.h b/XML/testsuite/src/NodeTest.h index dec0557b0..3e17a3892 100644 --- a/XML/testsuite/src/NodeTest.h +++ b/XML/testsuite/src/NodeTest.h @@ -1,7 +1,7 @@ // // NodeTest.h // -// $Id: //poco/1.1.0/XML/testsuite/src/NodeTest.h#2 $ +// $Id: //poco/1.2/XML/testsuite/src/NodeTest.h#1 $ // // Definition of the NodeTest class. // @@ -36,12 +36,8 @@ #define NodeTest_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/XML/XML.h" #include "CppUnit/TestCase.h" -#endif class NodeTest: public CppUnit::TestCase diff --git a/XML/testsuite/src/ParserWriterTest.cpp b/XML/testsuite/src/ParserWriterTest.cpp index c0777d2f8..d15971192 100644 --- a/XML/testsuite/src/ParserWriterTest.cpp +++ b/XML/testsuite/src/ParserWriterTest.cpp @@ -1,7 +1,7 @@ // // ParserWriterTest.cpp // -// $Id: //poco/1.1.0/XML/testsuite/src/ParserWriterTest.cpp#2 $ +// $Id: //poco/1.2/XML/testsuite/src/ParserWriterTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,22 +33,22 @@ #include "ParserWriterTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "DOM/DOMParser.h" -#include "DOM/DOMWriter.h" -#include "DOM/Document.h" -#include "DOM/AutoPtr.h" -#include "SAX/InputSource.h" -#include "XML/XMLWriter.h" +#include "Poco/DOM/DOMParser.h" +#include "Poco/DOM/DOMWriter.h" +#include "Poco/DOM/Document.h" +#include "Poco/DOM/AutoPtr.h" +#include "Poco/SAX/InputSource.h" +#include "Poco/XML/XMLWriter.h" #include #include -using XML::DOMParser; -using XML::DOMWriter; -using XML::XMLWriter; -using XML::Document; -using XML::AutoPtr; -using XML::InputSource; +using Poco::XML::DOMParser; +using Poco::XML::DOMWriter; +using Poco::XML::XMLWriter; +using Poco::XML::Document; +using Poco::XML::AutoPtr; +using Poco::XML::InputSource; ParserWriterTest::ParserWriterTest(const std::string& name): CppUnit::TestCase(name) diff --git a/XML/testsuite/src/ParserWriterTest.h b/XML/testsuite/src/ParserWriterTest.h index a4592a2b1..005c86533 100644 --- a/XML/testsuite/src/ParserWriterTest.h +++ b/XML/testsuite/src/ParserWriterTest.h @@ -1,7 +1,7 @@ // // ParserWriterTest.h // -// $Id: //poco/1.1.0/XML/testsuite/src/ParserWriterTest.h#2 $ +// $Id: //poco/1.2/XML/testsuite/src/ParserWriterTest.h#1 $ // // Definition of the ParserWriterTest class. // @@ -36,12 +36,8 @@ #define ParserWriterTest_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/XML/XML.h" #include "CppUnit/TestCase.h" -#endif class ParserWriterTest: public CppUnit::TestCase diff --git a/XML/testsuite/src/SAXParserTest.cpp b/XML/testsuite/src/SAXParserTest.cpp index c9e550f72..75e81dfb7 100644 --- a/XML/testsuite/src/SAXParserTest.cpp +++ b/XML/testsuite/src/SAXParserTest.cpp @@ -1,7 +1,7 @@ // // SAXParserTest.cpp // -// $Id: //poco/1.1.0/XML/testsuite/src/SAXParserTest.cpp#2 $ +// $Id: //poco/1.2/XML/testsuite/src/SAXParserTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,25 +33,25 @@ #include "SAXParserTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "SAX/SAXParser.h" -#include "SAX/InputSource.h" -#include "SAX/EntityResolver.h" -#include "SAX/SAXException.h" -#include "SAX/WhitespaceFilter.h" -#include "XML/XMLWriter.h" -#include "Foundation/Latin9Encoding.h" +#include "Poco/SAX/SAXParser.h" +#include "Poco/SAX/InputSource.h" +#include "Poco/SAX/EntityResolver.h" +#include "Poco/SAX/SAXException.h" +#include "Poco/SAX/WhitespaceFilter.h" +#include "Poco/XML/XMLWriter.h" +#include "Poco/Latin9Encoding.h" #include #include -using XML::SAXParser; -using XML::XMLWriter; -using XML::XMLReader; -using XML::InputSource; -using XML::EntityResolver; -using XML::XMLString; -using XML::SAXParseException; -using XML::WhitespaceFilter; +using Poco::XML::SAXParser; +using Poco::XML::XMLWriter; +using Poco::XML::XMLReader; +using Poco::XML::InputSource; +using Poco::XML::EntityResolver; +using Poco::XML::XMLString; +using Poco::XML::SAXParseException; +using Poco::XML::WhitespaceFilter; class TestEntityResolver: public EntityResolver @@ -281,7 +281,7 @@ void SAXParserTest::testRSS() XMLWriter writer(ostr, XMLWriter::CANONICAL | XMLWriter::PRETTY_PRINT); filter.setContentHandler(&writer); filter.setDTDHandler(&writer); - filter.setProperty(XMLReader::PROPERTY_LEXICAL_HANDLER, static_cast(&writer)); + filter.setProperty(XMLReader::PROPERTY_LEXICAL_HANDLER, static_cast(&writer)); InputSource source(istr); filter.parse(&source); } @@ -290,7 +290,7 @@ void SAXParserTest::testRSS() void SAXParserTest::testEncoding() { SAXParser parser; - Foundation::Latin9Encoding encoding; + Poco::Latin9Encoding encoding; parser.addEncoding("ISO-8859-15", &encoding); std::istringstream istr(ENCODING); @@ -298,7 +298,7 @@ void SAXParserTest::testEncoding() XMLWriter writer(ostr, XMLWriter::WRITE_XML_DECLARATION, "ISO-8859-15", encoding); parser.setContentHandler(&writer); parser.setDTDHandler(&writer); - parser.setProperty(XMLReader::PROPERTY_LEXICAL_HANDLER, static_cast(&writer)); + parser.setProperty(XMLReader::PROPERTY_LEXICAL_HANDLER, static_cast(&writer)); InputSource source(istr); parser.parse(&source); @@ -324,7 +324,7 @@ std::string SAXParserTest::parse(XMLReader& reader, int options, const std::stri XMLWriter writer(ostr, options); reader.setContentHandler(&writer); reader.setDTDHandler(&writer); - reader.setProperty(XMLReader::PROPERTY_LEXICAL_HANDLER, static_cast(&writer)); + reader.setProperty(XMLReader::PROPERTY_LEXICAL_HANDLER, static_cast(&writer)); InputSource source(istr); reader.parse(&source); return ostr.str(); diff --git a/XML/testsuite/src/SAXParserTest.h b/XML/testsuite/src/SAXParserTest.h index 6669003c5..e4b2f79e3 100644 --- a/XML/testsuite/src/SAXParserTest.h +++ b/XML/testsuite/src/SAXParserTest.h @@ -1,7 +1,7 @@ // // SAXParserTest.h // -// $Id: //poco/1.1.0/XML/testsuite/src/SAXParserTest.h#2 $ +// $Id: //poco/1.2/XML/testsuite/src/SAXParserTest.h#1 $ // // Definition of the SAXParserTest class. // @@ -36,15 +36,9 @@ #define SAXParserTest_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/XML/XML.h" #include "CppUnit/TestCase.h" -#endif -#ifndef SAX_XMLReader_INCLUDED -#include "SAX/XMLReader.h" -#endif +#include "Poco/SAX/XMLReader.h" class SAXParserTest: public CppUnit::TestCase @@ -77,7 +71,7 @@ public: void setUp(); void tearDown(); - std::string parse(XML::XMLReader& reader, int options, const std::string& data); + std::string parse(Poco::XML::XMLReader& reader, int options, const std::string& data); static CppUnit::Test* suite(); diff --git a/XML/testsuite/src/SAXTestSuite.cpp b/XML/testsuite/src/SAXTestSuite.cpp index 3148c1cbb..079998d8c 100644 --- a/XML/testsuite/src/SAXTestSuite.cpp +++ b/XML/testsuite/src/SAXTestSuite.cpp @@ -1,7 +1,7 @@ // // SAXTestSuite.cpp // -// $Id: //poco/1.1.0/XML/testsuite/src/SAXTestSuite.cpp#2 $ +// $Id: //poco/1.2/XML/testsuite/src/SAXTestSuite.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. diff --git a/XML/testsuite/src/SAXTestSuite.h b/XML/testsuite/src/SAXTestSuite.h index 6f2c510eb..eccc99c26 100644 --- a/XML/testsuite/src/SAXTestSuite.h +++ b/XML/testsuite/src/SAXTestSuite.h @@ -1,7 +1,7 @@ // // SAXTestSuite.h // -// $Id: //poco/1.1.0/XML/testsuite/src/SAXTestSuite.h#2 $ +// $Id: //poco/1.2/XML/testsuite/src/SAXTestSuite.h#1 $ // // Definition of the SAXTestSuite class. // @@ -36,9 +36,7 @@ #define SAXTestSuite_INCLUDED -#ifndef CppUnit_TestSuite_INCLUDED #include "CppUnit/TestSuite.h" -#endif class SAXTestSuite diff --git a/XML/testsuite/src/TextTest.cpp b/XML/testsuite/src/TextTest.cpp index a4e1f1180..9e65c3cd3 100644 --- a/XML/testsuite/src/TextTest.cpp +++ b/XML/testsuite/src/TextTest.cpp @@ -1,7 +1,7 @@ // // TextTest.cpp // -// $Id: //poco/1.1.0/XML/testsuite/src/TextTest.cpp#2 $ +// $Id: //poco/1.2/XML/testsuite/src/TextTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,19 +33,19 @@ #include "TextTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "DOM/Text.h" -#include "DOM/CDATASection.h" -#include "DOM/Element.h" -#include "DOM/Document.h" -#include "DOM/AutoPtr.h" +#include "Poco/DOM/Text.h" +#include "Poco/DOM/CDATASection.h" +#include "Poco/DOM/Element.h" +#include "Poco/DOM/Document.h" +#include "Poco/DOM/AutoPtr.h" -using XML::Text; -using XML::CDATASection; -using XML::Element; -using XML::Document; -using XML::AutoPtr; -using XML::XMLString; +using Poco::XML::Text; +using Poco::XML::CDATASection; +using Poco::XML::Element; +using Poco::XML::Document; +using Poco::XML::AutoPtr; +using Poco::XML::XMLString; TextTest::TextTest(const std::string& name): CppUnit::TestCase(name) diff --git a/XML/testsuite/src/TextTest.h b/XML/testsuite/src/TextTest.h index 242864272..e5eceaeb5 100644 --- a/XML/testsuite/src/TextTest.h +++ b/XML/testsuite/src/TextTest.h @@ -1,7 +1,7 @@ // // TextTest.h // -// $Id: //poco/1.1.0/XML/testsuite/src/TextTest.h#2 $ +// $Id: //poco/1.2/XML/testsuite/src/TextTest.h#1 $ // // Definition of the TextTest class. // @@ -36,12 +36,8 @@ #define TextTest_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/XML/XML.h" #include "CppUnit/TestCase.h" -#endif class TextTest: public CppUnit::TestCase diff --git a/XML/testsuite/src/TreeWalkerTest.cpp b/XML/testsuite/src/TreeWalkerTest.cpp index f81a3b9dd..7b5e2e0e6 100644 --- a/XML/testsuite/src/TreeWalkerTest.cpp +++ b/XML/testsuite/src/TreeWalkerTest.cpp @@ -1,7 +1,7 @@ // // TreeWalkerTest.cpp // -// $Id: //poco/1.1.0/XML/testsuite/src/TreeWalkerTest.cpp#2 $ +// $Id: //poco/1.2/XML/testsuite/src/TreeWalkerTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,22 +33,22 @@ #include "TreeWalkerTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "DOM/TreeWalker.h" -#include "DOM/NodeFilter.h" -#include "DOM/Document.h" -#include "DOM/Element.h" -#include "DOM/Text.h" -#include "DOM/AutoPtr.h" +#include "Poco/DOM/TreeWalker.h" +#include "Poco/DOM/NodeFilter.h" +#include "Poco/DOM/Document.h" +#include "Poco/DOM/Element.h" +#include "Poco/DOM/Text.h" +#include "Poco/DOM/AutoPtr.h" -using XML::TreeWalker; -using XML::NodeFilter; -using XML::Element; -using XML::Document; -using XML::Text; -using XML::Node; -using XML::AutoPtr; -using XML::XMLString; +using Poco::XML::TreeWalker; +using Poco::XML::NodeFilter; +using Poco::XML::Element; +using Poco::XML::Document; +using Poco::XML::Text; +using Poco::XML::Node; +using Poco::XML::AutoPtr; +using Poco::XML::XMLString; namespace diff --git a/XML/testsuite/src/TreeWalkerTest.h b/XML/testsuite/src/TreeWalkerTest.h index 79cdb3c25..10ae5dd37 100644 --- a/XML/testsuite/src/TreeWalkerTest.h +++ b/XML/testsuite/src/TreeWalkerTest.h @@ -1,7 +1,7 @@ // // TreeWalkerTest.h // -// $Id: //poco/1.1.0/XML/testsuite/src/TreeWalkerTest.h#2 $ +// $Id: //poco/1.2/XML/testsuite/src/TreeWalkerTest.h#1 $ // // Definition of the TreeWalkerTest class. // @@ -36,12 +36,8 @@ #define TreeWalkerTest_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/XML/XML.h" #include "CppUnit/TestCase.h" -#endif class TreeWalkerTest: public CppUnit::TestCase diff --git a/XML/testsuite/src/WinDriver.cpp b/XML/testsuite/src/WinDriver.cpp index 9cac9b35d..b01cbd316 100644 --- a/XML/testsuite/src/WinDriver.cpp +++ b/XML/testsuite/src/WinDriver.cpp @@ -1,7 +1,7 @@ // // WinDriver.cpp // -// $Id: //poco/1.1.0/XML/testsuite/src/WinDriver.cpp#2 $ +// $Id: //poco/1.2/XML/testsuite/src/WinDriver.cpp#1 $ // // Windows test driver for Poco XML. // diff --git a/XML/testsuite/src/XMLTestSuite.cpp b/XML/testsuite/src/XMLTestSuite.cpp index efb69e02a..4a1a43397 100644 --- a/XML/testsuite/src/XMLTestSuite.cpp +++ b/XML/testsuite/src/XMLTestSuite.cpp @@ -1,7 +1,7 @@ // // XMLTestSuite.cpp // -// $Id: //poco/1.1.0/XML/testsuite/src/XMLTestSuite.cpp#2 $ +// $Id: //poco/1.2/XML/testsuite/src/XMLTestSuite.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. diff --git a/XML/testsuite/src/XMLTestSuite.h b/XML/testsuite/src/XMLTestSuite.h index 476d8b3c2..177762203 100644 --- a/XML/testsuite/src/XMLTestSuite.h +++ b/XML/testsuite/src/XMLTestSuite.h @@ -1,7 +1,7 @@ // // XMLTestSuite.h // -// $Id: //poco/1.1.0/XML/testsuite/src/XMLTestSuite.h#2 $ +// $Id: //poco/1.2/XML/testsuite/src/XMLTestSuite.h#1 $ // // Definition of the XMLTestSuite class. // @@ -36,9 +36,7 @@ #define XMLTestSuite_INCLUDED -#ifndef CppUnit_TestSuite_INCLUDED #include "CppUnit/TestSuite.h" -#endif class XMLTestSuite diff --git a/XML/testsuite/src/XMLWriterTest.cpp b/XML/testsuite/src/XMLWriterTest.cpp index c99541dbe..bdd3fc9b6 100644 --- a/XML/testsuite/src/XMLWriterTest.cpp +++ b/XML/testsuite/src/XMLWriterTest.cpp @@ -1,7 +1,7 @@ // // XMLWriterTest.cpp // -// $Id: //poco/1.1.0/XML/testsuite/src/XMLWriterTest.cpp#2 $ +// $Id: //poco/1.2/XML/testsuite/src/XMLWriterTest.cpp#1 $ // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -33,14 +33,14 @@ #include "XMLWriterTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" -#include "XML/XMLWriter.h" -#include "SAX/AttributesImpl.h" -#include "Foundation/Exception.h" +#include "Poco/XML/XMLWriter.h" +#include "Poco/SAX/AttributesImpl.h" +#include "Poco/Exception.h" #include -using XML::XMLWriter; -using XML::AttributesImpl; +using Poco::XML::XMLWriter; +using Poco::XML::AttributesImpl; XMLWriterTest::XMLWriterTest(const std::string& name): CppUnit::TestCase(name) @@ -387,6 +387,22 @@ void XMLWriterTest::testNamespaces() assert (xml == "data"); } +void XMLWriterTest::testAttributeNamespaces() +{ + std::ostringstream str; + XMLWriter writer(str, XMLWriter::CANONICAL); + Poco::XML::AttributesImpl attrs; + attrs.addAttribute("urn:other", "myattr", "", "", "attrValue"); + attrs.addAttribute("urn:ns", "myattr2", "", "", "attrValue2"); + writer.startDocument(); + writer.startElement("urn:ns", "r", "", attrs); + writer.characters("data"); + writer.endElement("urn:ns", "r", ""); + writer.endDocument(); + std::string xml = str.str(); + assert (xml == "data"); +} + void XMLWriterTest::testNamespacesNested() { @@ -438,7 +454,7 @@ void XMLWriterTest::testWellformed() writer.endElement("", "", "bar"); fail("not wellformed - must throw exception"); } - catch (Foundation::Exception&) + catch (Poco::Exception&) { } } @@ -456,7 +472,7 @@ void XMLWriterTest::testWellformedNested() writer.endElement("", "", "foo"); fail("not wellformed - must throw exception"); } - catch (Foundation::Exception&) + catch (Poco::Exception&) { } } @@ -474,7 +490,7 @@ void XMLWriterTest::testWellformedNamespace() writer.endElement("urn:ns1", "bar", ""); fail("not wellformed - must throw exception"); } - catch (Foundation::Exception&) + catch (Poco::Exception&) { } } @@ -515,6 +531,7 @@ CppUnit::Test* XMLWriterTest::suite() CppUnit_addTest(pSuite, XMLWriterTest, testQNamespaces); CppUnit_addTest(pSuite, XMLWriterTest, testQNamespacesNested); CppUnit_addTest(pSuite, XMLWriterTest, testNamespaces); + CppUnit_addTest(pSuite, XMLWriterTest, testAttributeNamespaces); CppUnit_addTest(pSuite, XMLWriterTest, testNamespacesNested); CppUnit_addTest(pSuite, XMLWriterTest, testExplicitNamespaces); CppUnit_addTest(pSuite, XMLWriterTest, testWellformed); diff --git a/XML/testsuite/src/XMLWriterTest.h b/XML/testsuite/src/XMLWriterTest.h index 5d576c96d..d359faeb8 100644 --- a/XML/testsuite/src/XMLWriterTest.h +++ b/XML/testsuite/src/XMLWriterTest.h @@ -1,7 +1,7 @@ // // XMLWriterTest.h // -// $Id: //poco/1.1.0/XML/testsuite/src/XMLWriterTest.h#2 $ +// $Id: //poco/1.2/XML/testsuite/src/XMLWriterTest.h#1 $ // // Definition of the XMLWriterTest class. // @@ -36,12 +36,8 @@ #define XMLWriterTest_INCLUDED -#ifndef XML_XML_INCLUDED -#include "XML/XML.h" -#endif -#ifndef CppUnit_TestCase_INCLUDED +#include "Poco/XML/XML.h" #include "CppUnit/TestCase.h" -#endif class XMLWriterTest: public CppUnit::TestCase @@ -76,6 +72,7 @@ public: void testWellformed(); void testWellformedNested(); void testWellformedNamespace(); + void testAttributeNamespaces(); void setUp(); void tearDown(); diff --git a/build/config/ARM-Linux b/build/config/ARM-Linux index 2508801c2..d1f23c6d1 100644 --- a/build/config/ARM-Linux +++ b/build/config/ARM-Linux @@ -1,5 +1,5 @@ # -# $Id: //poco/1.1.0/build/config/ARM-Linux#1 $ +# $Id: //poco/1.2/build/config/ARM-Linux#1 $ # # ARM-Linux # @@ -22,10 +22,10 @@ OPENSSL_LIB = /usr/local/arm/2.95.3/lib # CC = arm-linux-gcc CXX = arm-linux-g++ -LINK = arm-linux-g++ +LINK = $(CXX) LIB = arm-linux-ar -cr RANLIB = arm-linux-ranlib -SHLIB = arm-linux-g++ -shared -Wl,-soname,$(notdir $@) -Wl,-rpath,$(dir $@) -o $@ +SHLIB = $(CXX) -shared -Wl,-soname,$(notdir $@) -Wl,-rpath,$(dir $@) -o $@ SHLIBLN = $(POCO_BASE)/build/script/shlibln DEP = $(POCO_BASE)/build/script/makedepend.gcc SHELL = sh @@ -67,7 +67,7 @@ RELEASEOPT_LINK = -O2 # # System Specific Flags # -SYSFLAGS = -I$(STLPORT_INCLUDE) -I$(OPENSSL_INCLUDE) -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_REENTRANT -D_THREAD_SAFE +SYSFLAGS = -I$(STLPORT_INCLUDE) -I$(OPENSSL_INCLUDE) -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_REENTRANT -D_THREAD_SAFE -DPOCO_NO_FPENVIRONMENT # # System Specific Libraries diff --git a/build/config/CYGWIN b/build/config/CYGWIN index ded4bbf15..3fb6a5c40 100644 --- a/build/config/CYGWIN +++ b/build/config/CYGWIN @@ -1,7 +1,7 @@ # # $Id: //poco/Main/build/config/Linux#5 $ # -# Linux +# CYGWIN # # Make settings for Cygwin on WinXP/gcc 3.4 # @@ -17,10 +17,10 @@ LINKMODE = SHARED # CC = gcc CXX = g++ -LINK = g++ +LINK = $(CXX) LIB = ar -cr RANLIB = ranlib -SHLIB = g++ -shared -Wl,-soname,$(notdir $@) -Wl,-rpath,$(dir $@) -o $@ +SHLIB = $(CXX) -shared -o $@ -Wl,--out-implib=$(dir $@)$(subst cyg,lib,$(notdir $@)).a -Wl,--export-all-symbols -Wl,--enable-auto-import SHLIBLN = $(POCO_BASE)/build/script/shlibln DEP = $(POCO_BASE)/build/script/makedepend.gcc SHELL = sh @@ -31,6 +31,7 @@ MKDIR = mkdir -p # # Extension for Shared Libraries # +LIBPREFIX = cyg SHAREDLIBEXT = .$(target_version).dll SHAREDLIBLINKEXT = .dll @@ -40,7 +41,7 @@ SHAREDLIBLINKEXT = .dll CFLAGS = CFLAGS32 = CFLAGS64 = -CXXFLAGS = +CXXFLAGS = -DPOCO_NO_FPENVIRONMENT -DPOCO_NO_WSTRING CXXFLAGS32 = CXXFLAGS64 = LINKFLAGS = @@ -50,8 +51,8 @@ STATICOPT_CC = STATICOPT_CXX = STATICOPT_LINK = -static SHAREDOPT_CC = -SHAREDOPT_CXX = -DPOCO_DLL -SHAREDOPT_LINK = -Wl,-rpath,$(LIBPATH) +SHAREDOPT_CXX = +SHAREDOPT_LINK = DEBUGOPT_CC = -g -D_DEBUG DEBUGOPT_CXX = -g -D_DEBUG DEBUGOPT_LINK = -g @@ -62,9 +63,9 @@ RELEASEOPT_LINK = -O2 # # System Specific Flags # -SYSFLAGS = -D_XOPEN_SOURCE=500 -D_REENTRANT -D_THREAD_SAFE +SYSFLAGS = -D_XOPEN_SOURCE=500 # # System Specific Libraries # -SYSLIBS = -lpthread -lcygwin +SYSLIBS = diff --git a/build/config/Darwin b/build/config/Darwin index 5d0e9b2fd..fe2448c89 100644 --- a/build/config/Darwin +++ b/build/config/Darwin @@ -1,9 +1,9 @@ # -# $Id: //poco/1.1.0/build/config/Darwin#1 $ +# $Id: //poco/1.2/build/config/Darwin#1 $ # -# Darwin +# Darwin8 # -# Build settings for Mac OS X 10.3 +# Build settings for Mac OS X 10.4/GCC 4.0.0 # # @@ -16,11 +16,11 @@ LINKMODE = SHARED # CC = gcc CXX = c++ -LINK = c++ -bind_at_load +LINK = $(CXX) -bind_at_load LIB = libtool -static -o RANLIB = ranlib -SHLIB = libtool -dynamic -flat_namespace -undefined suppress -noprebind -install_name $@ -o $@ -DYLIB = ld -dynamic -bundle -read_only_relocs suppress -flat_namespace -undefined warning -noprebind -bind_at_load -o $@ /usr/lib/bundle1.o +SHLIB = $(CXX) -dynamiclib -Wl,-install_name,$@ -o $@ +DYLIB = $(CXX) -dynamic -bundle -read_only_relocs suppress -Wl,-noprebind -Wl,-bind_at_load -o $@ SHLIBLN = $(POCO_BASE)/build/script/shlibln DEP = $(POCO_BASE)/build/script/makedepend.gcc SHELL = sh @@ -40,7 +40,7 @@ SHAREDLIBLINKEXT = .dylib CFLAGS = CFLAGS32 = CFLAGS64 = -CXXFLAGS = -Wno-long-double -fmessage-length=0 -fcoalesce-templates +CXXFLAGS = -Wall -Wno-sign-compare CXXFLAGS32 = CXXFLAGS64 = LINKFLAGS = @@ -49,11 +49,11 @@ LINKFLAGS64 = STATICOPT_CC = STATICOPT_CXX = STATICOPT_LINK = -SHAREDOPT_CC = -SHAREDOPT_CXX = +SHAREDOPT_CC = -fPIC +SHAREDOPT_CXX = -fPIC SHAREDOPT_LINK = DEBUGOPT_CC = -g -D_DEBUG=$(DEBUGLEVEL) -DEBUGOPT_CXX = -g -D_DEBUG=$(DEBUGLEVEL) +DEBUGOPT_CXX = -g -D_DEBUG=$(DEBUGLEVEL) DEBUGOPT_LINK = RELEASEOPT_CC = -DNDEBUG -O2 RELEASEOPT_CXX = -DNDEBUG -O @@ -62,9 +62,9 @@ RELEASEOPT_LINK = # # System Specific Flags # -SYSFLAGS = -D_XOPEN_SOURCE +SYSFLAGS = -DPOCO_HAVE_IPv6 # # System Specific Libraries # -SYSLIBS = -lstdc++ -framework System -ldl -lcc_dynamic +SYSLIBS = -ldl diff --git a/build/config/Darwin8 b/build/config/Darwin7 similarity index 59% rename from build/config/Darwin8 rename to build/config/Darwin7 index 535223ffa..b3446c5ae 100644 --- a/build/config/Darwin8 +++ b/build/config/Darwin7 @@ -1,9 +1,9 @@ # -# $Id: //poco/1.1.0/build/config/Darwin8#1 $ +# $Id: //poco/1.2/build/config/Darwin7#1 $ # -# Darwin8 +# Darwin # -# Build settings for Mac OS X 10.4/GCC 4.0.0 +# Build settings for Mac OS X 10.3 # # @@ -16,11 +16,11 @@ LINKMODE = SHARED # CC = gcc CXX = c++ -LINK = c++ -bind_at_load +LINK = $(CXX) -bind_at_load LIB = libtool -static -o RANLIB = ranlib -SHLIB = g++ -dynamiclib -Wl,-install_name,$@ -o $@ -DYLIB = g++ -dynamic -bundle -read_only_relocs suppress -Wl,-noprebind -Wl,-bind_at_load -o $@ +SHLIB = libtool -dynamic -flat_namespace -undefined suppress -noprebind -install_name $@ -o $@ +DYLIB = ld -dynamic -bundle -read_only_relocs suppress -flat_namespace -undefined warning -noprebind -bind_at_load -o $@ /usr/lib/bundle1.o SHLIBLN = $(POCO_BASE)/build/script/shlibln DEP = $(POCO_BASE)/build/script/makedepend.gcc SHELL = sh @@ -40,7 +40,7 @@ SHAREDLIBLINKEXT = .dylib CFLAGS = CFLAGS32 = CFLAGS64 = -CXXFLAGS = +CXXFLAGS = -Wno-long-double -fmessage-length=0 -fcoalesce-templates CXXFLAGS32 = CXXFLAGS64 = LINKFLAGS = @@ -49,8 +49,8 @@ LINKFLAGS64 = STATICOPT_CC = STATICOPT_CXX = STATICOPT_LINK = -SHAREDOPT_CC = -fPIC -SHAREDOPT_CXX = -fPIC +SHAREDOPT_CC = +SHAREDOPT_CXX = SHAREDOPT_LINK = DEBUGOPT_CC = -g -D_DEBUG=$(DEBUGLEVEL) DEBUGOPT_CXX = -g -D_DEBUG=$(DEBUGLEVEL) @@ -62,9 +62,9 @@ RELEASEOPT_LINK = # # System Specific Flags # -SYSFLAGS = -DPOCO_HAVE_IPv6 +SYSFLAGS = -D_XOPEN_SOURCE # # System Specific Libraries # -SYSLIBS = -ldl +SYSLIBS = -lstdc++ -framework System -ldl -lcc_dynamic diff --git a/build/config/FreeBSD b/build/config/FreeBSD index a2436bb7f..afbb69d20 100644 --- a/build/config/FreeBSD +++ b/build/config/FreeBSD @@ -1,5 +1,5 @@ # -# $Id: //poco/1.1.0/build/config/FreeBSD#1 $ +# $Id: //poco/1.2/build/config/FreeBSD#1 $ # # FreeBSD # @@ -17,10 +17,10 @@ LINKMODE = SHARED # CC = gcc CXX = g++ -LINK = g++ +LINK = $(CXX) LIB = ar -cr RANLIB = ranlib -SHLIB = g++ -shared -Wl,-soname,$(notdir $@) -Wl,-rpath,$(dir $@) -o $@ +SHLIB = $(CXX) -shared -Wl,-soname,$(notdir $@) -Wl,-rpath,$(dir $@) -o $@ SHLIBLN = $(POCO_BASE)/build/script/shlibln DEP = $(POCO_BASE)/build/script/makedepend.gcc SHELL = sh diff --git a/build/config/HP-UX b/build/config/HP-UX index d0a055c30..445a5d6dd 100644 --- a/build/config/HP-UX +++ b/build/config/HP-UX @@ -1,5 +1,5 @@ # -# $Id: //poco/1.1.0/build/config/HP-UX#1 $ +# $Id: //poco/1.2/build/config/HP-UX#1 $ # # HP-UX # @@ -16,10 +16,10 @@ LINKMODE = SHARED # CC = cc CXX = aCC -LINK = aCC +LINK = $(CXX) LIB = ar -cr RANLIB = ranlib -SHLIB = aCC $(LINKFLAGS) -b -Wl,+h$(notdir $@) -o $@ -Wl,+s +SHLIB = $(CXX) $(LINKFLAGS) -b -Wl,+h$(notdir $@) -o $@ -Wl,+s SHLIBLN = $(POCO_BASE)/build/script/shlibln DEP = $(POCO_BASE)/build/script/makedepend.aCC SHELL = sh diff --git a/build/config/Linux b/build/config/Linux index c48f4ea76..f4895fa05 100644 --- a/build/config/Linux +++ b/build/config/Linux @@ -1,5 +1,5 @@ # -# $Id: //poco/1.1.0/build/config/Linux#1 $ +# $Id: //poco/1.2/build/config/Linux#1 $ # # Linux # @@ -17,10 +17,10 @@ LINKMODE = SHARED # CC = gcc CXX = g++ -LINK = g++ +LINK = $(CXX) LIB = ar -cr RANLIB = ranlib -SHLIB = g++ -shared -Wl,-soname,$(notdir $@) -Wl,-rpath,$(dir $@) -o $@ +SHLIB = $(CXX) -shared -Wl,-soname,$(notdir $@) -Wl,-rpath,$(dir $@) -o $@ SHLIBLN = $(POCO_BASE)/build/script/shlibln DEP = $(POCO_BASE)/build/script/makedepend.gcc SHELL = sh @@ -62,7 +62,7 @@ RELEASEOPT_LINK = -O2 # # System Specific Flags # -SYSFLAGS = -D_XOPEN_SOURCE=500 -D_REENTRANT -D_THREAD_SAFE +SYSFLAGS = -D_XOPEN_SOURCE=500 -D_REENTRANT -D_THREAD_SAFE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE # # System Specific Libraries diff --git a/build/config/MinGW b/build/config/MinGW new file mode 100644 index 000000000..049a3732d --- /dev/null +++ b/build/config/MinGW @@ -0,0 +1,71 @@ +# +# $Id: //poco/1.2/build/config/MinGW#1 $ +# +# MinGW32 +# +# Make settings for MinGW on WinXP +# + +# +# General Settings +# +LINKMODE = SHARED +POCO_TARGET_OSNAME = MinGW +POCO_TARGET_OSARCH = ia32 + +# +# Define Tools +# +CC = gcc +CXX = g++ +LINK = $(CXX) +LIB = ar -cr +RANLIB = ranlib +SHLIB = $(CXX) -shared -mno-cygwin -o $@ -Wl,--out-implib=$(dir $@)$(subst cyg,lib,$(basename $(notdir $@))).a +SHLIBLN = $(POCO_BASE)/build/script/shlibln +DEP = $(POCO_BASE)/build/script/makedepend.gcc +SHELL = sh +RM = rm -rf +CP = cp +MKDIR = mkdir -p + +# +# Extension for Shared Libraries +# +SHAREDLIBEXT = .dll +SHAREDLIBLINKEXT = .dll + +# +# Compiler and Linker Flags +# +CFLAGS = +CFLAGS32 = +CFLAGS64 = +CXXFLAGS = +CXXFLAGS32 = +CXXFLAGS64 = +LINKFLAGS = +LINKFLAGS32 = +LINKFLAGS64 = +STATICOPT_CC = +STATICOPT_CXX = +STATICOPT_LINK = -static +SHAREDOPT_CC = +SHAREDOPT_CXX = +SHAREDOPT_LINK = +DEBUGOPT_CC = -g -D_DEBUG +DEBUGOPT_CXX = -g -D_DEBUG +DEBUGOPT_LINK = -g +RELEASEOPT_CC = -O2 -DNDEBUG +RELEASEOPT_CXX = -O2 -DNDEBUG +RELEASEOPT_LINK = -O2 + +# +# System Specific Flags +# +SYSFLAGS = -mno-cygwin -D_WIN32 -DPOCO_NO_FPENVIRONMENT + +# +# System Specific Libraries +# +SYSLIBS = -liphlpapi diff --git a/build/config/OSF1 b/build/config/OSF1 index 2afcda801..05159676c 100644 --- a/build/config/OSF1 +++ b/build/config/OSF1 @@ -1,5 +1,5 @@ # -# $Id: //poco/1.1.0/build/config/OSF1#1 $ +# $Id: //poco/1.2/build/config/OSF1#1 $ # # OSF1 # @@ -16,10 +16,10 @@ LINKMODE = SHARED # CC = cc CXX = cxx -LINK = cxx +LINK = $(CXX) LIB = ar -cr RANLIB = ranlib -SHLIB = cxx $(LINKFLAGS) -shared -o $@ -rpath $(LIBPATH) -soname $(notdir $@) +SHLIB = $(CXX) $(LINKFLAGS) -shared -o $@ -rpath $(LIBPATH) -soname $(notdir $@) SHLIBLN = $(POCO_BASE)/build/script/shlibln DEP = $(POCO_BASE)/build/script/makedepend.cxx SHELL = sh diff --git a/build/config/QNX b/build/config/QNX index 03045d170..0f5160bd0 100644 --- a/build/config/QNX +++ b/build/config/QNX @@ -1,5 +1,5 @@ # -# $Id: //poco/1.1.0/build/config/QNX#1 $ +# $Id: //poco/1.2/build/config/QNX#1 $ # # QNX # @@ -17,7 +17,7 @@ LINKMODE = SHARED CCVER = 3.3.1,gcc_ntox86 CC = qcc -V$(CCVER) CXX = QCC -V$(CCVER) -LINK = QCC -V$(CCVER) +LINK = $(CXX) -V$(CCVER) LIB = ar -cr RANLIB = ranlib SHLIB = $(CXX) -shared -Wl,-soname,$(notdir $@) -Wl,-rpath,$(dir $@) -o $@ diff --git a/build/config/SunOS b/build/config/SunOS index 657ee62e0..56316bb60 100644 --- a/build/config/SunOS +++ b/build/config/SunOS @@ -1,5 +1,5 @@ # -# $Id: //poco/1.1.0/build/config/SunOS#1 $ +# $Id: //poco/1.2/build/config/SunOS#1 $ # # SunOS # @@ -16,10 +16,10 @@ LINKMODE = SHARED # CC = cc CXX = CC -LINK = CC -LIB = CC -xar -o $@ +LINK = $(CXX) +LIB = $(CXX) -xar -o $@ RANLIB = ranlib -SHLIB = CC $(LINKFLAGS) -G -o $@ -h$(notdir $@) +SHLIB = $(CXX) $(LINKFLAGS) -G -o $@ -h$(notdir $@) SHLIBLN = $(POCO_BASE)/build/script/shlibln DEP = $(POCO_BASE)/build/script/makedepend.SunCC SHELL = sh diff --git a/build/rules/compile b/build/rules/compile index 6142de764..81415e1cd 100644 --- a/build/rules/compile +++ b/build/rules/compile @@ -1,5 +1,5 @@ # -# $Id: //poco/1.1.0/build/rules/compile#1 $ +# $Id: //poco/1.2/build/rules/compile#1 $ # # compiile # @@ -9,6 +9,9 @@ # # Targets # +.PHONY: all all_static all_shared all_debug all_release \ + clean static_debug static_release shared_debug shared_release + all: $(DEFAULT_TARGET) all_static: static_debug static_release all_shared: shared_debug shared_release @@ -18,7 +21,10 @@ all_release: static_release shared_release # # Create directories if necessary # -dirs: $(OBJPATH_RELEASE_STATIC) $(OBJPATH_DEBUG_STATIC) $(OBJPATH_RELEASE_SHARED) $(OBJPATH_DEBUG_SHARED) $(LIBPATH) $(BINPATH) +.PHONY: objdirs libdirs bindirs +objdirs: $(OBJPATH_RELEASE_STATIC) $(OBJPATH_DEBUG_STATIC) $(OBJPATH_RELEASE_SHARED) $(OBJPATH_DEBUG_SHARED) +libdirs: objdirs $(LIBPATH) +bindirs: objdirs $(BINPATH) $(OBJPATH_RELEASE_STATIC) $(OBJPATH_DEBUG_STATIC) $(OBJPATH_RELEASE_SHARED) $(OBJPATH_DEBUG_SHARED) $(LIBPATH) $(BINPATH): $(MKDIR) $@ diff --git a/build/rules/dylib b/build/rules/dylib index de787d7f2..1060bb284 100644 --- a/build/rules/dylib +++ b/build/rules/dylib @@ -1,5 +1,5 @@ # -# $Id: //poco/1.1.0/build/rules/dylib#1 $ +# $Id: //poco/1.2/build/rules/dylib#1 $ # # dylib # @@ -32,7 +32,7 @@ TARGET_LIBS_RELEASE = $(foreach l,$(target_libs),-l$(l)$(OSARCH_POSTFIX)) # # Include the compile rules # -include $(POCO_BUILD)/rules/compile +include $(POCO_BASE)/build/rules/compile # # Rules for creating a dynamically loadable shared library @@ -41,18 +41,15 @@ clean: $(RM) $(OBJPATH) $(RM) $(DYLIB_DEBUG) $(DYLIB_RELEASE) $(DYLIB_S_DEBUG) $(DYLIB_S_RELEASE) -forcelink: - $(RM) $(DYLIB_DEBUG) $(DYLIB_RELEASE) $(DYLIB_S_DEBUG) $(DYLIB_S_RELEASE) - ifeq ($(LINKMODE),BOTH) -static_debug: dirs $(DYLIB_S_DEBUG) -static_release: dirs $(DYLIB_S_RELEASE) +static_debug: bindirs $(DYLIB_S_DEBUG) +static_release: bindirs $(DYLIB_S_RELEASE) else -static_debug: dirs $(DYLIB_DEBUG) -static_release: dirs $(DYLIB_RELEASE) +static_debug: bindirs $(DYLIB_DEBUG) +static_release: bindirs $(DYLIB_RELEASE) endif -shared_debug: dirs $(DYLIB_DEBUG) -shared_release: dirs $(DYLIB_RELEASE) +shared_debug: bindirs $(DYLIB_DEBUG) +shared_release: bindirs $(DYLIB_RELEASE) $(DYLIB_DEBUG): $(foreach o,$(objects),$(OBJPATH_DEBUG_SHARED)/$(o).o) @echo "** Building dynamic library (debug)" $@ diff --git a/build/rules/exec b/build/rules/exec index 3c6de57d0..c10238888 100644 --- a/build/rules/exec +++ b/build/rules/exec @@ -1,5 +1,5 @@ # -# $Id: //poco/1.1.0/build/rules/exec#1 $ +# $Id: //poco/1.2/build/rules/exec#1 $ # # exec # @@ -20,7 +20,7 @@ TARGET_LIBS_RELEASE = $(foreach l,$(target_libs),-l$(l)$(OSARCH_POSTFIX)) # # Include the compile rules # -include $(POCO_BUILD)/rules/compile +include $(POCO_BASE)/build/rules/compile # # Rules for creating an executable @@ -29,13 +29,10 @@ clean: $(RM) $(OBJPATH) $(RM) $(EXEC_RELEASE_STATIC) $(EXEC_DEBUG_STATIC) $(EXEC_RELEASE_SHARED) $(EXEC_DEBUG_SHARED) -forcelink: - $(RM) $(EXEC_RELEASE_STATIC) $(EXEC_DEBUG_STATIC) $(EXEC_RELEASE_SHARED) $(EXEC_DEBUG_SHARED) - -static_debug: dirs $(EXEC_DEBUG_STATIC) -static_release: dirs $(EXEC_RELEASE_STATIC) -shared_debug: dirs $(EXEC_DEBUG_SHARED) -shared_release: dirs $(EXEC_RELEASE_SHARED) +static_debug: bindirs $(EXEC_DEBUG_STATIC) +static_release: bindirs $(EXEC_RELEASE_STATIC) +shared_debug: bindirs $(EXEC_DEBUG_SHARED) +shared_release: bindirs $(EXEC_RELEASE_SHARED) $(EXEC_DEBUG_STATIC): $(foreach o,$(objects),$(OBJPATH_DEBUG_STATIC)/$(o).o) @echo "** Building executable (debug)" $@ diff --git a/build/rules/global b/build/rules/global index 10b9828c1..3dadc22d0 100644 --- a/build/rules/global +++ b/build/rules/global @@ -1,10 +1,19 @@ # -# $Id: //poco/1.1.0/build/rules/global#1 $ +# $Id: //poco/1.2/build/rules/global#1 $ # # global # # Global build configuration # +# Environment variables: +# POCO_BASE: Path to POCO source tree. Must be defined. +# POCO_BUILD: Path to directory where build files are put. +# Defaults to $(POCO_BASE) +# POCO_CONFIG: Build configuration to use. +# Defaults to `uname`. +# POCO_TARGET_OSNAME: Target system operating system name (for cross builds) +# POCO_TARGET_OSARCH: Target system architecture (forr cross builds) +# # # Check for POCO_BASE @@ -12,13 +21,27 @@ ifndef POCO_BASE $(error POCO_BASE is not defined.) endif -POCO_BUILD = $(POCO_BASE)/build + +# +# Check for POCO_BUILD +# +ifndef POCO_BUILD +POCO_BUILD = $(POCO_BASE) +endif + +# +# Determine OS +# +POCO_HOST_OSNAME = $(shell uname) +ifeq ($(findstring CYGWIN,$(POCO_HOST_OSNAME)),CYGWIN) +POCO_HOST_OSNAME = CYGWIN +endif # # If POCO_CONFIG is not set, use the OS name as configuration name # ifndef POCO_CONFIG -POCO_CONFIG = $(shell uname) +POCO_CONFIG = $(POCO_HOST_OSNAME) endif # @@ -37,13 +60,13 @@ endif # # Include System Specific Settings # -include $(POCO_BUILD)/config/$(POCO_CONFIG) +include $(POCO_BASE)/build/config/$(POCO_CONFIG) # # Determine operating system # ifndef POCO_TARGET_OSNAME -OSNAME := $(shell uname) +OSNAME := $(POCO_HOST_OSNAME) else OSNAME := $(POCO_TARGET_OSNAME) endif @@ -57,7 +80,7 @@ HOSTNAME := $(shell hostname) # # Find out current component # -COMPONENT := $(shell $(POCO_BUILD)/script/projname) +COMPONENT := $(shell $(POCO_BASE)/build/script/projname) # # Define standard directories @@ -68,16 +91,25 @@ LIBDIR = lib/$(OSNAME)/$(OSARCH) BINDIR = bin/$(OSNAME)/$(OSARCH) OBJDIR = obj/$(OSNAME)/$(OSARCH) DEPDIR = .dep/$(OSNAME)/$(OSARCH) -LIBPATH = $(POCO_BASE)/$(LIBDIR) -BINPATH = $(POCO_BASE)/$(COMPONENT)/$(BINDIR) -OBJPATH = $(POCO_BASE)/$(COMPONENT)/$(OBJDIR) -DEPPATH = $(POCO_BASE)/$(COMPONENT)/$(DEPDIR) +LIBPATH = $(POCO_BUILD)/$(LIBDIR) +BINPATH = $(POCO_BUILD)/$(COMPONENT)/$(BINDIR) +OBJPATH = $(POCO_BUILD)/$(COMPONENT)/$(OBJDIR) +DEPPATH = $(POCO_BUILD)/$(COMPONENT)/$(DEPDIR) + +ifndef LIBPREFIX +LIBPREFIX = lib +endif # # Build component list # COMPONENTS := $(shell cat $(POCO_BASE)/components) +# +# Read global library version number +# +LIBVERSION := $(shell cat $(POCO_BASE)/libversion) + # # Determine link mode # diff --git a/build/rules/lib b/build/rules/lib index 0f8ef5680..6e7b8f1e7 100644 --- a/build/rules/lib +++ b/build/rules/lib @@ -1,5 +1,5 @@ # -# $Id: //poco/1.1.0/build/rules/lib#1 $ +# $Id: //poco/1.2/build/rules/lib#1 $ # # lib # @@ -9,18 +9,22 @@ # # Target names # +ifeq ($(OSNAME),CYGWIN) +SHL_EXT = $(SHAREDLIBLINKEXT) +else ifdef target_version SHL_EXT = $(SHAREDLIBEXT) else SHL_EXT = $(SHAREDLIBLINKEXT) endif +endif -LIB_RELEASE_STATIC = $(LIBPATH)/lib$(target)$(OSARCH_POSTFIX).a -LIB_DEBUG_STATIC = $(LIBPATH)/lib$(target)d$(OSARCH_POSTFIX).a -LIB_RELEASE_SHARED = $(LIBPATH)/lib$(target)$(OSARCH_POSTFIX)$(SHL_EXT) -LIB_DEBUG_SHARED = $(LIBPATH)/lib$(target)d$(OSARCH_POSTFIX)$(SHL_EXT) -LIB_RELEASE_SHARED_LINK = $(LIBPATH)/lib$(target)$(OSARCH_POSTFIX)$(SHAREDLIBLINKEXT) -LIB_DEBUG_SHARED_LINK = $(LIBPATH)/lib$(target)d$(OSARCH_POSTFIX)$(SHAREDLIBLINKEXT) +LIB_RELEASE_STATIC = $(LIBPATH)/$(LIBPREFIX)$(target)$(OSARCH_POSTFIX).a +LIB_DEBUG_STATIC = $(LIBPATH)/$(LIBPREFIX)$(target)d$(OSARCH_POSTFIX).a +LIB_RELEASE_SHARED = $(LIBPATH)/$(LIBPREFIX)$(target)$(OSARCH_POSTFIX)$(SHL_EXT) +LIB_DEBUG_SHARED = $(LIBPATH)/$(LIBPREFIX)$(target)d$(OSARCH_POSTFIX)$(SHL_EXT) +LIB_RELEASE_SHARED_LINK = $(LIBPATH)/$(LIBPREFIX)$(target)$(OSARCH_POSTFIX)$(SHAREDLIBLINKEXT) +LIB_DEBUG_SHARED_LINK = $(LIBPATH)/$(LIBPREFIX)$(target)d$(OSARCH_POSTFIX)$(SHAREDLIBLINKEXT) TARGET_LIBS_DEBUG = $(foreach l,$(target_libs),-l$(l)d$(OSARCH_POSTFIX)) TARGET_LIBS_RELEASE = $(foreach l,$(target_libs),-l$(l)$(OSARCH_POSTFIX)) @@ -28,7 +32,7 @@ TARGET_LIBS_RELEASE = $(foreach l,$(target_libs),-l$(l)$(OSARCH_POSTFIX)) # # Include the compile rules # -include $(POCO_BUILD)/rules/compile +include $(POCO_BASE)/build/rules/compile # # Rules for creating a library @@ -37,10 +41,10 @@ clean: $(RM) $(OBJPATH) $(RM) $(LIB_RELEASE_STATIC) $(LIB_DEBUG_STATIC) $(LIB_RELEASE_SHARED) $(LIB_DEBUG_SHARED) -static_debug: dirs $(LIB_DEBUG_STATIC) -static_release: dirs $(LIB_RELEASE_STATIC) -shared_debug: dirs $(LIB_DEBUG_SHARED) -shared_release: dirs $(LIB_RELEASE_SHARED) +static_debug: libdirs $(LIB_DEBUG_STATIC) +static_release: libdirs $(LIB_RELEASE_STATIC) +shared_debug: libdirs $(LIB_DEBUG_SHARED) +shared_release: libdirs $(LIB_RELEASE_SHARED) $(LIB_DEBUG_STATIC): $(foreach o,$(objects),$(OBJPATH_DEBUG_STATIC)/$(o).o) @echo "** Building library (debug)" $@ diff --git a/build/script/makedepend.SunCC b/build/script/makedepend.SunCC index 8993f9b49..be1d6b103 100644 --- a/build/script/makedepend.SunCC +++ b/build/script/makedepend.SunCC @@ -1,6 +1,6 @@ #! /bin/sh # -# $Id: //poco/1.1.0/build/script/makedepend.SunCC#1 $ +# $Id: //poco/1.2/build/script/makedepend.SunCC#1 $ # # makedepend.SunCC # diff --git a/build/script/makedepend.aCC b/build/script/makedepend.aCC index 5c6b79b3b..a609ad845 100644 --- a/build/script/makedepend.aCC +++ b/build/script/makedepend.aCC @@ -1,6 +1,6 @@ #! /bin/sh # -# $Id: //poco/1.1.0/build/script/makedepend.aCC#1 $ +# $Id: //poco/1.2/build/script/makedepend.aCC#1 $ # # makedepend.aCC # diff --git a/build/script/makedepend.cxx b/build/script/makedepend.cxx index a15000908..8d93fe8cf 100644 --- a/build/script/makedepend.cxx +++ b/build/script/makedepend.cxx @@ -1,6 +1,6 @@ #! /bin/sh # -# $Id: //poco/1.1.0/build/script/makedepend.cxx#1 $ +# $Id: //poco/1.2/build/script/makedepend.cxx#1 $ # # makedepend.cxx # diff --git a/build/script/makedepend.gcc b/build/script/makedepend.gcc index 4decbc596..f337ecbfd 100644 --- a/build/script/makedepend.gcc +++ b/build/script/makedepend.gcc @@ -1,6 +1,6 @@ #! /bin/sh # -# $Id: //poco/1.1.0/build/script/makedepend.gcc#1 $ +# $Id: //poco/1.2/build/script/makedepend.gcc#1 $ # # makedepend.gcc # diff --git a/build/script/makedepend.qcc b/build/script/makedepend.qcc index 3a56944d8..bc0fa7e6d 100644 --- a/build/script/makedepend.qcc +++ b/build/script/makedepend.qcc @@ -1,6 +1,6 @@ #! /bin/sh # -# $Id: //poco/1.1.0/build/script/makedepend.qcc#1 $ +# $Id: //poco/1.2/build/script/makedepend.qcc#1 $ # # makedepend.gcc # diff --git a/build/script/makeldpath b/build/script/makeldpath index 46bc70c60..88346b4a5 100644 --- a/build/script/makeldpath +++ b/build/script/makeldpath @@ -2,7 +2,7 @@ # # makeldpath # -# $Id: //poco/1.1.0/build/script/makeldpath#1 $ +# $Id: //poco/1.2/build/script/makeldpath#1 $ # # Create a LD_LIBRARY_PATH for all project libraries. # diff --git a/build/script/projname b/build/script/projname index 02ea034c5..59c7f86bc 100644 --- a/build/script/projname +++ b/build/script/projname @@ -1,6 +1,6 @@ #! /bin/sh # -# $Id: //poco/1.1.0/build/script/projname#1 $ +# $Id: //poco/1.2/build/script/projname#1 $ # # projname # diff --git a/build/script/shlibln b/build/script/shlibln index 1cdbd4f36..29a44597b 100644 --- a/build/script/shlibln +++ b/build/script/shlibln @@ -1,10 +1,10 @@ #! /bin/sh # -# $Id: //poco/1.1.0/build/script/shlibln#1 $ +# $Id: //poco/1.2/build/script/shlibln#1 $ # # shlibln # -# Create a symbolic link +# Create a symbolic link for a shared library # if [ $# -ne 2 ] ; then @@ -12,6 +12,17 @@ if [ $# -ne 2 ] ; then exit 1 fi -if [ "$1" != "$2" ] ; then - ln -sf "$1" "$2" +source="$1" +target="$2" + +sourcedir=`dirname "$source"` +targetdir=`dirname "$target"` + +if [ "$sourcedir" = "$targetdir" ] ; then + source=`basename $source` +fi + + +if [ "$1" != "$2" ] ; then + ln -sf "$source" "$target" fi diff --git a/build/vms/build.com b/build/vms/build.com index ad374457b..e81e2da4d 100644 --- a/build/vms/build.com +++ b/build/vms/build.com @@ -1,7 +1,7 @@ $ ! $ ! BUILD.COM $ ! -$ ! $Id: //poco/1.1.0/build/vms/build.com#1 $ +$ ! $Id: //poco/1.2/build/vms/build.com#1 $ $ ! $ ! OpenVMS build procedure $ ! diff --git a/build/vms/pococc.com b/build/vms/pococc.com index f5f921595..d2aba882e 100644 --- a/build/vms/pococc.com +++ b/build/vms/pococc.com @@ -1,7 +1,7 @@ $ ! $ ! POCOCC.COM $ ! -$ ! $Id: //poco/1.1.0/build/vms/pococc.com#1 $ +$ ! $Id: //poco/1.2/build/vms/pococc.com#1 $ $ ! $ ! C compile procedure for Poco libraries $ ! diff --git a/build/vms/pococxx.com b/build/vms/pococxx.com index 2a22eb7b2..a9e73f486 100644 --- a/build/vms/pococxx.com +++ b/build/vms/pococxx.com @@ -1,7 +1,7 @@ $ ! $ ! POCOCXX.COM $ ! -$ ! $Id: //poco/1.1.0/build/vms/pococxx.com#1 $ +$ ! $Id: //poco/1.2/build/vms/pococxx.com#1 $ $ ! $ ! C++ compile procedure for Poco libraries $ ! diff --git a/build/vms/pocolib.com b/build/vms/pocolib.com index 9c0966db0..0b3dc4a18 100644 --- a/build/vms/pocolib.com +++ b/build/vms/pocolib.com @@ -1,7 +1,7 @@ $ ! $ ! POCOLIB.COM $ ! -$ ! $Id: //poco/1.1.0/build/vms/pocolib.com#1 $ +$ ! $Id: //poco/1.2/build/vms/pocolib.com#1 $ $ ! $ ! C++ library creation procedure for Poco libraries $ ! diff --git a/build/vms/pocolnk.com b/build/vms/pocolnk.com index 1b6db06ca..9a853cdbb 100644 --- a/build/vms/pocolnk.com +++ b/build/vms/pocolnk.com @@ -1,7 +1,7 @@ $ ! $ ! POCOLNK.COM $ ! -$ ! $Id: //poco/1.1.0/build/vms/pocolnk.com#1 $ +$ ! $Id: //poco/1.2/build/vms/pocolnk.com#1 $ $ ! $ ! C++ link procedure for Poco $ ! diff --git a/build_vs71.cmd b/build_vs71.cmd index 18940823f..e8abdf0c4 100644 --- a/build_vs71.cmd +++ b/build_vs71.cmd @@ -3,18 +3,11 @@ rem rem build.cmd rem -rem $Id: //poco/1.1.0/build_vs71.cmd#2 $ +rem $Id: //poco/1.2/dist/build_vs71.cmd#1 $ rem rem command-line build script for VS 7.1 rem -rem Change OPENSSL_DIR to match your setup -set OPENSSL_DIR=c:\OpenSSL -set OPENSSL_INCLUDE=%OPENSSL_DIR%\include -set OPENSSL_LIB=%OPENSSL_DIR%\lib\VC -set INCLUDE=%INCLUDE%;%OPENSSL_INCLUDE% -set LIB=%LIB%;%OPENSSL_LIB% - cd CppUnit devenv /useenv /rebuild debug_shared CppUnit_vs71.sln devenv /useenv /rebuild release_shared CppUnit_vs71.sln @@ -55,4 +48,3 @@ devenv /useenv /rebuild debug_shared samples_vs71.sln devenv /useenv /rebuild release_shared samples_vs71.sln cd .. cd .. - diff --git a/build_vs80.cmd b/build_vs80.cmd index 984b9ca02..c70db962d 100644 --- a/build_vs80.cmd +++ b/build_vs80.cmd @@ -3,18 +3,11 @@ rem rem build.cmd rem -rem $Id: //poco/1.1.0/build_vs80.cmd#2 $ +rem $Id: //poco/1.2/dist/build_vs80.cmd#1 $ rem rem command-line build script for VS 8.0 rem -rem Change OPENSSL_DIR to match your setup -set OPENSSL_DIR=c:\OpenSSL -set OPENSSL_INCLUDE=%OPENSSL_DIR%\include -set OPENSSL_LIB=%OPENSSL_DIR%\lib\VC -set INCLUDE=%INCLUDE%;%OPENSSL_INCLUDE% -set LIB=%LIB%;%OPENSSL_LIB% - cd CppUnit devenv /useenv /rebuild debug_shared CppUnit_vs80.sln devenv /useenv /rebuild release_shared CppUnit_vs80.sln @@ -55,4 +48,3 @@ devenv /useenv /rebuild debug_shared samples_vs80.sln devenv /useenv /rebuild release_shared samples_vs80.sln cd .. cd .. - diff --git a/buildvms.com b/buildvms.com index 454907f74..9a57bc1bd 100644 --- a/buildvms.com +++ b/buildvms.com @@ -1,7 +1,7 @@ $ ! $ ! BUILDVMS.COM $ ! -$ ! $Id: //poco/1.1.0/buildvms.com#1 $ +$ ! $Id: //poco/1.2/buildvms.com#1 $ $ ! $ ! OpenVMS build procedure $ ! diff --git a/components b/components index de9f4c8a5..65a04c9c0 100644 --- a/components +++ b/components @@ -3,4 +3,3 @@ XML Util Net CppUnit - diff --git a/configure b/configure new file mode 100644 index 000000000..8663ce1e5 --- /dev/null +++ b/configure @@ -0,0 +1,91 @@ +#! /bin/sh +# +# configure +# +# $Id: //poco/1.2/dist/configure#1 $ +# +# Configuration script for POCO. +# +# Usage: +# configure [...] +# +# Options: +# --config= +# Use the given build configuration +# See $POCO_BASE/build/config for possible configs +# +# --prefix= +# Use the given install directory for make install. +# Default is /usr/local" +# +# --no-tests +# Do not build testsuites. +# +# --no-samples +# Do not build samples. +# + +# save cwd +build=`pwd` +# get directory where we are located +cd `dirname $0` +base=`pwd` +cd $build + +tests="tests" +samples="samples" +# parse arguments +while [ "$1" != "" ] ; do + val=`expr $1 : '--config=\(.*\)'` + if [ "$val" != "" ] ; then + config=$val; + fi + + val=`expr $1 : '--prefix=\(.*\)'` + if [ "$val" != "" ] ; then + prefix=$val + fi + + if [ "$1" = "--no-samples" ] ; then + samples="" + fi + + if [ "$1" = "--no-tests" ] ; then + tests="" + fi + shift +done + +# copy Makefile to build dir +if [ "$base" != "$build" ] ; then + cp $base/Makefile $build +fi + +if [ "$config" = "" ] ; then + config=`uname` + cyg=`expr $config : '\(CYGWIN\).*'` + if [ "$cyg" != "" ] ; then + config=CYGWIN + fi +fi + +if [ "$prefix" = "" ] ; then + prefix=/usr/local +fi + +# create config.make +echo '# config.make generated by configure script' >$build/config.make +echo "POCO_CONFIG = $config" >> $build/config.make +echo "POCO_BASE = $base" >> $build/config.make +echo "POCO_BUILD = $build" >> $build/config.make +echo "POCO_PREFIX = $prefix" >> $build/config.make + +echo "export POCO_CONFIG" >> $build/config.make +echo "export POCO_BASE" >> $build/config.make +echo "export POCO_BUILD" >> $build/config.make +echo "export POCO_PREFIX" >> $build/config.make + +echo ".PHONY: poco" >> $build/config.make +echo "poco: libs $tests $samples" >> $build/config.make + +echo "Configured for $config" diff --git a/contrib/poco-doc.pl b/contrib/poco-doc.pl new file mode 100644 index 000000000..e239774a9 --- /dev/null +++ b/contrib/poco-doc.pl @@ -0,0 +1,47 @@ +#!/usr/bin/perl -wi +# +# poco-doc.pl +# +# This script, when run on a POCO header file, moves the documentation +# for classes, methods, etc above their declarations, making the code +# suitable for running through Doxygen, etc. +# +# Author: Caleb Epstein +# +# $Id$ + +use strict; +use warnings; + +my @COMMENT; +my @DECL; + +my $comment_re = qr@^\s*//@; + +while (<>) { + if ((/^\s*(template|class|enum)/ and not /\;\s*$/) or + (/[\(\)](\s*const)?\;$/ and $_ !~ $comment_re)) { + if (scalar @DECL) { + print join ("", @COMMENT) if scalar @COMMENT; + print join ("", @DECL); + } + @DECL = ($_); + @COMMENT = (); + next; + } elsif (m@^\s*///@ and scalar @DECL) { + push (@COMMENT, $_); + } else { + if (scalar @DECL) { + print join ("", @COMMENT) if scalar @COMMENT; + print join ("", @DECL); + @COMMENT = @DECL = (); + } + + # Handle in-line documentation of enum values + if (m@^\s*[^/]@ and m@/// @) { + s@/// @///< @; + } + print; + } +} + diff --git a/libversion b/libversion new file mode 100644 index 000000000..78c6baefd --- /dev/null +++ b/libversion @@ -0,0 +1 @@ +2