Panda3D
 All Classes Functions Variables Enumerations
stringDecoder.I
1 // Filename: stringDecoder.I
2 // Created by: drose (11Feb02)
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 ////////////////////////////////////////////////////////////////////
17 // Function: StringDecoder::Constructor
18 // Access: Public
19 // Description:
20 ////////////////////////////////////////////////////////////////////
21 INLINE StringDecoder::
22 StringDecoder(const string &input) : _input(input) {
23  _p = 0;
24  _eof = false;
25 }
26 
27 ////////////////////////////////////////////////////////////////////
28 // Function: StringDecoder::is_eof
29 // Access: Public
30 // Description: Returns true if the decoder has returned the last
31 // character in the string, false if there are more to
32 // go.
33 ////////////////////////////////////////////////////////////////////
34 INLINE bool StringDecoder::
35 is_eof() {
36  return _eof;
37 }
38 
39 ////////////////////////////////////////////////////////////////////
40 // Function: StringDecoder::test_eof
41 // Access: Protected
42 // Description: If the pointer is past the last character of the
43 // string, set the eof flag and return true.
44 ////////////////////////////////////////////////////////////////////
45 INLINE bool StringDecoder::
46 test_eof() {
47  if (_p >= _input.size()) {
48  _eof = true;
49  return true;
50  }
51  return false;
52 }
53 
54 ////////////////////////////////////////////////////////////////////
55 // Function: StringUtf8Decoder::Constructor
56 // Access: Public
57 // Description:
58 ////////////////////////////////////////////////////////////////////
59 INLINE StringUtf8Decoder::
60 StringUtf8Decoder(const string &input) : StringDecoder(input) {
61 }
62 
63 ////////////////////////////////////////////////////////////////////
64 // Function: StringUnicodeDecoder::Constructor
65 // Access: Public
66 // Description:
67 ////////////////////////////////////////////////////////////////////
68 INLINE StringUnicodeDecoder::
69 StringUnicodeDecoder(const string &input) : StringDecoder(input) {
70 }
The base class to a family of classes that decode various kinds of encoded byte streams.
Definition: stringDecoder.h:28
bool is_eof()
Returns true if the decoder has returned the last character in the string, false if there are more to...
Definition: stringDecoder.I:35