X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=classes%2Fplflagset.php;h=c6c8d41f93b123407edf5a4545f95c60c2c6d9fc;hb=96dd0b0fbaaedf7d274cc919268fd717275d605f;hp=28c7addff674b9868bec8ff51b6c1c9589c2a2ee;hpb=cd1d4b4fe272a49f0d1c1ae84bf2a6b432979f09;p=platal.git diff --git a/classes/plflagset.php b/classes/plflagset.php index 28c7add..c6c8d41 100644 --- a/classes/plflagset.php +++ b/classes/plflagset.php @@ -1,6 +1,6 @@ values = array(); + } + /** return the PlFlagSet */ @@ -121,6 +128,18 @@ class PlFlagSet implements XDBFormat 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 */ @@ -128,6 +147,14 @@ class PlFlagSet implements XDBFormat { 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: