RecursiveDirectoryIterator and ListMap

1) Recursive and SortedDirectoryIterator

- added to VS projects
- fixed some style/formatting
- fxed windows tests

2) Added ListMap

Poco::ListMap is a std::mulitimap-like container that preserves
insertion order (needed to prevent Net message headers)
This commit is contained in:
aleks-f 2013-03-10 12:25:47 -05:00
commit 46c3d74c5f
46 changed files with 1120 additions and 130 deletions

View File

@ -2,23 +2,25 @@ This is the changelog file for the POCO C++ Libraries.
Release 1.5.2 (2013-03-??)
==========================
- added MongoDB library (by Franky Braem)
- added MongoDB library (Franky Braem)
- fixed GH #57: poco-1.5.1: Doesn't compile for Android
- added VoidEvent (by Arturo Castro)
- added VoidEvent (Arturo Castro)
- fixed GH #80: NumberFormatter::append broken
- fixed GH #93: ParallelSocketAcceptor virtual functions
- small object optimization for IPAddress, Any and Dynamic::Var
- SQLite events (insert, update, delete, commit, rollback) handlers
- merged GH #91: Improve SQLite multi-threaded use (by Rangel Reale)
- merged GH #86: Invalid pointers to vector internals (by Adrian Imboden)
- merged GH #91: Improve SQLite multi-threaded use (Rangel Reale)
- merged GH #86: Invalid pointers to vector internals (Adrian Imboden)
- automatic library initialization macros
- fixed GH #110: WebSocket accept() fails when Connection header contains multiple tokens
- fixed GH #71: WebSocket and broken Timeouts (POCO_BROKEN_TIMEOUTS)
- fixed a warning in Poco/Crypto/OpenSSLInitializer.h
- fixed GH #109: Bug in Poco::Net::SMTPClientSession::loginUsingPlain
- added clang libc++ build configurations for Darwin and iPhone (Andrea Bigagli)
- fixed GH #116: Wrong timezone parsing in DateTimeParse (fix by Matej Knopp)
- fixed GH #116: Wrong timezone parsing in DateTimeParse (Matej Knopp)
- fixed GH #118: JSON::Object::stringify endless loop
- added Recursive and SortedDirectoryIterator (Marian Krivos)
- added ListMap (map-like container with preserving insertion order)
Release 1.5.1 (2013-01-11)
==========================

View File

@ -5373,6 +5373,10 @@
RelativePath=".\include\Poco\Latin2Encoding.h"
>
</File>
<File
RelativePath=".\include\Poco\ListMap.h"
>
</File>
<File
RelativePath=".\include\Poco\Latin9Encoding.h"
>
@ -5541,6 +5545,10 @@
RelativePath=".\include\Poco\DefaultStrategy.h"
>
</File>
<File
RelativePath=".\include\Poco\DirectoryIteratorStrategy.h"
>
</File>
<File
RelativePath=".\include\Poco\Delegate.h"
>
@ -5589,6 +5597,14 @@
RelativePath=".\include\Poco\PriorityStrategy.h"
>
</File>
<File
RelativePath=".\include\Poco\RecursiveDirectoryIterator.h"
>
</File>
<File
RelativePath=".\include\Poco\RecursiveDirectoryIteratorImpl.h"
>
</File>
</Filter>
<Filter
Name="Source Files"
@ -6513,6 +6529,10 @@
RelativePath=".\src\RefCountedObject.cpp"
>
</File>
<File
RelativePath=".\src\SortedDirectoryIterator.cpp"
>
</File>
<File
RelativePath=".\src\String.cpp"
>
@ -6521,6 +6541,10 @@
RelativePath=".\src\NumericString.cpp"
>
</File>
<File
RelativePath=".\src\DirectoryIteratorStrategy.cpp"
>
</File>
<File
RelativePath=".\src\StringTokenizer.cpp"
>
@ -6729,6 +6753,10 @@
RelativePath=".\include\Poco\SmallObjectAllocator.h"
>
</File>
<File
RelativePath=".\include\Poco\SortedDirectoryIterator.h"
>
</File>
<File
RelativePath=".\include\Poco\String.h"
>

View File

@ -381,7 +381,9 @@
<ClCompile Include="src\NumberFormatter.cpp" />
<ClCompile Include="src\NumberParser.cpp" />
<ClCompile Include="src\NumericString.cpp" />
<ClCompile Include="src\DirectoryIteratorStrategy.cpp" />
<ClCompile Include="src\RefCountedObject.cpp" />
<ClCompile Include="src\SortedDirectoryIterator.cpp" />
<ClCompile Include="src\String.cpp" />
<ClCompile Include="src\StringTokenizer.cpp" />
<ClCompile Include="src\UTF32Encoding.cpp" />
@ -1015,6 +1017,7 @@
<ClInclude Include="include\Poco\FPEnvironment_WIN32.h" />
<ClInclude Include="include\Poco\Instantiator.h" />
<ClInclude Include="include\Poco\Latin2Encoding.h" />
<ClInclude Include="include\Poco\ListMap.h" />
<ClInclude Include="include\Poco\MemoryPool.h" />
<ClInclude Include="include\Poco\MetaProgramming.h" />
<ClInclude Include="include\Poco\NamedTuple.h" />
@ -1031,10 +1034,14 @@
<ClInclude Include="include\Poco\Platform_WIN32.h" />
<ClInclude Include="include\Poco\Poco.h" />
<ClInclude Include="include\Poco\PriorityStrategy.h" />
<ClInclude Include="include\Poco\RecursiveDirectoryIterator.h" />
<ClInclude Include="include\Poco\RecursiveDirectoryIteratorImpl.h" />
<ClInclude Include="include\poco\DirectoryIteratorStrategy.h" />
<ClInclude Include="include\Poco\RefCountedObject.h" />
<ClInclude Include="include\Poco\SharedPtr.h" />
<ClInclude Include="include\Poco\SingletonHolder.h" />
<ClInclude Include="include\Poco\SmallObjectAllocator.h" />
<ClInclude Include="include\Poco\SortedDirectoryIterator.h" />
<ClInclude Include="include\Poco\String.h" />
<ClInclude Include="include\Poco\StringTokenizer.h" />
<ClInclude Include="include\Poco\Tuple.h" />

View File

@ -897,6 +897,12 @@
<ClCompile Include="src\NumericString.cpp">
<Filter>Core\Source Files</Filter>
</ClCompile>
<ClCompile Include="src\SortedDirectoryIterator.cpp">
<Filter>Filesystem\Source Files</Filter>
</ClCompile>
<ClCompile Include="src\DirectoryIteratorStrategy.cpp">
<Filter>Filesystem\Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\Poco\Any.h">
@ -1859,6 +1865,21 @@
<ClInclude Include="include\Poco\Optional.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\ListMap.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\RecursiveDirectoryIterator.h">
<Filter>Filesystem\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\RecursiveDirectoryIteratorImpl.h">
<Filter>Filesystem\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\SortedDirectoryIterator.h">
<Filter>Filesystem\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\poco\DirectoryIteratorStrategy.h">
<Filter>Filesystem\Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="src\pocomsg.rc">

View File

@ -385,8 +385,10 @@
<ClCompile Include="src\NumberFormatter.cpp" />
<ClCompile Include="src\NumberParser.cpp" />
<ClCompile Include="src\RefCountedObject.cpp" />
<ClCompile Include="src\SortedDirectoryIterator.cpp" />
<ClCompile Include="src\String.cpp" />
<ClCompile Include="src\NumericString.cpp" />
<ClCompile Include="src\DirectoryIteratorStrategy.cpp" />
<ClCompile Include="src\StringTokenizer.cpp" />
<ClCompile Include="src\UTF32Encoding.cpp" />
<ClCompile Include="src\Var.cpp" />
@ -1018,6 +1020,8 @@
<ClInclude Include="include\Poco\FPEnvironment_SUN.h" />
<ClInclude Include="include\Poco\FPEnvironment_WIN32.h" />
<ClInclude Include="include\Poco\Instantiator.h" />
<ClInclude Include="include\Poco\Latin2Encoding.h" />
<ClInclude Include="include\Poco\ListMap.h" />
<ClInclude Include="include\Poco\MemoryPool.h" />
<ClInclude Include="include\Poco\MetaProgramming.h" />
<ClInclude Include="include\Poco\NamedTuple.h" />
@ -1034,10 +1038,14 @@
<ClInclude Include="include\Poco\Platform_WIN32.h" />
<ClInclude Include="include\Poco\Poco.h" />
<ClInclude Include="include\Poco\PriorityStrategy.h" />
<ClInclude Include="include\Poco\RecursiveDirectoryIterator.h" />
<ClInclude Include="include\Poco\RecursiveDirectoryIteratorImpl.h" />
<ClInclude Include="include\Poco\DirectoryIteratorStrategy.h" />
<ClInclude Include="include\Poco\RefCountedObject.h" />
<ClInclude Include="include\Poco\SharedPtr.h" />
<ClInclude Include="include\Poco\SingletonHolder.h" />
<ClInclude Include="include\Poco\SmallObjectAllocator.h" />
<ClInclude Include="include\Poco\SortedDirectoryIterator.h" />
<ClInclude Include="include\Poco\String.h" />
<ClInclude Include="include\Poco\StringTokenizer.h" />
<ClInclude Include="include\Poco\Tuple.h" />

View File

