root/library/tests/unittest-cpp/MemoryOutStream.h @ 477

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

RevLine 
[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]10namespace UnitTest {
[418]11
[477]12class MemoryOutStream : public std::ostringstream {
[418]13public:
[477]14        MemoryOutStream() {}
15        ~MemoryOutStream() {}
16        char const* GetText() const;
[418]17
18private:
[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]31namespace UnitTest {
[418]32
[477]33class MemoryOutStream {
[418]34public:
[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
52private:
[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
Note: See TracBrowser for help on using the browser.