Panda3D
stringDecoder.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 stringDecoder.h
10  * @author drose
11  * @date 2002-02-11
12  */
13 
14 #ifndef STRINGDECODER_H
15 #define STRINGDECODER_H
16 
17 #include "dtoolbase.h"
18 
19 /**
20  * The base class to a family of classes that decode various kinds of encoded
21  * byte streams. Give it a string, then ask it to pull the characters out one
22  * at a time. This also serves as the plain old byte-at-a-time decoder.
23  */
24 class EXPCL_DTOOL_DTOOLUTIL StringDecoder {
25 public:
26  INLINE StringDecoder(const std::string &input);
27  virtual ~StringDecoder();
28 
29  virtual char32_t get_next_character();
30  INLINE bool is_eof();
31 
32  static void set_notify_ptr(std::ostream *ptr);
33  static std::ostream *get_notify_ptr();
34 
35 protected:
36  INLINE bool test_eof();
37 
38  std::string _input;
39  size_t _p;
40  bool _eof;
41  static std::ostream *_notify_ptr;
42 };
43 
44 /**
45  * This decoder extracts utf-8 sequences.
46  */
48 public:
49  INLINE StringUtf8Decoder(const std::string &input);
50 
51  virtual char32_t get_next_character();
52 };
53 
54 /**
55  * This decoder extracts characters two at a time to get a plain wide
56  * character sequence. It supports surrogate pairs.
57  */
59 public:
60  INLINE StringUtf16Decoder(const std::string &input);
61 
62  virtual char32_t get_next_character();
63 };
64 
65 // Deprecated alias of StringUtf16Encoder.
67 
68 #include "stringDecoder.I"
69 
70 #endif
This decoder extracts characters two at a time to get a plain wide character sequence.
Definition: stringDecoder.h:58
This decoder extracts utf-8 sequences.
Definition: stringDecoder.h:47
virtual char32_t get_next_character()
Returns the next character in sequence.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual char32_t get_next_character()
Returns the next character in sequence.
The base class to a family of classes that decode various kinds of encoded byte streams.
Definition: stringDecoder.h:24
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.