WvStreams
wvstringmask.h
00001 /* -*- Mode: C++ -*-
00002  * Worldvisions Weaver Software:
00003  *   Copyright (C) 2005 Net Integration Technologies, Inc.
00004  *
00005  * Implementation of an efficient lookup for a set characters.
00006  *
00007  * It is, however, a little space intensive, but you should statically
00008  * create them in your functions, and then they won't be so bad.
00009  */
00010 #ifndef __WVSTRINGMASK_H
00011 #define __WVSTRINGMASK_H
00012 
00013 #include "wvstring.h"
00014 
00018 class WvStringMask
00019 {
00020 public:
00025     WvStringMask(WvStringParm s = WvString::null);
00026     WvStringMask(char c);
00027 
00031     bool operator[](const char c) const;
00032 
00036     const char first() const;
00037 
00041     void zap();
00042 
00046     void set(const char c, bool value);
00047 
00051     void set(WvStringParm s, bool value);
00052 
00053 private:
00054     bool _set[256];
00055     char _first;
00056 };
00057 
00058 #endif // __WVSTRINGMASK_H