* @revision 04 * @license http://creativecommons.org/licenses/by-sa/3.0/de/ Creative Commons Attribution-Share Alike 3.0 Germany * @homepage http://oss.tiggerswelt.net/oscar/ * @copyright Copyright © 2009 tiggersWelt.net */ require_once ("oscar/bart.php"); require_once ("oscar/common.php"); class Oscar_Bart_Named { public $Username = ""; public $Barts = array (); function __construct (&$Data = "", $Truncate = false) { // Check wheter to parse any data if (strlen ($Data) < 6) return; $Buffer = $Data; $this->Username = Oscar_Common::string08 ($Buffer, 0, true); $Count = Oscar_Common::str2int8 ($Buffer, 0, true); for ($i = 0; $i < $Count; $i++) $this->Barts [] = new Oscar_Bart ($Buffer, true); if ($Truncate) $Data = $Buffer; } // {{{ generate /** * Convert this Bart into binary string * * @access public * @return string **/ public function generate () { $Data = Oscar_Common::toString08 ($this->Username) . Oscar_Common::int8toStr (count ($this->Barts)); foreach ($this->Barts as $Bart) $Data .= $Bart->generate (); return $Data; } // }}} } ?>