コード例 #1
0
ファイル: Char.php プロジェクト: i-geo/odataphpprod
 /**
  * Checks this type is compactible with another type
  * Note: implementation of IType::isCompatibleWith
  * 
  * @param IType $type Type to check compactibility
  * 
  * @return boolean 
  */
 public function isCompatibleWith(IType $type)
 {
     switch ($type->getTypeCode()) {
         case TypeCode::BYTE:
         case TypeCode::CHAR:
             return true;
     }
     return false;
 }
コード例 #2
0
 /**
  * Get the function prototype as string
  *
  * @return string
  */
 public function getProtoTypeAsString()
 {
     $str = $this->returnType->getFullTypeName() . ' ' . $this->functionName . '(';
     foreach ($this->argumentTypes as $argumentType) {
         $str .= $argumentType->getFullTypeName() . ', ';
     }
     return rtrim($str, ', ') . ')';
 }
コード例 #3
0
ファイル: Void.php プロジェクト: i-geo/odataphpprod
 /**
  * Checks this type (Void) is compactible with another type
  * Note: implementation of IType::isCompatibleWith
  * 
  * @param IType $type Type to check compactibility
  * 
  * @return boolean 
  */
 public function isCompatibleWith(IType $type)
 {
     return $type->getTypeCode() == TypeCode::VOID;
 }
コード例 #4
0
 /**
  * Checks expression is a specific type
  * 
  * @param IType $type The type to check
  * 
  * @return boolean
  */
 public function typeIs(IType $type)
 {
     return $this->type->getTypeCode() == $type->getTypeCode();
 }
コード例 #5
0
 /**
  * Parse primitive type literal.
  *
  * @param IType $targetType Expected type of the current literal.
  *
  * @return AbstractExpression
  *
  * @throws ODataException
  */
 private function _parseTypedLiteral(IType $targetType)
 {
     $literal = $this->_lexer->getCurrentToken()->Text;
     $outVal = null;
     if (!$targetType->validate($literal, $outVal)) {
         ODataException::createSyntaxError(Messages::expressionParserUnrecognizedLiteral($targetType->getFullTypeName(), $literal, $this->_lexer->getCurrentToken()->Position));
     }
     $result = new ConstantExpression($outVal, $targetType);
     $this->_lexer->nextToken();
     return $result;
 }