Last change
on this file since 124 was
124,
checked in by epyon, 12 years ago
|
- stream and file_system interfaces added
- io folder/library added
- c_stream and c_file_system implementations
|
File size:
1.1 KB
|
Rev | Line | |
---|
[124] | 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 c_stream.hh
|
---|
| 8 | * @author Kornel Kisielewicz epyon@chaosforge.org
|
---|
| 9 | * @brief stream implementation via c f* functions
|
---|
| 10 | */
|
---|
| 11 |
|
---|
| 12 | #ifndef NV_C_STREAM_HH
|
---|
| 13 | #define NV_C_STREAM_HH
|
---|
| 14 |
|
---|
| 15 | #include <nv/common.hh>
|
---|
| 16 | #include <nv/interface/stream.hh>
|
---|
| 17 |
|
---|
| 18 | namespace nv
|
---|
| 19 | {
|
---|
| 20 | class c_file_system;
|
---|
| 21 |
|
---|
| 22 | class c_stream : public stream
|
---|
| 23 | {
|
---|
| 24 | friend class c_file_system;
|
---|
| 25 | protected:
|
---|
| 26 | c_stream();
|
---|
| 27 | c_stream( void* pfile, const char* filename );
|
---|
| 28 | public:
|
---|
| 29 | virtual ~c_stream();
|
---|
| 30 | virtual size_t read( void* buffer, size_t size, size_t count );
|
---|
| 31 | virtual size_t write( void* buffer, size_t size, size_t count );
|
---|
| 32 | virtual bool seek( size_t offset, origin orig );
|
---|
| 33 | virtual size_t tell();
|
---|
| 34 | virtual size_t size();
|
---|
| 35 | virtual void flush();
|
---|
| 36 | private:
|
---|
| 37 | void* m_file; //!< FILE* structure, masked
|
---|
| 38 | const char* m_file_name; //!< File name
|
---|
| 39 | size_t m_file_size; //!< Cached file size
|
---|
| 40 | };
|
---|
| 41 |
|
---|
| 42 | } // namespace nv
|
---|
| 43 |
|
---|
| 44 | #endif // NV_STREAM_HH
|
---|
Note: See
TracBrowser
for help on using the repository browser.