Last change
on this file since 134 was
134,
checked in by epyon, 12 years ago
|
- io/std_stream adapter added
- TODO: test, and substitute memmove for copy
|
File size:
1.0 KB
|
Line | |
---|
1 | // Copyright (C) 2012-2013 ChaosForge / Kornel Kisielewicz
|
---|
2 | // http://chaosforge.org/
|
---|
3 | //
|
---|
4 | // This file is part of NV Libraries.
|
---|
5 | // For conditions of distribution and use, see copyright notice in nv.hh
|
---|
6 | /**
|
---|
7 | * @file std_stream.hh
|
---|
8 | * @author Kornel Kisielewicz epyon@chaosforge.org
|
---|
9 | * @brief stream adapter for usage with STL
|
---|
10 | */
|
---|
11 |
|
---|
12 | #ifndef NV_STD_STREAM_HH
|
---|
13 | #define NV_STD_STREAM_HH
|
---|
14 |
|
---|
15 | #include <nv/common.hh>
|
---|
16 | #include <nv/interface/stream.hh>
|
---|
17 | #include <streambuf>
|
---|
18 | #include <vector>
|
---|
19 |
|
---|
20 | namespace nv
|
---|
21 | {
|
---|
22 | class std_stream : public std::streambuf
|
---|
23 | {
|
---|
24 | public:
|
---|
25 | explicit std_stream( stream* source, bool owner = false, std::size_t bsize = 256, std::size_t put_back = 8 );
|
---|
26 | ~std_stream();
|
---|
27 | protected:
|
---|
28 | stream* m_stream;
|
---|
29 | bool m_owner;
|
---|
30 | std::vector<char> m_buffer;
|
---|
31 | std::size_t m_put_back;
|
---|
32 | private:
|
---|
33 | std_stream( const std_stream& ); // dissalow copy
|
---|
34 | std_stream *operator =( const std_stream& ); // dissalow assign
|
---|
35 | int_type underflow();
|
---|
36 | };
|
---|
37 |
|
---|
38 | } // namespace nv
|
---|
39 |
|
---|
40 | #endif // NV_STD_STREAM_HH
|
---|
Note: See
TracBrowser
for help on using the repository browser.