Fresco/Berlin/modules/Text TextKitImpl.cc,1.37,1.38

Tobias Hunger <[email protected]>
Newsgroups gmane.comp.video.fresco.cvs
Message-ID <[email protected]>
Update of /cvs/fresco/Fresco/Berlin/modules/Text
In directory purcel:/tmp/cvs-serv9995/Berlin/modules/Text

Modified Files:
	TextKitImpl.cc 
Log Message:
Cleanup the cleanup.

A new template create_and_set_body added to KitImpl. That gets us around the
need to define a temporary in most places, shortening the code even further.


Index: TextKitImpl.cc
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Text/TextKitImpl.cc,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- TextKitImpl.cc	23 Jan 2003 22:31:05 -0000	1.37
+++ TextKitImpl.cc	25 Jan 2003 22:37:03 -0000	1.38
@@ -112,8 +112,7 @@
       _canonicalDK->allocate_char(ch, r);
       TextChunk *chunk = new TextChunk(ch, r);
       activate(chunk);
-      Graphic_ptr res = chunk->_this();
-      _cache[ch] = res;
+      _cache[ch] = chunk->_this();
   }
   return Graphic::_duplicate(_cache[ch]);
 }
@@ -140,22 +139,22 @@
 
 Graphic_ptr TextKitImpl::simple_viewer(TextBuffer_ptr buf)
 {
-  Graphic_ptr tv = create<Graphic>(new TextViewer(buf,
+  Graphic_var tv = create<Graphic>(new TextViewer(buf,
 						  TextKit_var(_this()),
 						  _canonicalDK,
 						  _lineCompositor));
-  buf->attach(Observer_ptr(tv));
+  buf->attach(Observer_ptr(Graphic_ptr(tv)));
   return tv;
 }
 
 Graphic_ptr TextKitImpl::terminal(StreamBuffer_ptr buf)
 {
-  Graphic_ptr tv = create<Graphic>(new TerminalView(buf,
+  Graphic_var tv = create<Graphic>(new TerminalView(buf,
 						    TextKit_var(_this()),
 						    _canonicalDK,
 						    _lineCompositor,
 						    _pageCompositor));
-  buf->attach(Observer_ptr(tv));
+  buf->attach(Observer_ptr(Graphic_ptr(tv)));
   return tv;
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.