Panda3D
ramfile.h
1 // Filename: ramfile.h
2 // Created by: mike (09Jan97)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef RAMFILE_H
16 #define RAMFILE_H
17 
18 #include "pandabase.h"
19 #include "typedef.h"
20 #include "referenceCount.h"
21 
22 ////////////////////////////////////////////////////////////////////
23 // Class : Ramfile
24 // Description : An in-memory buffer specifically designed for
25 // downloading files to memory.
26 ////////////////////////////////////////////////////////////////////
27 class EXPCL_PANDAEXPRESS Ramfile {
28 PUBLISHED:
29  INLINE Ramfile();
30 
31  INLINE void seek(size_t pos);
32  INLINE size_t tell() const;
33  string read(size_t length);
34  string readline();
35  EXTENSION(PyObject *readlines());
36 
37  INLINE const string &get_data() const;
38  INLINE size_t get_data_size() const;
39  INLINE void clear();
40 
41 public:
42  size_t _pos;
43  string _data;
44 };
45 
46 #include "ramfile.I"
47 
48 #endif
An in-memory buffer specifically designed for downloading files to memory.
Definition: ramfile.h:27