ReadStream.st
changeset 1400 0ee12d945849
parent 1295 83f594f05c52
child 1406 fd7eed0e648f
--- a/ReadStream.st	Wed May 15 02:13:33 1996 +0200
+++ b/ReadStream.st	Wed May 15 17:30:49 1996 +0200
@@ -52,6 +52,33 @@
     ^ self
 ! !
 
+!ReadStream methodsFor:'emphasis'!
+
+emphasis
+    "return the emphasis of the current (i.e. next returned by #next)
+     element. Streams on a string will return nil for all elements.
+     Streams on collections which nothing at all about emphasises, 
+     will report an error."
+
+    ^ collection emphasisAt:position.
+
+    "
+     |t s|
+
+     t := 'hello world' asText
+                emphasizeFrom:1 to:5 with:#bold;
+                emphasizeFrom:7 to:11 with:#italic.
+
+     s := t readStream.
+     [s atEnd] whileFalse:[
+        Transcript show:(s emphasis); show:' '.
+        Transcript show:''''; show:(s next); showCr:''''.
+     ].
+    "
+
+    "Modified: 15.5.1996 / 17:30:33 / cg"
+! !
+
 !ReadStream methodsFor:'queries'!
 
 isReadable
@@ -542,5 +569,5 @@
 !ReadStream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ReadStream.st,v 1.26 1996-04-25 17:00:45 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ReadStream.st,v 1.27 1996-05-15 15:30:49 cg Exp $'
 ! !