@ -651,6 +651,12 @@
<ClCompile Include="src\DirectoryIterator_WIN32U.cpp">
<Filter>Filesystem\Source Files</Filter>
</ClCompile>
<ClCompile Include="src\DirectoryIteratorStrategy.cpp">
<Filter>Filesystem\Source Files</Filter>
</ClCompile>
<ClCompile Include="src\SortedDirectoryIterator.cpp">
<Filter>Filesystem\Source Files</Filter>
</ClCompile>
<ClCompile Include="src\File.cpp">
<Filter>Filesystem\Source Files</Filter>
</ClCompile>
@ -989,6 +995,12 @@
<ClInclude Include="include\Poco\Instantiator.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\Latin2Encoding.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\ListMap.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\MemoryPool.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
@ -1469,6 +1481,18 @@
<ClInclude Include="include\Poco\DirectoryIterator_WIN32U.h">
<Filter>Filesystem\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\RecursiveDirectoryIterator.h">
<Filter>Filesystem\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\RecursiveDirectoryIteratorImpl.h">
<Filter>Filesystem\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\DirectoryIteratorStrategy.h">
<Filter>Filesystem\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\SortedDirectoryIterator.h">
<Filter>Filesystem\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\File.h">
<Filter>Filesystem\Header Files</Filter>
</ClInclude>

View File

@ -768,9 +768,15 @@
<File
RelativePath=".\src\NumericString.cpp">
</File>
<File
RelativePath=".\src\DirectoryIteratorStrategy.cpp">
</File>
<File
RelativePath=".\src\RefCountedObject.cpp">
</File>
<File
RelativePath=".\src\SortedDirectoryIterator.cpp">
</File>
<File
RelativePath=".\src\String.cpp">
</File>
@ -937,6 +943,9 @@
<File
RelativePath=".\include\Poco\SmallObjectAllocator.h">
</File>
<File
RelativePath=".\include\Poco\SortedDirectoryIterator.h">
</File>
<File
RelativePath=".\include\Poco\String.h">
</File>
@ -4374,6 +4383,9 @@
<File
RelativePath=".\include\Poco\Latin2Encoding.h">
</File>
<File
RelativePath=".\include\Poco\ListMap.h">
</File>
<File
RelativePath=".\include\Poco\Latin9Encoding.h">
</File>
@ -4544,6 +4556,15 @@
<File
RelativePath=".\include\Poco\PriorityStrategy.h">
</File>
<File
RelativePath=".\include\Poco\RecursiveDirectoryIterator.h">
</File>
<File
RelativePath=".\include\Poco\RecursiveDirectoryIteratorImpl.h">
</File>
<File
RelativePath=".\include\Poco\DirectoryIteratorStrategy.h">
</File>
</Filter>
<Filter
Name="Source Files"

View File

@ -1031,6 +1031,10 @@
RelativePath=".\src\RefCountedObject.cpp"
>
</File>
<File
RelativePath=".\src\SortedDirectoryIterator.cpp"
>
</File>
<File
RelativePath=".\src\String.cpp"
>
@ -1039,6 +1043,10 @@
RelativePath=".\src\NumericString.cpp"
>
</File>
<File
RelativePath=".\src\DirectoryIteratorStrategy.cpp"
>
</File>
<File
RelativePath=".\src\StringTokenizer.cpp"
>
@ -1251,6 +1259,10 @@
RelativePath=".\include\Poco\SmallObjectAllocator.h"
>
</File>
<File
RelativePath=".\include\Poco\SortedDirectoryIterator.h"
>
</File>
<File
RelativePath=".\include\Poco\String.h"
>
@ -5681,6 +5693,10 @@
RelativePath=".\include\Poco\Latin2Encoding.h"
>
</File>
<File
RelativePath=".\include\Poco\ListMap.h"
>
</File>
<File
RelativePath=".\include\Poco\Latin9Encoding.h"
>
@ -5897,6 +5913,18 @@
RelativePath=".\include\Poco\PriorityStrategy.h"
>
</File>
<File
RelativePath=".\include\Poco\RecursiveDirectoryIterator.h"
>
</File>
<File
RelativePath=".\include\Poco\RecursiveDirectoryIteratorImpl.h"
>
</File>
<File
RelativePath=".\include\Poco\DirectoryIteratorStrategy.h"
>
</File>
</Filter>
<Filter
Name="Source Files"

View File

@ -1028,6 +1028,10 @@
RelativePath=".\src\RefCountedObject.cpp"
>
</File>
<File
RelativePath=".\src\SortedDirectoryIterator.cpp"
>
</File>
<File
RelativePath=".\src\String.cpp"
>
@ -1036,6 +1040,10 @@
RelativePath=".\src\NumericString.cpp"
>
</File>
<File
RelativePath=".\src\DirectoryIteratorStrategy.cpp"
>
</File>
<File
RelativePath=".\src\StringTokenizer.cpp"
>
@ -1248,6 +1256,10 @@
RelativePath=".\include\Poco\SmallObjectAllocator.h"
>
</File>
<File
RelativePath=".\include\Poco\SortedDirectoryIterator.h"
>
</File>
<File
RelativePath=".\include\Poco\String.h"
>
@ -5674,6 +5686,10 @@
RelativePath=".\include\Poco\Latin2Encoding.h"
>
</File>
<File
RelativePath=".\include\Poco\ListMap.h"
>
</File>
<File
RelativePath=".\include\Poco\Latin9Encoding.h"
>
@ -5890,6 +5906,18 @@
RelativePath=".\include\Poco\PriorityStrategy.h"
>
</File>
<File
RelativePath=".\include\Poco\RecursiveDirectoryIterator.h"
>
</File>
<File
RelativePath=".\include\Poco\RecursiveDirectoryIteratorImpl.h"
>
</File>
<File
RelativePath=".\include\Poco\DirectoryIteratorStrategy.h"
>
</File>
</Filter>
<Filter
Name="Source Files"

View File

@ -385,8 +385,10 @@
<ClCompile Include="src\NumberFormatter.cpp" />
<ClCompile Include="src\NumberParser.cpp" />
<ClCompile Include="src\RefCountedObject.cpp" />
<ClCompile Include="src\SortedDirectoryIterator.cpp" />
<ClCompile Include="src\String.cpp" />
<ClCompile Include="src\NumericString.cpp" />
<ClCompile Include="src\DirectoryIteratorStrategy.cpp" />
<ClCompile Include="src\StringTokenizer.cpp" />
<ClCompile Include="src\UTF32Encoding.cpp" />
<ClCompile Include="src\Var.cpp" />
@ -1017,6 +1019,7 @@
<ClInclude Include="include\Poco\FPEnvironment_WIN32.h" />
<ClInclude Include="include\Poco\Instantiator.h" />
<ClInclude Include="include\Poco\Latin2Encoding.h" />
<ClInclude Include="include\Poco\ListMap.h" />
<ClInclude Include="include\Poco\MemoryPool.h" />
<ClInclude Include="include\Poco\MetaProgramming.h" />
<ClInclude Include="include\Poco\NamedTuple.h" />
@ -1033,10 +1036,14 @@
<ClInclude Include="include\Poco\Platform_WIN32.h" />
<ClInclude Include="include\Poco\Poco.h" />
<ClInclude Include="include\Poco\PriorityStrategy.h" />
<ClInclude Include="include\Poco\RecursiveDirectoryIterator.h" />
<ClInclude Include="include\Poco\RecursiveDirectoryIteratorImpl.h" />
<ClInclude Include="include\Poco\DirectoryIteratorStrategy.h" />
<ClInclude Include="include\Poco\RefCountedObject.h" />
<ClInclude Include="include\Poco\SharedPtr.h" />
<ClInclude Include="include\Poco\SingletonHolder.h" />
<ClInclude Include="include\Poco\SmallObjectAllocator.h" />
<ClInclude Include="include\Poco\SortedDirectoryIterator.h" />
<ClInclude Include="include\Poco\String.h" />
<ClInclude Include="include\Poco\StringTokenizer.h" />
<ClInclude Include="include\Poco\Tuple.h" />

View File

@ -651,6 +651,12 @@
<ClCompile Include="src\DirectoryIterator_WIN32U.cpp">
<Filter>Filesystem\Source Files</Filter>
</ClCompile>
<ClCompile Include="src\DirectoryIteratorStrategy.cpp">
<Filter>Filesystem\Source Files</Filter>
</ClCompile>
<ClCompile Include="src\SortedDirectoryIterator.cpp">
<Filter>Filesystem\Source Files</Filter>
</ClCompile>
<ClCompile Include="src\File.cpp">
<Filter>Filesystem\Source Files</Filter>
</ClCompile>
@ -989,6 +995,9 @@
<ClInclude Include="include\Poco\Instantiator.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\ListMap.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\MemoryPool.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
@ -1472,6 +1481,18 @@
<ClInclude Include="include\Poco\DirectoryIterator_WIN32U.h">
<Filter>Filesystem\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\RecursiveDirectoryIterator.h">
<Filter>Filesystem\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\RecursiveDirectoryIteratorImpl.h">
<Filter>Filesystem\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\DirectoryIteratorStrategy.h">
<Filter>Filesystem\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\SortedDirectoryIterator.h">
<Filter>Filesystem\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\File.h">
<Filter>Filesystem\Header Files</Filter>
</ClInclude>

View File

