PageRenderTime 18ms CodeModel.GetById 13ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

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