Panda3D
ramfile.I
1 // Filename: ramfile.I
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 ////////////////////////////////////////////////////////////////////
16 // Function: Ramfile::constructor
17 // Access: Published
18 // Description:
19 ////////////////////////////////////////////////////////////////////
20 INLINE Ramfile::
21 Ramfile() {
22  _pos = 0;
23 }
24 
25 ////////////////////////////////////////////////////////////////////
26 // Function: Ramfile::seek
27 // Access: Published
28 // Description: Moves the data pointer to the indicated byte
29 // position. It is not an error to move the pointer
30 // past the end of data.
31 ////////////////////////////////////////////////////////////////////
32 INLINE void Ramfile::
33 seek(size_t pos) {
34  _pos = pos;
35 }
36 
37 ////////////////////////////////////////////////////////////////////
38 // Function: Ramfile::tell
39 // Access: Published
40 // Description: Returns the current data pointer position as a byte
41 // offset from the beginning of the stream.
42 ////////////////////////////////////////////////////////////////////
43 INLINE size_t Ramfile::
44 tell() const {
45  return _pos;
46 }
47 
48 ////////////////////////////////////////////////////////////////////
49 // Function: Ramfile::get_data
50 // Access: Published
51 // Description: Returns the entire buffer contents as a string,
52 // regardless of the current data pointer.
53 ////////////////////////////////////////////////////////////////////
54 INLINE const string &Ramfile::
55 get_data() const {
56  return _data;
57 }
58 
59 ////////////////////////////////////////////////////////////////////
60 // Function: Ramfile::get_data_size
61 // Access: Published
62 // Description: Returns the size of the entire buffer contents.
63 ////////////////////////////////////////////////////////////////////
64 INLINE size_t Ramfile::
65 get_data_size() const {
66  return _data.size();
67 }
68 
69 ////////////////////////////////////////////////////////////////////
70 // Function: Ramfile::clear
71 // Access: Published
72 // Description: Empties the current buffer contents.
73 ////////////////////////////////////////////////////////////////////
74 INLINE void Ramfile::
75 clear() {
76  _data.clear();
77 }
const string & get_data() const
Returns the entire buffer contents as a string, regardless of the current data pointer.
Definition: ramfile.I:55
size_t get_data_size() const
Returns the size of the entire buffer contents.
Definition: ramfile.I:65
void clear()
Empties the current buffer contents.
Definition: ramfile.I:75
void seek(size_t pos)
Moves the data pointer to the indicated byte position.
Definition: ramfile.I:33
size_t tell() const
Returns the current data pointer position as a byte offset from the beginning of the stream...
Definition: ramfile.I:44