nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
nitdoc: does not apply header style to span elements anymore.
[nit.git]
/
lib
/
filter_stream.nit
diff --git
a/lib/filter_stream.nit
b/lib/filter_stream.nit
index
999f12c
..
2797b67
100644
(file)
--- a/
lib/filter_stream.nit
+++ b/
lib/filter_stream.nit
@@
-12,26
+12,21
@@
# another product.
class FilterIStream
# another product.
class FilterIStream
-special IStream
+ super IStream
# Filter readed elements
# Filter readed elements
- readable var _stream: nullable IStream
+ var stream: nullable IStream = null
redef fun eof: Bool
do
assert stream != null
return stream.eof
end
redef fun eof: Bool
do
assert stream != null
return stream.eof
end
-
- private fun stream=(i: nullable IStream)
- do
- _stream = i
- end
end
class FilterOStream
end
class FilterOStream
-special OStream
+ super OStream
# Filter outputed elements
# Filter outputed elements
- readable var _stream: nullable OStream
+ var stream: nullable OStream = null
# Can the stream be used to write
redef fun is_writable: Bool
# Can the stream be used to write
redef fun is_writable: Bool
@@
-39,16
+34,11
@@
special OStream
assert stream != null
return stream.is_writable
end
assert stream != null
return stream.is_writable
end
-
- private fun stream=(i: OStream)
- do
- _stream = i
- end
end
class StreamCat
end
class StreamCat
-special FilterIStream
- var _streams: Iterator[IStream]
+ super FilterIStream
+ private var streams: Iterator[IStream]
redef fun eof: Bool
do
redef fun eof: Bool
do
@@
-65,12
+55,14
@@
special FilterIStream
redef fun stream: nullable IStream
do
redef fun stream: nullable IStream
do
- if _stream == null and _streams.is_ok then
- stream = _streams.item
- assert _stream != null
+ var res = super
+ if res == null and _streams.is_ok then
+ res = _streams.item
+ stream = res
+ assert stream != null
_streams.next
end
_streams.next
end
- return _stream
+ return res
end
redef fun read_char: Int
end
redef fun read_char: Int
@@
-98,8
+90,8
@@
special FilterIStream
end
class StreamDemux
end
class StreamDemux
-special FilterOStream
- var _streams: Array[OStream]
+ super FilterOStream
+ private var streams: Array[OStream]
redef fun is_writable: Bool
do
redef fun is_writable: Bool
do
@@
-116,7
+108,7
@@
special FilterOStream
end
end
end
end
- redef fun write(s: String)
+ redef fun write(s: Text)
do
for i in _streams
do
do
for i in _streams
do
@@
-127,6
+119,15
@@
special FilterOStream
end
end
end
end
+ redef fun close
+ do
+ for i in _streams
+ do
+ stream = i
+ stream.close
+ end
+ end
+
init with_streams(streams: Array[OStream])
do
_streams = streams
init with_streams(streams: Array[OStream])
do
_streams = streams