コード例 #1
0
ファイル: module_types.php プロジェクト: nemith/fbthrift
 public function read(TProtocol $input)
 {
     $xfer = 0;
     $fname = null;
     $ftype = 0;
     $fid = 0;
     $xfer += $input->readStructBegin($fname);
     while (true) {
         $xfer += $input->readFieldBegin($fname, $ftype, $fid);
         if ($ftype == TType::STOP) {
             break;
         }
         if (!$fid && $fname !== null) {
             if (isset(self::$_TFIELDMAP[$fname])) {
                 $fid = self::$_TFIELDMAP[$fname];
                 $ftype = self::$_TSPEC[$fid]['type'];
             }
         }
         switch ($fid) {
             case 1:
                 if ($ftype == TType::I32) {
                     $xfer += $input->readI32($this->weeks);
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 2:
                 if ($ftype == TType::STRING) {
                     $xfer += $input->readString($this->title);
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 3:
                 if ($ftype == TType::I32) {
                     $xfer += $input->readI32($this->employer);
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             default:
                 $xfer += $input->skip($ftype);
                 break;
         }
         $xfer += $input->readFieldEnd();
     }
     $xfer += $input->readStructEnd();
     return $xfer;
 }
コード例 #2
0
ファイル: module_types.php プロジェクト: davidnasar/fbthrift
 public function read(TProtocol $input)
 {
     $xfer = 0;
     $fname = null;
     $ftype = 0;
     $fid = 0;
     $xfer += $input->readStructBegin($fname);
     while (true) {
         $xfer += $input->readFieldBegin($fname, $ftype, $fid);
         if ($ftype == TType::STOP) {
             break;
         }
         if (!$fid && $fname !== null) {
             if (isset(self::$_TFIELDMAP[$fname])) {
                 $fid = self::$_TFIELDMAP[$fname];
                 $ftype = self::$_TSPEC[$fid]['type'];
             }
         }
         switch ($fid) {
             case 1:
                 if ($ftype == TType::DOUBLE) {
                     $xfer += $input->readDouble($this->red);
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 2:
                 if ($ftype == TType::DOUBLE) {
                     $xfer += $input->readDouble($this->green);
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 3:
                 if ($ftype == TType::DOUBLE) {
                     $xfer += $input->readDouble($this->blue);
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 4:
                 if ($ftype == TType::DOUBLE) {
                     $xfer += $input->readDouble($this->alpha);
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             default:
                 $xfer += $input->skip($ftype);
                 break;
         }
         $xfer += $input->readFieldEnd();
     }
     $xfer += $input->readStructEnd();
     return $xfer;
 }
コード例 #3
0
ファイル: module_types.php プロジェクト: davidnasar/fbthrift
 public function read(TProtocol $input)
 {
     $xfer = 0;
     $fname = null;
     $ftype = 0;
     $fid = 0;
     $xfer += $input->readStructBegin($fname);
     while (true) {
         $xfer += $input->readFieldBegin($fname, $ftype, $fid);
         if ($ftype == TType::STOP) {
             break;
         }
         if (!$fid && $fname !== null) {
             if (isset(self::$_TFIELDMAP[$fname])) {
                 $fid = self::$_TFIELDMAP[$fname];
                 $ftype = self::$_TSPEC[$fid]['type'];
             }
         }
         switch ($fid) {
             case 1:
                 if ($ftype == TType::I32) {
                     $xfer += $input->readI32($this->min);
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 2:
                 if ($ftype == TType::I32) {
                     $xfer += $input->readI32($this->max);
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             default:
                 $xfer += $input->skip($ftype);
                 break;
         }
         $xfer += $input->readFieldEnd();
     }
     $xfer += $input->readStructEnd();
     if (!isset($this->min)) {
         throw new TProtocolException("Required field 'min' was not found in serialized data! Struct: Range", TProtocolException::MISSING_REQUIRED_FIELD);
     }
     if (!isset($this->max)) {
         throw new TProtocolException("Required field 'max' was not found in serialized data! Struct: Range", TProtocolException::MISSING_REQUIRED_FIELD);
     }
     return $xfer;
 }