-
-
Save bookvik/3742079 to your computer and use it in GitHub Desktop.
Diff PHP and Python proto generated code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// DO NOT EDIT! Generated by Protobuf-PHP protoc plugin @package_version@ | |
// Source: protos.proto | |
// Date: 2012-09-18 08:38:34 | |
namespace { | |
class B extends \DrSlump\Protobuf\Message { | |
/** @var \Closure[] */ | |
protected static $__extensions = array(); | |
public static function descriptor() | |
{ | |
$descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, '.B'); | |
foreach (self::$__extensions as $cb) { | |
$descriptor->addField($cb(), true); | |
} | |
return $descriptor; | |
} | |
} | |
} | |
namespace { | |
class A extends \DrSlump\Protobuf\Message { | |
/** @var string */ | |
public $first = null; | |
/** @var \Closure[] */ | |
protected static $__extensions = array(); | |
public static function descriptor() | |
{ | |
$descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, '.A'); | |
// OPTIONAL STRING first = 1 | |
$f = new \DrSlump\Protobuf\Field(); | |
$f->number = 1; | |
$f->name = "first"; | |
$f->type = \DrSlump\Protobuf::TYPE_STRING; | |
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; | |
$descriptor->addField($f); | |
foreach (self::$__extensions as $cb) { | |
$descriptor->addField($cb(), true); | |
} | |
return $descriptor; | |
} | |
/** | |
* Check if <first> has a value | |
* | |
* @return boolean | |
*/ | |
public function hasFirst(){ | |
return $this->_has(1); | |
} | |
/** | |
* Clear <first> value | |
* | |
* @return \A | |
*/ | |
public function clearFirst(){ | |
return $this->_clear(1); | |
} | |
/** | |
* Get <first> value | |
* | |
* @return string | |
*/ | |
public function getFirst(){ | |
return $this->_get(1); | |
} | |
/** | |
* Set <first> value | |
* | |
* @param string $value | |
* @return \A | |
*/ | |
public function setFirst( $value){ | |
return $this->_set(1, $value); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Generated by the protocol buffer compiler. DO NOT EDIT! | |
from google.protobuf import descriptor | |
from google.protobuf import message | |
from google.protobuf import reflection | |
from google.protobuf import descriptor_pb2 | |
# @@protoc_insertion_point(imports) | |
DESCRIPTOR = descriptor.FileDescriptor( | |
name='protos.proto', | |
package='', | |
serialized_pb='\n\x0cprotos.proto\"\x17\n\x01\x42\x32\x12\n\x06second\x12\x02.A\x18\x02 \x01(\t\"\x18\n\x01\x41\x12\r\n\x05\x66irst\x18\x01 \x01(\t*\x04\x08\x02\x10\x04') | |
_B = descriptor.Descriptor( | |
name='B', | |
full_name='B', | |
filename=None, | |
file=DESCRIPTOR, | |
containing_type=None, | |
fields=[ | |
], | |
extensions=[ | |
descriptor.FieldDescriptor( | |
name='second', full_name='B.second', index=0, | |
number=2, type=9, cpp_type=9, label=1, | |
has_default_value=False, default_value=unicode("", "utf-8"), | |
message_type=None, enum_type=None, containing_type=None, | |
is_extension=True, extension_scope=None, | |
options=None), | |
], | |
nested_types=[], | |
enum_types=[ | |
], | |
options=None, | |
is_extendable=False, | |
extension_ranges=[], | |
serialized_start=16, | |
serialized_end=39, | |
) | |
_A = descriptor.Descriptor( | |
name='A', | |
full_name='A', | |
filename=None, | |
file=DESCRIPTOR, | |
containing_type=None, | |
fields=[ | |
descriptor.FieldDescriptor( | |
name='first', full_name='A.first', index=0, | |
number=1, type=9, cpp_type=9, label=1, | |
has_default_value=False, default_value=unicode("", "utf-8"), | |
message_type=None, enum_type=None, containing_type=None, | |
is_extension=False, extension_scope=None, | |
options=None), | |
], | |
extensions=[ | |
], | |
nested_types=[], | |
enum_types=[ | |
], | |
options=None, | |
is_extendable=True, | |
extension_ranges=[(2, 4), ], | |
serialized_start=41, | |
serialized_end=65, | |
) | |
DESCRIPTOR.message_types_by_name['B'] = _B | |
DESCRIPTOR.message_types_by_name['A'] = _A | |
class B(message.Message): | |
__metaclass__ = reflection.GeneratedProtocolMessageType | |
DESCRIPTOR = _B | |
# @@protoc_insertion_point(class_scope:B) | |
class A(message.Message): | |
__metaclass__ = reflection.GeneratedProtocolMessageType | |
DESCRIPTOR = _A | |
# @@protoc_insertion_point(class_scope:A) | |
A.RegisterExtension(_B.extensions_by_name['second']) | |
# @@protoc_insertion_point(module_scope) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment