NAME
OTC_BitSetC -
A bit set of size 256.
SYNOPSIS
#include <OTC/collctn/bitsetc.hh>
class OTC_BitSetC
{
public:
static os_typespec* get_os_typespec();
inline static int rank(
OTC_BitSetC const& theSet1,
OTC_BitSetC const& theSet2
);
inline static int hash(OTC_BitSetC const& theSet);
inline OTC_BitSetC();
inline OTC_BitSetC(OTC_BitSetC const& theSet);
OTC_BitSetC(char const* theString);
OTC_BitSetC(char const* theString, u_int theNum);
inline OTC_BitSetC& operator=(OTC_BitSetC const& theSet);
int count() const;
inline int test(char theBit) const;
inline int operator[](char theBit) const;
inline OTC_Boolean operator==(OTC_BitSetC const& theSet) const;
inline OTC_Boolean operator!=(OTC_BitSetC const& theSet) const;
inline void reset();
inline void reset(u_char theBit);
void reset(u_char theStart, u_char theNum);
inline void set();
inline void set(u_char theBit);
void set(u_char theStart, u_char theNum);
void complement();
inline void complement(u_char theBit);
void complement(u_char theStart, u_char theNum);
OTC_BitSetC operator~() const;
OTC_BitSetC operator&(OTC_BitSetC const& theSet);
OTC_BitSetC& operator&=(OTC_BitSetC const& theSet);
OTC_BitSetC operator|(OTC_BitSetC const& theSet);
OTC_BitSetC& operator|=(OTC_BitSetC const& theSet);
OTC_BitSetC operator^(OTC_BitSetC const& theSet);
OTC_BitSetC& operator^=(OTC_BitSetC const& theSet);
};
CLASS TYPE
Concrete
DESCRIPTION
OTC_BitSetC is a bit set for the range of values 0 to 255.
The class is designed for tracking character classes in parsing
type applications.
INITIALISATION
inline OTC_BitSetC();
Creates a bit set with all bits set to 0.
inline OTC_BitSetC(OTC_BitSetC const& theSet);
Creates a bit set which is a copy of
theSet.
OTC_BitSetC(char const* theString);
Creates a bit set which has bits set
corresponding to the characters listed
in theString. theString should be
null terminated. The null terminator
does not result in bit 0 being set.
OTC_BitSetC(char const* theString, u_int theNum);
Creates a bit set which has bits set
corresponding to first theNum characters
listed in theString.
inline OTC_BitSetC& operator=(OTC_BitSetC const& theSet);
Replaces this set with theSet.
QUERY
int count() const;
Returns the number of bits set.
inline int test(char theBit) const;
Returns a non zero value if theBit is set.
inline int operator[](char theBit) const;
Returns a non zero value if theBit is set.
inline OTC_Boolean operator==(OTC_BitSetC const& theSet) const;
Returns OTCLIB_TRUE if this bit set
is equivalent to theSet.
inline OTC_Boolean operator!=(OTC_BitSetC const& theSet) const;
Returns OTCLIB_TRUE if this bit set
is not equivalent to theSet.
MANIPULATORS
inline void reset();
inline void reset(u_char theBit);
void reset(u_char theStart, u_char theNum);
Resets theNum bits starting at theStart
to 0.
inline void set();
inline void set(u_char theBit);
void set(u_char theStart, u_char theNum);
Sets theNum bits starting at theStart
to 1.
void complement();
Complements, or inverts all bits.
inline void complement(u_char theBit);
Complements, or inverts theBit.
void complement(u_char theStart, u_char theNum);
Complements theNum bits starting at
theStart.
OPERATORS
OTC_BitSetC operator~() const;
Returns a set which is the complement of
this set, ie. with all bits inverted.
OTC_BitSetC operator&(OTC_BitSetC const& theSet);
Returns the result of performing an
intersection between theSet and this
set.
OTC_BitSetC& operator&=(OTC_BitSetC const& theSet);
Performs an intersection of theSet and
this set with the result being left in
this set.
OTC_BitSetC operator|(OTC_BitSetC const& theSet);
Returns the result of performing a union
of theSet and this set.
OTC_BitSetC& operator|=(OTC_BitSetC const& theSet);
Performs a union of theSet and this set
with the result being left in this set.
OTC_BitSetC operator^(OTC_BitSetC const& theSet);
Returns the result of performing an
exclusive or of theSet and this set.
OTC_BitSetC& operator^=(OTC_BitSetC const& theSet);
Performs an exclusive or between theSet
and this set with the result being left in
this set.
LIBRARY
OTC
AUTHOR(S)
Graham Dumpleton
COPYRIGHT
Copyright 1992 1994 OTC LIMITED
Copyright 1994 DUMPLETON SOFTWARE CONSULTING PTY LIMITED