subStream.I 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // Filename: subStream.I
  2. // Created by: drose (02Aug02)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
  8. //
  9. // All use of this software is subject to the terms of the Panda 3d
  10. // Software license. You should have received a copy of this license
  11. // along with this source code; you will also find a current copy of
  12. // the license at http://www.panda3d.org/license.txt .
  13. //
  14. // To contact the maintainers of this program write to
  15. // [email protected] .
  16. //
  17. ////////////////////////////////////////////////////////////////////
  18. ////////////////////////////////////////////////////////////////////
  19. // Function: ISubStream::Constructor
  20. // Access: Public
  21. // Description:
  22. ////////////////////////////////////////////////////////////////////
  23. INLINE ISubStream::
  24. ISubStream() : istream(&_buf) {
  25. }
  26. ////////////////////////////////////////////////////////////////////
  27. // Function: ISubStream::Constructor
  28. // Access: Public
  29. // Description:
  30. ////////////////////////////////////////////////////////////////////
  31. INLINE ISubStream::
  32. ISubStream(istream *source, streampos start, streampos end) : istream(&_buf) {
  33. open(source, start, end);
  34. }
  35. ////////////////////////////////////////////////////////////////////
  36. // Function: ISubStream::open
  37. // Access: Public
  38. // Description: Starts the SubStream reading from the indicated
  39. // source, with the first character being the character
  40. // at position "start" within the source, for end -
  41. // start total characters. The character at "end"
  42. // within the source will never be read; this will
  43. // appear to be EOF.
  44. //
  45. // If end is zero, it indicates that the ISubStream will
  46. // continue until the end of the source stream.
  47. ////////////////////////////////////////////////////////////////////
  48. INLINE ISubStream &ISubStream::
  49. open(istream *source, streampos start, streampos end) {
  50. clear(0);
  51. _buf.open(source, start, end);
  52. return *this;
  53. }
  54. ////////////////////////////////////////////////////////////////////
  55. // Function: ISubStream::close
  56. // Access: Public
  57. // Description: Resets the SubStream to empty, but does not actually
  58. // close the source istream.
  59. ////////////////////////////////////////////////////////////////////
  60. INLINE ISubStream &ISubStream::
  61. close() {
  62. _buf.close();
  63. return *this;
  64. }