@ -391,8 +391,10 @@
<ClCompile Include="src\NumberFormatter.cpp" />
<ClCompile Include="src\NumberParser.cpp" />
<ClCompile Include="src\RefCountedObject.cpp" />
<ClCompile Include="src\SortedDirectoryIterator.cpp" />
<ClCompile Include="src\String.cpp" />
<ClCompile Include="src\NumericString.cpp" />
<ClCompile Include="src\DirectoryIteratorStrategy.cpp" />
<ClCompile Include="src\StringTokenizer.cpp" />
<ClCompile Include="src\UTF32Encoding.cpp" />
<ClCompile Include="src\Var.cpp" />
@ -1023,6 +1025,7 @@
<ClInclude Include="include\Poco\FPEnvironment_WIN32.h" />
<ClInclude Include="include\Poco\Instantiator.h" />
<ClInclude Include="include\Poco\Latin2Encoding.h" />
<ClInclude Include="include\Poco\ListMap.h" />
<ClInclude Include="include\Poco\MemoryPool.h" />
<ClInclude Include="include\Poco\MetaProgramming.h" />
<ClInclude Include="include\Poco\NamedTuple.h" />
@ -1039,6 +1042,10 @@
<ClInclude Include="include\Poco\Platform_WIN32.h" />
<ClInclude Include="include\Poco\Poco.h" />
<ClInclude Include="include\Poco\PriorityStrategy.h" />
<ClInclude Include="include\Poco\RecursiveDirectoryIterator.h" />
<ClInclude Include="include\Poco\RecursiveDirectoryIteratorImpl.h" />
<ClInclude Include="include\Poco\DirectoryIteratorStrategy.h" />
<ClInclude Include="include\Poco\SortedDirectoryIterator.h" />
<ClInclude Include="include\Poco\RefCountedObject.h" />
<ClInclude Include="include\Poco\SharedPtr.h" />
<ClInclude Include="include\Poco\SingletonHolder.h" />

View File

@ -651,6 +651,12 @@
<ClCompile Include="src\DirectoryIterator_WIN32U.cpp">
<Filter>Filesystem\Source Files</Filter>
</ClCompile>
<ClCompile Include="src\DirectoryIteratorStrategy.cpp">
<Filter>Filesystem\Source Files</Filter>
</ClCompile>
<ClCompile Include="src\SortedDirectoryIterator.cpp">
<Filter>Filesystem\Source Files</Filter>
</ClCompile>
<ClCompile Include="src\File.cpp">
<Filter>Filesystem\Source Files</Filter>
</ClCompile>
@ -989,6 +995,9 @@
<ClInclude Include="include\Poco\Instantiator.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\ListMap.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\MemoryPool.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
@ -1475,6 +1484,18 @@
<ClInclude Include="include\Poco\DirectoryIterator_WIN32U.h">
<Filter>Filesystem\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\RecursiveDirectoryIterator.h">
<Filter>Filesystem\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\RecursiveDirectoryIteratorImpl.h">
<Filter>Filesystem\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\DirectoryIteratorStrategy.h">
<Filter>Filesystem\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\SortedDirectoryIterator.h">
<Filter>Filesystem\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\File.h">
<Filter>Filesystem\Header Files</Filter>
</ClInclude>

View File

@ -1026,10 +1026,18 @@
RelativePath=".\src\NumericString.cpp"
>
</File>
<File
RelativePath=".\src\DirectoryIteratorStrategy.cpp"
>
</File>
<File
RelativePath=".\src\RefCountedObject.cpp"
>
</File>
<File
RelativePath=".\src\SortedDirectoryIterator.cpp"
>
</File>
<File
RelativePath=".\src\String.cpp"
>
@ -1246,6 +1254,10 @@
RelativePath=".\include\Poco\SmallObjectAllocator.h"
>
</File>
<File
RelativePath=".\include\Poco\SortedDirectoryIterator.h"
>
</File>
<File
RelativePath=".\include\Poco\String.h"
>
@ -5680,6 +5692,10 @@
RelativePath=".\include\Poco\Latin9Encoding.h"
>
</File>
<File
RelativePath=".\include\Poco\ListMap.h"
>
</File>
<File
RelativePath=".\include\Poco\StreamConverter.h"
>
@ -5892,6 +5908,18 @@
RelativePath=".\include\Poco\PriorityStrategy.h"
>
</File>
<File
RelativePath=".\include\Poco\RecursiveDirectoryIterator.h"
>
</File>
<File
RelativePath=".\include\Poco\RecursiveDirectoryIteratorImpl.h"
>
</File>
<File
RelativePath=".\include\Poco\DirectoryIteratorStrategy.h"
>
</File>
</Filter>
<Filter
Name="Source Files"

View File

@ -11,7 +11,7 @@ include $(POCO_BASE)/build/rules/global
objects = ArchiveStrategy Ascii ASCIIEncoding AsyncChannel \
Base32Decoder Base32Encoder Base64Decoder Base64Encoder \
BinaryReader BinaryWriter Bugcheck ByteOrder Channel Checksum Configurable ConsoleChannel \
CountingStream DateTime LocalDateTime DateTimeFormat DateTimeFormatter DateTimeParser \
Condition CountingStream DateTime LocalDateTime DateTimeFormat DateTimeFormatter DateTimeParser \
Debugger DeflatingStream DigestEngine DigestStream DirectoryIterator DirectoryWatcher \
Environment Event Error EventArgs ErrorHandler Exception FIFOBufferStream FPEnvironment File \
FileChannel Formatter FormattingChannel Glob HexBinaryDecoder LineEndingConverter \
@ -22,7 +22,7 @@ objects = ArchiveStrategy Ascii ASCIIEncoding AsyncChannel \
NotificationQueue PriorityNotificationQueue TimedNotificationQueue \
NullStream NumberFormatter NumberParser NumericString AbstractObserver \
Path PatternFormatter Process PurgeStrategy RWLock Random RandomStream \
RecursiveDirectoryIteratorStrategies RegularExpression RefCountedObject Runnable RotateStrategy Condition \
RecursiveDirectoryIteratorStrategy RegularExpression RefCountedObject Runnable RotateStrategy \
SHA1Engine Semaphore SharedLibrary SimpleFileChannel \
SignalHandler SplitterChannel SortedDirectoryIterator Stopwatch StreamChannel \
StreamConverter StreamCopier StreamTokenizer String StringTokenizer SynchronizedObject \

View File

@ -43,8 +43,11 @@
// Define to enable Windows Unicode (UTF-8) support
#define POCO_WIN32_UTF8
#if defined(__cplusplus) && (__cplusplus > 199711L)
// Define to enable C++11 support
//#define POCO_ENABLE_CPP11
// #define POCO_ENABLE_CPP11
#endif
// Define to disable implicit linking

View File

