source: trunk/nv/io/c_stream.hh @ 442

Last change on this file since 442 was 442, checked in by epyon, 10 years ago
  • more std removal - only <random> left
File size: 1.3 KB
RevLine 
[395]1// Copyright (C) 2012-2015 ChaosForge Ltd
[124]2// http://chaosforge.org/
3//
[395]4// This file is part of Nova libraries.
5// For conditions of distribution and use, see copying.txt file in root folder.
6
[124]7/**
8 * @file c_stream.hh
9 * @author Kornel Kisielewicz epyon@chaosforge.org
10 * @brief stream implementation via c f* functions
11 */
12
[395]13#ifndef NV_IO_C_STREAM_HH
14#define NV_IO_C_STREAM_HH
[124]15
[395]16#include <nv/common.hh>
[422]17#include <nv/stl/stream.hh>
[124]18
19namespace nv
20{
21        class c_file_system;
22
23        class c_stream : public stream
24        {
25                friend class c_file_system;
26        protected:
27                c_stream();
[438]28                // TODO: const char* is prone to deletion - don't store it, or store differently!
[124]29                c_stream( void* pfile, const char* filename );
30        public:
31                virtual ~c_stream();
32                virtual size_t read( void* buffer, size_t size, size_t count );
[279]33                virtual size_t write( const void* buffer, size_t size, size_t count );
[442]34                virtual bool gets( char* buffer, size_t max_count );
[198]35                virtual bool seek( long offset, origin orig );
[124]36                virtual size_t tell();
37                virtual size_t size();
38                virtual void flush();
39        private:
40                void*       m_file;      //!< FILE* structure, masked
41                const char* m_file_name; //!< File name
42                size_t      m_file_size; //!< Cached file size
43        };
44
45} // namespace nv
46
[395]47#endif // NV_IO_C_STREAM_HH
Note: See TracBrowser for help on using the repository browser.