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