added nextPutLineBlock support.
authormd
Thu, 08 Nov 2001 16:31:12 +0100
changeset 987 686f04a472ff
parent 986 96deeecb60d6
child 988 e7e70b439226
added nextPutLineBlock support.
ActorStream.st
--- a/ActorStream.st	Fri Oct 12 19:56:56 2001 +0200
+++ b/ActorStream.st	Thu Nov 08 16:31:12 2001 +0100
@@ -13,7 +13,8 @@
 "{ Package: 'stx:libbasic2' }"
 
 Stream subclass:#ActorStream
-	instanceVariableNames:'nextPutBlock nextPutAllBlock nextBlock atEndBlock'
+	instanceVariableNames:'nextPutBlock nextPutAllBlock nextPutLineBlock nextBlock
+		atEndBlock'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'Streams'
@@ -82,18 +83,19 @@
     "put something onto the stream by evaluating the nextPutBlock with
      something as argument"
 
-    nextPutBlock notNil ifTrue:[
-	^ nextPutBlock value:something
+    nextPutBlock notNil ifTrue:[  
+        ^ nextPutBlock value:something
     ].
     self error:'action for nextPut: is undefined'
 !
 
 nextPutAll:something
     "put all elements of something onto the stream by evaluating
-     the nextPutAllBlock with something as argument"
+     the nextPutAllBlock with something as argument.
+     If there is no nextPutAllBlock, nextPuts will be used (as inherited)"
 
-    nextPutAllBlock notNil ifTrue:[
-	^ nextPutAllBlock value:something
+    nextPutAllBlock notNil ifTrue:[    
+        ^ nextPutAllBlock value:something
     ].
     super nextPutAll:something
 !
@@ -105,6 +107,17 @@
     self nextPut:(something asCharacter)
 
     "Created: 6.8.1997 / 00:44:32 / cg"
+!
+
+nextPutLine:something
+    "put the line onto the stream by evaluating
+     the nextPutLineBlock with something as argument.
+     If there is no nextPutLineBlock, nextPutAll/nextPut will be used (as inherited)"
+
+    nextPutLineBlock notNil ifTrue:[    
+        ^ nextPutLineBlock value:something
+    ].
+    super nextPutLine:something
 ! !
 
 !ActorStream methodsFor:'defining actions'!
@@ -122,7 +135,8 @@
 !
 
 nextPutAllBlock:aBlock
-    "define the block to be evaluated for every nextPutAll-message"
+    "define the block to be evaluated for every nextPutAll-message.
+     If undefined, nextPuts will be used (as inherited)"
 
     nextPutAllBlock := aBlock
 !
@@ -131,6 +145,13 @@
     "define the block to be evaluated for every nextPut-message"
 
     nextPutBlock := aBlock
+!
+
+nextPutLineBlock:aBlock
+    "define the block to be evaluated for every nextPutLineBlock-message.
+     If undefined, nextPutAll/nextPut will be used (as inherited)"
+
+    nextPutLineBlock := aBlock
 ! !
 
 !ActorStream methodsFor:'queries'!
@@ -147,5 +168,5 @@
 !ActorStream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic2/ActorStream.st,v 1.7 2000-12-13 16:28:02 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/ActorStream.st,v 1.8 2001-11-08 15:31:12 md Exp $'
 ! !