/** class for describing flags
*/
-class PlFlagSet implements XDBFormat
+class PlFlagSet extends PlAbstractIterable implements XDBFormat, PlExportable
{
/** string that holds the PlFlagSet */
private $values = array();
}
}
+ /** Remove all the flags.
+ */
+ public function clear()
+ {
+ $this->values = array();
+ }
+
/** return the PlFlagSet
*/
return $flags;
}
+ /** export the PlFlagSet
+ */
+ public function export()
+ {
+ $array = array();
+ foreach ($this->values as $key=>$value) {
+ if ($value) {
+ $array[] = $key;
+ }
+ }
+ return $array;
+ }
/** format for XDB
*/
{
return XDB::escape($this->flags());
}
+
+
+ /** Build an iterator for this PlFlagSet.
+ */
+ public function iterate()
+ {
+ return PlIteratorUtils::fromArray($this->export(), 1, true);
+ }
}
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: