/src/lib/io/core/filter_input_stream.e

http://github.com/tybor/Liberty · Specman e · 81 lines · 45 code · 10 blank · 26 comment · 2 complexity · 0c3d1b1bce71794a2cb47a45cbb6adaf MD5 · raw file

  1. -- This file is part of a Liberty Eiffel library.
  2. -- See the full copyright at the end.
  3. --
  4. deferred class FILTER_INPUT_STREAM
  5. --
  6. -- A filtered input stream.
  7. --
  8. inherit
  9. INPUT_STREAM
  10. insert
  11. FILTER
  12. redefine stream
  13. end
  14. feature {ANY}
  15. end_of_input: BOOLEAN
  16. do
  17. Result := not is_connected or else stream.end_of_input
  18. end
  19. can_read_character: BOOLEAN
  20. do
  21. Result := is_connected and then stream.can_read_character
  22. end
  23. valid_last_character: BOOLEAN
  24. do
  25. Result := is_connected and then stream.valid_last_character
  26. end
  27. can_read_line: BOOLEAN
  28. do
  29. Result := is_connected and then stream.can_read_line
  30. end
  31. can_unread_character: BOOLEAN
  32. do
  33. Result := is_connected and then stream.can_unread_character
  34. end
  35. disconnect
  36. do
  37. stream.disconnect
  38. stream := Void
  39. end
  40. feature {STREAM}
  41. do_detach
  42. do
  43. if filter /= Void then
  44. filter.do_detach
  45. filter := Void
  46. end
  47. stream := Void
  48. end
  49. feature {}
  50. stream: INPUT_STREAM
  51. end -- class FILTER_INPUT_STREAM
  52. --
  53. -- Copyright (C) 2009-2017: by all the people cited in the AUTHORS file.
  54. --
  55. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  56. -- of this software and associated documentation files (the "Software"), to deal
  57. -- in the Software without restriction, including without limitation the rights
  58. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  59. -- copies of the Software, and to permit persons to whom the Software is
  60. -- furnished to do so, subject to the following conditions:
  61. --
  62. -- The above copyright notice and this permission notice shall be included in
  63. -- all copies or substantial portions of the Software.
  64. --
  65. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  66. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  67. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  68. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  69. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  70. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  71. -- THE SOFTWARE.