@ -862,6 +862,8 @@ static void init_file_wrappers(TSRMLS_D) {
// -----------------------------------------------------------------------------
static zend_function_entry field_cardinality_methods [ ] = {
PHP_ME ( Field_Cardinality , name , NULL , ZEND_ACC_PUBLIC | ZEND_ACC_STATIC )
PHP_ME ( Field_Cardinality , value , NULL , ZEND_ACC_PUBLIC | ZEND_ACC_STATIC )
{ NULL , NULL , NULL }
} ;
@ -886,11 +888,60 @@ PHP_PROTO_INIT_ENUMCLASS_START("Google\\Protobuf\\Field\\Cardinality",
# endif
PHP_PROTO_INIT_ENUMCLASS_END
PHP_METHOD ( Field_Cardinality , name ) {
PHP_PROTO_LONG value ;
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " l " , & value ) = =
FAILURE ) {
return ;
}
switch ( value ) {
case 0 :
PHP_PROTO_RETURN_STRING ( " CARDINALITY_UNKNOWN " , 1 ) ;
case 1 :
PHP_PROTO_RETURN_STRING ( " CARDINALITY_OPTIONAL " , 1 ) ;
case 2 :
PHP_PROTO_RETURN_STRING ( " CARDINALITY_REQUIRED " , 1 ) ;
case 3 :
PHP_PROTO_RETURN_STRING ( " CARDINALITY_REPEATED " , 1 ) ;
default :
zend_throw_exception (
NULL ,
" Enum Google \\ Protobuf \\ Field_Cardinality has no name "
" defined for value %d. " ,
value ,
0 TSRMLS_CC ) ;
}
}
PHP_METHOD ( Field_Cardinality , value ) {
char * name = NULL ;
PHP_PROTO_SIZE name_len ;
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " s " , & name , & name_len ) = =
FAILURE ) {
return ;
}
if ( strncmp ( name , " CARDINALITY_UNKNOWN " , name_len ) = = 0 ) RETURN_LONG ( 0 ) ;
if ( strncmp ( name , " CARDINALITY_OPTIONAL " , name_len ) = = 0 ) RETURN_LONG ( 1 ) ;
if ( strncmp ( name , " CARDINALITY_REQUIRED " , name_len ) = = 0 ) RETURN_LONG ( 2 ) ;
if ( strncmp ( name , " CARDINALITY_REPEATED " , name_len ) = = 0 ) RETURN_LONG ( 3 ) ;
zend_throw_exception (
NULL ,
" Enum Google \\ Protobuf \\ Field_Cardinality has no value "
" defined for name %s. " ,
name ,
0 TSRMLS_CC ) ;
}
// -----------------------------------------------------------------------------
// Field_Kind
// -----------------------------------------------------------------------------
static zend_function_entry field_kind_methods [ ] = {
PHP_ME ( Field_Kind , name , NULL , ZEND_ACC_PUBLIC | ZEND_ACC_STATIC )
PHP_ME ( Field_Kind , value , NULL , ZEND_ACC_PUBLIC | ZEND_ACC_STATIC )
{ NULL , NULL , NULL }
} ;
@ -945,11 +996,105 @@ PHP_PROTO_INIT_ENUMCLASS_START("Google\\Protobuf\\Field\\Kind",
# endif
PHP_PROTO_INIT_ENUMCLASS_END
PHP_METHOD ( Field_Kind , name ) {
PHP_PROTO_LONG value ;
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " l " , & value ) = =
FAILURE ) {
return ;
}
switch ( value ) {
case 0 :
PHP_PROTO_RETURN_STRING ( " TYPE_UNKNOWN " , 1 ) ;
case 1 :
PHP_PROTO_RETURN_STRING ( " TYPE_DOUBLE " , 1 ) ;
case 2 :
PHP_PROTO_RETURN_STRING ( " TYPE_FLOAT " , 1 ) ;
case 3 :
PHP_PROTO_RETURN_STRING ( " TYPE_INT64 " , 1 ) ;
case 4 :
PHP_PROTO_RETURN_STRING ( " TYPE_UINT64 " , 1 ) ;
case 5 :
PHP_PROTO_RETURN_STRING ( " TYPE_INT32 " , 1 ) ;
case 6 :
PHP_PROTO_RETURN_STRING ( " TYPE_FIXED64 " , 1 ) ;
case 7 :
PHP_PROTO_RETURN_STRING ( " TYPE_FIXED32 " , 1 ) ;
case 8 :
PHP_PROTO_RETURN_STRING ( " TYPE_BOOL " , 1 ) ;
case 9 :
PHP_PROTO_RETURN_STRING ( " TYPE_STRING " , 1 ) ;
case 10 :
PHP_PROTO_RETURN_STRING ( " TYPE_GROUP " , 1 ) ;
case 11 :
PHP_PROTO_RETURN_STRING ( " TYPE_MESSAGE " , 1 ) ;
case 12 :
PHP_PROTO_RETURN_STRING ( " TYPE_BYTES " , 1 ) ;
case 13 :
PHP_PROTO_RETURN_STRING ( " TYPE_UINT32 " , 1 ) ;
case 14 :
PHP_PROTO_RETURN_STRING ( " TYPE_ENUM " , 1 ) ;
case 15 :
PHP_PROTO_RETURN_STRING ( " TYPE_SFIXED32 " , 1 ) ;
case 16 :
PHP_PROTO_RETURN_STRING ( " TYPE_SFIXED64 " , 1 ) ;
case 17 :
PHP_PROTO_RETURN_STRING ( " TYPE_SINT32 " , 1 ) ;
case 18 :
PHP_PROTO_RETURN_STRING ( " TYPE_SINT64 " , 1 ) ;
default :
zend_throw_exception (
NULL ,
" Enum Google \\ Protobuf \\ Field_Kind has no name "
" defined for value %d. " ,
value ,
0 TSRMLS_CC ) ;
}
}
PHP_METHOD ( Field_Kind , value ) {
char * name = NULL ;
PHP_PROTO_SIZE name_len ;
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " s " , & name , & name_len ) = =
FAILURE ) {
return ;
}
if ( strncmp ( name , " TYPE_UNKNOWN " , name_len ) = = 0 ) RETURN_LONG ( 0 ) ;
if ( strncmp ( name , " TYPE_DOUBLE " , name_len ) = = 0 ) RETURN_LONG ( 1 ) ;
if ( strncmp ( name , " TYPE_FLOAT " , name_len ) = = 0 ) RETURN_LONG ( 2 ) ;
if ( strncmp ( name , " TYPE_INT64 " , name_len ) = = 0 ) RETURN_LONG ( 3 ) ;
if ( strncmp ( name , " TYPE_UINT64 " , name_len ) = = 0 ) RETURN_LONG ( 4 ) ;
if ( strncmp ( name , " TYPE_INT32 " , name_len ) = = 0 ) RETURN_LONG ( 5 ) ;
if ( strncmp ( name , " TYPE_FIXED64 " , name_len ) = = 0 ) RETURN_LONG ( 6 ) ;
if ( strncmp ( name , " TYPE_FIXED32 " , name_len ) = = 0 ) RETURN_LONG ( 7 ) ;
if ( strncmp ( name , " TYPE_BOOL " , name_len ) = = 0 ) RETURN_LONG ( 8 ) ;
if ( strncmp ( name , " TYPE_STRING " , name_len ) = = 0 ) RETURN_LONG ( 9 ) ;
if ( strncmp ( name , " TYPE_GROUP " , name_len ) = = 0 ) RETURN_LONG ( 10 ) ;
if ( strncmp ( name , " TYPE_MESSAGE " , name_len ) = = 0 ) RETURN_LONG ( 11 ) ;
if ( strncmp ( name , " TYPE_BYTES " , name_len ) = = 0 ) RETURN_LONG ( 12 ) ;
if ( strncmp ( name , " TYPE_UINT32 " , name_len ) = = 0 ) RETURN_LONG ( 13 ) ;
if ( strncmp ( name , " TYPE_ENUM " , name_len ) = = 0 ) RETURN_LONG ( 14 ) ;
if ( strncmp ( name , " TYPE_SFIXED32 " , name_len ) = = 0 ) RETURN_LONG ( 15 ) ;
if ( strncmp ( name , " TYPE_SFIXED64 " , name_len ) = = 0 ) RETURN_LONG ( 16 ) ;
if ( strncmp ( name , " TYPE_SINT32 " , name_len ) = = 0 ) RETURN_LONG ( 17 ) ;
if ( strncmp ( name , " TYPE_SINT64 " , name_len ) = = 0 ) RETURN_LONG ( 18 ) ;
zend_throw_exception (
NULL ,
" Enum Google \\ Protobuf \\ Field_Kind has no value "
" defined for name %s. " ,
name ,
0 TSRMLS_CC ) ;
}
// -----------------------------------------------------------------------------
// NullValue
// -----------------------------------------------------------------------------
static zend_function_entry null_value_methods [ ] = {
PHP_ME ( NullValue , name , NULL , ZEND_ACC_PUBLIC | ZEND_ACC_STATIC )
PHP_ME ( NullValue , value , NULL , ZEND_ACC_PUBLIC | ZEND_ACC_STATIC )
{ NULL , NULL , NULL }
} ;
@ -962,11 +1107,51 @@ PHP_PROTO_INIT_ENUMCLASS_START("Google\\Protobuf\\NullValue",
" NULL_VALUE " , 10 , 0 TSRMLS_CC ) ;
PHP_PROTO_INIT_ENUMCLASS_END
PHP_METHOD ( NullValue , name ) {
PHP_PROTO_LONG value ;
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " l " , & value ) = =
FAILURE ) {
return ;
}
switch ( value ) {
case 0 :
PHP_PROTO_RETURN_STRING ( " NULL_VALUE " , 1 ) ;
default :
zend_throw_exception (
NULL ,
" Enum Google \\ Protobuf \\ NullValue has no name "
" defined for value %d. " ,
value ,
0 TSRMLS_CC ) ;
}
}
PHP_METHOD ( NullValue , value ) {
char * name = NULL ;
PHP_PROTO_SIZE name_len ;
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " s " , & name , & name_len ) = =
FAILURE ) {
return ;
}
if ( strncmp ( name , " NULL_VALUE " , name_len ) = = 0 ) RETURN_LONG ( 0 ) ;
zend_throw_exception (
NULL ,
" Enum Google \\ Protobuf \\ NullValue has no value "
" defined for name %s. " ,
name ,
0 TSRMLS_CC ) ;
}
// -----------------------------------------------------------------------------
// Syntax
// -----------------------------------------------------------------------------
static zend_function_entry syntax_methods [ ] = {
PHP_ME ( Syntax , name , NULL , ZEND_ACC_PUBLIC | ZEND_ACC_STATIC )
PHP_ME ( Syntax , value , NULL , ZEND_ACC_PUBLIC | ZEND_ACC_STATIC )
{ NULL , NULL , NULL }
} ;
@ -981,7 +1166,46 @@ PHP_PROTO_INIT_ENUMCLASS_START("Google\\Protobuf\\Syntax",
" SYNTAX_PROTO3 " , 13 , 1 TSRMLS_CC ) ;
PHP_PROTO_INIT_ENUMCLASS_END
PHP_METHOD ( Syntax , name ) {
PHP_PROTO_LONG value ;
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " l " , & value ) = =
FAILURE ) {
return ;
}
switch ( value ) {
case 0 :
PHP_PROTO_RETURN_STRING ( " SYNTAX_PROTO2 " , 1 ) ;
case 1 :
PHP_PROTO_RETURN_STRING ( " SYNTAX_PROTO3 " , 1 ) ;
default :
zend_throw_exception (
NULL ,
" Enum Google \\ Protobuf \\ Syntax has no name "
" defined for value %d. " ,
value ,
0 TSRMLS_CC ) ;
}
}
PHP_METHOD ( Syntax , value ) {
char * name = NULL ;
PHP_PROTO_SIZE name_len ;
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " s " , & name , & name_len ) = =
FAILURE ) {
return ;
}
if ( strncmp ( name , " SYNTAX_PROTO2 " , name_len ) = = 0 ) RETURN_LONG ( 0 ) ;
if ( strncmp ( name , " SYNTAX_PROTO3 " , name_len ) = = 0 ) RETURN_LONG ( 1 ) ;
zend_throw_exception (
NULL ,
" Enum Google \\ Protobuf \\ Syntax has no value "
" defined for name %s. " ,
name ,
0 TSRMLS_CC ) ;
}
// -----------------------------------------------------------------------------
// Define message