Revision 477, 1.2 kB
(checked in by mido, 15 years ago)
|
panove, vite, jak jsem peclivej na upravu kodu.. snad se vam bude libit:) konfigurace je v souboru /system/astylerc
|
Rev | Line | |
---|
[418] | 1 | #ifndef UNITTEST_MEMORYOUTSTREAM_H |
---|
| 2 | #define UNITTEST_MEMORYOUTSTREAM_H |
---|
| 3 | |
---|
| 4 | #include "Config.h" |
---|
| 5 | |
---|
| 6 | #ifndef UNITTEST_USE_CUSTOM_STREAMS |
---|
| 7 | |
---|
| 8 | #include <sstream> |
---|
| 9 | |
---|
[477] | 10 | namespace UnitTest { |
---|
[418] | 11 | |
---|
[477] | 12 | class MemoryOutStream : public std::ostringstream { |
---|
[418] | 13 | public: |
---|
[477] | 14 | MemoryOutStream() {} |
---|
| 15 | ~MemoryOutStream() {} |
---|
| 16 | char const* GetText() const; |
---|
[418] | 17 | |
---|
| 18 | private: |
---|
[477] | 19 | MemoryOutStream ( MemoryOutStream const& ); |
---|
| 20 | void operator = ( MemoryOutStream const& ); |
---|
[418] | 21 | |
---|
[477] | 22 | mutable std::string m_text; |
---|
[418] | 23 | }; |
---|
| 24 | |
---|
| 25 | } |
---|
| 26 | |
---|
| 27 | #else |
---|
| 28 | |
---|
| 29 | #include <cstddef> |
---|
| 30 | |
---|
[477] | 31 | namespace UnitTest { |
---|
[418] | 32 | |
---|
[477] | 33 | class MemoryOutStream { |
---|
[418] | 34 | public: |
---|
[477] | 35 | explicit MemoryOutStream ( int const size = 256 ); |
---|
| 36 | ~MemoryOutStream(); |
---|
[418] | 37 | |
---|
[477] | 38 | char const* GetText() const; |
---|
[418] | 39 | |
---|
[477] | 40 | MemoryOutStream& operator << ( char const* txt ); |
---|
| 41 | MemoryOutStream& operator << ( int n ); |
---|
| 42 | MemoryOutStream& operator << ( long n ); |
---|
| 43 | MemoryOutStream& operator << ( unsigned long n ); |
---|
| 44 | MemoryOutStream& operator << ( float f ); |
---|
| 45 | MemoryOutStream& operator << ( double d ); |
---|
| 46 | MemoryOutStream& operator << ( void const* p ); |
---|
| 47 | MemoryOutStream& operator << ( unsigned int s ); |
---|
[418] | 48 | |
---|
[477] | 49 | enum { GROW_CHUNK_SIZE = 32 }; |
---|
| 50 | int GetCapacity() const; |
---|
[418] | 51 | |
---|
| 52 | private: |
---|
[477] | 53 | void operator= ( MemoryOutStream const& ); |
---|
| 54 | void GrowBuffer ( int capacity ); |
---|
[418] | 55 | |
---|
[477] | 56 | int m_capacity; |
---|
| 57 | char* m_buffer; |
---|
[418] | 58 | }; |
---|
| 59 | |
---|
| 60 | } |
---|
| 61 | |
---|
| 62 | #endif |
---|
| 63 | |
---|
| 64 | #endif |
---|