Panda3D

ramfile.I
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.I
10 * @author mike
11 * @date 1997-01-09
12 */
13
14 /**
15 *
16 */
17 INLINE Ramfile::
18 Ramfile() {
19 _pos = 0;
20 }
21
22 /**
23 * Moves the data pointer to the indicated byte position. It is not an error
24 * to move the pointer past the end of data.
25 */
26 INLINE void Ramfile::
27 seek(size_t pos) {
28 _pos = pos;
29 }
30
31 /**
32 * Returns the current data pointer position as a byte offset from the
33 * beginning of the stream.
34 */
35 INLINE size_t Ramfile::
36 tell() const {
37 return _pos;
38 }
39
40 /**
41 * Returns the entire buffer contents as a string, regardless of the current
42 * data pointer.
43 */
44 INLINE const std::string &Ramfile::
45 get_data() const {
46 return _data;
47 }
48
49 /**
50 * Returns the size of the entire buffer contents.
51 */
52 INLINE size_t Ramfile::
53 get_data_size() const {
54 return _data.size();
55 }
56
57 /**
58 * Empties the current buffer contents.
59 */
60 INLINE void Ramfile::
61 clear() {
62 _data.clear();
63 }
Ramfile::clear
void clear()
Empties the current buffer contents.
Definition: ramfile.I:61
Ramfile::tell
size_t tell() const
Returns the current data pointer position as a byte offset from the beginning of the stream.
Definition: ramfile.I:36
Ramfile::seek
void seek(size_t pos)
Moves the data pointer to the indicated byte position.
Definition: ramfile.I:27
Ramfile::get_data_size
size_t get_data_size() const
Returns the size of the entire buffer contents.
Definition: ramfile.I:53
Ramfile::get_data
const std::string & get_data() const
Returns the entire buffer contents as a string, regardless of the current data pointer.
Definition: ramfile.I:45