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

Last change on this file since 438 was 438, checked in by epyon, 10 years ago
  • massive amount of std::string removal
  • removed slurp, use filesystem::slurp instead
  • lua_values const_string support
  • several bugfixes
  • program_manager and shader loading without std::string/std::stream
File size: 1.2 KB
Line 
1// Copyright (C) 2012-2015 ChaosForge Ltd
2// http://chaosforge.org/
3//
4// This file is part of Nova libraries.
5// For conditions of distribution and use, see copying.txt file in root folder.
6
7/**
8 * @file c_stream.hh
9 * @author Kornel Kisielewicz epyon@chaosforge.org
10 * @brief stream implementation via c f* functions
11 */
12
13#ifndef NV_IO_C_STREAM_HH
14#define NV_IO_C_STREAM_HH
15
16#include <nv/common.hh>
17#include <nv/stl/stream.hh>
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();
28                // TODO: const char* is prone to deletion - don't store it, or store differently!
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 );
33                virtual size_t write( const void* buffer, size_t size, size_t count );
34                virtual bool seek( long offset, origin orig );
35                virtual size_t tell();
36                virtual size_t size();
37                virtual void flush();
38        private:
39                void*       m_file;      //!< FILE* structure, masked
40                const char* m_file_name; //!< File name
41                size_t      m_file_size; //!< Cached file size
42        };
43
44} // namespace nv
45
46#endif // NV_IO_C_STREAM_HH
Note: See TracBrowser for help on using the repository browser.