Show
Ignore:
Timestamp:
01/11/06 17:33:07 (3 years ago)
Author:
kris
Message:

Overhaul of the tokenizers -- now use iterators instead.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/example/lineio.d

    r749 r754  
     1 
    12private import  mango.io.Console, 
    23                mango.io.FileConduit; 
    34 
    4 private import  mango.text.LineStream
     5private import  mango.text.LineIterator
    56 
    67/******************************************************************************* 
    78 
    89        Read a file line-by-line, sending each one to the console. This 
    9         illustrates how to bind a Conduit or a Buffer to a Tokenizer. 
     10        illustrates how to bind a conduit to a text iterator. Iterators 
     11        also support the binding of buffer and string instances. 
    1012 
    11         Note that Tokenizers are templated for char, wchar and dchar ~  
     13        Note that iterators are templated for char, wchar and dchar ~  
    1214        this example uses char 
    1315 
     
    2123           auto file = new FileConduit (args[1]); 
    2224 
    23            // create a Tokenizer and bind it to the file 
    24            auto line = new LineStream (file); 
     25           // create an iterator and bind it to the file 
     26           auto line = new LineIterator (file); 
    2527 
    2628           // process file one line at a time 
    2729           while (line.next) 
    28                   Cout (line.get).newline()
     30                  Cout (line.get) .newline
    2931           } 
    3032        else 
    3133           Cout ("usage: lineio filename"); 
    3234} 
    33