@ -36,8 +36,8 @@
//
#ifndef Foundation_RecursiveDirectoryIteratorStategies_INCLUDE
#define Foundation_RecursiveDirectoryIteratorStategies_INCLUDE
#ifndef Foundation_RecursiveDirectoryIteratorStrategy_INCLUDE
#define Foundation_RecursiveDirectoryIteratorStrategy_INCLUDE
#include "Poco/Foundation.h"
#include "Poco/DirectoryIterator.h"
@ -49,7 +49,7 @@
namespace Poco
{
class TraverseBase
class Foundation_API TraverseBase
{
public:
typedef std::stack<DirectoryIterator> Stack;
@ -77,7 +77,7 @@ private:
};
class ChildrenFirstTraverse: public TraverseBase
class Foundation_API ChildrenFirstTraverse: public TraverseBase
{
public:
ChildrenFirstTraverse(DepthFunPtr depthDeterminer, UInt16 maxDepth = D_INFINITE);
@ -91,7 +91,7 @@ private:
};
class SiblingsFirstTraverse: public TraverseBase
class Foundation_API SiblingsFirstTraverse: public TraverseBase
{
public:
SiblingsFirstTraverse(DepthFunPtr depthDeterminer, UInt16 maxDepth = D_INFINITE);
@ -109,4 +109,4 @@ private:
} // namespace Poco
#endif // Foundation_RecursiveDirectoryIteratorStategies_INCLUDE
#endif // Foundation_RecursiveDirectoryIteratorStrategy_INCLUDE

View File

@ -0,0 +1,279 @@
//
// ListMap.h
//
// $Id: //poco/1.4/Foundation/include/Poco/ListMap.h#1 $
//
// Library: Foundation
// Package: Hashing
// Module: ListMap
//
// Definition of the ListMap 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_ListMap_INCLUDED
#define Foundation_ListMap_INCLUDED
#include "Poco/Foundation.h"
#include "Poco/String.h"
#include "Poco/Exception.h"
#include <list>
#include <utility>
namespace Poco {
template <class Key, class Mapped, class Container = std::list<std::pair<Key, Mapped> >, bool CaseSensitive = false >
class ListMap
/// This class implements a multimap in terms of a sequential container.
/// The use for this type of associative container is wherever automatic
/// ordering of elements is not desirable. Naturally, this container will
/// have inferior data retrieval performance and it is not recommended for
/// use with large datasets. The main purpose within POCO is for Internet
/// messages (email message, http headers etc), to prevent autmomatic
/// header entry reordering.
{
public:
typedef Key KeyType;
typedef Mapped MappedType;
typedef Mapped& Reference;
typedef const Mapped& ConstReference;
typedef Mapped* Pointer;
typedef const Mapped* ConstPointer;
typedef typename Container::value_type ValueType;
typedef typename Container::size_type SizeType;
typedef typename Container::iterator Iterator;
typedef typename Container::const_iterator ConstIterator;
ListMap()
/// Creates an empty ListMap.
{
}
ListMap(std::size_t initialReserve):
_list(initialReserve)
/// Creates the ListMap with room for initialReserve entries.
{
}
ListMap& operator = (const ListMap& map)
/// Assigns another ListMap.
{
ListMap tmp(map);
swap(tmp);
return *this;
}
void swap(ListMap& map)
/// Swaps the ListMap with another one.
{
_list.swap(map._list);
}
ConstIterator begin() const
/// Returns the beginning of the map.
{
return _list.begin();
}
ConstIterator end() const
/// Returns the end of the map.
{
return _list.end();
}
Iterator begin()
/// Returns the beginning of the map.
{
return _list.begin();
}
Iterator end()
/// Returns the end of the map.
{
return _list.end();
}
ConstIterator find(const KeyType& key) const
/// Finds the first occurence of the key and
/// returns iterator pointing to the found entry
/// or iterator pointing to the end if entry is
/// not found.
{
Container::const_iterator it = _list.begin();
Container::const_iterator end = _list.end();
for(; it != end; ++it)
{
if (isEqual(it->first, key)) return it;
}
return end;
}
Iterator find(const KeyType& key)
/// Finds the first occurence of the key and
/// returns iterator pointing to the found entry
/// or iterator pointing to the end if entry is
/// not found.
{
Container::iterator it = _list.begin();
Container::iterator end = _list.end();
for(; it != end; ++it)
{
if (isEqual(it->first, key)) return it;
}
return end;
}
Iterator insert(const ValueType& val)
/// Inserts the value into the map. If one or more values
/// already exist, new value is inserted at the end of the
/// block. Thus, all the equal value entries are located
/// sequentially at all times.
/// Returns iterator pointing to the newly inserted value
{
Iterator it = find(val.first);
if (it == _list.end())
{
_list.push_back(val);
it = _list.end();
--it;
}
else
{
_list.insert(it, 1, val);
}
return it;
}
void erase(Iterator it)
{
_list.erase(it);
}
SizeType erase(const KeyType& key)
{
SizeType count = 0;
Iterator it = find(key);
bool removed = false;
while (it != _list.end())
{
if (isEqual(it->first, key))
{
++count;
it = _list.erase(it);
removed = true;
}
else
{
if (removed) return count;
++it;
}
}
return count;
}
void clear()
{
_list.clear();
}
std::size_t size() const
{
return _list.size();
}
bool empty() const
{
return _list.empty();
}
ConstReference operator [] (const KeyType& key) const
{
ConstIterator it = find(key);
if (it != _list.end())
return it->second;
else
throw NotFoundException();
}
Reference operator [] (const KeyType& key)
{
Iterator it = find(key);
if (it != _list.end())
return it->second;
else
{
ValueType value(key, Mapped());
Iterator it = insert(value);
return it->second;
}
}
private:
template <typename T1, typename T2>
bool isEqual(T1 val1, T2 val2) const
{
return val1 == val2;
}
bool isEqual(const std::string& s1, const std::string& s2) const
{
if (!CaseSensitive)
return Poco::icompare(s1, s2) == 0;
else
return s1 == s2;
}
bool isEqual(const std::string& s1, const char* s2) const
{
return isEqual(s1, std::string(s2));
}
bool isEqual(const char* s1, const std::string& s2) const
{
return isEqual(std::string(s1), s2);
}
bool isEqual(const char* s1, const char* s2) const
{
return isEqual(std::string(s1), std::string(s2));
}
Container _list;
};
} // namespace Poco
#endif // Foundation_ListMap_INCLUDED

View File

@ -43,37 +43,39 @@
#include "Poco/File.h"
#include "Poco/Path.h"
#include "Poco/RecursiveDirectoryIteratorImpl.h"
#include "Poco/RecursiveDirectoryIteratorStrategies.h"
#include "Poco/DirectoryIteratorStrategy.h"
namespace Poco
{
namespace Poco {
class DirectoryIterator;
template<class TTravStr>
class RecursiveDirectoryIteratorImpl;
template<class TTravStr = ChildrenFirstTraverse>
class RecursiveDirectoryIterator
/// The RecursiveDirectoryIterator class is used to enumerate
/// all files in a directory and its subdirectories.
///
/// RecursiveDirectoryIterator has some limitations:
/// * only forward iteration (++) is supported
/// * an iterator copied from another one will always
/// point to the same file as the original iterator,
/// even is the original iterator has been advanced
/// (all copies of an iterator share their state with
/// the original iterator)
/// * only forward iteration (++) is supported
/// * an iterator copied from another one will always
/// point to the same file as the original iterator,
/// even is the original iterator has been advanced
/// (all copies of an iterator share their state with
/// the original iterator)
///
/// The class can follow different traversal strategies:
/// * depth-first strategy;
/// * siblings-first strategy.
/// * depth-first strategy;
/// * siblings-first strategy.
/// The stategies are set by template parameter.
/// There are two corresponding typedefs:
/// * SimpleRecursiveDirectoryIterator;
/// * SiblingsFirstRecursiveDirectoryIterator.
/// * SimpleRecursiveDirectoryIterator;
/// * SiblingsFirstRecursiveDirectoryIterator.
///
/// The depth of traversal can be limited by constructor
/// parameter maxDepth (which sets the infinite depth by default).
@ -260,15 +262,6 @@ inline bool operator !=(const RecursiveDirectoryIterator<T1>& a, const Recursive
}
//
// exported instances
//
template class Foundation_API
RecursiveDirectoryIterator<ChildrenFirstTraverse> ;
template class Foundation_API
RecursiveDirectoryIterator<SiblingsFirstTraverse> ;
//
// typedefs
//

View File

@ -39,18 +39,20 @@
#ifndef Foundation_RecursiveDirectoryIteratorImpl_INCLUDE
#define Foundation_RecursiveDirectoryIteratorImpl_INCLUDE
#include "Poco/Foundation.h"
#include "Poco/RecursiveDirectoryIteratorStrategies.h"
#include "Poco/DirectoryIteratorStrategy.h"
#include <stack>
#include <functional>
namespace Poco
{
namespace Poco {
class ChildrenFirstTraverse;
class SiblingsFirstTraverse;
template<class TTraverseStrategy = ChildrenFirstTraverse>
class RecursiveDirectoryIteratorImpl
{

View File

@ -34,13 +34,11 @@
//
#include "Poco/RecursiveDirectoryIteratorStrategies.h"
#include "Poco/DirectoryIteratorStrategy.h"
namespace Poco
{
namespace Poco {
using namespace std;
//
// TraverseBase
@ -66,13 +64,13 @@ ChildrenFirstTraverse::ChildrenFirstTraverse(DepthFunPtr depthDeterminer, UInt16
}
const string ChildrenFirstTraverse::next(Stack* itStack, bool* isFinished)
const std::string ChildrenFirstTraverse::next(Stack* itStack, bool* isFinished)
{
// pointer mustn't point to NULL and iteration mustn't be finished
poco_check_ptr(isFinished);
poco_assert(!(*isFinished));
stack<DirectoryIterator> it;
std::stack<DirectoryIterator> it;
//_depthDeterminer(it);
@ -120,11 +118,11 @@ const string ChildrenFirstTraverse::next(Stack* itStack, bool* isFinished)
SiblingsFirstTraverse::SiblingsFirstTraverse(DepthFunPtr depthDeterminer, UInt16 maxDepth)
: TraverseBase(depthDeterminer, maxDepth)
{
_dirsStack.push(queue<string>());
_dirsStack.push(std::queue<std::string>());
}
const string SiblingsFirstTraverse::next(Stack* itStack, bool* isFinished)
const std::string SiblingsFirstTraverse::next(Stack* itStack, bool* isFinished)
{
// pointer mustn't point to NULL and iteration mustn't be finished
poco_check_ptr(isFinished);
@ -134,7 +132,7 @@ const string SiblingsFirstTraverse::next(Stack* itStack, bool* isFinished)
bool isDepthLimitReached = isFiniteDepth() && _depthDeterminer(*itStack) >= _maxDepth;
if (!isDepthLimitReached && itStack->top()->isDirectory())
{
const string& p = itStack->top()->path();
const std::string& p = itStack->top()->path();
_dirsStack.top().push(p);
}
@ -147,7 +145,7 @@ const string SiblingsFirstTraverse::next(Stack* itStack, bool* isFinished)
// try to find first not empty directory and go deeper
while (!_dirsStack.top().empty())
{
string dir = _dirsStack.top().front();
std::string dir = _dirsStack.top().front();
_dirsStack.top().pop();
DirectoryIterator child_it(dir);
@ -155,7 +153,7 @@ const string SiblingsFirstTraverse::next(Stack* itStack, bool* isFinished)
if (child_it != _itEnd)
{
itStack->push(child_it);
_dirsStack.push(queue<string>());
_dirsStack.push(std::queue<std::string>());
return child_it->path();
}
}

View File

@ -37,8 +37,8 @@
#include <algorithm>
namespace Poco
{
namespace Poco {
SortedDirectoryIterator::SortedDirectoryIterator()
: DirectoryIterator(), _is_finished(true)

View File

@ -614,6 +614,10 @@
RelativePath=".\src\CoreTestSuite.cpp"
>
</File>
<File
RelativePath=".\src\DirectoryIteratorsTest.cpp"
>
</File>
<File
RelativePath=".\src\DynamicFactoryTest.cpp"
>
@ -626,6 +630,10 @@
RelativePath=".\src\FPETest.cpp"
>
</File>
<File
RelativePath=".\src\ListMapTest.cpp"
>
</File>
<File
RelativePath=".\src\MemoryPoolTest.cpp"
>
@ -706,6 +714,10 @@
RelativePath=".\src\CoreTestSuite.h"
>
</File>
<File
RelativePath=".\src\DirectoryIteratorsTest.h"
>
</File>
<File
RelativePath=".\src\DynamicFactoryTest.h"
>
@ -718,6 +730,10 @@
RelativePath=".\src\FPETest.h"
>
</File>
<File
RelativePath=".\src\ListMapTest.h"
>
</File>
<File
RelativePath=".\src\MemoryPoolTest.h"
>

View File

@ -309,11 +309,13 @@
<ClCompile Include="src\ByteOrderTest.cpp" />
<ClCompile Include="src\CoreTest.cpp" />
<ClCompile Include="src\CoreTestSuite.cpp" />
<ClCompile Include="src\DirectoryIteratorsTest.cpp" />
<ClCompile Include="src\DirectoryWatcherTest.cpp" />
<ClCompile Include="src\DynamicFactoryTest.cpp" />
<ClCompile Include="src\FIFOBufferStreamTest.cpp" />
<ClCompile Include="src\FormatTest.cpp" />
<ClCompile Include="src\FPETest.cpp" />
<ClCompile Include="src\ListMapTest.cpp" />
<ClCompile Include="src\MemoryPoolTest.cpp" />
<ClCompile Include="src\NamedTuplesTest.cpp" />
<ClCompile Include="src\NDCTest.cpp" />
@ -443,11 +445,13 @@
<ClInclude Include="src\ByteOrderTest.h" />
<ClInclude Include="src\CoreTest.h" />
<ClInclude Include="src\CoreTestSuite.h" />
<ClInclude Include="src\DirectoryIteratorsTest.h" />
<ClInclude Include="src\DirectoryWatcherTest.h" />
<ClInclude Include="src\DynamicFactoryTest.h" />
<ClInclude Include="src\FIFOBufferStreamTest.h" />
<ClInclude Include="src\FormatTest.h" />
<ClInclude Include="src\FPETest.h" />
<ClInclude Include="src\ListMapTest.h" />
<ClInclude Include="src\MemoryPoolTest.h" />
<ClInclude Include="src\NamedTuplesTest.h" />
<ClInclude Include="src\NDCTest.h" />

View File

@ -576,6 +576,12 @@
<ClCompile Include="src\Base32Test.cpp">
<Filter>Streams\Source Files</Filter>
</ClCompile>
<ClCompile Include="src\ListMapTest.cpp">
<Filter>Core\Source Files</Filter>
</ClCompile>
<ClCompile Include="src\DirectoryIteratorsTest.cpp">
<Filter>Filesystem\Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\AnyTest.h">
@ -971,5 +977,11 @@
<ClInclude Include="src\Base32Test.h">
<Filter>Streams\Header Files</Filter>
</ClInclude>
<ClInclude Include="src\ListMapTest.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
<ClInclude Include="src\DirectoryIteratorsTest.h">
<Filter>Filesystem\Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -313,11 +313,13 @@
<ClCompile Include="src\ByteOrderTest.cpp" />
<ClCompile Include="src\CoreTest.cpp" />
<ClCompile Include="src\CoreTestSuite.cpp" />
<ClCompile Include="src\DirectoryIteratorsTest.cpp" />
<ClCompile Include="src\DirectoryWatcherTest.cpp" />
<ClCompile Include="src\DynamicFactoryTest.cpp" />
<ClCompile Include="src\FIFOBufferStreamTest.cpp" />
<ClCompile Include="src\FormatTest.cpp" />
<ClCompile Include="src\FPETest.cpp" />
<ClCompile Include="src\ListMapTest.cpp" />
<ClCompile Include="src\MemoryPoolTest.cpp" />
<ClCompile Include="src\NamedTuplesTest.cpp" />
<ClCompile Include="src\NDCTest.cpp" />
@ -447,11 +449,13 @@
<ClInclude Include="src\ByteOrderTest.h" />
<ClInclude Include="src\CoreTest.h" />
<ClInclude Include="src\CoreTestSuite.h" />
<ClInclude Include="src\DirectoryIteratorsTest.h" />
<ClInclude Include="src\DirectoryWatcherTest.h" />
<ClInclude Include="src\DynamicFactoryTest.h" />
<ClInclude Include="src\FIFOBufferStreamTest.h" />
<ClInclude Include="src\FormatTest.h" />
<ClInclude Include="src\FPETest.h" />
<ClInclude Include="src\ListMapTest.h" />
<ClInclude Include="src\MemoryPoolTest.h" />
<ClInclude Include="src\NamedTuplesTest.h" />
<ClInclude Include="src\NDCTest.h" />

View File

@ -207,6 +207,9 @@
<ClCompile Include="src\FPETest.cpp">
<Filter>Core\Source Files</Filter>
</ClCompile>
<ClCompile Include="src\ListMapTest.cpp">
<Filter>Core\Source Files</Filter>
</ClCompile>
<ClCompile Include="src\MemoryPoolTest.cpp">
<Filter>Core\Source Files</Filter>
</ClCompile>
@ -402,6 +405,9 @@
<ClCompile Include="src\FilesystemTestSuite.cpp">
<Filter>Filesystem\Source Files</Filter>
</ClCompile>
<ClCompile Include="src\DirectoryIteratorsTest.cpp">
<Filter>Filesystem\Source Files</Filter>
</ClCompile>
<ClCompile Include="src\FileTest.cpp">
<Filter>Filesystem\Source Files</Filter>
</ClCompile>
@ -605,6 +611,9 @@
<ClInclude Include="src\FPETest.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
<ClInclude Include="src\ListMapTest.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
<ClInclude Include="src\MemoryPoolTest.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
@ -800,6 +809,9 @@
<ClInclude Include="src\FilesystemTestSuite.h">
<Filter>Filesystem\Header Files</Filter>
</ClInclude>
<ClInclude Include="src\DirectoryIteratorsTest.h">
<Filter>Filesystem\Header Files</Filter>
</ClInclude>
<ClInclude Include="src\FileTest.h">
<Filter>Filesystem\Header Files</Filter>
</ClInclude>

View File

@ -418,6 +418,9 @@
<File
RelativePath=".\src\CoreTestSuite.cpp">
</File>
<File
RelativePath=".\src\DirectoryIteratorsTest.cpp">
</File>
<File
RelativePath=".\src\DynamicFactoryTest.cpp">
</File>
@ -430,6 +433,9 @@
<File
RelativePath=".\src\FPETest.cpp">
</File>
<File
RelativePath=".\src\ListMapTest.cpp">
</File>
<File
RelativePath=".\src\MemoryPoolTest.cpp">
</File>
@ -491,6 +497,9 @@
<File
RelativePath=".\src\CoreTestSuite.h">
</File>
<File
RelativePath=".\src\DirectoryIteratorsTest.h">
</File>
<File
RelativePath=".\src\DynamicFactoryTest.h">
</File>
@ -503,6 +512,9 @@
<File
RelativePath=".\src\FPETest.h">
</File>
<File
RelativePath=".\src\ListMapTest.h">
</File>
<File
RelativePath=".\src\MemoryPoolTest.h">
</File>

View File

@ -583,6 +583,10 @@
RelativePath=".\src\CoreTestSuite.cpp"
>
</File>
<File
RelativePath=".\src\DirectoryIteratorsTest.cpp"
>
</File>
<File
RelativePath=".\src\DynamicFactoryTest.cpp"
>
@ -595,6 +599,10 @@
RelativePath=".\src\FPETest.cpp"
>
</File>
<File
RelativePath=".\src\ListMapTest.cpp"
>
</File>
<File
RelativePath=".\src\MemoryPoolTest.cpp"
>
@ -675,6 +683,10 @@
RelativePath=".\src\CoreTestSuite.h"
>
</File>
<File
RelativePath=".\src\DirectoryIteratorsTest.h"
>
</File>
<File
RelativePath=".\src\DynamicFactoryTest.h"
>
@ -687,6 +699,10 @@
RelativePath=".\src\FPETest.h"
>
</File>
<File
RelativePath=".\src\ListMapTest.h"
>
</File>
<File
RelativePath=".\src\MemoryPoolTest.h"
>

View File

@ -565,6 +565,10 @@
RelativePath=".\src\CoreTestSuite.cpp"
>
</File>
<File
RelativePath=".\src\DirectoryIteratorsTest.cpp"
>
</File>
<File
RelativePath=".\src\DynamicFactoryTest.cpp"
>
@ -577,6 +581,10 @@
RelativePath=".\src\FPETest.cpp"
>
</File>
<File
RelativePath=".\src\ListMapTest.cpp"
>
</File>
<File
RelativePath=".\src\MemoryPoolTest.cpp"
>
@ -657,6 +665,10 @@
RelativePath=".\src\CoreTestSuite.h"
>
</File>
<File
RelativePath=".\src\DirectoryIteratorsTest.h"
>
</File>
<File
RelativePath=".\src\DynamicAnyTest.h"
>
@ -673,6 +685,10 @@
RelativePath=".\src\FPETest.h"
>
</File>
<File
RelativePath=".\src\ListMapTest.h"
>
</File>
<File
RelativePath=".\src\MemoryPoolTest.h"
>

View File

@ -307,11 +307,13 @@
<ClCompile Include="src\ByteOrderTest.cpp" />
<ClCompile Include="src\CoreTest.cpp" />
<ClCompile Include="src\CoreTestSuite.cpp" />
<ClCompile Include="src\DirectoryIteratorsTest.cpp" />
<ClCompile Include="src\DirectoryWatcherTest.cpp" />
<ClCompile Include="src\DynamicFactoryTest.cpp" />
<ClCompile Include="src\FIFOBufferStreamTest.cpp" />
<ClCompile Include="src\FormatTest.cpp" />
<ClCompile Include="src\FPETest.cpp" />
<ClCompile Include="src\ListMapTest.cpp" />
<ClCompile Include="src\MemoryPoolTest.cpp" />
<ClCompile Include="src\NamedTuplesTest.cpp" />
<ClCompile Include="src\NDCTest.cpp" />
@ -441,12 +443,14 @@
<ClInclude Include="src\ByteOrderTest.h" />
<ClInclude Include="src\CoreTest.h" />
<ClInclude Include="src\CoreTestSuite.h" />
<ClInclude Include="src\DirectoryIteratorsTest.h" />
<ClInclude Include="src\DirectoryWatcherTest.h" />
<ClInclude Include="src\DynamicAnyTest.h" />
<ClInclude Include="src\DynamicFactoryTest.h" />
<ClInclude Include="src\FIFOBufferStreamTest.h" />
<ClInclude Include="src\FormatTest.h" />
<ClInclude Include="src\FPETest.h" />
<ClInclude Include="src\ListMapTest.h" />
<ClInclude Include="src\MemoryPoolTest.h" />
<ClInclude Include="src\NamedTuplesTest.h" />
<ClInclude Include="src\NDCTest.h" />

View File

@ -198,6 +198,9 @@
<ClCompile Include="src\CoreTestSuite.cpp">
<Filter>Core\Source Files</Filter>
</ClCompile>
<ClCompile Include="src\DirectoryIteratorsTest.cpp">
<Filter>Core\Source Files</Filter>
</ClCompile>
<ClCompile Include="src\DynamicFactoryTest.cpp">
<Filter>Core\Source Files</Filter>
</ClCompile>
@ -207,6 +210,9 @@
<ClCompile Include="src\FPETest.cpp">
<Filter>Core\Source Files</Filter>
</ClCompile>
<ClCompile Include="src\ListMapTest.cpp">
<Filter>Core\Source Files</Filter>
</ClCompile>
<ClCompile Include="src\MemoryPoolTest.cpp">
<Filter>Core\Source Files</Filter>
</ClCompile>
@ -596,6 +602,9 @@
<ClInclude Include="src\CoreTestSuite.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
<ClInclude Include="src\DirectoryIteratorsTest.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
<ClInclude Include="src\DynamicAnyTest.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
@ -608,6 +617,9 @@
<ClInclude Include="src\FPETest.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
<ClInclude Include="src\ListMapTest.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
<ClInclude Include="src\MemoryPoolTest.h">
<Filter>Core\Header Files</Filter>
</ClInclude>

View File

@ -313,11 +313,13 @@
<ClCompile Include="src\ByteOrderTest.cpp" />
<ClCompile Include="src\CoreTest.cpp" />
<ClCompile Include="src\CoreTestSuite.cpp" />
<ClCompile Include="src\DirectoryIteratorsTest.cpp" />
<ClCompile Include="src\DirectoryWatcherTest.cpp" />
<ClCompile Include="src\DynamicFactoryTest.cpp" />
<ClCompile Include="src\FIFOBufferStreamTest.cpp" />
<ClCompile Include="src\FormatTest.cpp" />
<ClCompile Include="src\FPETest.cpp" />
<ClCompile Include="src\ListMapTest.cpp" />
<ClCompile Include="src\MemoryPoolTest.cpp" />
<ClCompile Include="src\NamedTuplesTest.cpp" />
<ClCompile Include="src\NDCTest.cpp" />
@ -447,12 +449,14 @@
<ClInclude Include="src\ByteOrderTest.h" />
<ClInclude Include="src\CoreTest.h" />
<ClInclude Include="src\CoreTestSuite.h" />
<ClInclude Include="src\DirectoryIteratorsTest.h" />
<ClInclude Include="src\DirectoryWatcherTest.h" />
<ClInclude Include="src\DynamicAnyTest.h" />
<ClInclude Include="src\DynamicFactoryTest.h" />
<ClInclude Include="src\FIFOBufferStreamTest.h" />
<ClInclude Include="src\FormatTest.h" />
<ClInclude Include="src\FPETest.h" />
<ClInclude Include="src\ListMapTest.h" />
<ClInclude Include="src\MemoryPoolTest.h" />
<ClInclude Include="src\NamedTuplesTest.h" />
<ClInclude Include="src\NDCTest.h" />

View File

@ -207,6 +207,9 @@
<ClCompile Include="src\FPETest.cpp">
<Filter>Core\Source Files</Filter>
</ClCompile>
<ClCompile Include="src\ListMapTest.cpp">
<Filter>Core\Source Files</Filter>
</ClCompile>
<ClCompile Include="src\MemoryPoolTest.cpp">
<Filter>Core\Source Files</Filter>
</ClCompile>
@ -402,6 +405,9 @@
<ClCompile Include="src\FilesystemTestSuite.cpp">
<Filter>Filesystem\Source Files</Filter>
</ClCompile>
<ClCompile Include="src\DirectoryIteratorsTest.cpp">
<Filter>Filesystem\Source Files</Filter>
</ClCompile>
<ClCompile Include="src\FileTest.cpp">
<Filter>Filesystem\Source Files</Filter>
</ClCompile>
@ -608,6 +614,9 @@
<ClInclude Include="src\FPETest.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
<ClInclude Include="src\ListMapTest.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
<ClInclude Include="src\MemoryPoolTest.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
@ -803,6 +812,9 @@
<ClInclude Include="src\FilesystemTestSuite.h">
<Filter>Filesystem\Header Files</Filter>
</ClInclude>
<ClInclude Include="src\DirectoryIteratorsTest.h">
<Filter>Filesystem\Header Files</Filter>
</ClInclude>
<ClInclude Include="src\FileTest.h">
<Filter>Filesystem\Header Files</Filter>
</ClInclude>

View File

@ -559,6 +559,10 @@
RelativePath=".\src\CoreTestSuite.cpp"
>
</File>
<File
RelativePath=".\src\DirectoryIteratorsTest.cpp"
>
</File>
<File
RelativePath=".\src\DynamicFactoryTest.cpp"
>
@ -571,6 +575,10 @@
RelativePath=".\src\FPETest.cpp"
>
</File>
<File
RelativePath=".\src\ListMapTest.cpp"
>
</File>
<File
RelativePath=".\src\MemoryPoolTest.cpp"
>
@ -651,6 +659,10 @@
RelativePath=".\src\CoreTestSuite.h"
>
</File>
<File
RelativePath=".\src\DirectoryIteratorsTest.h"
>
</File>
<File
RelativePath=".\src\DynamicAnyTest.h"
>
@ -667,6 +679,10 @@
RelativePath=".\src\FPETest.h"
>
</File>
<File
RelativePath=".\src\ListMapTest.h"
>
</File>
<File
RelativePath=".\src\MemoryPoolTest.h"
>

View File

@ -57,6 +57,7 @@
#endif
#include "TypeListTest.h"
#include "ObjectPoolTest.h"
#include "ListMapTest.h"
CppUnit::Test* CoreTestSuite::suite()
@ -89,6 +90,7 @@ CppUnit::Test* CoreTestSuite::suite()
#endif
pSuite->addTest(TypeListTest::suite());
pSuite->addTest(ObjectPoolTest::suite());
pSuite->addTest(ListMapTest::suite());
return pSuite;
}

View File

@ -94,8 +94,8 @@ void DirectoryIteratorsTest::testSortedDirectoryIterator()
assertEquals("2", result[2]);
assertEquals("A", result[3]);
assertEquals("B", result[4]);
assertEquals("a", result[5]);
assertEquals("b", result[6]);
assertEquals("c", result[5]);
assertEquals("d", result[6]);
}
@ -139,14 +139,8 @@ void DirectoryIteratorsTest::testSiblingsFirstRecursiveDirectoryIterator()
void DirectoryIteratorsTest::setUp()
{
try
{
File d(path());
d.remove(true);
}
catch (...)
{
}
File d(path());
if (d.exists()) d.remove(true);
/*
Build Directory Tree like this:
@ -156,22 +150,22 @@ void DirectoryIteratorsTest::setUp()
|-- 2
|-- A
|-- B
|-- a
|-- b
|-- c
|-- d
`-- first
|-- 1
|-- 2
|-- A
|-- B
|-- a
|-- b
|-- c
|-- d
`-- second
|-- 1
|-- 2
|-- A
|-- B
|-- a
`-- b
|-- c
`-- d
2 directories, 18 files
*/
@ -190,12 +184,12 @@ void DirectoryIteratorsTest::createSubdir(Path& p)
{
File d(p);
d.createDirectories();
FileStream f1(p.toString() + "b");
FileStream f1(p.toString() + "d");
FileStream f2(p.toString() + "1");
FileStream f3(p.toString() + "A");
FileStream f4(p.toString() + "2");
FileStream f5(p.toString() + "B");
FileStream f6(p.toString() + "a");
FileStream f6(p.toString() + "c");
}

View File

@ -0,0 +1,269 @@
//
// ListMapTest.cpp
//
// $Id: //poco/1.4/Foundation/testsuite/src/ListMapTest.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 "ListMapTest.h"
#include "CppUnit/TestCaller.h"
#include "CppUnit/TestSuite.h"
#include "Poco/ListMap.h"
#include "Poco/Exception.h"
#include <map>
using Poco::ListMap;
ListMapTest::ListMapTest(const std::string& name): CppUnit::TestCase(name)
{
}
ListMapTest::~ListMapTest()
{
}
void ListMapTest::testInsert()
{
const int N = 1000;
typedef ListMap<int, int> IntMap;
IntMap hm;
assert (hm.empty());
for (int i = 0; i < N; ++i)
{
IntMap::Iterator res = hm.insert(IntMap::ValueType(i, i*2));
assert (res->first == i);
assert (res->second == i*2);
IntMap::Iterator it = hm.find(i);
assert (it != hm.end());
assert (it->first == i);
assert (it->second == i*2);
assert (hm.size() == i + 1);
}
assert (!hm.empty());
for (int i = 0; i < N; ++i)
{
IntMap::Iterator it = hm.find(i);
assert (it != hm.end());
assert (it->first == i);
assert (it->second == i*2);
}
hm.clear();
for (int i = 0; i < N; ++i)
{
IntMap::Iterator res = hm.insert(IntMap::ValueType(i, 0));
assert (res->first == i);
assert (res->second == 0);
}
}
void ListMapTest::testErase()
{
const int N = 1000;
typedef ListMap<int, int> IntMap;
IntMap hm;
for (int i = 0; i < N; ++i)
{
hm.insert(IntMap::ValueType(i, i*2));
}
assert (hm.size() == N);
for (int i = 0; i < N; i += 2)
{
hm.erase(i);
IntMap::Iterator it = hm.find(i);
assert (it == hm.end());
}
assert (hm.size() == N/2);
for (int i = 0; i < N; i += 2)
{
IntMap::Iterator it = hm.find(i);
assert (it == hm.end());
}
for (int i = 1; i < N; i += 2)
{
IntMap::Iterator it = hm.find(i);
assert (it != hm.end());
assert (it->first == i);
}
for (int i = 0; i < N; i += 2)
{
hm.insert(IntMap::ValueType(i, i*2));
}
for (int i = 0; i < N; ++i)
{
IntMap::Iterator it = hm.find(i);
assert (it != hm.end());
assert (it->first == i);
assert (it->second == i*2);
}
}
void ListMapTest::testIterator()
{
const int N = 1000;
typedef ListMap<int, int> IntMap;
IntMap hm;
for (int i = 0; i < N; ++i)
{
hm.insert(IntMap::ValueType(i, i*2));
}
std::map<int, int> values;
IntMap::Iterator it; // do not initialize here to test proper behavior of uninitialized iterators
it = hm.begin();
while (it != hm.end())
{
assert (values.find(it->first) == values.end());
values[it->first] = it->second;
++it;
}
assert (values.size() == N);
}
void ListMapTest::testConstIterator()
{
const int N = 1000;
typedef ListMap<int, int> IntMap;
IntMap hm;
for (int i = 0; i < N; ++i)
{
hm.insert(IntMap::ValueType(i, i*2));
}
std::map<int, int> values;
IntMap::ConstIterator it = hm.begin();
while (it != hm.end())
{
assert (values.find(it->first) == values.end());
values[it->first] = it->second;
++it;
}
assert (values.size() == N);
}
void ListMapTest::testIntIndex()
{
typedef ListMap<int, int> IntMap;
IntMap hm;
hm[1] = 2;
hm[2] = 4;
hm[3] = 6;
assert (hm.size() == 3);
assert (hm[1] == 2);
assert (hm[2] == 4);
assert (hm[3] == 6);
try
{
const IntMap& im = hm;
int x = im[4];
fail("no such key - must throw");
}
catch (Poco::NotFoundException&)
{
}
}
void ListMapTest::testStringIndex()
{
typedef ListMap<const char*, std::string> StringMap;
StringMap hm;
hm["index1"] = "value2";
hm["index2"] = "value4";
hm["index3"] = "value6";
assert (hm.size() == 3);
assert (hm["index1"] == "value2");
assert (hm["Index2"] == "value4");
assert (hm["inDeX3"] == "value6");
try
{
const StringMap& im = hm;
std::string x = im["index4"];
fail("no such key - must throw");
}
catch (Poco::NotFoundException&)
{
}
}
void ListMapTest::setUp()
{
}
void ListMapTest::tearDown()
{
}
CppUnit::Test* ListMapTest::suite()
{
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("ListMapTest");
CppUnit_addTest(pSuite, ListMapTest, testInsert);
CppUnit_addTest(pSuite, ListMapTest, testErase);
CppUnit_addTest(pSuite, ListMapTest, testIterator);
CppUnit_addTest(pSuite, ListMapTest, testConstIterator);
CppUnit_addTest(pSuite, ListMapTest, testIntIndex);
CppUnit_addTest(pSuite, ListMapTest, testStringIndex);
return pSuite;
}

View File

@ -0,0 +1,65 @@
//
// ListMapTest.h
//
// $Id: //poco/1.4/Foundation/testsuite/src/ListMapTest.h#1 $
//
// Definition of the ListMapTest 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 ListMapTest_INCLUDED
#define ListMapTest_INCLUDED
#include "Poco/Foundation.h"
#include "CppUnit/TestCase.h"
class ListMapTest: public CppUnit::TestCase
{
public:
ListMapTest(const std::string& name);
~ListMapTest();
void testInsert();
void testErase();
void testIterator();
void testConstIterator();
void testIntIndex();
void testStringIndex();
void setUp();
void tearDown();
static CppUnit::Test* suite();
private:
};
#endif // ListMapTest_INCLUDED

View File

@ -42,7 +42,7 @@
#include "Poco/Net/Net.h"
#include "Poco/String.h"
#include <map>
#include "Poco/ListMap.h"
namespace Poco {
@ -59,17 +59,9 @@ class Net_API NameValueCollection
/// same name.
{
public:
struct ILT
{
bool operator() (const std::string& s1, const std::string& s2) const
{
return Poco::icompare(s1, s2) < 0;
}
};
typedef std::multimap<std::string, std::string, ILT> HeaderMap;
typedef HeaderMap::iterator Iterator;
typedef HeaderMap::const_iterator ConstIterator;
typedef Poco::ListMap<std::string, std::string> HeaderMap;
typedef HeaderMap::Iterator Iterator;
typedef HeaderMap::ConstIterator ConstIterator;
NameValueCollection();
/// Creates an empty NameValueCollection.

View File

@ -94,13 +94,13 @@ void NameValueCollection::set(const std::string& name, const std::string& value)
if (it != _map.end())
it->second = value;
else
_map.insert(HeaderMap::value_type(name, value));
_map.insert(HeaderMap::ValueType(name, value));
}
void NameValueCollection::add(const std::string& name, const std::string& value)
{
_map.insert(HeaderMap::value_type(name, value));
_map.insert(HeaderMap::ValueType(name, value));
}

View File

@ -160,8 +160,8 @@ void HTMLFormTest::testWriteMultipart()
"\r\n"
"This is an attachment\r\n"
"--MIME_boundary_0123456789\r\n"
"Content-Disposition: form-data; name=\"attachment2\"; filename=\"att2.txt\"\r\n"
"Content-ID: 1234abcd\r\n"
"Content-Disposition: form-data; name=\"attachment2\"; filename=\"att2.txt\"\r\n"
"Content-Type: text/plain\r\n"
"\r\n"
"This is another attachment\r\n"

View File

@ -172,7 +172,8 @@ void HTTPCredentialsTest::testDigestCredentials()
HTTPResponse response;
response.set("WWW-Authenticate", "Digest realm=\"TestDigest\", nonce=\"212573bb90170538efad012978ab811f%lu\"");
creds.authenticate(request, response);
assert (request.get("Authorization") == "Digest nonce=\"212573bb90170538efad012978ab811f%lu\", realm=\"TestDigest\", response=\"40e4889cfbd0e561f71e3107a2863bc4\", uri=\"/digest/\", username=\"user\"");
std::string auth = request.get("Authorization");
assert (auth == "Digest username=\"user\", nonce=\"212573bb90170538efad012978ab811f%lu\", realm=\"TestDigest\", uri=\"/digest/\", response=\"40e4889cfbd0e561f71e3107a2863bc4\"");
}
@ -244,8 +245,9 @@ void HTTPCredentialsTest::testCredentialsDigest()
HTTPRequest request(HTTPRequest::HTTP_GET, "/digest/");
HTTPResponse response;
response.set("WWW-Authenticate", "Digest realm=\"TestDigest\", nonce=\"212573bb90170538efad012978ab811f%lu\"");
creds.authenticate(request, response);
assert (request.get("Authorization") == "Digest nonce=\"212573bb90170538efad012978ab811f%lu\", realm=\"TestDigest\", response=\"40e4889cfbd0e561f71e3107a2863bc4\", uri=\"/digest/\", username=\"user\"");
creds.authenticate(request, response);
std::string auth = request.get("Authorization");
assert (auth == "Digest username=\"user\", nonce=\"212573bb90170538efad012978ab811f%lu\", realm=\"TestDigest\", uri=\"/digest/\", response=\"40e4889cfbd0e561f71e3107a2863bc4\"");
}
@ -256,7 +258,7 @@ void HTTPCredentialsTest::testProxyCredentialsDigest()
HTTPResponse response;
response.set("Proxy-Authenticate", "Digest realm=\"TestDigest\", nonce=\"212573bb90170538efad012978ab811f%lu\"");
creds.proxyAuthenticate(request, response);
assert (request.get("Proxy-Authorization") == "Digest nonce=\"212573bb90170538efad012978ab811f%lu\", realm=\"TestDigest\", response=\"40e4889cfbd0e561f71e3107a2863bc4\", uri=\"/digest/\", username=\"user\"");
assert (request.get("Proxy-Authorization") == "Digest username=\"user\", nonce=\"212573bb90170538efad012978ab811f%lu\", realm=\"TestDigest\", uri=\"/digest/\", response=\"40e4889cfbd0e561f71e3107a2863bc4\"");
}

View File

@ -73,7 +73,7 @@ void HTTPRequestTest::testWrite2()
std::ostringstream ostr;
request.write(ostr);
std::string s = ostr.str();
assert (s == "HEAD /index.html HTTP/1.1\r\nConnection: Keep-Alive\r\nHost: localhost\r\nUser-Agent: Poco\r\n\r\n");
assert (s == "HEAD /index.html HTTP/1.1\r\nHost: localhost\r\nConnection: Keep-Alive\r\nUser-Agent: Poco\r\n\r\n");
}
@ -88,7 +88,7 @@ void HTTPRequestTest::testWrite3()
std::ostringstream ostr;
request.write(ostr);
std::string s = ostr.str();
assert (s == "POST /test.cgi HTTP/1.1\r\nConnection: Close\r\nContent-Length: 100\r\nContent-Type: text/plain\r\nHost: localhost:8000\r\nUser-Agent: Poco\r\n\r\n");
assert (s == "POST /test.cgi HTTP/1.1\r\nHost: localhost:8000\r\nConnection: Close\r\nUser-Agent: Poco\r\nContent-Length: 100\r\nContent-Type: text/plain\r\n\r\n");
}

View File

@ -136,13 +136,13 @@ void MailMessageTest::testWriteQP()
message.write(str);
std::string s = str.str();
assert (s ==
"CC: Jane Doe <jane.doe@no.where>\r\n"
"Content-Transfer-Encoding: quoted-printable\r\n"
"Content-Type: text/plain\r\n"
"Date: Thu, 1 Jan 1970 00:00:00 GMT\r\n"
"From: poco@appinf.com\r\n"
"Content-Type: text/plain\r\n"
"Subject: Test Message\r\n"
"From: poco@appinf.com\r\n"
"Content-Transfer-Encoding: quoted-printable\r\n"
"To: John Doe <john.doe@no.where>\r\n"
"CC: Jane Doe <jane.doe@no.where>\r\n"
"\r\n"
"Hello, world!\r\n"
"This is a test for the MailMessage class.\r\n"
@ -172,11 +172,11 @@ void MailMessageTest::testWrite8Bit()
message.write(str);
std::string s = str.str();
assert (s ==
"Content-Transfer-Encoding: 8bit\r\n"
"Content-Type: text/plain\r\n"
"Date: Thu, 1 Jan 1970 00:00:00 GMT\r\n"
"From: poco@appinf.com\r\n"
"Content-Type: text/plain\r\n"
"Subject: Test Message\r\n"
"From: poco@appinf.com\r\n"
"Content-Transfer-Encoding: 8bit\r\n"
"To: John Doe <john.doe@no.where>\r\n"
"\r\n"
"Hello, world!\r\n"
@ -204,11 +204,11 @@ void MailMessageTest::testWriteBase64()
message.write(str);
std::string s = str.str();
assert (s ==
"Content-Transfer-Encoding: base64\r\n"
"Content-Type: text/plain\r\n"
"Date: Thu, 1 Jan 1970 00:00:00 GMT\r\n"
"From: poco@appinf.com\r\n"
"Content-Type: text/plain\r\n"
"Subject: Test Message\r\n"
"From: poco@appinf.com\r\n"
"Content-Transfer-Encoding: base64\r\n"
"To: John Doe <john.doe@no.where>\r\n"
"\r\n"
"SGVsbG8sIHdvcmxkIQ0KVGhpcyBpcyBhIHRlc3QgZm9yIHRoZSBNYWlsTWVzc2FnZSBjbGFz\r\n"
@ -244,15 +244,15 @@ void MailMessageTest::testWriteManyRecipients()
message.write(str);
std::string s = str.str();
assert (s ==
"Content-Transfer-Encoding: 8bit\r\n"
"Content-Type: text/plain\r\n"
"Date: Thu, 1 Jan 1970 00:00:00 GMT\r\n"
"From: poco@appinf.com\r\n"
"Content-Type: text/plain\r\n"
"Subject: Test Message\r\n"
"From: poco@appinf.com\r\n"
"Content-Transfer-Encoding: 8bit\r\n"
"To: John Doe <john.doe@no.where>, Jane Doe <jane.doe@no.where>, \r\n"
"\tFrank Foo <walter.foo@no.where>, Bernie Bar <bernie.bar@no.where>, \r\n"
"\tJoe Spammer <joe.spammer@no.where>\r\n"
"\r\n"
"\tFrank Foo <walter.foo@no.where>, Bernie Bar <bernie.bar@no.where>, \r\n"
"\tJoe Spammer <joe.spammer@no.where>\r\n"
"\r\n"
"Hello, world!\r\n"
"This is a test for the MailMessage class.\r\n"
);
@ -279,32 +279,32 @@ void MailMessageTest::testWriteMultiPart()
message.write(str);
std::string s = str.str();
std::string rawMsg(
"Content-Type: multipart/mixed; boundary=$\r\n"
"Date: Thu, 1 Jan 1970 00:00:00 GMT\r\n"
"From: poco@appinf.com\r\n"
"Mime-Version: 1.0\r\n"
"Content-Type: multipart/mixed; boundary=$\r\n"
"Subject: Test Message\r\n"
"From: poco@appinf.com\r\n"
"To: John Doe <john.doe@no.where>\r\n"
"Mime-Version: 1.0\r\n"
"\r\n"
"--$\r\n"
"Content-Disposition: inline\r\n"
"Content-Transfer-Encoding: 8bit\r\n"
"Content-Type: text/plain\r\n"
"Content-Transfer-Encoding: 8bit\r\n"
"Content-Disposition: inline\r\n"
"\r\n"
"Hello World!\r\n"
"\r\n"
"--$\r\n"
"Content-Disposition: attachment; filename=sample.dat\r\n"
"Content-ID: abcd1234\r\n"
"Content-Transfer-Encoding: base64\r\n"
"Content-Type: application/octet-stream; name=sample\r\n"
"Content-Transfer-Encoding: base64\r\n"
"Content-Disposition: attachment; filename=sample.dat\r\n"
"\r\n"
"VGhpcyBpcyBzb21lIGJpbmFyeSBkYXRhLiBSZWFsbHku\r\n"
"--$--\r\n"
);
std::string::size_type p1 = s.find('=') + 1;
std::string::size_type p2 = s.find('\r');
std::string boundary(s, p1, p2 - p1);
std::string::size_type p2 = s.rfind("--");
std::string::size_type p1 = s.rfind("--", p2 - 1);
std::string boundary(s, p1 + 2, p2 - 2 - p1);
std::string msg;
for (std::string::const_iterator it = rawMsg.begin(); it != rawMsg.end(); ++it)
{

View File

@ -136,16 +136,16 @@ void SMTPClientSessionTest::testSend()
cmd = server.popCommandWait();
assert (cmd == "DATA");
cmd = server.popCommandWait();
assert (cmd == "Content-Transfer-Encoding: quoted-printable");
assert (cmd.substr(0, 4) == "Date");
cmd = server.popCommandWait();
assert (cmd == "Content-Type: text/plain");
cmd = server.popCommandWait();
assert (cmd.substr(0, 4) == "Date");
cmd = server.popCommandWait();
assert (cmd == "From: john.doe@no.where");
cmd = server.popCommandWait();
assert (cmd == "Subject: Test Message");
cmd = server.popCommandWait();
assert (cmd == "Content-Transfer-Encoding: quoted-printable");
cmd = server.popCommandWait();
assert (cmd == "To: Jane Doe <jane.doe@no.where>");
cmd = server.popCommandWait();
assert (cmd == "Hello");
@ -199,20 +199,20 @@ void SMTPClientSessionTest::testSendMultiRecipient()
cmd = server.popCommandWait();
assert (cmd == "DATA");
cmd = server.popCommandWait();
assert (cmd == "CC: Jack Doe <jack.doe@no.where>");
cmd = server.popCommandWait();
assert (cmd == "Content-Transfer-Encoding: quoted-printable");
assert (cmd.substr(0, 4) == "Date");
cmd = server.popCommandWait();
assert (cmd == "Content-Type: text/plain");
cmd = server.popCommandWait();
assert (cmd.substr(0, 4) == "Date");
cmd = server.popCommandWait();
assert (cmd == "From: john.doe@no.where");
cmd = server.popCommandWait();
assert (cmd == "Subject: Test Message");
cmd = server.popCommandWait();
assert (cmd == "Content-Transfer-Encoding: quoted-printable");
cmd = server.popCommandWait();
assert (cmd == "To: Jane Doe <jane.doe@no.where>");
cmd = server.popCommandWait();
assert (cmd == "CC: Jack Doe <jack.doe@no.where>");
cmd = server.popCommandWait();
assert (cmd == "Hello");
cmd = server.popCommandWait();
assert (cmd == "blah blah");
@ -269,20 +269,20 @@ void SMTPClientSessionTest::testMultiSeparateRecipient()
cmd = server.popCommandWait();
assert (cmd == "DATA");
cmd = server.popCommandWait();
assert (cmd == "CC: Jack Doe <jack.doe@no.where>, Joe Doe <joe.doe@no.where>");
cmd = server.popCommandWait();
assert (cmd == "Content-Transfer-Encoding: quoted-printable");
assert (cmd.substr(0, 4) == "Date");
cmd = server.popCommandWait();
assert (cmd == "Content-Type: text/plain");
cmd = server.popCommandWait();
assert (cmd.substr(0, 4) == "Date");
cmd = server.popCommandWait();
assert (cmd == "From: john.doe@no.where");
cmd = server.popCommandWait();
assert (cmd == "Subject: Test Message");
cmd = server.popCommandWait();
assert (cmd == "Content-Transfer-Encoding: quoted-printable");
cmd = server.popCommandWait();
assert (cmd == "To: Jane Doe <jane.doe@no.where>");
cmd = server.popCommandWait();
assert (cmd == "CC: Jack Doe <jack.doe@no.where>, Joe Doe <joe.doe@no.where>");
cmd = server.popCommandWait();
assert (cmd == "Hello");
cmd = server.popCommandWait();
assert (cmd == "blah blah");