WvStreams
include/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
18class WvStringMask
19{
20public:
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
53private:
54 bool _set[256];
55 char _first;
56};
57
58#endif // __WVSTRINGMASK_H
A WvFastString acts exactly like a WvString, but can take (const char *) strings without needing to a...
A class used to provide a masked lookup for characters in a string.
WvStringMask(WvStringParm s=WvString::null)
Create a WvStringMask out of a WvString.
void set(const char c, bool value)
Set a character 'c' to a particular truth value.
bool operator[](const char c) const
Look up a character.
void zap()
Clear the WvStringMask, so that all lookups return false.
void set(WvStringParm s, bool value)
Set all characters in string 's' to a particular truth value.
const char first() const
Get the first character set into the mask.