14 #include "wvhashtable.h"
16 #include "wvlinklist.h"
25 return strncasecmp(*a, *b, strlen(a->
cstr()));
35 WvString s1(
"aussi"), s2(
"Bonjour"), s3(
"comment");
36 WvString s4(
"demain"), s5(
"non"), s6(
"oui");
37 WvString s7(
"matin"), s8(
"bonsoir"), s9(
"bien");
42 t.add(&s1,
false); t.add(&s2,
false), t.add(&s3,
false);
43 t.add(&s4,
false); t.add(&s5,
false), t.add(&s6,
false);
44 t.add(&s7,
false); t.add(&s8,
false), t.add(&s9,
false), t.add(&s10,
false);
47 printf(
"What words do we have in the dictionary?\n");
48 WvStringTable::Iter i(t);
49 for( i.rewind(); i.next(); )
51 printf(
"%s\n", i->cstr() );
54 printf(
"There are %d words stored in the dictionary so far.\n", t.count());
60 printf(
"Is 'Bonjour' in the dictionary? %s\n", t[sample1]?
"Yes":
"No");
62 printf(
"Is 'Salut' in the dictionary? %s\n", t[sample2]?
"Yes":
"No");
69 printf(
"Modified List:\n");
70 for( i.rewind(); i.next(); )
72 printf(
"%s\n", i->cstr() );
75 WvStringTable::Sorter s(t,ascending);
76 printf(
"Sorted modified List:\n");
77 for( s.rewind(); s.next(); )
79 printf(
"%s\n", s->cstr() );
87 printf(
"Empty List:\n");
88 for( i.rewind(); i.next(); )
90 printf(
"%s\n", i->cstr() );