in reply to Bitmask or Named permissions
From memory, C++ code would work something like:
CMode mode = new CMode("abcd*eAB"); mode = "beB"; // mode.Clear(); mode.SetModes("beB"); mode += "a"; // mode.SetModes("a"); mode -= "b"; // mode.ClearModes("b"); mode += "d Jones"; // mode.SetModes("d", "Jones"); if (mode & "a") { ... } // mode.IsModeSet("a")
The special handling of "d*" meant that mode "d" took an argument, and you could have any number of them. (Kinda like "/mode #chan +b n!i@h" on IRC.)
Limits, similar to that of bitfields, are that you have a fixed and arbitrary set of fields. Benefits over bitfields are that it's fairly easy to expose the flags to the end user in a consistent way.
--
[ e d @ h a l l e y . c c ]
|
|---|