WvStreams
wvstringmask.h
1 /* -*- Mode: C++ -*-
2  * Worldvisions Weaver Software:
3  * Copyright (C) 2005 Net Integration Technologies, Inc.
4  *
5  * Implementation of an efficient lookup for a set characters.
6  *
7  * It is, however, a little space intensive, but you should statically
8  * create them in your functions, and then they won't be so bad.
9  */
10 #ifndef __WVSTRINGMASK_H
11 #define __WVSTRINGMASK_H
12 
13 #include "wvstring.h"
14 
19 {
20 public:
25  WvStringMask(WvStringParm s = WvString::null);
26  WvStringMask(char c);
27 
31  bool operator[](const char c) const;
32 
36  const char first() const;
37 
41  void zap();
42 
46  void set(const char c, bool value);
47 
51  void set(WvStringParm s, bool value);
52 
53 private:
54  bool _set[256];
55  char _first;
56 };
57 
58 #endif // __WVSTRINGMASK_H
WvStringMask
A class used to provide a masked lookup for characters in a string.
Definition: wvstringmask.h:18
WvStringMask::WvStringMask
WvStringMask(WvStringParm s=WvString::null)
Create a WvStringMask out of a WvString.
Definition: wvstringmask.cc:12
WvStringMask::zap
void zap()
Clear the WvStringMask, so that all lookups return false.
Definition: wvstringmask.cc:35
WvStringMask::first
const char first() const
Get the first character set into the mask.
Definition: wvstringmask.cc:30
WvStringMask::operator[]
bool operator[](const char c) const
Look up a character.
Definition: wvstringmask.cc:24
WvStringMask::set
void set(const char c, bool value)
Set a character 'c' to a particular truth value.
Definition: wvstringmask.cc:41