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
|
Line | |
---|
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 | |
---|
10 | namespace UnitTest { |
---|
11 | |
---|
12 | class MemoryOutStream : public std::ostringstream { |
---|
13 | public: |
---|
14 | MemoryOutStream() {} |
---|
15 | ~MemoryOutStream() {} |
---|
16 | char const* GetText() const; |
---|
17 | |
---|
18 | private: |
---|
19 | MemoryOutStream ( MemoryOutStream const& ); |
---|
20 | void operator = ( MemoryOutStream const& ); |
---|
21 | |
---|
22 | mutable std::string m_text; |
---|
23 | }; |
---|
24 | |
---|
25 | } |
---|
26 | |
---|
27 | #else |
---|
28 | |
---|
29 | #include <cstddef> |
---|
30 | |
---|
31 | namespace UnitTest { |
---|
32 | |
---|
33 | class MemoryOutStream { |
---|
34 | public: |
---|
35 | explicit MemoryOutStream ( int const size = 256 ); |
---|
36 | ~MemoryOutStream(); |
---|
37 | |
---|
38 | char const* GetText() const; |
---|
39 | |
---|
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 ); |
---|
48 | |
---|
49 | enum { GROW_CHUNK_SIZE = 32 }; |
---|
50 | int GetCapacity() const; |
---|
51 | |
---|
52 | private: |
---|
53 | void operator= ( MemoryOutStream const& ); |
---|
54 | void GrowBuffer ( int capacity ); |
---|
55 | |
---|
56 | int m_capacity; |
---|
57 | char* m_buffer; |
---|
58 | }; |
---|
59 | |
---|
60 | } |
---|
61 | |
---|
62 | #endif |
---|
63 | |
---|
64 | #endif |
---|