X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=classes%2Fplflagset.php;h=c6c8d41f93b123407edf5a4545f95c60c2c6d9fc;hb=feb45d1d9fc152beff746c83048ff7704cc27ea2;hp=94bd85533efb2b888548834aa29b1deceee78e4b;hpb=3c7bc7a377e3d5422f61b92ddf69c4a953ad3d15;p=platal.git diff --git a/classes/plflagset.php b/classes/plflagset.php index 94bd855..c6c8d41 100644 --- a/classes/plflagset.php +++ b/classes/plflagset.php @@ -1,6 +1,6 @@ values = array(); + } + /** return the PlFlagSet */ @@ -120,6 +127,34 @@ class 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 + */ + public function format() + { + 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: