nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
lib: implement `close` in StringOStream
[nit.git]
/
lib
/
standard
/
stream.nit
diff --git
a/lib/standard/stream.nit
b/lib/standard/stream.nit
index
504396a
..
a94601c
100644
(file)
--- a/
lib/standard/stream.nit
+++ b/
lib/standard/stream.nit
@@
-20,6
+20,7
@@
in "C" `{
#include <poll.h>
#include <errno.h>
#include <string.h>
#include <poll.h>
#include <errno.h>
#include <string.h>
+ #include <signal.h>
`}
# Abstract stream class
`}
# Abstract stream class
@@
-418,6
+419,13
@@
class StringOStream
private var content = new Array[String]
redef fun to_s do return content.to_s
private var content = new Array[String]
redef fun to_s do return content.to_s
- redef fun is_writable do return true
- redef fun write(str) do content.add(str.to_s)
+ redef fun is_writable do return not closed
+ redef fun write(str)
+ do
+ assert not closed
+ content.add(str.to_s)
+ end
+
+ protected var closed = false
+ redef fun close do closed = true
end
end