comparison ext/UnitTest++/src/MemoryOutStream.h @ 37:0d325e9d5953

added unittest++ files into ext. Not hooked into build scripts yet
author jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
date Sat, 12 Jul 2008 12:00:57 +0000
parents
children
comparison
equal deleted inserted replaced
36:6f1227f4932b 37:0d325e9d5953
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
13 class MemoryOutStream : public std::ostringstream
14 {
15 public:
16 MemoryOutStream() {}
17 char const* GetText() const;
18
19 private:
20 MemoryOutStream(MemoryOutStream const&);
21 void operator =(MemoryOutStream const&);
22
23 mutable std::string m_text;
24 };
25
26 }
27
28 #else
29
30 #include <cstddef>
31
32 namespace UnitTest
33 {
34
35 class MemoryOutStream
36 {
37 public:
38 explicit MemoryOutStream(int const size = 256);
39 ~MemoryOutStream();
40
41 char const* GetText() const;
42
43 MemoryOutStream& operator << (char const* txt);
44 MemoryOutStream& operator << (int n);
45 MemoryOutStream& operator << (long n);
46 MemoryOutStream& operator << (unsigned long n);
47 MemoryOutStream& operator << (float f);
48 MemoryOutStream& operator << (double d);
49 MemoryOutStream& operator << (void const* p);
50 MemoryOutStream& operator << (unsigned int s);
51
52 enum { GROW_CHUNK_SIZE = 32 };
53 int GetCapacity() const;
54
55 private:
56 void operator= (MemoryOutStream const&);
57 void GrowBuffer(int capacity);
58
59 int m_capacity;
60 char* m_buffer;
61 };
62
63 }
64
65 #endif
66
67 #endif