#include "squid.h"
#include "CharacterSet.h"
+#include <algorithm>
+#include <functional>
+
CharacterSet &
CharacterSet::operator +=(const CharacterSet &src)
{
return *this;
}
+CharacterSet
+CharacterSet::complement(const char *label) const
+{
+ CharacterSet result((label ? label : "complement_of_some_other_set"), "");
+ // negate each of our elements and add them to the result storage
+ std::transform(chars_.begin(), chars_.end(), result.chars_.begin(),
+ std::logical_not<Storage::value_type>());
+ return result;
+}
+
CharacterSet::CharacterSet(const char *label, const char * const c) :
name(label == NULL ? "anonymous" : label),
chars_(Storage(256,0))
/// return a new CharacterSet containing the union of two sets
CharacterSet operator +(const CharacterSet &src) const;
+ /// return a new CharacterSet containing characters not in this set
+ CharacterSet complement(const char *complementLabel = NULL) const;
+
+ /// change name; handy in const declarations that use operators
+ CharacterSet &rename(const char *label) { name = label; return *this; }
+
/// optional set label for debugging (default: "anonymous")
const char * name;