stringDecoder.I 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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.I
  10. * @author drose
  11. * @date 2002-02-11
  12. */
  13. /**
  14. *
  15. */
  16. INLINE StringDecoder::
  17. StringDecoder(const std::string &input) : _input(input) {
  18. _p = 0;
  19. _eof = false;
  20. }
  21. /**
  22. * Returns true if the decoder has returned the last character in the string,
  23. * false if there are more to go.
  24. */
  25. INLINE bool StringDecoder::
  26. is_eof() {
  27. return _eof;
  28. }
  29. /**
  30. * If the pointer is past the last character of the string, set the eof flag
  31. * and return true.
  32. */
  33. INLINE bool StringDecoder::
  34. test_eof() {
  35. if (_p >= _input.size()) {
  36. _eof = true;
  37. return true;
  38. }
  39. return false;
  40. }
  41. /**
  42. *
  43. */
  44. INLINE StringUtf8Decoder::
  45. StringUtf8Decoder(const std::string &input) : StringDecoder(input) {
  46. }
  47. /**
  48. *
  49. */
  50. INLINE StringUnicodeDecoder::
  51. StringUtf16Decoder(const std::string &input) : StringDecoder(input) {
  52. }