Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

wvlistex.cc

Go to the documentation of this file.
00001 #include "wvstring.h"
00002 #include "wvlinklist.h"
00003    
00004 DeclareWvList(WvString);   // creates class WvStringList
00005    
00006 int main()
00007 {
00008     WvStringList l;
00009     WvStringList::Iter i(l);
00010     WvString autostr("bork bork");
00011     
00012     l.append(new WvString("blah blah"), true); // auto-free enabled
00013     l.append(&autostr, false); // auto-free disabled: C++ will do this one
00014     // etc
00015     
00016     for (i.rewind(); i.next(); )
00017     {
00018         // we will learn a nicer way to do this with WvStream later.
00019         printf("%s\n", (const char *)i());
00020     }
00021     
00022     // exiting this function will have C++ auto-free the list, which
00023     // causes the list to auto-free the "blah blah" string.  C++ also
00024     // auto-frees the "bork bork" string automatically.  It doesn't matter
00025     // that "bork bork" is freed before the list destructor is called; the
00026     // list doesn't refer to its members during destruction, unless it
00027     // needs to free the elements by itself.
00028 }

Generated on Sun Aug 25 02:29:32 2002 for WvStreams by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002