From 66f0f4f0aad038f2759c495c29e0524a28e3bf08 Mon Sep 17 00:00:00 2001 From: Dan Fuhry Date: Wed, 16 Apr 2014 16:05:28 -0400 Subject: [PATCH 01/11] Update composer.json --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index e167d66..bd9d7ef 100644 --- a/composer.json +++ b/composer.json @@ -1,8 +1,8 @@ { - "name": "DrSlump/Protobuf-PHP", + "name": "datto/protobuf-php", "description": "PHP implementation of Google's Protocol Buffers", "keywords": ["protobuf", "protocol buffer", "serializing"], - "homepage": "https://github.com/drslump/Protobuf-PHP", + "homepage": "https://github.com/datto/Protobuf-PHP", "type": "library", "license": "MIT", "authors": [ From 3a8578ebe7c4e44de15e4603f2f0b91aa85cc57b Mon Sep 17 00:00:00 2001 From: Dan Fuhry Date: Wed, 16 Apr 2014 16:10:29 -0400 Subject: [PATCH 02/11] Fix composer.json I think --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index bd9d7ef..ad5b85e 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ }, "extra": { "branch-alias": { - "dev-master": "1.0" + "dev-master": "1.0-dev" } } } From c8c9f8412291f1b11e7ef50593754e020b09081a Mon Sep 17 00:00:00 2001 From: Michael Lumish Date: Thu, 21 Aug 2014 16:00:43 -0700 Subject: [PATCH 03/11] Added stub generation to PHP generator --- library/DrSlump/Protobuf/Compiler.php | 1 - library/DrSlump/Protobuf/Compiler/Cli.php | 6 +- .../Protobuf/Compiler/PhpGenerator.php | 67 + .../Compiler/protos/descriptor.pb.php | 4064 ++++++++++------- .../Protobuf/Compiler/protos/descriptor.proto | 246 +- library/DrSlump/Protobuf/Message.php | 7 + package.pear | 6 +- 7 files changed, 2760 insertions(+), 1637 deletions(-) diff --git a/library/DrSlump/Protobuf/Compiler.php b/library/DrSlump/Protobuf/Compiler.php index f1af381..6ea71f0 100644 --- a/library/DrSlump/Protobuf/Compiler.php +++ b/library/DrSlump/Protobuf/Compiler.php @@ -208,4 +208,3 @@ public function getComment($ident, $prefix = '') return $comment; } } - diff --git a/library/DrSlump/Protobuf/Compiler/Cli.php b/library/DrSlump/Protobuf/Compiler/Cli.php index b998365..964c1a4 100644 --- a/library/DrSlump/Protobuf/Compiler/Cli.php +++ b/library/DrSlump/Protobuf/Compiler/Cli.php @@ -51,12 +51,12 @@ public static function run($pluginExecutable) // We have data from stdin so compile it try { // Create a compiler interface - $comp = new Protobuf\Compiler(); + $comp = new Protobuf\Compiler(true); echo $comp->compile($stdin); exit(0); } catch(\Exception $e) { - fputs(STDERR, 'ERROR: ' . $e->getMessage()); - fputs(STDERR, $e->getTraceAsString()); + fputs(STDERR, 'ERROR: ' . $e->getMessage() . PHP_EOL); + fputs(STDERR, $e->getTraceAsString() . PHP_EOL); exit(255); } } diff --git a/library/DrSlump/Protobuf/Compiler/PhpGenerator.php b/library/DrSlump/Protobuf/Compiler/PhpGenerator.php index d9d7333..37e1488 100644 --- a/library/DrSlump/Protobuf/Compiler/PhpGenerator.php +++ b/library/DrSlump/Protobuf/Compiler/PhpGenerator.php @@ -82,6 +82,10 @@ public function generate(proto\FileDescriptorProto $proto) $this->addComponent($namespace, $service->getName(), $src); } endif; + foreach($proto->getServiceList() as $service) { + $src = $this->compileStub($service, $namespace); + $this->addComponent($namespace, $service->getName() . 'Stub', $src); + } // Collect extensions if ($proto->hasExtension()) { @@ -409,6 +413,69 @@ protected function compileService(proto\ServiceDescriptorProto $service, $ns) return implode(PHP_EOL, $s) . PHP_EOL; } + protected function compileStub(proto\ServiceDescriptorProto $service, $ns){ + $s = array(); + $s[] = 'namespace ' . $this->normalizeNS($ns) . ' {'; + $s[] = ''; + $s[]= " // @@protoc_insertion_point(scope_namespace)"; + $s[]= " // @@protoc_insertion_point(namespace_$ns)"; + $s[]= ''; + + $cmt = $this->compiler->getComment($ns . '.' . $service->getName(), ' * '); + if($cmt){ + $s[]= " /**"; + $s[]= $cmt; + $s[]= " */"; + } + $s[] = ' class ' . $service->getName() . 'Client{'; + $s[] = ''; + $s[] = ' private $rpc_impl;'; + $s[] = ''; + $s[] = ' public function __construct($rpc_impl) {'; + $s[] = ' $this->rpc_impl = $rpc_impl;'; + $s[] = ' }'; + + foreach ($service->getMethodList() as $method){ + $ns_input = $this->normalizeNS($method->getInputType()); + $ns_output = $this->normalizeNS($method->getOutputType()); + $s[]= ' /**'; + + $cmt = $this->compiler->getComment($ns . '.' . $service->getName() . '.' . $method->getName(), ' * '); + if ($cmt){ + $s[]= $cmt; + $s[]= ' * '; + } + + $s[]= ' * @param ' . $ns_input . ' $input'; + $s[]= ' */'; + $server_stream = $method->getServerStreaming(); + $client_stream = $method->getClientStreaming(); + $service_fqn = $ns . '.' . $service->getName(); + if($client_stream){ + if($server_stream){ + $s[]= ' public function ' . $method->getName() . '($metadata = array()) {'; + $s[]= ' return $this->rpc_impl->_bidiRequest(\'/' . $service_fqn . '/' . $method->getName() . '\', \'\\' . $ns_output . '::deserialize\', $metadata);'; + } else { + $s[]= ' public function ' . $method->getName() . '($arguments, $metadata = array()) {'; + $s[]= ' return $this->rpc_impl->_clientStreamRequest(\'/' . $service_fqn . '/' . $method->getName() . '\', $arguments, \'\\' . $ns_output . '::deserialize\', $metadata);'; + } + } else { + if($server_stream){ + $s[]= ' public function ' . $method->getName() . '($argument, $metadata = array()) {'; + $s[]= ' return $this->rpc_impl->_serverStreamRequest(\'/' . $service_fqn . '/' . $method->getName() . '\', $argument, \'\\' . $ns_output . '::deserialize\', $metadata);'; + } else { + $s[]= ' public function ' . $method->getName() . '(\\' . $ns_input . ' $argument, $metadata = array()) {'; + $s[]= ' return $this->rpc_impl->_simpleRequest(\'/' . $service_fqn . '/' . $method->getName() . '\', $argument, \'\\' . $ns_output . '::deserialize\', $metadata);'; + } + } + $s[]= ' }'; + } + $s[]= ' }'; + $s[]= '}'; + + return implode(PHP_EOL, $s) . PHP_EOL; + } + protected function generatePublicField(proto\FieldDescriptorProto $field, $ns, $indent) { $cmt = $this->compiler->getComment($ns . '.' . $field->getNumber(), "$indent * "); diff --git a/library/DrSlump/Protobuf/Compiler/protos/descriptor.pb.php b/library/DrSlump/Protobuf/Compiler/protos/descriptor.pb.php index 46ad8d9..58cf168 100644 --- a/library/DrSlump/Protobuf/Compiler/protos/descriptor.pb.php +++ b/library/DrSlump/Protobuf/Compiler/protos/descriptor.pb.php @@ -1,51 +1,39 @@ number = 1; - $f->name = "file"; - $f->nameOrig = "file"; - $f->type = 11; - $f->rule = 3; - $f->reference = "\google\protobuf\FileDescriptorProto"; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - self::$__descriptor = $descriptor; + $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'google.protobuf.FileDescriptorSet'); + + // REPEATED MESSAGE file = 1 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 1; + $f->name = "file"; + $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; + $f->rule = \DrSlump\Protobuf::RULE_REPEATED; + $f->reference = '\google\protobuf\FileDescriptorProto'; + $descriptor->addField($f); + + foreach (self::$__extensions as $cb) { + $descriptor->addField($cb(), true); } - return self::$__descriptor; + return $descriptor; } - /** @var \google\protobuf\FileDescriptorProto[] */ - public $file = array(); - - /** * Check if has a value * @@ -102,7 +90,6 @@ public function getFileList(){ public function addFile(\google\protobuf\FileDescriptorProto $value){ return $this->_add(1, $value); } - } } @@ -110,142 +97,158 @@ public function addFile(\google\protobuf\FileDescriptorProto $value){ class FileDescriptorProto extends \DrSlump\Protobuf\Message { - /** @var \DrSlump\Protobuf\Descriptor */ - protected static $__descriptor; - /** @var \Closure[] */ - protected static $__extensions = array(); - - public static function descriptor(\DrSlump\Protobuf\Descriptor $descriptor = NULL) - { - if (NULL !== $descriptor) { - self::$__descriptor = $descriptor; - return self::$__descriptor; - } - - if (!self::$__descriptor) { - $descriptor = new \DrSlump\Protobuf\Descriptor("\google\protobuf\FileDescriptorProto"); - - // optional name = 1 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "name"; - $f->nameOrig = "name"; - $f->type = 9; - $f->rule = 1; - $descriptor->addField($f); - - // optional package = 2 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 2; - $f->name = "package"; - $f->nameOrig = "package"; - $f->type = 9; - $f->rule = 1; - $descriptor->addField($f); - - // repeated dependency = 3 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 3; - $f->name = "dependency"; - $f->nameOrig = "dependency"; - $f->type = 9; - $f->rule = 3; - $descriptor->addField($f); - - // repeated .google.protobuf.DescriptorProto message_type = 4 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 4; - $f->name = "message_type"; - $f->type = 11; - $f->rule = 3; - $f->reference = "\google\protobuf\DescriptorProto"; - $descriptor->addField($f); - - // repeated .google.protobuf.EnumDescriptorProto enum_type = 5 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 5; - $f->name = "enum_type"; - $f->type = 11; - $f->rule = 3; - $f->reference = "\google\protobuf\EnumDescriptorProto"; - $descriptor->addField($f); - - // repeated .google.protobuf.ServiceDescriptorProto service = 6 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 6; - $f->name = "service"; - $f->nameOrig = "service"; - $f->type = 11; - $f->rule = 3; - $f->reference = "\google\protobuf\ServiceDescriptorProto"; - $descriptor->addField($f); - - // repeated .google.protobuf.FieldDescriptorProto extension = 7 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 7; - $f->name = "extension"; - $f->nameOrig = "extension"; - $f->type = 11; - $f->rule = 3; - $f->reference = "\google\protobuf\FieldDescriptorProto"; - $descriptor->addField($f); - - // optional .google.protobuf.FileOptions options = 8 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 8; - $f->name = "options"; - $f->nameOrig = "options"; - $f->type = 11; - $f->rule = 1; - $f->reference = "\google\protobuf\FileOptions"; - $descriptor->addField($f); - - // optional .google.protobuf.SourceCodeInfo source_code_info = 9 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 9; - $f->name = "source_code_info"; - $f->type = 11; - $f->rule = 1; - $f->reference = "\google\protobuf\SourceCodeInfo"; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - self::$__descriptor = $descriptor; - } - - return self::$__descriptor; - } - - /** @var string */ + /** @var string */ public $name = null; - /** @var string */ + /** @var string */ public $package = null; - /** @var string[] */ + /** @var string[] */ public $dependency = array(); - /** @var \google\protobuf\DescriptorProto[] */ + /** @var int[] */ + public $public_dependency = array(); + + /** @var int[] */ + public $weak_dependency = array(); + + /** @var \google\protobuf\DescriptorProto[] */ public $message_type = array(); - /** @var \google\protobuf\EnumDescriptorProto[] */ + /** @var \google\protobuf\EnumDescriptorProto[] */ public $enum_type = array(); - /** @var \google\protobuf\ServiceDescriptorProto[] */ + /** @var \google\protobuf\ServiceDescriptorProto[] */ public $service = array(); - /** @var \google\protobuf\FieldDescriptorProto[] */ + /** @var \google\protobuf\FieldDescriptorProto[] */ public $extension = array(); - /** @var \google\protobuf\FileOptions */ + /** @var \google\protobuf\FileOptions */ public $options = null; - /** @var \google\protobuf\SourceCodeInfo */ + /** @var \google\protobuf\SourceCodeInfo */ public $source_code_info = null; + /** @var string */ + public $syntax = null; + + + /** @var \Closure[] */ + protected static $__extensions = array(); + + public static function descriptor() + { + $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'google.protobuf.FileDescriptorProto'); + + // OPTIONAL STRING name = 1 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 1; + $f->name = "name"; + $f->type = \DrSlump\Protobuf::TYPE_STRING; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $descriptor->addField($f); + + // OPTIONAL STRING package = 2 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 2; + $f->name = "package"; + $f->type = \DrSlump\Protobuf::TYPE_STRING; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $descriptor->addField($f); + + // REPEATED STRING dependency = 3 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 3; + $f->name = "dependency"; + $f->type = \DrSlump\Protobuf::TYPE_STRING; + $f->rule = \DrSlump\Protobuf::RULE_REPEATED; + $descriptor->addField($f); + + // REPEATED INT32 public_dependency = 10 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 10; + $f->name = "public_dependency"; + $f->type = \DrSlump\Protobuf::TYPE_INT32; + $f->rule = \DrSlump\Protobuf::RULE_REPEATED; + $descriptor->addField($f); + + // REPEATED INT32 weak_dependency = 11 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 11; + $f->name = "weak_dependency"; + $f->type = \DrSlump\Protobuf::TYPE_INT32; + $f->rule = \DrSlump\Protobuf::RULE_REPEATED; + $descriptor->addField($f); + + // REPEATED MESSAGE message_type = 4 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 4; + $f->name = "message_type"; + $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; + $f->rule = \DrSlump\Protobuf::RULE_REPEATED; + $f->reference = '\google\protobuf\DescriptorProto'; + $descriptor->addField($f); + + // REPEATED MESSAGE enum_type = 5 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 5; + $f->name = "enum_type"; + $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; + $f->rule = \DrSlump\Protobuf::RULE_REPEATED; + $f->reference = '\google\protobuf\EnumDescriptorProto'; + $descriptor->addField($f); + + // REPEATED MESSAGE service = 6 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 6; + $f->name = "service"; + $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; + $f->rule = \DrSlump\Protobuf::RULE_REPEATED; + $f->reference = '\google\protobuf\ServiceDescriptorProto'; + $descriptor->addField($f); + + // REPEATED MESSAGE extension = 7 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 7; + $f->name = "extension"; + $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; + $f->rule = \DrSlump\Protobuf::RULE_REPEATED; + $f->reference = '\google\protobuf\FieldDescriptorProto'; + $descriptor->addField($f); + + // OPTIONAL MESSAGE options = 8 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 8; + $f->name = "options"; + $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->reference = '\google\protobuf\FileOptions'; + $descriptor->addField($f); + + // OPTIONAL MESSAGE source_code_info = 9 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 9; + $f->name = "source_code_info"; + $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->reference = '\google\protobuf\SourceCodeInfo'; + $descriptor->addField($f); + + // OPTIONAL STRING syntax = 12 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 12; + $f->name = "syntax"; + $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 has a value @@ -378,6 +381,120 @@ public function addDependency( $value){ return $this->_add(3, $value); } + /** + * Check if has a value + * + * @return boolean + */ + public function hasPublicDependency(){ + return $this->_has(10); + } + + /** + * Clear value + * + * @return \google\protobuf\FileDescriptorProto + */ + public function clearPublicDependency(){ + return $this->_clear(10); + } + + /** + * Get value + * + * @param int $idx + * @return int + */ + public function getPublicDependency($idx = NULL){ + return $this->_get(10, $idx); + } + + /** + * Set value + * + * @param int $value + * @return \google\protobuf\FileDescriptorProto + */ + public function setPublicDependency( $value, $idx = NULL){ + return $this->_set(10, $value, $idx); + } + + /** + * Get all elements of + * + * @return int[] + */ + public function getPublicDependencyList(){ + return $this->_get(10); + } + + /** + * Add a new element to + * + * @param int $value + * @return \google\protobuf\FileDescriptorProto + */ + public function addPublicDependency( $value){ + return $this->_add(10, $value); + } + + /** + * Check if has a value + * + * @return boolean + */ + public function hasWeakDependency(){ + return $this->_has(11); + } + + /** + * Clear value + * + * @return \google\protobuf\FileDescriptorProto + */ + public function clearWeakDependency(){ + return $this->_clear(11); + } + + /** + * Get value + * + * @param int $idx + * @return int + */ + public function getWeakDependency($idx = NULL){ + return $this->_get(11, $idx); + } + + /** + * Set value + * + * @param int $value + * @return \google\protobuf\FileDescriptorProto + */ + public function setWeakDependency( $value, $idx = NULL){ + return $this->_set(11, $value, $idx); + } + + /** + * Get all elements of + * + * @return int[] + */ + public function getWeakDependencyList(){ + return $this->_get(11); + } + + /** + * Add a new element to + * + * @param int $value + * @return \google\protobuf\FileDescriptorProto + */ + public function addWeakDependency( $value){ + return $this->_add(11, $value); + } + /** * Check if has a value * @@ -680,126 +797,276 @@ public function setSourceCodeInfo(\google\protobuf\SourceCodeInfo $value){ return $this->_set(9, $value); } + /** + * Check if has a value + * + * @return boolean + */ + public function hasSyntax(){ + return $this->_has(12); + } + + /** + * Clear value + * + * @return \google\protobuf\FileDescriptorProto + */ + public function clearSyntax(){ + return $this->_clear(12); + } + + /** + * Get value + * + * @return string + */ + public function getSyntax(){ + return $this->_get(12); + } + + /** + * Set value + * + * @param string $value + * @return \google\protobuf\FileDescriptorProto + */ + public function setSyntax( $value){ + return $this->_set(12, $value); + } } } -namespace google\protobuf { +namespace google\protobuf\DescriptorProto { - class DescriptorProto extends \DrSlump\Protobuf\Message { + class ExtensionRange extends \DrSlump\Protobuf\Message { + + /** @var int */ + public $start = null; + + /** @var int */ + public $end = null; + - /** @var \DrSlump\Protobuf\Descriptor */ - protected static $__descriptor; /** @var \Closure[] */ protected static $__extensions = array(); - public static function descriptor(\DrSlump\Protobuf\Descriptor $descriptor = NULL) + public static function descriptor() { - if (NULL !== $descriptor) { - self::$__descriptor = $descriptor; - return self::$__descriptor; + $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'google.protobuf.DescriptorProto.ExtensionRange'); + + // OPTIONAL INT32 start = 1 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 1; + $f->name = "start"; + $f->type = \DrSlump\Protobuf::TYPE_INT32; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $descriptor->addField($f); + + // OPTIONAL INT32 end = 2 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 2; + $f->name = "end"; + $f->type = \DrSlump\Protobuf::TYPE_INT32; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $descriptor->addField($f); + + foreach (self::$__extensions as $cb) { + $descriptor->addField($cb(), true); } - if (!self::$__descriptor) { - $descriptor = new \DrSlump\Protobuf\Descriptor("\google\protobuf\DescriptorProto"); - - // optional name = 1 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "name"; - $f->nameOrig = "name"; - $f->type = 9; - $f->rule = 1; - $descriptor->addField($f); - - // repeated .google.protobuf.FieldDescriptorProto field = 2 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 2; - $f->name = "field"; - $f->nameOrig = "field"; - $f->type = 11; - $f->rule = 3; - $f->reference = "\google\protobuf\FieldDescriptorProto"; - $descriptor->addField($f); - - // repeated .google.protobuf.FieldDescriptorProto extension = 6 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 6; - $f->name = "extension"; - $f->nameOrig = "extension"; - $f->type = 11; - $f->rule = 3; - $f->reference = "\google\protobuf\FieldDescriptorProto"; - $descriptor->addField($f); - - // repeated .google.protobuf.DescriptorProto nested_type = 3 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 3; - $f->name = "nested_type"; - $f->type = 11; - $f->rule = 3; - $f->reference = "\google\protobuf\DescriptorProto"; - $descriptor->addField($f); - - // repeated .google.protobuf.EnumDescriptorProto enum_type = 4 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 4; - $f->name = "enum_type"; - $f->type = 11; - $f->rule = 3; - $f->reference = "\google\protobuf\EnumDescriptorProto"; - $descriptor->addField($f); - - // repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 5; - $f->name = "extension_range"; - $f->type = 11; - $f->rule = 3; - $f->reference = "\google\protobuf\DescriptorProto\ExtensionRange"; - $descriptor->addField($f); - - // optional .google.protobuf.MessageOptions options = 7 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 7; - $f->name = "options"; - $f->nameOrig = "options"; - $f->type = 11; - $f->rule = 1; - $f->reference = "\google\protobuf\MessageOptions"; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - self::$__descriptor = $descriptor; - } + return $descriptor; + } - return self::$__descriptor; + /** + * Check if has a value + * + * @return boolean + */ + public function hasStart(){ + return $this->_has(1); + } + + /** + * Clear value + * + * @return \google\protobuf\DescriptorProto\ExtensionRange + */ + public function clearStart(){ + return $this->_clear(1); + } + + /** + * Get value + * + * @return int + */ + public function getStart(){ + return $this->_get(1); + } + + /** + * Set value + * + * @param int $value + * @return \google\protobuf\DescriptorProto\ExtensionRange + */ + public function setStart( $value){ + return $this->_set(1, $value); + } + + /** + * Check if has a value + * + * @return boolean + */ + public function hasEnd(){ + return $this->_has(2); } + + /** + * Clear value + * + * @return \google\protobuf\DescriptorProto\ExtensionRange + */ + public function clearEnd(){ + return $this->_clear(2); + } + + /** + * Get value + * + * @return int + */ + public function getEnd(){ + return $this->_get(2); + } + + /** + * Set value + * + * @param int $value + * @return \google\protobuf\DescriptorProto\ExtensionRange + */ + public function setEnd( $value){ + return $this->_set(2, $value); + } + } +} + +namespace google\protobuf { - /** @var string */ + class DescriptorProto extends \DrSlump\Protobuf\Message { + + /** @var string */ public $name = null; - /** @var \google\protobuf\FieldDescriptorProto[] */ + /** @var \google\protobuf\FieldDescriptorProto[] */ public $field = array(); - /** @var \google\protobuf\FieldDescriptorProto[] */ + /** @var \google\protobuf\FieldDescriptorProto[] */ public $extension = array(); - /** @var \google\protobuf\DescriptorProto[] */ + /** @var \google\protobuf\DescriptorProto[] */ public $nested_type = array(); - /** @var \google\protobuf\EnumDescriptorProto[] */ + /** @var \google\protobuf\EnumDescriptorProto[] */ public $enum_type = array(); - /** @var \google\protobuf\DescriptorProto\ExtensionRange[] */ + /** @var \google\protobuf\DescriptorProto\ExtensionRange[] */ public $extension_range = array(); - /** @var \google\protobuf\MessageOptions */ + /** @var \google\protobuf\OneofDescriptorProto[] */ + public $oneof_decl = array(); + + /** @var \google\protobuf\MessageOptions */ public $options = null; + /** @var \Closure[] */ + protected static $__extensions = array(); + + public static function descriptor() + { + $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'google.protobuf.DescriptorProto'); + + // OPTIONAL STRING name = 1 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 1; + $f->name = "name"; + $f->type = \DrSlump\Protobuf::TYPE_STRING; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $descriptor->addField($f); + + // REPEATED MESSAGE field = 2 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 2; + $f->name = "field"; + $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; + $f->rule = \DrSlump\Protobuf::RULE_REPEATED; + $f->reference = '\google\protobuf\FieldDescriptorProto'; + $descriptor->addField($f); + + // REPEATED MESSAGE extension = 6 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 6; + $f->name = "extension"; + $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; + $f->rule = \DrSlump\Protobuf::RULE_REPEATED; + $f->reference = '\google\protobuf\FieldDescriptorProto'; + $descriptor->addField($f); + + // REPEATED MESSAGE nested_type = 3 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 3; + $f->name = "nested_type"; + $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; + $f->rule = \DrSlump\Protobuf::RULE_REPEATED; + $f->reference = '\google\protobuf\DescriptorProto'; + $descriptor->addField($f); + + // REPEATED MESSAGE enum_type = 4 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 4; + $f->name = "enum_type"; + $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; + $f->rule = \DrSlump\Protobuf::RULE_REPEATED; + $f->reference = '\google\protobuf\EnumDescriptorProto'; + $descriptor->addField($f); + + // REPEATED MESSAGE extension_range = 5 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 5; + $f->name = "extension_range"; + $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; + $f->rule = \DrSlump\Protobuf::RULE_REPEATED; + $f->reference = '\google\protobuf\DescriptorProto\ExtensionRange'; + $descriptor->addField($f); + + // REPEATED MESSAGE oneof_decl = 8 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 8; + $f->name = "oneof_decl"; + $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; + $f->rule = \DrSlump\Protobuf::RULE_REPEATED; + $f->reference = '\google\protobuf\OneofDescriptorProto'; + $descriptor->addField($f); + + // OPTIONAL MESSAGE options = 7 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 7; + $f->name = "options"; + $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->reference = '\google\protobuf\MessageOptions'; + $descriptor->addField($f); + + foreach (self::$__extensions as $cb) { + $descriptor->addField($cb(), true); + } + + return $descriptor; + } + /** * Check if has a value * @@ -1123,303 +1390,253 @@ public function addExtensionRange(\google\protobuf\DescriptorProto\ExtensionRang } /** - * Check if has a value + * Check if has a value * * @return boolean */ - public function hasOptions(){ - return $this->_has(7); + public function hasOneofDecl(){ + return $this->_has(8); } /** - * Clear value + * Clear value * * @return \google\protobuf\DescriptorProto */ - public function clearOptions(){ - return $this->_clear(7); + public function clearOneofDecl(){ + return $this->_clear(8); } /** - * Get value + * Get value * - * @return \google\protobuf\MessageOptions + * @param int $idx + * @return \google\protobuf\OneofDescriptorProto */ - public function getOptions(){ - return $this->_get(7); + public function getOneofDecl($idx = NULL){ + return $this->_get(8, $idx); } /** - * Set value + * Set value * - * @param \google\protobuf\MessageOptions $value + * @param \google\protobuf\OneofDescriptorProto $value * @return \google\protobuf\DescriptorProto */ - public function setOptions(\google\protobuf\MessageOptions $value){ - return $this->_set(7, $value); - } - - } -} - -namespace google\protobuf\DescriptorProto { - - class ExtensionRange extends \DrSlump\Protobuf\Message { - - /** @var \DrSlump\Protobuf\Descriptor */ - protected static $__descriptor; - /** @var \Closure[] */ - protected static $__extensions = array(); - - public static function descriptor(\DrSlump\Protobuf\Descriptor $descriptor = NULL) - { - if (NULL !== $descriptor) { - self::$__descriptor = $descriptor; - return self::$__descriptor; - } - - if (!self::$__descriptor) { - $descriptor = new \DrSlump\Protobuf\Descriptor("\google\protobuf\DescriptorProto\ExtensionRange"); - - // optional start = 1 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "start"; - $f->nameOrig = "start"; - $f->type = 5; - $f->rule = 1; - $descriptor->addField($f); - - // optional end = 2 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 2; - $f->name = "end"; - $f->nameOrig = "end"; - $f->type = 5; - $f->rule = 1; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - self::$__descriptor = $descriptor; - } - - return self::$__descriptor; - } - - /** @var int */ - public $start = null; - - /** @var int */ - public $end = null; - - - /** - * Check if has a value - * - * @return boolean - */ - public function hasStart(){ - return $this->_has(1); - } - - /** - * Clear value - * - * @return \google\protobuf\DescriptorProto\ExtensionRange - */ - public function clearStart(){ - return $this->_clear(1); + public function setOneofDecl(\google\protobuf\OneofDescriptorProto $value, $idx = NULL){ + return $this->_set(8, $value, $idx); } /** - * Get value + * Get all elements of * - * @return int + * @return \google\protobuf\OneofDescriptorProto[] */ - public function getStart(){ - return $this->_get(1); + public function getOneofDeclList(){ + return $this->_get(8); } /** - * Set value + * Add a new element to * - * @param int $value - * @return \google\protobuf\DescriptorProto\ExtensionRange + * @param \google\protobuf\OneofDescriptorProto $value + * @return \google\protobuf\DescriptorProto */ - public function setStart( $value){ - return $this->_set(1, $value); + public function addOneofDecl(\google\protobuf\OneofDescriptorProto $value){ + return $this->_add(8, $value); } /** - * Check if has a value + * Check if has a value * * @return boolean */ - public function hasEnd(){ - return $this->_has(2); + public function hasOptions(){ + return $this->_has(7); } /** - * Clear value + * Clear value * - * @return \google\protobuf\DescriptorProto\ExtensionRange + * @return \google\protobuf\DescriptorProto */ - public function clearEnd(){ - return $this->_clear(2); + public function clearOptions(){ + return $this->_clear(7); } /** - * Get value + * Get value * - * @return int + * @return \google\protobuf\MessageOptions */ - public function getEnd(){ - return $this->_get(2); + public function getOptions(){ + return $this->_get(7); } /** - * Set value + * Set value * - * @param int $value - * @return \google\protobuf\DescriptorProto\ExtensionRange + * @param \google\protobuf\MessageOptions $value + * @return \google\protobuf\DescriptorProto */ - public function setEnd( $value){ - return $this->_set(2, $value); + public function setOptions(\google\protobuf\MessageOptions $value){ + return $this->_set(7, $value); } - } } -namespace google\protobuf { - - class FieldDescriptorProto extends \DrSlump\Protobuf\Message { - - /** @var \DrSlump\Protobuf\Descriptor */ - protected static $__descriptor; - /** @var \Closure[] */ - protected static $__extensions = array(); +namespace google\protobuf\FieldDescriptorProto { - public static function descriptor(\DrSlump\Protobuf\Descriptor $descriptor = NULL) - { - if (NULL !== $descriptor) { - self::$__descriptor = $descriptor; - return self::$__descriptor; - } + class Type extends \DrSlump\Protobuf\Enum { + const TYPE_DOUBLE = 1; + const TYPE_FLOAT = 2; + const TYPE_INT64 = 3; + const TYPE_UINT64 = 4; + const TYPE_INT32 = 5; + const TYPE_FIXED64 = 6; + const TYPE_FIXED32 = 7; + const TYPE_BOOL = 8; + const TYPE_STRING = 9; + const TYPE_GROUP = 10; + const TYPE_MESSAGE = 11; + const TYPE_BYTES = 12; + const TYPE_UINT32 = 13; + const TYPE_ENUM = 14; + const TYPE_SFIXED32 = 15; + const TYPE_SFIXED64 = 16; + const TYPE_SINT32 = 17; + const TYPE_SINT64 = 18; + } +} +namespace google\protobuf\FieldDescriptorProto { - if (!self::$__descriptor) { - $descriptor = new \DrSlump\Protobuf\Descriptor("\google\protobuf\FieldDescriptorProto"); - - // optional name = 1 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "name"; - $f->nameOrig = "name"; - $f->type = 9; - $f->rule = 1; - $descriptor->addField($f); - - // optional number = 3 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 3; - $f->name = "number"; - $f->nameOrig = "number"; - $f->type = 5; - $f->rule = 1; - $descriptor->addField($f); - - // optional .google.protobuf.FieldDescriptorProto.Label label = 4 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 4; - $f->name = "label"; - $f->nameOrig = "label"; - $f->type = 14; - $f->rule = 1; - $f->reference = "\google\protobuf\FieldDescriptorProto\Label"; - $descriptor->addField($f); - - // optional .google.protobuf.FieldDescriptorProto.Type type = 5 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 5; - $f->name = "type"; - $f->nameOrig = "type"; - $f->type = 14; - $f->rule = 1; - $f->reference = "\google\protobuf\FieldDescriptorProto\Type"; - $descriptor->addField($f); - - // optional type_name = 6 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 6; - $f->name = "type_name"; - $f->type = 9; - $f->rule = 1; - $descriptor->addField($f); - - // optional extendee = 2 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 2; - $f->name = "extendee"; - $f->nameOrig = "extendee"; - $f->type = 9; - $f->rule = 1; - $descriptor->addField($f); - - // optional default_value = 7 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 7; - $f->name = "default_value"; - $f->type = 9; - $f->rule = 1; - $descriptor->addField($f); - - // optional .google.protobuf.FieldOptions options = 8 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 8; - $f->name = "options"; - $f->nameOrig = "options"; - $f->type = 11; - $f->rule = 1; - $f->reference = "\google\protobuf\FieldOptions"; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - self::$__descriptor = $descriptor; - } + class Label extends \DrSlump\Protobuf\Enum { + const LABEL_OPTIONAL = 1; + const LABEL_REQUIRED = 2; + const LABEL_REPEATED = 3; + } +} +namespace google\protobuf { - return self::$__descriptor; - } + class FieldDescriptorProto extends \DrSlump\Protobuf\Message { - /** @var string */ + /** @var string */ public $name = null; - /** @var int */ + /** @var int */ public $number = null; - /** @var int - \google\protobuf\FieldDescriptorProto\Label */ + /** @var int - \google\protobuf\FieldDescriptorProto\Label */ public $label = null; - /** @var int - \google\protobuf\FieldDescriptorProto\Type */ + /** @var int - \google\protobuf\FieldDescriptorProto\Type */ public $type = null; - /** @var string */ + /** @var string */ public $type_name = null; - /** @var string */ + /** @var string */ public $extendee = null; - /** @var string */ + /** @var string */ public $default_value = null; - /** @var \google\protobuf\FieldOptions */ + /** @var int */ + public $oneof_index = null; + + /** @var \google\protobuf\FieldOptions */ public $options = null; + /** @var \Closure[] */ + protected static $__extensions = array(); + + public static function descriptor() + { + $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'google.protobuf.FieldDescriptorProto'); + + // OPTIONAL STRING name = 1 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 1; + $f->name = "name"; + $f->type = \DrSlump\Protobuf::TYPE_STRING; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $descriptor->addField($f); + + // OPTIONAL INT32 number = 3 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 3; + $f->name = "number"; + $f->type = \DrSlump\Protobuf::TYPE_INT32; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $descriptor->addField($f); + + // OPTIONAL ENUM label = 4 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 4; + $f->name = "label"; + $f->type = \DrSlump\Protobuf::TYPE_ENUM; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->reference = '\google\protobuf\FieldDescriptorProto\Label'; + $descriptor->addField($f); + + // OPTIONAL ENUM type = 5 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 5; + $f->name = "type"; + $f->type = \DrSlump\Protobuf::TYPE_ENUM; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->reference = '\google\protobuf\FieldDescriptorProto\Type'; + $descriptor->addField($f); + + // OPTIONAL STRING type_name = 6 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 6; + $f->name = "type_name"; + $f->type = \DrSlump\Protobuf::TYPE_STRING; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $descriptor->addField($f); + + // OPTIONAL STRING extendee = 2 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 2; + $f->name = "extendee"; + $f->type = \DrSlump\Protobuf::TYPE_STRING; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $descriptor->addField($f); + + // OPTIONAL STRING default_value = 7 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 7; + $f->name = "default_value"; + $f->type = \DrSlump\Protobuf::TYPE_STRING; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $descriptor->addField($f); + + // OPTIONAL INT32 oneof_index = 9 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 9; + $f->name = "oneof_index"; + $f->type = \DrSlump\Protobuf::TYPE_INT32; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $descriptor->addField($f); + + // OPTIONAL MESSAGE options = 8 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 8; + $f->name = "options"; + $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->reference = '\google\protobuf\FieldOptions'; + $descriptor->addField($f); + + foreach (self::$__extensions as $cb) { + $descriptor->addField($cb(), true); + } + + return $descriptor; + } + /** * Check if has a value * @@ -1679,6 +1896,43 @@ public function setDefaultValue( $value){ return $this->_set(7, $value); } + /** + * Check if has a value + * + * @return boolean + */ + public function hasOneofIndex(){ + return $this->_has(9); + } + + /** + * Clear value + * + * @return \google\protobuf\FieldDescriptorProto + */ + public function clearOneofIndex(){ + return $this->_clear(9); + } + + /** + * Get value + * + * @return int + */ + public function getOneofIndex(){ + return $this->_get(9); + } + + /** + * Set value + * + * @param int $value + * @return \google\protobuf\FieldDescriptorProto + */ + public function setOneofIndex( $value){ + return $this->_set(9, $value); + } + /** * Check if has a value * @@ -1715,111 +1969,132 @@ public function getOptions(){ public function setOptions(\google\protobuf\FieldOptions $value){ return $this->_set(8, $value); } - - } -} - -namespace google\protobuf\FieldDescriptorProto { - - class Type { - const TYPE_DOUBLE = 1; - const TYPE_FLOAT = 2; - const TYPE_INT64 = 3; - const TYPE_UINT64 = 4; - const TYPE_INT32 = 5; - const TYPE_FIXED64 = 6; - const TYPE_FIXED32 = 7; - const TYPE_BOOL = 8; - const TYPE_STRING = 9; - const TYPE_GROUP = 10; - const TYPE_MESSAGE = 11; - const TYPE_BYTES = 12; - const TYPE_UINT32 = 13; - const TYPE_ENUM = 14; - const TYPE_SFIXED32 = 15; - const TYPE_SFIXED64 = 16; - const TYPE_SINT32 = 17; - const TYPE_SINT64 = 18; - } -} - -namespace google\protobuf\FieldDescriptorProto { - - class Label { - const LABEL_OPTIONAL = 1; - const LABEL_REQUIRED = 2; - const LABEL_REPEATED = 3; } } namespace google\protobuf { - class EnumDescriptorProto extends \DrSlump\Protobuf\Message { + class OneofDescriptorProto extends \DrSlump\Protobuf\Message { + + /** @var string */ + public $name = null; + - /** @var \DrSlump\Protobuf\Descriptor */ - protected static $__descriptor; /** @var \Closure[] */ protected static $__extensions = array(); - public static function descriptor(\DrSlump\Protobuf\Descriptor $descriptor = NULL) + public static function descriptor() { - if (NULL !== $descriptor) { - self::$__descriptor = $descriptor; - return self::$__descriptor; + $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'google.protobuf.OneofDescriptorProto'); + + // OPTIONAL STRING name = 1 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 1; + $f->name = "name"; + $f->type = \DrSlump\Protobuf::TYPE_STRING; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $descriptor->addField($f); + + foreach (self::$__extensions as $cb) { + $descriptor->addField($cb(), true); } - if (!self::$__descriptor) { - $descriptor = new \DrSlump\Protobuf\Descriptor("\google\protobuf\EnumDescriptorProto"); - - // optional name = 1 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "name"; - $f->nameOrig = "name"; - $f->type = 9; - $f->rule = 1; - $descriptor->addField($f); - - // repeated .google.protobuf.EnumValueDescriptorProto value = 2 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 2; - $f->name = "value"; - $f->nameOrig = "value"; - $f->type = 11; - $f->rule = 3; - $f->reference = "\google\protobuf\EnumValueDescriptorProto"; - $descriptor->addField($f); - - // optional .google.protobuf.EnumOptions options = 3 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 3; - $f->name = "options"; - $f->nameOrig = "options"; - $f->type = 11; - $f->rule = 1; - $f->reference = "\google\protobuf\EnumOptions"; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - self::$__descriptor = $descriptor; - } + return $descriptor; + } - return self::$__descriptor; + /** + * Check if has a value + * + * @return boolean + */ + public function hasName(){ + return $this->_has(1); + } + + /** + * Clear value + * + * @return \google\protobuf\OneofDescriptorProto + */ + public function clearName(){ + return $this->_clear(1); + } + + /** + * Get value + * + * @return string + */ + public function getName(){ + return $this->_get(1); + } + + /** + * Set value + * + * @param string $value + * @return \google\protobuf\OneofDescriptorProto + */ + public function setName( $value){ + return $this->_set(1, $value); } + } +} + +namespace google\protobuf { + + class EnumDescriptorProto extends \DrSlump\Protobuf\Message { - /** @var string */ + /** @var string */ public $name = null; - /** @var \google\protobuf\EnumValueDescriptorProto[] */ + /** @var \google\protobuf\EnumValueDescriptorProto[] */ public $value = array(); - /** @var \google\protobuf\EnumOptions */ + /** @var \google\protobuf\EnumOptions */ public $options = null; + /** @var \Closure[] */ + protected static $__extensions = array(); + + public static function descriptor() + { + $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'google.protobuf.EnumDescriptorProto'); + + // OPTIONAL STRING name = 1 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 1; + $f->name = "name"; + $f->type = \DrSlump\Protobuf::TYPE_STRING; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $descriptor->addField($f); + + // REPEATED MESSAGE value = 2 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 2; + $f->name = "value"; + $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; + $f->rule = \DrSlump\Protobuf::RULE_REPEATED; + $f->reference = '\google\protobuf\EnumValueDescriptorProto'; + $descriptor->addField($f); + + // OPTIONAL MESSAGE options = 3 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 3; + $f->name = "options"; + $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->reference = '\google\protobuf\EnumOptions'; + $descriptor->addField($f); + + foreach (self::$__extensions as $cb) { + $descriptor->addField($cb(), true); + } + + return $descriptor; + } + /** * Check if has a value * @@ -1950,7 +2225,6 @@ public function getOptions(){ public function setOptions(\google\protobuf\EnumOptions $value){ return $this->_set(3, $value); } - } } @@ -1958,69 +2232,55 @@ public function setOptions(\google\protobuf\EnumOptions $value){ class EnumValueDescriptorProto extends \DrSlump\Protobuf\Message { - /** @var \DrSlump\Protobuf\Descriptor */ - protected static $__descriptor; + /** @var string */ + public $name = null; + + /** @var int */ + public $number = null; + + /** @var \google\protobuf\EnumValueOptions */ + public $options = null; + + /** @var \Closure[] */ protected static $__extensions = array(); - public static function descriptor(\DrSlump\Protobuf\Descriptor $descriptor = NULL) + public static function descriptor() { - if (NULL !== $descriptor) { - self::$__descriptor = $descriptor; - return self::$__descriptor; - } - - if (!self::$__descriptor) { - $descriptor = new \DrSlump\Protobuf\Descriptor("\google\protobuf\EnumValueDescriptorProto"); - - // optional name = 1 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "name"; - $f->nameOrig = "name"; - $f->type = 9; - $f->rule = 1; - $descriptor->addField($f); - - // optional number = 2 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 2; - $f->name = "number"; - $f->nameOrig = "number"; - $f->type = 5; - $f->rule = 1; - $descriptor->addField($f); - - // optional .google.protobuf.EnumValueOptions options = 3 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 3; - $f->name = "options"; - $f->nameOrig = "options"; - $f->type = 11; - $f->rule = 1; - $f->reference = "\google\protobuf\EnumValueOptions"; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - self::$__descriptor = $descriptor; + $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'google.protobuf.EnumValueDescriptorProto'); + + // OPTIONAL STRING name = 1 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 1; + $f->name = "name"; + $f->type = \DrSlump\Protobuf::TYPE_STRING; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $descriptor->addField($f); + + // OPTIONAL INT32 number = 2 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 2; + $f->name = "number"; + $f->type = \DrSlump\Protobuf::TYPE_INT32; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $descriptor->addField($f); + + // OPTIONAL MESSAGE options = 3 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 3; + $f->name = "options"; + $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->reference = '\google\protobuf\EnumValueOptions'; + $descriptor->addField($f); + + foreach (self::$__extensions as $cb) { + $descriptor->addField($cb(), true); } - return self::$__descriptor; + return $descriptor; } - /** @var string */ - public $name = null; - - /** @var int */ - public $number = null; - - /** @var \google\protobuf\EnumValueOptions */ - public $options = null; - - /** * Check if has a value * @@ -2131,7 +2391,6 @@ public function getOptions(){ public function setOptions(\google\protobuf\EnumValueOptions $value){ return $this->_set(3, $value); } - } } @@ -2139,70 +2398,56 @@ public function setOptions(\google\protobuf\EnumValueOptions $value){ class ServiceDescriptorProto extends \DrSlump\Protobuf\Message { - /** @var \DrSlump\Protobuf\Descriptor */ - protected static $__descriptor; + /** @var string */ + public $name = null; + + /** @var \google\protobuf\MethodDescriptorProto[] */ + public $method = array(); + + /** @var \google\protobuf\ServiceOptions */ + public $options = null; + + /** @var \Closure[] */ protected static $__extensions = array(); - public static function descriptor(\DrSlump\Protobuf\Descriptor $descriptor = NULL) + public static function descriptor() { - if (NULL !== $descriptor) { - self::$__descriptor = $descriptor; - return self::$__descriptor; - } - - if (!self::$__descriptor) { - $descriptor = new \DrSlump\Protobuf\Descriptor("\google\protobuf\ServiceDescriptorProto"); - - // optional name = 1 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "name"; - $f->nameOrig = "name"; - $f->type = 9; - $f->rule = 1; - $descriptor->addField($f); - - // repeated .google.protobuf.MethodDescriptorProto method = 2 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 2; - $f->name = "method"; - $f->nameOrig = "method"; - $f->type = 11; - $f->rule = 3; - $f->reference = "\google\protobuf\MethodDescriptorProto"; - $descriptor->addField($f); - - // optional .google.protobuf.ServiceOptions options = 3 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 3; - $f->name = "options"; - $f->nameOrig = "options"; - $f->type = 11; - $f->rule = 1; - $f->reference = "\google\protobuf\ServiceOptions"; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - self::$__descriptor = $descriptor; + $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'google.protobuf.ServiceDescriptorProto'); + + // OPTIONAL STRING name = 1 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 1; + $f->name = "name"; + $f->type = \DrSlump\Protobuf::TYPE_STRING; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $descriptor->addField($f); + + // REPEATED MESSAGE method = 2 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 2; + $f->name = "method"; + $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; + $f->rule = \DrSlump\Protobuf::RULE_REPEATED; + $f->reference = '\google\protobuf\MethodDescriptorProto'; + $descriptor->addField($f); + + // OPTIONAL MESSAGE options = 3 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 3; + $f->name = "options"; + $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->reference = '\google\protobuf\ServiceOptions'; + $descriptor->addField($f); + + foreach (self::$__extensions as $cb) { + $descriptor->addField($cb(), true); } - return self::$__descriptor; + return $descriptor; } - /** @var string */ - public $name = null; - - /** @var \google\protobuf\MethodDescriptorProto[] */ - public $method = array(); - - /** @var \google\protobuf\ServiceOptions */ - public $options = null; - - /** * Check if has a value * @@ -2333,7 +2578,6 @@ public function getOptions(){ public function setOptions(\google\protobuf\ServiceOptions $value){ return $this->_set(3, $value); } - } } @@ -2341,78 +2585,89 @@ public function setOptions(\google\protobuf\ServiceOptions $value){ class MethodDescriptorProto extends \DrSlump\Protobuf\Message { - /** @var \DrSlump\Protobuf\Descriptor */ - protected static $__descriptor; - /** @var \Closure[] */ - protected static $__extensions = array(); - - public static function descriptor(\DrSlump\Protobuf\Descriptor $descriptor = NULL) - { - if (NULL !== $descriptor) { - self::$__descriptor = $descriptor; - return self::$__descriptor; - } - - if (!self::$__descriptor) { - $descriptor = new \DrSlump\Protobuf\Descriptor("\google\protobuf\MethodDescriptorProto"); - - // optional name = 1 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "name"; - $f->nameOrig = "name"; - $f->type = 9; - $f->rule = 1; - $descriptor->addField($f); - - // optional input_type = 2 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 2; - $f->name = "input_type"; - $f->type = 9; - $f->rule = 1; - $descriptor->addField($f); - - // optional output_type = 3 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 3; - $f->name = "output_type"; - $f->type = 9; - $f->rule = 1; - $descriptor->addField($f); - - // optional .google.protobuf.MethodOptions options = 4 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 4; - $f->name = "options"; - $f->nameOrig = "options"; - $f->type = 11; - $f->rule = 1; - $f->reference = "\google\protobuf\MethodOptions"; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - self::$__descriptor = $descriptor; - } - - return self::$__descriptor; - } - - /** @var string */ + /** @var string */ public $name = null; - /** @var string */ + /** @var string */ public $input_type = null; - /** @var string */ + /** @var string */ public $output_type = null; - /** @var \google\protobuf\MethodOptions */ + /** @var \google\protobuf\MethodOptions */ public $options = null; + /** @var boolean */ + public $client_streaming = false; + + /** @var boolean */ + public $server_streaming = false; + + + /** @var \Closure[] */ + protected static $__extensions = array(); + + public static function descriptor() + { + $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'google.protobuf.MethodDescriptorProto'); + + // OPTIONAL STRING name = 1 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 1; + $f->name = "name"; + $f->type = \DrSlump\Protobuf::TYPE_STRING; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $descriptor->addField($f); + + // OPTIONAL STRING input_type = 2 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 2; + $f->name = "input_type"; + $f->type = \DrSlump\Protobuf::TYPE_STRING; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $descriptor->addField($f); + + // OPTIONAL STRING output_type = 3 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 3; + $f->name = "output_type"; + $f->type = \DrSlump\Protobuf::TYPE_STRING; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $descriptor->addField($f); + + // OPTIONAL MESSAGE options = 4 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 4; + $f->name = "options"; + $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->reference = '\google\protobuf\MethodOptions'; + $descriptor->addField($f); + + // OPTIONAL BOOL client_streaming = 5 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 5; + $f->name = "client_streaming"; + $f->type = \DrSlump\Protobuf::TYPE_BOOL; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->default = false; + $descriptor->addField($f); + + // OPTIONAL BOOL server_streaming = 6 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 6; + $f->name = "server_streaming"; + $f->type = \DrSlump\Protobuf::TYPE_BOOL; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->default = false; + $descriptor->addField($f); + + foreach (self::$__extensions as $cb) { + $descriptor->addField($cb(), true); + } + + return $descriptor; + } /** * Check if has a value @@ -2562,146 +2817,263 @@ public function setOptions(\google\protobuf\MethodOptions $value){ return $this->_set(4, $value); } + /** + * Check if has a value + * + * @return boolean + */ + public function hasClientStreaming(){ + return $this->_has(5); + } + + /** + * Clear value + * + * @return \google\protobuf\MethodDescriptorProto + */ + public function clearClientStreaming(){ + return $this->_clear(5); + } + + /** + * Get value + * + * @return boolean + */ + public function getClientStreaming(){ + return $this->_get(5); + } + + /** + * Set value + * + * @param boolean $value + * @return \google\protobuf\MethodDescriptorProto + */ + public function setClientStreaming( $value){ + return $this->_set(5, $value); + } + + /** + * Check if has a value + * + * @return boolean + */ + public function hasServerStreaming(){ + return $this->_has(6); + } + + /** + * Clear value + * + * @return \google\protobuf\MethodDescriptorProto + */ + public function clearServerStreaming(){ + return $this->_clear(6); + } + + /** + * Get value + * + * @return boolean + */ + public function getServerStreaming(){ + return $this->_get(6); + } + + /** + * Set value + * + * @param boolean $value + * @return \google\protobuf\MethodDescriptorProto + */ + public function setServerStreaming( $value){ + return $this->_set(6, $value); + } } } +namespace google\protobuf\FileOptions { + + class OptimizeMode extends \DrSlump\Protobuf\Enum { + const SPEED = 1; + const CODE_SIZE = 2; + const LITE_RUNTIME = 3; + } +} namespace google\protobuf { class FileOptions extends \DrSlump\Protobuf\Message { - /** @var \DrSlump\Protobuf\Descriptor */ - protected static $__descriptor; - /** @var \Closure[] */ - protected static $__extensions = array(); - - public static function descriptor(\DrSlump\Protobuf\Descriptor $descriptor = NULL) - { - if (NULL !== $descriptor) { - self::$__descriptor = $descriptor; - return self::$__descriptor; - } - - if (!self::$__descriptor) { - $descriptor = new \DrSlump\Protobuf\Descriptor("\google\protobuf\FileOptions"); - - // optional java_package = 1 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "java_package"; - $f->type = 9; - $f->rule = 1; - $descriptor->addField($f); - - // optional java_outer_classname = 8 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 8; - $f->name = "java_outer_classname"; - $f->type = 9; - $f->rule = 1; - $descriptor->addField($f); - - // optional java_multiple_files = 10 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 10; - $f->name = "java_multiple_files"; - $f->type = 8; - $f->rule = 1; - $f->default = true; - $descriptor->addField($f); - - // optional java_generate_equals_and_hash = 20 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 20; - $f->name = "java_generate_equals_and_hash"; - $f->type = 8; - $f->rule = 1; - $f->default = true; - $descriptor->addField($f); - - // optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 9; - $f->name = "optimize_for"; - $f->type = 14; - $f->rule = 1; - $f->reference = "\google\protobuf\FileOptions\OptimizeMode"; - $f->default = "SPEED"; - $descriptor->addField($f); - - // optional cc_generic_services = 16 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 16; - $f->name = "cc_generic_services"; - $f->type = 8; - $f->rule = 1; - $f->default = true; - $descriptor->addField($f); - - // optional java_generic_services = 17 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 17; - $f->name = "java_generic_services"; - $f->type = 8; - $f->rule = 1; - $f->default = true; - $descriptor->addField($f); - - // optional py_generic_services = 18 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 18; - $f->name = "py_generic_services"; - $f->type = 8; - $f->rule = 1; - $f->default = true; - $descriptor->addField($f); - - // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 999; - $f->name = "uninterpreted_option"; - $f->type = 11; - $f->rule = 3; - $f->reference = "\google\protobuf\UninterpretedOption"; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - self::$__descriptor = $descriptor; - } - - return self::$__descriptor; - } - - /** @var string */ + /** @var string */ public $java_package = null; - /** @var string */ + /** @var string */ public $java_outer_classname = null; - /** @var boolean */ - public $java_multiple_files = true; + /** @var boolean */ + public $java_multiple_files = false; + + /** @var boolean */ + public $java_generate_equals_and_hash = false; + + /** @var boolean */ + public $java_string_check_utf8 = false; - /** @var boolean */ - public $java_generate_equals_and_hash = true; + /** @var int - \google\protobuf\FileOptions\OptimizeMode */ + public $optimize_for = \google\protobuf\FileOptions\OptimizeMode::SPEED; - /** @var int - \google\protobuf\FileOptions\OptimizeMode */ - public $optimize_for = "SPEED"; + /** @var string */ + public $go_package = null; - /** @var boolean */ - public $cc_generic_services = true; + /** @var boolean */ + public $cc_generic_services = false; - /** @var boolean */ - public $java_generic_services = true; + /** @var boolean */ + public $java_generic_services = false; - /** @var boolean */ - public $py_generic_services = true; + /** @var boolean */ + public $py_generic_services = false; - /** @var \google\protobuf\UninterpretedOption[] */ + /** @var boolean */ + public $deprecated = false; + + /** @var boolean */ + public $cc_enable_arenas = false; + + /** @var \google\protobuf\UninterpretedOption[] */ public $uninterpreted_option = array(); + /** @var \Closure[] */ + protected static $__extensions = array(); + + public static function descriptor() + { + $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'google.protobuf.FileOptions'); + + // OPTIONAL STRING java_package = 1 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 1; + $f->name = "java_package"; + $f->type = \DrSlump\Protobuf::TYPE_STRING; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $descriptor->addField($f); + + // OPTIONAL STRING java_outer_classname = 8 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 8; + $f->name = "java_outer_classname"; + $f->type = \DrSlump\Protobuf::TYPE_STRING; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $descriptor->addField($f); + + // OPTIONAL BOOL java_multiple_files = 10 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 10; + $f->name = "java_multiple_files"; + $f->type = \DrSlump\Protobuf::TYPE_BOOL; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->default = false; + $descriptor->addField($f); + + // OPTIONAL BOOL java_generate_equals_and_hash = 20 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 20; + $f->name = "java_generate_equals_and_hash"; + $f->type = \DrSlump\Protobuf::TYPE_BOOL; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->default = false; + $descriptor->addField($f); + + // OPTIONAL BOOL java_string_check_utf8 = 27 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 27; + $f->name = "java_string_check_utf8"; + $f->type = \DrSlump\Protobuf::TYPE_BOOL; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->default = false; + $descriptor->addField($f); + + // OPTIONAL ENUM optimize_for = 9 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 9; + $f->name = "optimize_for"; + $f->type = \DrSlump\Protobuf::TYPE_ENUM; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->reference = '\google\protobuf\FileOptions\OptimizeMode'; + $f->default = \google\protobuf\FileOptions\OptimizeMode::SPEED; + $descriptor->addField($f); + + // OPTIONAL STRING go_package = 11 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 11; + $f->name = "go_package"; + $f->type = \DrSlump\Protobuf::TYPE_STRING; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $descriptor->addField($f); + + // OPTIONAL BOOL cc_generic_services = 16 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 16; + $f->name = "cc_generic_services"; + $f->type = \DrSlump\Protobuf::TYPE_BOOL; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->default = false; + $descriptor->addField($f); + + // OPTIONAL BOOL java_generic_services = 17 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 17; + $f->name = "java_generic_services"; + $f->type = \DrSlump\Protobuf::TYPE_BOOL; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->default = false; + $descriptor->addField($f); + + // OPTIONAL BOOL py_generic_services = 18 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 18; + $f->name = "py_generic_services"; + $f->type = \DrSlump\Protobuf::TYPE_BOOL; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->default = false; + $descriptor->addField($f); + + // OPTIONAL BOOL deprecated = 23 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 23; + $f->name = "deprecated"; + $f->type = \DrSlump\Protobuf::TYPE_BOOL; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->default = false; + $descriptor->addField($f); + + // OPTIONAL BOOL cc_enable_arenas = 31 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 31; + $f->name = "cc_enable_arenas"; + $f->type = \DrSlump\Protobuf::TYPE_BOOL; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->default = false; + $descriptor->addField($f); + + // REPEATED MESSAGE uninterpreted_option = 999 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 999; + $f->name = "uninterpreted_option"; + $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; + $f->rule = \DrSlump\Protobuf::RULE_REPEATED; + $f->reference = '\google\protobuf\UninterpretedOption'; + $descriptor->addField($f); + + foreach (self::$__extensions as $cb) { + $descriptor->addField($cb(), true); + } + + return $descriptor; + } + /** * Check if has a value * @@ -2850,6 +3222,43 @@ public function setJavaGenerateEqualsAndHash( $value){ return $this->_set(20, $value); } + /** + * Check if has a value + * + * @return boolean + */ + public function hasJavaStringCheckUtf8(){ + return $this->_has(27); + } + + /** + * Clear value + * + * @return \google\protobuf\FileOptions + */ + public function clearJavaStringCheckUtf8(){ + return $this->_clear(27); + } + + /** + * Get value + * + * @return boolean + */ + public function getJavaStringCheckUtf8(){ + return $this->_get(27); + } + + /** + * Set value + * + * @param boolean $value + * @return \google\protobuf\FileOptions + */ + public function setJavaStringCheckUtf8( $value){ + return $this->_set(27, $value); + } + /** * Check if has a value * @@ -2887,6 +3296,43 @@ public function setOptimizeFor( $value){ return $this->_set(9, $value); } + /** + * Check if has a value + * + * @return boolean + */ + public function hasGoPackage(){ + return $this->_has(11); + } + + /** + * Clear value + * + * @return \google\protobuf\FileOptions + */ + public function clearGoPackage(){ + return $this->_clear(11); + } + + /** + * Get value + * + * @return string + */ + public function getGoPackage(){ + return $this->_get(11); + } + + /** + * Set value + * + * @param string $value + * @return \google\protobuf\FileOptions + */ + public function setGoPackage( $value){ + return $this->_set(11, $value); + } + /** * Check if has a value * @@ -2998,6 +3444,80 @@ public function setPyGenericServices( $value){ return $this->_set(18, $value); } + /** + * Check if has a value + * + * @return boolean + */ + public function hasDeprecated(){ + return $this->_has(23); + } + + /** + * Clear value + * + * @return \google\protobuf\FileOptions + */ + public function clearDeprecated(){ + return $this->_clear(23); + } + + /** + * Get value + * + * @return boolean + */ + public function getDeprecated(){ + return $this->_get(23); + } + + /** + * Set value + * + * @param boolean $value + * @return \google\protobuf\FileOptions + */ + public function setDeprecated( $value){ + return $this->_set(23, $value); + } + + /** + * Check if has a value + * + * @return boolean + */ + public function hasCcEnableArenas(){ + return $this->_has(31); + } + + /** + * Clear value + * + * @return \google\protobuf\FileOptions + */ + public function clearCcEnableArenas(){ + return $this->_clear(31); + } + + /** + * Get value + * + * @return boolean + */ + public function getCcEnableArenas(){ + return $this->_get(31); + } + + /** + * Set value + * + * @param boolean $value + * @return \google\protobuf\FileOptions + */ + public function setCcEnableArenas( $value){ + return $this->_set(31, $value); + } + /** * Check if has a value * @@ -3054,16 +3574,6 @@ public function getUninterpretedOptionList(){ public function addUninterpretedOption(\google\protobuf\UninterpretedOption $value){ return $this->_add(999, $value); } - - } -} - -namespace google\protobuf\FileOptions { - - class OptimizeMode { - const SPEED = 1; - const CODE_SIZE = 2; - const LITE_RUNTIME = 3; } } @@ -3071,68 +3581,80 @@ class OptimizeMode { class MessageOptions extends \DrSlump\Protobuf\Message { - /** @var \DrSlump\Protobuf\Descriptor */ - protected static $__descriptor; + /** @var boolean */ + public $message_set_wire_format = false; + + /** @var boolean */ + public $no_standard_descriptor_accessor = false; + + /** @var boolean */ + public $deprecated = false; + + /** @var boolean */ + public $map_entry = null; + + /** @var \google\protobuf\UninterpretedOption[] */ + public $uninterpreted_option = array(); + + /** @var \Closure[] */ protected static $__extensions = array(); - public static function descriptor(\DrSlump\Protobuf\Descriptor $descriptor = NULL) + public static function descriptor() { - if (NULL !== $descriptor) { - self::$__descriptor = $descriptor; - return self::$__descriptor; - } - - if (!self::$__descriptor) { - $descriptor = new \DrSlump\Protobuf\Descriptor("\google\protobuf\MessageOptions"); - - // optional message_set_wire_format = 1 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "message_set_wire_format"; - $f->type = 8; - $f->rule = 1; - $f->default = true; - $descriptor->addField($f); - - // optional no_standard_descriptor_accessor = 2 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 2; - $f->name = "no_standard_descriptor_accessor"; - $f->type = 8; - $f->rule = 1; - $f->default = true; - $descriptor->addField($f); - - // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 999; - $f->name = "uninterpreted_option"; - $f->type = 11; - $f->rule = 3; - $f->reference = "\google\protobuf\UninterpretedOption"; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - self::$__descriptor = $descriptor; + $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'google.protobuf.MessageOptions'); + + // OPTIONAL BOOL message_set_wire_format = 1 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 1; + $f->name = "message_set_wire_format"; + $f->type = \DrSlump\Protobuf::TYPE_BOOL; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->default = false; + $descriptor->addField($f); + + // OPTIONAL BOOL no_standard_descriptor_accessor = 2 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 2; + $f->name = "no_standard_descriptor_accessor"; + $f->type = \DrSlump\Protobuf::TYPE_BOOL; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->default = false; + $descriptor->addField($f); + + // OPTIONAL BOOL deprecated = 3 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 3; + $f->name = "deprecated"; + $f->type = \DrSlump\Protobuf::TYPE_BOOL; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->default = false; + $descriptor->addField($f); + + // OPTIONAL BOOL map_entry = 7 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 7; + $f->name = "map_entry"; + $f->type = \DrSlump\Protobuf::TYPE_BOOL; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $descriptor->addField($f); + + // REPEATED MESSAGE uninterpreted_option = 999 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 999; + $f->name = "uninterpreted_option"; + $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; + $f->rule = \DrSlump\Protobuf::RULE_REPEATED; + $f->reference = '\google\protobuf\UninterpretedOption'; + $descriptor->addField($f); + + foreach (self::$__extensions as $cb) { + $descriptor->addField($cb(), true); } - return self::$__descriptor; + return $descriptor; } - /** @var boolean */ - public $message_set_wire_format = true; - - /** @var boolean */ - public $no_standard_descriptor_accessor = true; - - /** @var \google\protobuf\UninterpretedOption[] */ - public $uninterpreted_option = array(); - - /** * Check if has a value * @@ -3207,6 +3729,80 @@ public function setNoStandardDescriptorAccessor( $value){ return $this->_set(2, $value); } + /** + * Check if has a value + * + * @return boolean + */ + public function hasDeprecated(){ + return $this->_has(3); + } + + /** + * Clear value + * + * @return \google\protobuf\MessageOptions + */ + public function clearDeprecated(){ + return $this->_clear(3); + } + + /** + * Get value + * + * @return boolean + */ + public function getDeprecated(){ + return $this->_get(3); + } + + /** + * Set value + * + * @param boolean $value + * @return \google\protobuf\MessageOptions + */ + public function setDeprecated( $value){ + return $this->_set(3, $value); + } + + /** + * Check if has a value + * + * @return boolean + */ + public function hasMapEntry(){ + return $this->_has(7); + } + + /** + * Clear value + * + * @return \google\protobuf\MessageOptions + */ + public function clearMapEntry(){ + return $this->_clear(7); + } + + /** + * Get value + * + * @return boolean + */ + public function getMapEntry(){ + return $this->_get(7); + } + + /** + * Set value + * + * @param boolean $value + * @return \google\protobuf\MessageOptions + */ + public function setMapEntry( $value){ + return $this->_set(7, $value); + } + /** * Check if has a value * @@ -3263,102 +3859,108 @@ public function getUninterpretedOptionList(){ public function addUninterpretedOption(\google\protobuf\UninterpretedOption $value){ return $this->_add(999, $value); } - } } +namespace google\protobuf\FieldOptions { + + class CType extends \DrSlump\Protobuf\Enum { + const STRING = 0; + const CORD = 1; + const STRING_PIECE = 2; + } +} namespace google\protobuf { class FieldOptions extends \DrSlump\Protobuf\Message { - /** @var \DrSlump\Protobuf\Descriptor */ - protected static $__descriptor; - /** @var \Closure[] */ - protected static $__extensions = array(); - - public static function descriptor(\DrSlump\Protobuf\Descriptor $descriptor = NULL) - { - if (NULL !== $descriptor) { - self::$__descriptor = $descriptor; - return self::$__descriptor; - } - - if (!self::$__descriptor) { - $descriptor = new \DrSlump\Protobuf\Descriptor("\google\protobuf\FieldOptions"); - - // optional .google.protobuf.FieldOptions.CType ctype = 1 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "ctype"; - $f->nameOrig = "ctype"; - $f->type = 14; - $f->rule = 1; - $f->reference = "\google\protobuf\FieldOptions\CType"; - $f->default = "STRING"; - $descriptor->addField($f); - - // optional packed = 2 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 2; - $f->name = "packed"; - $f->nameOrig = "packed"; - $f->type = 8; - $f->rule = 1; - $descriptor->addField($f); - - // optional deprecated = 3 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 3; - $f->name = "deprecated"; - $f->nameOrig = "deprecated"; - $f->type = 8; - $f->rule = 1; - $f->default = true; - $descriptor->addField($f); - - // optional experimental_map_key = 9 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 9; - $f->name = "experimental_map_key"; - $f->type = 9; - $f->rule = 1; - $descriptor->addField($f); - - // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 999; - $f->name = "uninterpreted_option"; - $f->type = 11; - $f->rule = 3; - $f->reference = "\google\protobuf\UninterpretedOption"; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - self::$__descriptor = $descriptor; - } - - return self::$__descriptor; - } - - /** @var int - \google\protobuf\FieldOptions\CType */ - public $ctype = "STRING"; + /** @var int - \google\protobuf\FieldOptions\CType */ + public $ctype = \google\protobuf\FieldOptions\CType::STRING; - /** @var boolean */ + /** @var boolean */ public $packed = null; - /** @var boolean */ - public $deprecated = true; + /** @var boolean */ + public $lazy = false; + + /** @var boolean */ + public $deprecated = false; - /** @var string */ - public $experimental_map_key = null; + /** @var boolean */ + public $weak = false; - /** @var \google\protobuf\UninterpretedOption[] */ + /** @var \google\protobuf\UninterpretedOption[] */ public $uninterpreted_option = array(); + /** @var \Closure[] */ + protected static $__extensions = array(); + + public static function descriptor() + { + $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'google.protobuf.FieldOptions'); + + // OPTIONAL ENUM ctype = 1 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 1; + $f->name = "ctype"; + $f->type = \DrSlump\Protobuf::TYPE_ENUM; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->reference = '\google\protobuf\FieldOptions\CType'; + $f->default = \google\protobuf\FieldOptions\CType::STRING; + $descriptor->addField($f); + + // OPTIONAL BOOL packed = 2 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 2; + $f->name = "packed"; + $f->type = \DrSlump\Protobuf::TYPE_BOOL; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $descriptor->addField($f); + + // OPTIONAL BOOL lazy = 5 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 5; + $f->name = "lazy"; + $f->type = \DrSlump\Protobuf::TYPE_BOOL; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->default = false; + $descriptor->addField($f); + + // OPTIONAL BOOL deprecated = 3 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 3; + $f->name = "deprecated"; + $f->type = \DrSlump\Protobuf::TYPE_BOOL; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->default = false; + $descriptor->addField($f); + + // OPTIONAL BOOL weak = 10 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 10; + $f->name = "weak"; + $f->type = \DrSlump\Protobuf::TYPE_BOOL; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->default = false; + $descriptor->addField($f); + + // REPEATED MESSAGE uninterpreted_option = 999 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 999; + $f->name = "uninterpreted_option"; + $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; + $f->rule = \DrSlump\Protobuf::RULE_REPEATED; + $f->reference = '\google\protobuf\UninterpretedOption'; + $descriptor->addField($f); + + foreach (self::$__extensions as $cb) { + $descriptor->addField($cb(), true); + } + + return $descriptor; + } + /** * Check if has a value * @@ -3433,6 +4035,43 @@ public function setPacked( $value){ return $this->_set(2, $value); } + /** + * Check if has a value + * + * @return boolean + */ + public function hasLazy(){ + return $this->_has(5); + } + + /** + * Clear value + * + * @return \google\protobuf\FieldOptions + */ + public function clearLazy(){ + return $this->_clear(5); + } + + /** + * Get value + * + * @return boolean + */ + public function getLazy(){ + return $this->_get(5); + } + + /** + * Set value + * + * @param boolean $value + * @return \google\protobuf\FieldOptions + */ + public function setLazy( $value){ + return $this->_set(5, $value); + } + /** * Check if has a value * @@ -3471,40 +4110,40 @@ public function setDeprecated( $value){ } /** - * Check if has a value + * Check if has a value * * @return boolean */ - public function hasExperimentalMapKey(){ - return $this->_has(9); + public function hasWeak(){ + return $this->_has(10); } /** - * Clear value + * Clear value * * @return \google\protobuf\FieldOptions */ - public function clearExperimentalMapKey(){ - return $this->_clear(9); + public function clearWeak(){ + return $this->_clear(10); } /** - * Get value + * Get value * - * @return string + * @return boolean */ - public function getExperimentalMapKey(){ - return $this->_get(9); + public function getWeak(){ + return $this->_get(10); } /** - * Set value + * Set value * - * @param string $value + * @param boolean $value * @return \google\protobuf\FieldOptions */ - public function setExperimentalMapKey( $value){ - return $this->_set(9, $value); + public function setWeak( $value){ + return $this->_set(10, $value); } /** @@ -3563,16 +4202,6 @@ public function getUninterpretedOptionList(){ public function addUninterpretedOption(\google\protobuf\UninterpretedOption $value){ return $this->_add(999, $value); } - - } -} - -namespace google\protobuf\FieldOptions { - - class CType { - const STRING = 0; - const CORD = 1; - const STRING_PIECE = 2; } } @@ -3580,146 +4209,130 @@ class CType { class EnumOptions extends \DrSlump\Protobuf\Message { - /** @var \DrSlump\Protobuf\Descriptor */ - protected static $__descriptor; + /** @var boolean */ + public $allow_alias = null; + + /** @var boolean */ + public $deprecated = false; + + /** @var \google\protobuf\UninterpretedOption[] */ + public $uninterpreted_option = array(); + + /** @var \Closure[] */ protected static $__extensions = array(); - public static function descriptor(\DrSlump\Protobuf\Descriptor $descriptor = NULL) + public static function descriptor() { - if (NULL !== $descriptor) { - self::$__descriptor = $descriptor; - return self::$__descriptor; - } - - if (!self::$__descriptor) { - $descriptor = new \DrSlump\Protobuf\Descriptor("\google\protobuf\EnumOptions"); - - // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 999; - $f->name = "uninterpreted_option"; - $f->type = 11; - $f->rule = 3; - $f->reference = "\google\protobuf\UninterpretedOption"; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - self::$__descriptor = $descriptor; + $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'google.protobuf.EnumOptions'); + + // OPTIONAL BOOL allow_alias = 2 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 2; + $f->name = "allow_alias"; + $f->type = \DrSlump\Protobuf::TYPE_BOOL; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $descriptor->addField($f); + + // OPTIONAL BOOL deprecated = 3 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 3; + $f->name = "deprecated"; + $f->type = \DrSlump\Protobuf::TYPE_BOOL; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->default = false; + $descriptor->addField($f); + + // REPEATED MESSAGE uninterpreted_option = 999 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 999; + $f->name = "uninterpreted_option"; + $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; + $f->rule = \DrSlump\Protobuf::RULE_REPEATED; + $f->reference = '\google\protobuf\UninterpretedOption'; + $descriptor->addField($f); + + foreach (self::$__extensions as $cb) { + $descriptor->addField($cb(), true); } - return self::$__descriptor; + return $descriptor; } - /** @var \google\protobuf\UninterpretedOption[] */ - public $uninterpreted_option = array(); - - /** - * Check if has a value + * Check if has a value * * @return boolean */ - public function hasUninterpretedOption(){ - return $this->_has(999); + public function hasAllowAlias(){ + return $this->_has(2); } /** - * Clear value + * Clear value * * @return \google\protobuf\EnumOptions */ - public function clearUninterpretedOption(){ - return $this->_clear(999); + public function clearAllowAlias(){ + return $this->_clear(2); } /** - * Get value + * Get value * - * @param int $idx - * @return \google\protobuf\UninterpretedOption + * @return boolean */ - public function getUninterpretedOption($idx = NULL){ - return $this->_get(999, $idx); + public function getAllowAlias(){ + return $this->_get(2); } /** - * Set value + * Set value * - * @param \google\protobuf\UninterpretedOption $value + * @param boolean $value * @return \google\protobuf\EnumOptions */ - public function setUninterpretedOption(\google\protobuf\UninterpretedOption $value, $idx = NULL){ - return $this->_set(999, $value, $idx); + public function setAllowAlias( $value){ + return $this->_set(2, $value); } /** - * Get all elements of + * Check if has a value * - * @return \google\protobuf\UninterpretedOption[] + * @return boolean */ - public function getUninterpretedOptionList(){ - return $this->_get(999); + public function hasDeprecated(){ + return $this->_has(3); } /** - * Add a new element to + * Clear value * - * @param \google\protobuf\UninterpretedOption $value * @return \google\protobuf\EnumOptions */ - public function addUninterpretedOption(\google\protobuf\UninterpretedOption $value){ - return $this->_add(999, $value); + public function clearDeprecated(){ + return $this->_clear(3); } - } -} - -namespace google\protobuf { - - class EnumValueOptions extends \DrSlump\Protobuf\Message { - - /** @var \DrSlump\Protobuf\Descriptor */ - protected static $__descriptor; - /** @var \Closure[] */ - protected static $__extensions = array(); - - public static function descriptor(\DrSlump\Protobuf\Descriptor $descriptor = NULL) - { - if (NULL !== $descriptor) { - self::$__descriptor = $descriptor; - return self::$__descriptor; - } - - if (!self::$__descriptor) { - $descriptor = new \DrSlump\Protobuf\Descriptor("\google\protobuf\EnumValueOptions"); - - // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 999; - $f->name = "uninterpreted_option"; - $f->type = 11; - $f->rule = 3; - $f->reference = "\google\protobuf\UninterpretedOption"; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - self::$__descriptor = $descriptor; - } - - return self::$__descriptor; + /** + * Get value + * + * @return boolean + */ + public function getDeprecated(){ + return $this->_get(3); + } + + /** + * Set value + * + * @param boolean $value + * @return \google\protobuf\EnumOptions + */ + public function setDeprecated( $value){ + return $this->_set(3, $value); } - - /** @var \google\protobuf\UninterpretedOption[] */ - public $uninterpreted_option = array(); - /** * Check if has a value * @@ -3732,7 +4345,7 @@ public function hasUninterpretedOption(){ /** * Clear value * - * @return \google\protobuf\EnumValueOptions + * @return \google\protobuf\EnumOptions */ public function clearUninterpretedOption(){ return $this->_clear(999); @@ -3752,7 +4365,7 @@ public function getUninterpretedOption($idx = NULL){ * Set value * * @param \google\protobuf\UninterpretedOption $value - * @return \google\protobuf\EnumValueOptions + * @return \google\protobuf\EnumOptions */ public function setUninterpretedOption(\google\protobuf\UninterpretedOption $value, $idx = NULL){ return $this->_set(999, $value, $idx); @@ -3771,70 +4384,107 @@ public function getUninterpretedOptionList(){ * Add a new element to * * @param \google\protobuf\UninterpretedOption $value - * @return \google\protobuf\EnumValueOptions + * @return \google\protobuf\EnumOptions */ public function addUninterpretedOption(\google\protobuf\UninterpretedOption $value){ return $this->_add(999, $value); } - } } namespace google\protobuf { - class ServiceOptions extends \DrSlump\Protobuf\Message { + class EnumValueOptions extends \DrSlump\Protobuf\Message { + + /** @var boolean */ + public $deprecated = false; + + /** @var \google\protobuf\UninterpretedOption[] */ + public $uninterpreted_option = array(); + - /** @var \DrSlump\Protobuf\Descriptor */ - protected static $__descriptor; /** @var \Closure[] */ protected static $__extensions = array(); - public static function descriptor(\DrSlump\Protobuf\Descriptor $descriptor = NULL) + public static function descriptor() { - if (NULL !== $descriptor) { - self::$__descriptor = $descriptor; - return self::$__descriptor; - } - - if (!self::$__descriptor) { - $descriptor = new \DrSlump\Protobuf\Descriptor("\google\protobuf\ServiceOptions"); - - // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 999; - $f->name = "uninterpreted_option"; - $f->type = 11; - $f->rule = 3; - $f->reference = "\google\protobuf\UninterpretedOption"; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - self::$__descriptor = $descriptor; + $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'google.protobuf.EnumValueOptions'); + + // OPTIONAL BOOL deprecated = 1 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 1; + $f->name = "deprecated"; + $f->type = \DrSlump\Protobuf::TYPE_BOOL; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->default = false; + $descriptor->addField($f); + + // REPEATED MESSAGE uninterpreted_option = 999 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 999; + $f->name = "uninterpreted_option"; + $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; + $f->rule = \DrSlump\Protobuf::RULE_REPEATED; + $f->reference = '\google\protobuf\UninterpretedOption'; + $descriptor->addField($f); + + foreach (self::$__extensions as $cb) { + $descriptor->addField($cb(), true); } - return self::$__descriptor; + return $descriptor; } - /** @var \google\protobuf\UninterpretedOption[] */ - public $uninterpreted_option = array(); - - /** - * Check if has a value + * Check if has a value * * @return boolean */ - public function hasUninterpretedOption(){ - return $this->_has(999); + public function hasDeprecated(){ + return $this->_has(1); + } + + /** + * Clear value + * + * @return \google\protobuf\EnumValueOptions + */ + public function clearDeprecated(){ + return $this->_clear(1); + } + + /** + * Get value + * + * @return boolean + */ + public function getDeprecated(){ + return $this->_get(1); + } + + /** + * Set value + * + * @param boolean $value + * @return \google\protobuf\EnumValueOptions + */ + public function setDeprecated( $value){ + return $this->_set(1, $value); + } + + /** + * Check if has a value + * + * @return boolean + */ + public function hasUninterpretedOption(){ + return $this->_has(999); } /** * Clear value * - * @return \google\protobuf\ServiceOptions + * @return \google\protobuf\EnumValueOptions */ public function clearUninterpretedOption(){ return $this->_clear(999); @@ -3854,7 +4504,7 @@ public function getUninterpretedOption($idx = NULL){ * Set value * * @param \google\protobuf\UninterpretedOption $value - * @return \google\protobuf\ServiceOptions + * @return \google\protobuf\EnumValueOptions */ public function setUninterpretedOption(\google\protobuf\UninterpretedOption $value, $idx = NULL){ return $this->_set(999, $value, $idx); @@ -3873,57 +4523,94 @@ public function getUninterpretedOptionList(){ * Add a new element to * * @param \google\protobuf\UninterpretedOption $value - * @return \google\protobuf\ServiceOptions + * @return \google\protobuf\EnumValueOptions */ public function addUninterpretedOption(\google\protobuf\UninterpretedOption $value){ return $this->_add(999, $value); } - } } namespace google\protobuf { - class MethodOptions extends \DrSlump\Protobuf\Message { + class ServiceOptions extends \DrSlump\Protobuf\Message { + + /** @var boolean */ + public $deprecated = false; + + /** @var \google\protobuf\UninterpretedOption[] */ + public $uninterpreted_option = array(); + - /** @var \DrSlump\Protobuf\Descriptor */ - protected static $__descriptor; /** @var \Closure[] */ protected static $__extensions = array(); - public static function descriptor(\DrSlump\Protobuf\Descriptor $descriptor = NULL) + public static function descriptor() { - if (NULL !== $descriptor) { - self::$__descriptor = $descriptor; - return self::$__descriptor; - } - - if (!self::$__descriptor) { - $descriptor = new \DrSlump\Protobuf\Descriptor("\google\protobuf\MethodOptions"); - - // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 999; - $f->name = "uninterpreted_option"; - $f->type = 11; - $f->rule = 3; - $f->reference = "\google\protobuf\UninterpretedOption"; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - self::$__descriptor = $descriptor; + $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'google.protobuf.ServiceOptions'); + + // OPTIONAL BOOL deprecated = 33 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 33; + $f->name = "deprecated"; + $f->type = \DrSlump\Protobuf::TYPE_BOOL; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->default = false; + $descriptor->addField($f); + + // REPEATED MESSAGE uninterpreted_option = 999 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 999; + $f->name = "uninterpreted_option"; + $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; + $f->rule = \DrSlump\Protobuf::RULE_REPEATED; + $f->reference = '\google\protobuf\UninterpretedOption'; + $descriptor->addField($f); + + foreach (self::$__extensions as $cb) { + $descriptor->addField($cb(), true); } - return self::$__descriptor; + return $descriptor; } - /** @var \google\protobuf\UninterpretedOption[] */ - public $uninterpreted_option = array(); + /** + * Check if has a value + * + * @return boolean + */ + public function hasDeprecated(){ + return $this->_has(33); + } + + /** + * Clear value + * + * @return \google\protobuf\ServiceOptions + */ + public function clearDeprecated(){ + return $this->_clear(33); + } + + /** + * Get value + * + * @return boolean + */ + public function getDeprecated(){ + return $this->_get(33); + } + + /** + * Set value + * + * @param boolean $value + * @return \google\protobuf\ServiceOptions + */ + public function setDeprecated( $value){ + return $this->_set(33, $value); + } - /** * Check if has a value * @@ -3936,7 +4623,7 @@ public function hasUninterpretedOption(){ /** * Clear value * - * @return \google\protobuf\MethodOptions + * @return \google\protobuf\ServiceOptions */ public function clearUninterpretedOption(){ return $this->_clear(999); @@ -3956,7 +4643,7 @@ public function getUninterpretedOption($idx = NULL){ * Set value * * @param \google\protobuf\UninterpretedOption $value - * @return \google\protobuf\MethodOptions + * @return \google\protobuf\ServiceOptions */ public function setUninterpretedOption(\google\protobuf\UninterpretedOption $value, $idx = NULL){ return $this->_set(999, $value, $idx); @@ -3975,257 +4662,500 @@ public function getUninterpretedOptionList(){ * Add a new element to * * @param \google\protobuf\UninterpretedOption $value - * @return \google\protobuf\MethodOptions + * @return \google\protobuf\ServiceOptions */ public function addUninterpretedOption(\google\protobuf\UninterpretedOption $value){ return $this->_add(999, $value); } - } } namespace google\protobuf { - class UninterpretedOption extends \DrSlump\Protobuf\Message { + class MethodOptions extends \DrSlump\Protobuf\Message { + + /** @var boolean */ + public $deprecated = false; + + /** @var \google\protobuf\UninterpretedOption[] */ + public $uninterpreted_option = array(); + - /** @var \DrSlump\Protobuf\Descriptor */ - protected static $__descriptor; /** @var \Closure[] */ protected static $__extensions = array(); - public static function descriptor(\DrSlump\Protobuf\Descriptor $descriptor = NULL) + public static function descriptor() { - if (NULL !== $descriptor) { - self::$__descriptor = $descriptor; - return self::$__descriptor; + $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'google.protobuf.MethodOptions'); + + // OPTIONAL BOOL deprecated = 33 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 33; + $f->name = "deprecated"; + $f->type = \DrSlump\Protobuf::TYPE_BOOL; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->default = false; + $descriptor->addField($f); + + // REPEATED MESSAGE uninterpreted_option = 999 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 999; + $f->name = "uninterpreted_option"; + $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; + $f->rule = \DrSlump\Protobuf::RULE_REPEATED; + $f->reference = '\google\protobuf\UninterpretedOption'; + $descriptor->addField($f); + + foreach (self::$__extensions as $cb) { + $descriptor->addField($cb(), true); } - if (!self::$__descriptor) { - $descriptor = new \DrSlump\Protobuf\Descriptor("\google\protobuf\UninterpretedOption"); - - // repeated .google.protobuf.UninterpretedOption.NamePart name = 2 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 2; - $f->name = "name"; - $f->nameOrig = "name"; - $f->type = 11; - $f->rule = 3; - $f->reference = "\google\protobuf\UninterpretedOption\NamePart"; - $descriptor->addField($f); - - // optional identifier_value = 3 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 3; - $f->name = "identifier_value"; - $f->type = 9; - $f->rule = 1; - $descriptor->addField($f); - - // optional positive_int_value = 4 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 4; - $f->name = "positive_int_value"; - $f->type = 4; - $f->rule = 1; - $descriptor->addField($f); - - // optional negative_int_value = 5 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 5; - $f->name = "negative_int_value"; - $f->type = 3; - $f->rule = 1; - $descriptor->addField($f); - - // optional double_value = 6 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 6; - $f->name = "double_value"; - $f->type = 1; - $f->rule = 1; - $descriptor->addField($f); - - // optional string_value = 7 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 7; - $f->name = "string_value"; - $f->type = 12; - $f->rule = 1; - $descriptor->addField($f); - - // optional aggregate_value = 8 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 8; - $f->name = "aggregate_value"; - $f->type = 9; - $f->rule = 1; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - self::$__descriptor = $descriptor; - } - - return self::$__descriptor; + return $descriptor; } - /** @var \google\protobuf\UninterpretedOption\NamePart[] */ - public $name = array(); - - /** @var string */ - public $identifier_value = null; - - /** @var int */ - public $positive_int_value = null; - - /** @var int */ - public $negative_int_value = null; - - /** @var float */ - public $double_value = null; - - /** @var string */ - public $string_value = null; - - /** @var string */ - public $aggregate_value = null; - - /** - * Check if has a value + * Check if has a value * * @return boolean */ - public function hasName(){ - return $this->_has(2); + public function hasDeprecated(){ + return $this->_has(33); } /** - * Clear value + * Clear value * - * @return \google\protobuf\UninterpretedOption + * @return \google\protobuf\MethodOptions */ - public function clearName(){ - return $this->_clear(2); + public function clearDeprecated(){ + return $this->_clear(33); } /** - * Get value + * Get value * - * @param int $idx - * @return \google\protobuf\UninterpretedOption\NamePart + * @return boolean */ - public function getName($idx = NULL){ - return $this->_get(2, $idx); + public function getDeprecated(){ + return $this->_get(33); } /** - * Set value + * Set value * - * @param \google\protobuf\UninterpretedOption\NamePart $value - * @return \google\protobuf\UninterpretedOption + * @param boolean $value + * @return \google\protobuf\MethodOptions */ - public function setName(\google\protobuf\UninterpretedOption\NamePart $value, $idx = NULL){ - return $this->_set(2, $value, $idx); + public function setDeprecated( $value){ + return $this->_set(33, $value); } /** - * Get all elements of + * Check if has a value * - * @return \google\protobuf\UninterpretedOption\NamePart[] + * @return boolean */ - public function getNameList(){ - return $this->_get(2); + public function hasUninterpretedOption(){ + return $this->_has(999); } /** - * Add a new element to + * Clear value * - * @param \google\protobuf\UninterpretedOption\NamePart $value - * @return \google\protobuf\UninterpretedOption + * @return \google\protobuf\MethodOptions */ - public function addName(\google\protobuf\UninterpretedOption\NamePart $value){ - return $this->_add(2, $value); + public function clearUninterpretedOption(){ + return $this->_clear(999); } /** - * Check if has a value + * Get value * - * @return boolean + * @param int $idx + * @return \google\protobuf\UninterpretedOption */ - public function hasIdentifierValue(){ - return $this->_has(3); + public function getUninterpretedOption($idx = NULL){ + return $this->_get(999, $idx); } /** - * Clear value + * Set value * - * @return \google\protobuf\UninterpretedOption + * @param \google\protobuf\UninterpretedOption $value + * @return \google\protobuf\MethodOptions */ - public function clearIdentifierValue(){ - return $this->_clear(3); + public function setUninterpretedOption(\google\protobuf\UninterpretedOption $value, $idx = NULL){ + return $this->_set(999, $value, $idx); } /** - * Get value + * Get all elements of * - * @return string + * @return \google\protobuf\UninterpretedOption[] */ - public function getIdentifierValue(){ - return $this->_get(3); + public function getUninterpretedOptionList(){ + return $this->_get(999); } /** - * Set value + * Add a new element to * - * @param string $value - * @return \google\protobuf\UninterpretedOption + * @param \google\protobuf\UninterpretedOption $value + * @return \google\protobuf\MethodOptions */ - public function setIdentifierValue( $value){ - return $this->_set(3, $value); + public function addUninterpretedOption(\google\protobuf\UninterpretedOption $value){ + return $this->_add(999, $value); } + } +} + +namespace google\protobuf\UninterpretedOption { + + class NamePart extends \DrSlump\Protobuf\Message { + + /** @var string */ + public $name_part = null; + + /** @var boolean */ + public $is_extension = null; + + /** @var \Closure[] */ + protected static $__extensions = array(); + + public static function descriptor() + { + $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'google.protobuf.UninterpretedOption.NamePart'); + + // REQUIRED STRING name_part = 1 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 1; + $f->name = "name_part"; + $f->type = \DrSlump\Protobuf::TYPE_STRING; + $f->rule = \DrSlump\Protobuf::RULE_REQUIRED; + $descriptor->addField($f); + + // REQUIRED BOOL is_extension = 2 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 2; + $f->name = "is_extension"; + $f->type = \DrSlump\Protobuf::TYPE_BOOL; + $f->rule = \DrSlump\Protobuf::RULE_REQUIRED; + $descriptor->addField($f); + + foreach (self::$__extensions as $cb) { + $descriptor->addField($cb(), true); + } + + return $descriptor; + } + /** - * Check if has a value + * Check if has a value * * @return boolean */ - public function hasPositiveIntValue(){ - return $this->_has(4); + public function hasNamePart(){ + return $this->_has(1); } /** - * Clear value + * Clear value * - * @return \google\protobuf\UninterpretedOption + * @return \google\protobuf\UninterpretedOption\NamePart */ - public function clearPositiveIntValue(){ - return $this->_clear(4); + public function clearNamePart(){ + return $this->_clear(1); } /** - * Get value + * Get value * - * @return int + * @return string */ - public function getPositiveIntValue(){ - return $this->_get(4); + public function getNamePart(){ + return $this->_get(1); } /** - * Set value + * Set value * - * @param int $value - * @return \google\protobuf\UninterpretedOption + * @param string $value + * @return \google\protobuf\UninterpretedOption\NamePart */ - public function setPositiveIntValue( $value){ - return $this->_set(4, $value); + public function setNamePart( $value){ + return $this->_set(1, $value); } /** - * Check if has a value + * Check if has a value + * + * @return boolean + */ + public function hasIsExtension(){ + return $this->_has(2); + } + + /** + * Clear value + * + * @return \google\protobuf\UninterpretedOption\NamePart + */ + public function clearIsExtension(){ + return $this->_clear(2); + } + + /** + * Get value + * + * @return boolean + */ + public function getIsExtension(){ + return $this->_get(2); + } + + /** + * Set value + * + * @param boolean $value + * @return \google\protobuf\UninterpretedOption\NamePart + */ + public function setIsExtension( $value){ + return $this->_set(2, $value); + } + } +} + +namespace google\protobuf { + + class UninterpretedOption extends \DrSlump\Protobuf\Message { + + /** @var \google\protobuf\UninterpretedOption\NamePart[] */ + public $name = array(); + + /** @var string */ + public $identifier_value = null; + + /** @var int */ + public $positive_int_value = null; + + /** @var int */ + public $negative_int_value = null; + + /** @var float */ + public $double_value = null; + + /** @var string */ + public $string_value = null; + + /** @var string */ + public $aggregate_value = null; + + + /** @var \Closure[] */ + protected static $__extensions = array(); + + public static function descriptor() + { + $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'google.protobuf.UninterpretedOption'); + + // REPEATED MESSAGE name = 2 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 2; + $f->name = "name"; + $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; + $f->rule = \DrSlump\Protobuf::RULE_REPEATED; + $f->reference = '\google\protobuf\UninterpretedOption\NamePart'; + $descriptor->addField($f); + + // OPTIONAL STRING identifier_value = 3 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 3; + $f->name = "identifier_value"; + $f->type = \DrSlump\Protobuf::TYPE_STRING; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $descriptor->addField($f); + + // OPTIONAL UINT64 positive_int_value = 4 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 4; + $f->name = "positive_int_value"; + $f->type = \DrSlump\Protobuf::TYPE_UINT64; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $descriptor->addField($f); + + // OPTIONAL INT64 negative_int_value = 5 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 5; + $f->name = "negative_int_value"; + $f->type = \DrSlump\Protobuf::TYPE_INT64; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $descriptor->addField($f); + + // OPTIONAL DOUBLE double_value = 6 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 6; + $f->name = "double_value"; + $f->type = \DrSlump\Protobuf::TYPE_DOUBLE; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $descriptor->addField($f); + + // OPTIONAL BYTES string_value = 7 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 7; + $f->name = "string_value"; + $f->type = \DrSlump\Protobuf::TYPE_BYTES; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $descriptor->addField($f); + + // OPTIONAL STRING aggregate_value = 8 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 8; + $f->name = "aggregate_value"; + $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 has a value + * + * @return boolean + */ + public function hasName(){ + return $this->_has(2); + } + + /** + * Clear value + * + * @return \google\protobuf\UninterpretedOption + */ + public function clearName(){ + return $this->_clear(2); + } + + /** + * Get value + * + * @param int $idx + * @return \google\protobuf\UninterpretedOption\NamePart + */ + public function getName($idx = NULL){ + return $this->_get(2, $idx); + } + + /** + * Set value + * + * @param \google\protobuf\UninterpretedOption\NamePart $value + * @return \google\protobuf\UninterpretedOption + */ + public function setName(\google\protobuf\UninterpretedOption\NamePart $value, $idx = NULL){ + return $this->_set(2, $value, $idx); + } + + /** + * Get all elements of + * + * @return \google\protobuf\UninterpretedOption\NamePart[] + */ + public function getNameList(){ + return $this->_get(2); + } + + /** + * Add a new element to + * + * @param \google\protobuf\UninterpretedOption\NamePart $value + * @return \google\protobuf\UninterpretedOption + */ + public function addName(\google\protobuf\UninterpretedOption\NamePart $value){ + return $this->_add(2, $value); + } + + /** + * Check if has a value + * + * @return boolean + */ + public function hasIdentifierValue(){ + return $this->_has(3); + } + + /** + * Clear value + * + * @return \google\protobuf\UninterpretedOption + */ + public function clearIdentifierValue(){ + return $this->_clear(3); + } + + /** + * Get value + * + * @return string + */ + public function getIdentifierValue(){ + return $this->_get(3); + } + + /** + * Set value + * + * @param string $value + * @return \google\protobuf\UninterpretedOption + */ + public function setIdentifierValue( $value){ + return $this->_set(3, $value); + } + + /** + * Check if has a value + * + * @return boolean + */ + public function hasPositiveIntValue(){ + return $this->_has(4); + } + + /** + * Clear value + * + * @return \google\protobuf\UninterpretedOption + */ + public function clearPositiveIntValue(){ + return $this->_clear(4); + } + + /** + * Get value + * + * @return int + */ + public function getPositiveIntValue(){ + return $this->_get(4); + } + + /** + * Set value + * + * @param int $value + * @return \google\protobuf\UninterpretedOption + */ + public function setPositiveIntValue( $value){ + return $this->_set(4, $value); + } + + /** + * Check if has a value * * @return boolean */ @@ -4371,409 +5301,349 @@ public function getAggregateValue(){ public function setAggregateValue( $value){ return $this->_set(8, $value); } - } } -namespace google\protobuf\UninterpretedOption { +namespace google\protobuf\SourceCodeInfo { - class NamePart extends \DrSlump\Protobuf\Message { + class Location extends \DrSlump\Protobuf\Message { + + /** @var int[] */ + public $path = array(); + + /** @var int[] */ + public $span = array(); + + /** @var string */ + public $leading_comments = null; + + /** @var string */ + public $trailing_comments = null; + - /** @var \DrSlump\Protobuf\Descriptor */ - protected static $__descriptor; /** @var \Closure[] */ protected static $__extensions = array(); - public static function descriptor(\DrSlump\Protobuf\Descriptor $descriptor = NULL) + public static function descriptor() { - if (NULL !== $descriptor) { - self::$__descriptor = $descriptor; - return self::$__descriptor; + $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'google.protobuf.SourceCodeInfo.Location'); + + // REPEATED INT32 path = 1 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 1; + $f->name = "path"; + $f->type = \DrSlump\Protobuf::TYPE_INT32; + $f->rule = \DrSlump\Protobuf::RULE_REPEATED; + $descriptor->addField($f); + + // REPEATED INT32 span = 2 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 2; + $f->name = "span"; + $f->type = \DrSlump\Protobuf::TYPE_INT32; + $f->rule = \DrSlump\Protobuf::RULE_REPEATED; + $descriptor->addField($f); + + // OPTIONAL STRING leading_comments = 3 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 3; + $f->name = "leading_comments"; + $f->type = \DrSlump\Protobuf::TYPE_STRING; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $descriptor->addField($f); + + // OPTIONAL STRING trailing_comments = 4 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 4; + $f->name = "trailing_comments"; + $f->type = \DrSlump\Protobuf::TYPE_STRING; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $descriptor->addField($f); + + foreach (self::$__extensions as $cb) { + $descriptor->addField($cb(), true); } - if (!self::$__descriptor) { - $descriptor = new \DrSlump\Protobuf\Descriptor("\google\protobuf\UninterpretedOption\NamePart"); - - // required name_part = 1 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "name_part"; - $f->type = 9; - $f->rule = 2; - $descriptor->addField($f); - - // required is_extension = 2 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 2; - $f->name = "is_extension"; - $f->type = 8; - $f->rule = 2; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - self::$__descriptor = $descriptor; - } - - return self::$__descriptor; + return $descriptor; } - /** @var string */ - public $name_part = null; - - /** @var boolean */ - public $is_extension = null; - - /** - * Check if has a value + * Check if has a value * * @return boolean */ - public function hasNamePart(){ + public function hasPath(){ return $this->_has(1); } /** - * Clear value + * Clear value * - * @return \google\protobuf\UninterpretedOption\NamePart + * @return \google\protobuf\SourceCodeInfo\Location */ - public function clearNamePart(){ + public function clearPath(){ return $this->_clear(1); } /** - * Get value + * Get value * - * @return string + * @param int $idx + * @return int */ - public function getNamePart(){ - return $this->_get(1); + public function getPath($idx = NULL){ + return $this->_get(1, $idx); } /** - * Set value + * Set value * - * @param string $value - * @return \google\protobuf\UninterpretedOption\NamePart + * @param int $value + * @return \google\protobuf\SourceCodeInfo\Location */ - public function setNamePart( $value){ - return $this->_set(1, $value); + public function setPath( $value, $idx = NULL){ + return $this->_set(1, $value, $idx); } /** - * Check if has a value + * Get all elements of * - * @return boolean + * @return int[] */ - public function hasIsExtension(){ - return $this->_has(2); + public function getPathList(){ + return $this->_get(1); } /** - * Clear value + * Add a new element to * - * @return \google\protobuf\UninterpretedOption\NamePart + * @param int $value + * @return \google\protobuf\SourceCodeInfo\Location */ - public function clearIsExtension(){ - return $this->_clear(2); + public function addPath( $value){ + return $this->_add(1, $value); } /** - * Get value + * Check if has a value * * @return boolean */ - public function getIsExtension(){ - return $this->_get(2); + public function hasSpan(){ + return $this->_has(2); } /** - * Set value + * Clear value * - * @param boolean $value - * @return \google\protobuf\UninterpretedOption\NamePart + * @return \google\protobuf\SourceCodeInfo\Location */ - public function setIsExtension( $value){ - return $this->_set(2, $value); + public function clearSpan(){ + return $this->_clear(2); } - } -} - -namespace google\protobuf { - - class SourceCodeInfo extends \DrSlump\Protobuf\Message { - - /** @var \DrSlump\Protobuf\Descriptor */ - protected static $__descriptor; - /** @var \Closure[] */ - protected static $__extensions = array(); - - public static function descriptor(\DrSlump\Protobuf\Descriptor $descriptor = NULL) - { - if (NULL !== $descriptor) { - self::$__descriptor = $descriptor; - return self::$__descriptor; - } - - if (!self::$__descriptor) { - $descriptor = new \DrSlump\Protobuf\Descriptor("\google\protobuf\SourceCodeInfo"); - - // repeated .google.protobuf.SourceCodeInfo.Location location = 1 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "location"; - $f->nameOrig = "location"; - $f->type = 11; - $f->rule = 3; - $f->reference = "\google\protobuf\SourceCodeInfo\Location"; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - self::$__descriptor = $descriptor; - } - - return self::$__descriptor; - } - - /** @var \google\protobuf\SourceCodeInfo\Location[] */ - public $location = array(); - - /** - * Check if has a value + * Get value * - * @return boolean + * @param int $idx + * @return int */ - public function hasLocation(){ - return $this->_has(1); + public function getSpan($idx = NULL){ + return $this->_get(2, $idx); } /** - * Clear value + * Set value * - * @return \google\protobuf\SourceCodeInfo + * @param int $value + * @return \google\protobuf\SourceCodeInfo\Location */ - public function clearLocation(){ - return $this->_clear(1); + public function setSpan( $value, $idx = NULL){ + return $this->_set(2, $value, $idx); } /** - * Get value + * Get all elements of * - * @param int $idx - * @return \google\protobuf\SourceCodeInfo\Location + * @return int[] */ - public function getLocation($idx = NULL){ - return $this->_get(1, $idx); + public function getSpanList(){ + return $this->_get(2); } /** - * Set value + * Add a new element to * - * @param \google\protobuf\SourceCodeInfo\Location $value - * @return \google\protobuf\SourceCodeInfo + * @param int $value + * @return \google\protobuf\SourceCodeInfo\Location */ - public function setLocation(\google\protobuf\SourceCodeInfo\Location $value, $idx = NULL){ - return $this->_set(1, $value, $idx); + public function addSpan( $value){ + return $this->_add(2, $value); } /** - * Get all elements of + * Check if has a value * - * @return \google\protobuf\SourceCodeInfo\Location[] + * @return boolean */ - public function getLocationList(){ - return $this->_get(1); + public function hasLeadingComments(){ + return $this->_has(3); } /** - * Add a new element to + * Clear value * - * @param \google\protobuf\SourceCodeInfo\Location $value - * @return \google\protobuf\SourceCodeInfo + * @return \google\protobuf\SourceCodeInfo\Location */ - public function addLocation(\google\protobuf\SourceCodeInfo\Location $value){ - return $this->_add(1, $value); - } - - } -} - -namespace google\protobuf\SourceCodeInfo { - - class Location extends \DrSlump\Protobuf\Message { - - /** @var \DrSlump\Protobuf\Descriptor */ - protected static $__descriptor; - /** @var \Closure[] */ - protected static $__extensions = array(); - - public static function descriptor(\DrSlump\Protobuf\Descriptor $descriptor = NULL) - { - if (NULL !== $descriptor) { - self::$__descriptor = $descriptor; - return self::$__descriptor; - } - - if (!self::$__descriptor) { - $descriptor = new \DrSlump\Protobuf\Descriptor("\google\protobuf\SourceCodeInfo\Location"); - - // repeated path = 1 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "path"; - $f->nameOrig = "path"; - $f->type = 5; - $f->rule = 3; - $descriptor->addField($f); - - // repeated span = 2 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 2; - $f->name = "span"; - $f->nameOrig = "span"; - $f->type = 5; - $f->rule = 3; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - self::$__descriptor = $descriptor; - } - - return self::$__descriptor; + public function clearLeadingComments(){ + return $this->_clear(3); } - - /** @var int[] */ - public $path = array(); - /** @var int[] */ - public $span = array(); - - /** - * Check if has a value + * Get value * - * @return boolean + * @return string */ - public function hasPath(){ - return $this->_has(1); + public function getLeadingComments(){ + return $this->_get(3); } /** - * Clear value + * Set value * + * @param string $value * @return \google\protobuf\SourceCodeInfo\Location */ - public function clearPath(){ - return $this->_clear(1); + public function setLeadingComments( $value){ + return $this->_set(3, $value); } /** - * Get value + * Check if has a value * - * @param int $idx - * @return int + * @return boolean */ - public function getPath($idx = NULL){ - return $this->_get(1, $idx); + public function hasTrailingComments(){ + return $this->_has(4); } /** - * Set value + * Clear value * - * @param int $value * @return \google\protobuf\SourceCodeInfo\Location */ - public function setPath( $value, $idx = NULL){ - return $this->_set(1, $value, $idx); + public function clearTrailingComments(){ + return $this->_clear(4); } /** - * Get all elements of + * Get value * - * @return int[] + * @return string */ - public function getPathList(){ - return $this->_get(1); + public function getTrailingComments(){ + return $this->_get(4); } /** - * Add a new element to + * Set value * - * @param int $value + * @param string $value * @return \google\protobuf\SourceCodeInfo\Location */ - public function addPath( $value){ - return $this->_add(1, $value); + public function setTrailingComments( $value){ + return $this->_set(4, $value); } + } +} + +namespace google\protobuf { + + class SourceCodeInfo extends \DrSlump\Protobuf\Message { + + /** @var \google\protobuf\SourceCodeInfo\Location[] */ + public $location = array(); + + /** @var \Closure[] */ + protected static $__extensions = array(); + + public static function descriptor() + { + $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'google.protobuf.SourceCodeInfo'); + + // REPEATED MESSAGE location = 1 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 1; + $f->name = "location"; + $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; + $f->rule = \DrSlump\Protobuf::RULE_REPEATED; + $f->reference = '\google\protobuf\SourceCodeInfo\Location'; + $descriptor->addField($f); + + foreach (self::$__extensions as $cb) { + $descriptor->addField($cb(), true); + } + + return $descriptor; + } + /** - * Check if has a value + * Check if has a value * * @return boolean */ - public function hasSpan(){ - return $this->_has(2); + public function hasLocation(){ + return $this->_has(1); } /** - * Clear value + * Clear value * - * @return \google\protobuf\SourceCodeInfo\Location + * @return \google\protobuf\SourceCodeInfo */ - public function clearSpan(){ - return $this->_clear(2); + public function clearLocation(){ + return $this->_clear(1); } /** - * Get value + * Get value * * @param int $idx - * @return int + * @return \google\protobuf\SourceCodeInfo\Location */ - public function getSpan($idx = NULL){ - return $this->_get(2, $idx); + public function getLocation($idx = NULL){ + return $this->_get(1, $idx); } /** - * Set value + * Set value * - * @param int $value - * @return \google\protobuf\SourceCodeInfo\Location + * @param \google\protobuf\SourceCodeInfo\Location $value + * @return \google\protobuf\SourceCodeInfo */ - public function setSpan( $value, $idx = NULL){ - return $this->_set(2, $value, $idx); + public function setLocation(\google\protobuf\SourceCodeInfo\Location $value, $idx = NULL){ + return $this->_set(1, $value, $idx); } /** - * Get all elements of + * Get all elements of * - * @return int[] + * @return \google\protobuf\SourceCodeInfo\Location[] */ - public function getSpanList(){ - return $this->_get(2); + public function getLocationList(){ + return $this->_get(1); } /** - * Add a new element to + * Add a new element to * - * @param int $value - * @return \google\protobuf\SourceCodeInfo\Location + * @param \google\protobuf\SourceCodeInfo\Location $value + * @return \google\protobuf\SourceCodeInfo */ - public function addSpan( $value){ - return $this->_add(2, $value); + public function addLocation(\google\protobuf\SourceCodeInfo\Location $value){ + return $this->_add(1, $value); } - } } + diff --git a/library/DrSlump/Protobuf/Compiler/protos/descriptor.proto b/library/DrSlump/Protobuf/Compiler/protos/descriptor.proto index 2cc650a..e17c0cc 100644 --- a/library/DrSlump/Protobuf/Compiler/protos/descriptor.proto +++ b/library/DrSlump/Protobuf/Compiler/protos/descriptor.proto @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -37,9 +37,9 @@ // without any other information (e.g. without reading its imports). +syntax = "proto2"; package google.protobuf; - option java_package = "com.google.protobuf"; option java_outer_classname = "DescriptorProtos"; @@ -60,6 +60,11 @@ message FileDescriptorProto { // Names of files imported by this file. repeated string dependency = 3; + // Indexes of the public imported files in the dependency list above. + repeated int32 public_dependency = 10; + // Indexes of the weak imported files in the dependency list. + // For Google-internal migration only. Do not use. + repeated int32 weak_dependency = 11; // All top-level definitions in this file. repeated DescriptorProto message_type = 4; @@ -70,10 +75,14 @@ message FileDescriptorProto { optional FileOptions options = 8; // This field contains optional information about the original source code. - // You may safely remove this entire field whithout harming runtime + // You may safely remove this entire field without harming runtime // functionality of the descriptors -- the information is needed only by // development tools. optional SourceCodeInfo source_code_info = 9; + + // The syntax of the proto file. + // The supported values are "proto2" and "proto3". + optional string syntax = 12; } // Describes a message type. @@ -92,6 +101,8 @@ message DescriptorProto { } repeated ExtensionRange extension_range = 5; + repeated OneofDescriptorProto oneof_decl = 8; + optional MessageOptions options = 7; } @@ -102,13 +113,13 @@ message FieldDescriptorProto { // Order is weird for historical reasons. TYPE_DOUBLE = 1; TYPE_FLOAT = 2; - TYPE_INT64 = 3; // Not ZigZag encoded. Negative numbers - // take 10 bytes. Use TYPE_SINT64 if negative - // values are likely. + // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if + // negative values are likely. + TYPE_INT64 = 3; TYPE_UINT64 = 4; - TYPE_INT32 = 5; // Not ZigZag encoded. Negative numbers - // take 10 bytes. Use TYPE_SINT32 if negative - // values are likely. + // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if + // negative values are likely. + TYPE_INT32 = 5; TYPE_FIXED64 = 6; TYPE_FIXED32 = 7; TYPE_BOOL = 8; @@ -139,7 +150,7 @@ message FieldDescriptorProto { optional Label label = 4; // If type_name is set, this need not be set. If both this and type_name - // are set, this must be either TYPE_ENUM or TYPE_MESSAGE. + // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. optional Type type = 5; // For message and enum types, this is the name of the type. If the name @@ -160,9 +171,20 @@ message FieldDescriptorProto { // TODO(kenton): Base-64 encode? optional string default_value = 7; + // If set, gives the index of a oneof in the containing type's oneof_decl + // list. This field is a member of that oneof. Extensions of a oneof should + // not set this since the oneof to which they belong will be inferred based + // on the extension range containing the extension's field number. + optional int32 oneof_index = 9; + optional FieldOptions options = 8; } +// Describes a oneof. +message OneofDescriptorProto { + optional string name = 1; +} + // Describes an enum type. message EnumDescriptorProto { optional string name = 1; @@ -198,8 +220,14 @@ message MethodDescriptorProto { optional string output_type = 3; optional MethodOptions options = 4; + + // Identifies if client streams multiple client messages + optional bool client_streaming = 5 [default=false]; + // Identifies if server streams multiple server messages + optional bool server_streaming = 6 [default=false]; } + // =================================================================== // Options @@ -221,10 +249,15 @@ message MethodDescriptorProto { // through 99999. It is up to you to ensure that you do not use the // same number for multiple options. // * For options which will be published and used publicly by multiple -// independent entities, e-mail kenton@google.com to reserve extension -// numbers. Simply tell me how many you need and I'll send you back a -// set of numbers to use -- there's no need to explain how you intend to -// use them. If this turns out to be popular, a web service will be set up +// independent entities, e-mail protobuf-global-extension-registry@google.com +// to reserve extension numbers. Simply provide your project name (e.g. +// Object-C plugin) and your porject website (if available) -- there's no need +// to explain how you intend to use them. Usually you only need one extension +// number. You can declare multiple options with only one extension number by +// putting them in a sub-message. See the Custom Options section of the docs +// for examples: +// https://developers.google.com/protocol-buffers/docs/proto#options +// If this turns out to be popular, a web service will be set up // to automatically assign option numbers. @@ -253,11 +286,26 @@ message FileOptions { optional bool java_multiple_files = 10 [default=false]; // If set true, then the Java code generator will generate equals() and - // hashCode() methods for all messages defined in the .proto file. This is - // purely a speed optimization, as the AbstractMessage base class includes - // reflection-based implementations of these methods. + // hashCode() methods for all messages defined in the .proto file. + // - In the full runtime, this is purely a speed optimization, as the + // AbstractMessage base class includes reflection-based implementations of + // these methods. + //- In the lite runtime, setting this option changes the semantics of + // equals() and hashCode() to more closely match those of the full runtime; + // the generated methods compute their results based on field values rather + // than object identity. (Implementations should not assume that hashcodes + // will be consistent across runtimes or versions of the protocol compiler.) optional bool java_generate_equals_and_hash = 20 [default=false]; + // If set true, then the Java2 code generator will generate code that + // throws an exception whenever an attempt is made to assign a non-UTF-8 + // byte sequence to a string field. + // Message reflection will do the same. + // However, an extension field still accepts non-UTF-8 byte sequences. + // This option has no effect on when used with the lite runtime. + optional bool java_string_check_utf8 = 27 [default=false]; + + // Generated classes can be optimized for speed or code size. enum OptimizeMode { SPEED = 1; // Generate complete code for parsing, serialization, @@ -267,6 +315,12 @@ message FileOptions { } optional OptimizeMode optimize_for = 9 [default=SPEED]; + // Sets the Go package where structs generated from this .proto will be + // placed. If omitted, the Go package will be derived from the following: + // - The basename of the package import path, if provided. + // - Otherwise, the package statement in the .proto file, if present. + // - Otherwise, the basename of the .proto file, without extension. + optional string go_package = 11; @@ -274,7 +328,7 @@ message FileOptions { // are not specific to any particular RPC system. They are generated by the // main code generators in each language (without additional plugins). // Generic services were the only kind of service generation supported by - // early versions of proto2. + // early versions of google.protobuf. // // Generic services are now considered deprecated in favor of using plugins // that generate code specific to your particular RPC system. Therefore, @@ -284,6 +338,18 @@ message FileOptions { optional bool java_generic_services = 17 [default=false]; optional bool py_generic_services = 18 [default=false]; + // Is this file deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for everything in the file, or it will be completely ignored; in the very + // least, this is a formalization for deprecating files. + optional bool deprecated = 23 [default=false]; + + + // Enables the use of arenas for the proto messages in this file. This applies + // only to generated classes for C++. + optional bool cc_enable_arenas = 31 [default=false]; + + // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -317,6 +383,35 @@ message MessageOptions { // from proto1 easier; new code should avoid fields named "descriptor". optional bool no_standard_descriptor_accessor = 2 [default=false]; + // Is this message deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the message, or it will be completely ignored; in the very least, + // this is a formalization for deprecating messages. + optional bool deprecated = 3 [default=false]; + + // Whether the message is an automatically generated map entry type for the + // maps field. + // + // For maps fields: + // map map_field = 1; + // The parsed descriptor looks like: + // message MapFieldEntry { + // option map_entry = true; + // optional KeyType key = 1; + // optional ValueType value = 2; + // } + // repeated MapFieldEntry map_field = 1; + // + // Implementations may choose not to generate the map_entry=true message, but + // use a native map in the target language to hold the keys and values. + // The reflection APIs in such implementions still need to work as + // if the field is a repeated message field. + // + // NOTE: Do not set the option in .proto files. Always use the maps syntax + // instead. The option should only be implicitly set by the proto compiler + // parser. + optional bool map_entry = 7; + // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -345,25 +440,47 @@ message FieldOptions { optional bool packed = 2; + + // Should this field be parsed lazily? Lazy applies only to message-type + // fields. It means that when the outer message is initially parsed, the + // inner message's contents will not be parsed but instead stored in encoded + // form. The inner message will actually be parsed when it is first accessed. + // + // This is only a hint. Implementations are free to choose whether to use + // eager or lazy parsing regardless of the value of this option. However, + // setting this option true suggests that the protocol author believes that + // using lazy parsing on this field is worth the additional bookkeeping + // overhead typically needed to implement it. + // + // This option does not affect the public interface of any generated code; + // all method signatures remain the same. Furthermore, thread-safety of the + // interface is not affected by this option; const methods remain safe to + // call from multiple threads concurrently, while non-const methods continue + // to require exclusive access. + // + // + // Note that implementations may choose not to check required fields within + // a lazy sub-message. That is, calling IsInitialized() on the outher message + // may return true even if the inner message has missing required fields. + // This is necessary because otherwise the inner message would have to be + // parsed in order to perform the check, defeating the purpose of lazy + // parsing. An implementation which chooses not to check required fields + // must be consistent about it. That is, for any particular sub-message, the + // implementation must either *always* check its required fields, or *never* + // check its required fields, regardless of whether or not the message has + // been parsed. + optional bool lazy = 5 [default=false]; + // Is this field deprecated? // Depending on the target platform, this can emit Deprecated annotations // for accessors, or it will be completely ignored; in the very least, this // is a formalization for deprecating fields. optional bool deprecated = 3 [default=false]; - // EXPERIMENTAL. DO NOT USE. - // For "map" fields, the name of the field in the enclosed type that - // is the key for this map. For example, suppose we have: - // message Item { - // required string name = 1; - // required string value = 2; - // } - // message Config { - // repeated Item items = 1 [experimental_map_key="name"]; - // } - // In this situation, the map key for Item will be set to "name". - // TODO: Fully-implement this, then remove the "experimental_" prefix. - optional string experimental_map_key = 9; + // For Google-internal migration only. Do not use. + optional bool weak = 10 [default=false]; + + // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -374,6 +491,16 @@ message FieldOptions { message EnumOptions { + // Set this option to true to allow mapping different tag names to the same + // value. + optional bool allow_alias = 2; + + // Is this enum deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the enum, or it will be completely ignored; in the very least, this + // is a formalization for deprecating enums. + optional bool deprecated = 3 [default=false]; + // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -382,6 +509,12 @@ message EnumOptions { } message EnumValueOptions { + // Is this enum value deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the enum value, or it will be completely ignored; in the very least, + // this is a formalization for deprecating enum values. + optional bool deprecated = 1 [default=false]; + // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -396,6 +529,12 @@ message ServiceOptions { // we were already using them long before we decided to release Protocol // Buffers. + // Is this service deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the service, or it will be completely ignored; in the very least, + // this is a formalization for deprecating services. + optional bool deprecated = 33 [default=false]; + // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -410,6 +549,12 @@ message MethodOptions { // we were already using them long before we decided to release Protocol // Buffers. + // Is this method deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the method, or it will be completely ignored; in the very least, + // this is a formalization for deprecating methods. + optional bool deprecated = 33 [default=false]; + // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -417,6 +562,7 @@ message MethodOptions { extensions 1000 to max; } + // A message representing a option the parser does not recognize. This only // appears in options protos created by the compiler::Parser class. // DescriptorPool resolves these when building Descriptor objects. Therefore, @@ -528,7 +674,41 @@ message SourceCodeInfo { // 1 to each before displaying to a user. repeated int32 span = 2 [packed=true]; - // TODO(kenton): Record comments appearing before and after the - // declaration. + // If this SourceCodeInfo represents a complete declaration, these are any + // comments appearing before and after the declaration which appear to be + // attached to the declaration. + // + // A series of line comments appearing on consecutive lines, with no other + // tokens appearing on those lines, will be treated as a single comment. + // + // Only the comment content is provided; comment markers (e.g. //) are + // stripped out. For block comments, leading whitespace and an asterisk + // will be stripped from the beginning of each line other than the first. + // Newlines are included in the output. + // + // Examples: + // + // optional int32 foo = 1; // Comment attached to foo. + // // Comment attached to bar. + // optional int32 bar = 2; + // + // optional string baz = 3; + // // Comment attached to baz. + // // Another line attached to baz. + // + // // Comment attached to qux. + // // + // // Another line attached to qux. + // optional double qux = 4; + // + // optional string corge = 5; + // /* Block comment attached + // * to corge. Leading asterisks + // * will be removed. */ + // /* Block comment attached to + // * grault. */ + // optional int32 grault = 6; + optional string leading_comments = 3; + optional string trailing_comments = 4; } } diff --git a/library/DrSlump/Protobuf/Message.php b/library/DrSlump/Protobuf/Message.php index bd6970b..7cb7f8c 100644 --- a/library/DrSlump/Protobuf/Message.php +++ b/library/DrSlump/Protobuf/Message.php @@ -107,6 +107,13 @@ public function parse($data, Protobuf\CodecInterface $codec = null) $codec->decode($this, $data); } + public static function deserialize($data, + Protobuf\CodecInterface $codec = null){ + $retval = new static(); + $retval->parse($data, $codec); + return $retval; + } + /** * Serialize the current object data * diff --git a/package.pear b/package.pear index f02e5a3..0fab6e9 100644 --- a/package.pear +++ b/package.pear @@ -4,11 +4,11 @@ http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd"> Protobuf - pear.pollinimini.net + __uri PHP implementation of Google's Protocol Buffers -Protobuf for PHP is an implementation of Google's Protocol Buffers for the -PHP language, supporting its binary data serialization and including a +Protobuf for PHP is an implementation of Google's Protocol Buffers for the +PHP language, supporting its binary data serialization and including a protoc plugin to generate PHP classes from .proto files. From c9b4787a0b7ccf8a70444fe11774ed50eba82329 Mon Sep 17 00:00:00 2001 From: Stanley Cheung Date: Thu, 20 Aug 2015 14:19:43 -0700 Subject: [PATCH 04/11] codegen: have each generated client class extends Grpc\BaseStub class instead --- .../DrSlump/Protobuf/Compiler/PhpGenerator.php | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/library/DrSlump/Protobuf/Compiler/PhpGenerator.php b/library/DrSlump/Protobuf/Compiler/PhpGenerator.php index 37e1488..bc19a2f 100644 --- a/library/DrSlump/Protobuf/Compiler/PhpGenerator.php +++ b/library/DrSlump/Protobuf/Compiler/PhpGenerator.php @@ -427,12 +427,10 @@ protected function compileStub(proto\ServiceDescriptorProto $service, $ns){ $s[]= $cmt; $s[]= " */"; } - $s[] = ' class ' . $service->getName() . 'Client{'; + $s[] = ' class ' . $service->getName() . 'Client extends \Grpc\BaseStub {'; $s[] = ''; - $s[] = ' private $rpc_impl;'; - $s[] = ''; - $s[] = ' public function __construct($rpc_impl) {'; - $s[] = ' $this->rpc_impl = $rpc_impl;'; + $s[] = ' public function __construct($hostname, $opts) {'; + $s[] = ' parent::__construct($hostname, $opts);'; $s[] = ' }'; foreach ($service->getMethodList() as $method){ @@ -454,18 +452,18 @@ protected function compileStub(proto\ServiceDescriptorProto $service, $ns){ if($client_stream){ if($server_stream){ $s[]= ' public function ' . $method->getName() . '($metadata = array()) {'; - $s[]= ' return $this->rpc_impl->_bidiRequest(\'/' . $service_fqn . '/' . $method->getName() . '\', \'\\' . $ns_output . '::deserialize\', $metadata);'; + $s[]= ' return $this->_bidiRequest(\'/' . $service_fqn . '/' . $method->getName() . '\', \'\\' . $ns_output . '::deserialize\', $metadata);'; } else { $s[]= ' public function ' . $method->getName() . '($arguments, $metadata = array()) {'; - $s[]= ' return $this->rpc_impl->_clientStreamRequest(\'/' . $service_fqn . '/' . $method->getName() . '\', $arguments, \'\\' . $ns_output . '::deserialize\', $metadata);'; + $s[]= ' return $this->_clientStreamRequest(\'/' . $service_fqn . '/' . $method->getName() . '\', $arguments, \'\\' . $ns_output . '::deserialize\', $metadata);'; } } else { if($server_stream){ $s[]= ' public function ' . $method->getName() . '($argument, $metadata = array()) {'; - $s[]= ' return $this->rpc_impl->_serverStreamRequest(\'/' . $service_fqn . '/' . $method->getName() . '\', $argument, \'\\' . $ns_output . '::deserialize\', $metadata);'; + $s[]= ' return $this->_serverStreamRequest(\'/' . $service_fqn . '/' . $method->getName() . '\', $argument, \'\\' . $ns_output . '::deserialize\', $metadata);'; } else { $s[]= ' public function ' . $method->getName() . '(\\' . $ns_input . ' $argument, $metadata = array()) {'; - $s[]= ' return $this->rpc_impl->_simpleRequest(\'/' . $service_fqn . '/' . $method->getName() . '\', $argument, \'\\' . $ns_output . '::deserialize\', $metadata);'; + $s[]= ' return $this->_simpleRequest(\'/' . $service_fqn . '/' . $method->getName() . '\', $argument, \'\\' . $ns_output . '::deserialize\', $metadata);'; } } $s[]= ' }'; From d49fbd3247ed2a3c13d364d6beb407849417a73f Mon Sep 17 00:00:00 2001 From: Stanley Cheung Date: Tue, 25 Aug 2015 09:57:37 -0700 Subject: [PATCH 05/11] codegen: add options param --- library/DrSlump/Protobuf/Compiler/PhpGenerator.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/library/DrSlump/Protobuf/Compiler/PhpGenerator.php b/library/DrSlump/Protobuf/Compiler/PhpGenerator.php index bc19a2f..e750b5f 100644 --- a/library/DrSlump/Protobuf/Compiler/PhpGenerator.php +++ b/library/DrSlump/Protobuf/Compiler/PhpGenerator.php @@ -454,16 +454,16 @@ protected function compileStub(proto\ServiceDescriptorProto $service, $ns){ $s[]= ' public function ' . $method->getName() . '($metadata = array()) {'; $s[]= ' return $this->_bidiRequest(\'/' . $service_fqn . '/' . $method->getName() . '\', \'\\' . $ns_output . '::deserialize\', $metadata);'; } else { - $s[]= ' public function ' . $method->getName() . '($arguments, $metadata = array()) {'; - $s[]= ' return $this->_clientStreamRequest(\'/' . $service_fqn . '/' . $method->getName() . '\', $arguments, \'\\' . $ns_output . '::deserialize\', $metadata);'; + $s[]= ' public function ' . $method->getName() . '($metadata = array()) {'; + $s[]= ' return $this->_clientStreamRequest(\'/' . $service_fqn . '/' . $method->getName() . '\', \'\\' . $ns_output . '::deserialize\', $metadata);'; } } else { if($server_stream){ - $s[]= ' public function ' . $method->getName() . '($argument, $metadata = array()) {'; - $s[]= ' return $this->_serverStreamRequest(\'/' . $service_fqn . '/' . $method->getName() . '\', $argument, \'\\' . $ns_output . '::deserialize\', $metadata);'; + $s[]= ' public function ' . $method->getName() . '($argument, $metadata = array(), $options = array()) {'; + $s[]= ' return $this->_serverStreamRequest(\'/' . $service_fqn . '/' . $method->getName() . '\', $argument, \'\\' . $ns_output . '::deserialize\', $metadata, $options);'; } else { - $s[]= ' public function ' . $method->getName() . '(\\' . $ns_input . ' $argument, $metadata = array()) {'; - $s[]= ' return $this->_simpleRequest(\'/' . $service_fqn . '/' . $method->getName() . '\', $argument, \'\\' . $ns_output . '::deserialize\', $metadata);'; + $s[]= ' public function ' . $method->getName() . '(\\' . $ns_input . ' $argument, $metadata = array(), $options = array()) {'; + $s[]= ' return $this->_simpleRequest(\'/' . $service_fqn . '/' . $method->getName() . '\', $argument, \'\\' . $ns_output . '::deserialize\', $metadata, $options);'; } } $s[]= ' }'; From b96f149c71f5cb578a67159fdb122a6da829dede Mon Sep 17 00:00:00 2001 From: Stanley Cheung Date: Wed, 9 Dec 2015 19:34:22 -0800 Subject: [PATCH 06/11] make sure call options are passed to all types of calls --- library/DrSlump/Protobuf/Compiler/PhpGenerator.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/library/DrSlump/Protobuf/Compiler/PhpGenerator.php b/library/DrSlump/Protobuf/Compiler/PhpGenerator.php index e750b5f..3f5f1cd 100644 --- a/library/DrSlump/Protobuf/Compiler/PhpGenerator.php +++ b/library/DrSlump/Protobuf/Compiler/PhpGenerator.php @@ -451,11 +451,11 @@ protected function compileStub(proto\ServiceDescriptorProto $service, $ns){ $service_fqn = $ns . '.' . $service->getName(); if($client_stream){ if($server_stream){ - $s[]= ' public function ' . $method->getName() . '($metadata = array()) {'; - $s[]= ' return $this->_bidiRequest(\'/' . $service_fqn . '/' . $method->getName() . '\', \'\\' . $ns_output . '::deserialize\', $metadata);'; + $s[]= ' public function ' . $method->getName() . '($metadata = array(), $options = array()) {'; + $s[]= ' return $this->_bidiRequest(\'/' . $service_fqn . '/' . $method->getName() . '\', \'\\' . $ns_output . '::deserialize\', $metadata, $options);'; } else { - $s[]= ' public function ' . $method->getName() . '($metadata = array()) {'; - $s[]= ' return $this->_clientStreamRequest(\'/' . $service_fqn . '/' . $method->getName() . '\', \'\\' . $ns_output . '::deserialize\', $metadata);'; + $s[]= ' public function ' . $method->getName() . '($metadata = array(), $options = array()) {'; + $s[]= ' return $this->_clientStreamRequest(\'/' . $service_fqn . '/' . $method->getName() . '\', \'\\' . $ns_output . '::deserialize\', $metadata, $options);'; } } else { if($server_stream){ From dbbe0846ee99e9579a0e5b09abf03e671614f0a8 Mon Sep 17 00:00:00 2001 From: Stanley Cheung Date: Wed, 18 May 2016 15:11:39 -0700 Subject: [PATCH 07/11] Add optional channel param to Grpc BaseStub constructor, and fix generated stub file name --- library/DrSlump/Protobuf/Compiler/PhpGenerator.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/DrSlump/Protobuf/Compiler/PhpGenerator.php b/library/DrSlump/Protobuf/Compiler/PhpGenerator.php index 3f5f1cd..999922a 100644 --- a/library/DrSlump/Protobuf/Compiler/PhpGenerator.php +++ b/library/DrSlump/Protobuf/Compiler/PhpGenerator.php @@ -84,7 +84,7 @@ public function generate(proto\FileDescriptorProto $proto) endif; foreach($proto->getServiceList() as $service) { $src = $this->compileStub($service, $namespace); - $this->addComponent($namespace, $service->getName() . 'Stub', $src); + $this->addComponent($namespace, $service->getName() . 'Client', $src); } // Collect extensions @@ -429,8 +429,8 @@ protected function compileStub(proto\ServiceDescriptorProto $service, $ns){ } $s[] = ' class ' . $service->getName() . 'Client extends \Grpc\BaseStub {'; $s[] = ''; - $s[] = ' public function __construct($hostname, $opts) {'; - $s[] = ' parent::__construct($hostname, $opts);'; + $s[] = ' public function __construct($hostname, $opts, $channel = null) {'; + $s[] = ' parent::__construct($hostname, $opts, $channel);'; $s[] = ' }'; foreach ($service->getMethodList() as $method){ From c5ffcf0f472ab42bcbb1b5960dd0e8e1c3217573 Mon Sep 17 00:00:00 2001 From: jdpedrie Date: Wed, 6 Jul 2016 13:51:20 -0400 Subject: [PATCH 08/11] Update package name and homepage --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index ad5b85e..60d74a8 100644 --- a/composer.json +++ b/composer.json @@ -1,8 +1,8 @@ { - "name": "datto/protobuf-php", + "name": "stanley-cheung/protobuf-php", "description": "PHP implementation of Google's Protocol Buffers", "keywords": ["protobuf", "protocol buffer", "serializing"], - "homepage": "https://github.com/datto/Protobuf-PHP", + "homepage": "https://github.com/stanley-cheung/Protobuf-PHP", "type": "library", "license": "MIT", "authors": [ From 4d1af206cc4eb077ccd8b05570e42688efb954f9 Mon Sep 17 00:00:00 2001 From: Stanley Cheung Date: Fri, 22 Jul 2016 02:02:23 +0000 Subject: [PATCH 09/11] Rename conflicting function signature --- library/DrSlump/Protobuf/Message.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/library/DrSlump/Protobuf/Message.php b/library/DrSlump/Protobuf/Message.php index 7cb7f8c..f3451df 100644 --- a/library/DrSlump/Protobuf/Message.php +++ b/library/DrSlump/Protobuf/Message.php @@ -64,7 +64,7 @@ public function offsetExists($offset) if (is_numeric($offset)) { return $this->_has($offset); } else { - return $this->hasExtension($offset); + return $this->_hasExtension($offset); } } @@ -73,7 +73,7 @@ public function offsetSet($offset, $value) if (is_numeric($offset)) { $this->_set($offset, $value); } else { - $this->setExtension($offset, $value); + $this->_setExtension($offset, $value); } } @@ -82,7 +82,7 @@ public function offsetGet( $offset ) if (is_numeric($offset)) { return $this->_get($offset); } else { - return $this->getExtension($offset); + return $this->_getExtension($offset); } } @@ -91,7 +91,7 @@ public function offsetUnset( $offset ) if (is_numeric($offset)) { $this->_clear($offset); } else { - $this->clearExtension($offset); + $this->_clearExtension($offset); } } @@ -287,7 +287,7 @@ public function _clear($tag) * @param string $extname * @return bool */ - public function hasExtension($extname) + public function _hasExtension($extname) { return isset($this->_extensions[$extname]); } @@ -299,7 +299,7 @@ public function hasExtension($extname) * @param int|null $idx * @return mixed */ - public function getExtension($extname, $idx = null) + public function _getExtension($extname, $idx = null) { if (!isset($this->_extensions[$extname])) return NULL; @@ -314,7 +314,7 @@ public function getExtension($extname, $idx = null) * @param string $extname * @return array */ - public function getExtensionList($extname) + public function _getExtensionList($extname) { return isset($this->_extensions[$extname]) ? $this->_extensions[$extname] @@ -329,7 +329,7 @@ public function getExtensionList($extname) * @param int|null $idx * @return \DrSlump\Protobuf\Message - Fluent Interface */ - public function setExtension($extname, $value, $idx = null) + public function _setExtension($extname, $value, $idx = null) { if (NULL !== $idx) { if (empty($this->_extensions)) { @@ -350,7 +350,7 @@ public function setExtension($extname, $value, $idx = null) * @param mixed $value * @return \DrSlump\Protobuf\Message - Fluent Interface */ - public function addExtension($extname, $value) + public function _addExtension($extname, $value) { $this->_extensions[$extname][] = $value; } @@ -359,7 +359,7 @@ public function addExtension($extname, $value) * @param $extname * @return void */ - public function clearExtension($extname) + public function _clearExtension($extname) { unset($this->_extensions[$extname]); } From aa651f157a695b939e768b71b4e84d2debd62741 Mon Sep 17 00:00:00 2001 From: Stanley Cheung Date: Mon, 25 Jul 2016 15:42:26 -0700 Subject: [PATCH 10/11] update installation instruction --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a79481c..ca7a9b4 100644 --- a/README.md +++ b/README.md @@ -83,8 +83,8 @@ $data = $book->serialize($codec); Install with Pear - pear channel-discover pear.pollinimini.net - pear install drslump/Protobuf-beta + rake pear:package version=1.0 + [sudo] pear install Protobuf-1.0.tgz You can also get the latest version by checking out a copy of the repository in your computer. From 7a02786c6121d56fc06273535d4fdab7e62eab27 Mon Sep 17 00:00:00 2001 From: Simon Yousoufov Date: Fri, 23 Sep 2016 12:17:31 -0400 Subject: [PATCH 11/11] Use absolute namespaces in phpdoc blocks for service methods. Add appropriate param types for service methods. --- .../Protobuf/Compiler/PhpGenerator.php | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/library/DrSlump/Protobuf/Compiler/PhpGenerator.php b/library/DrSlump/Protobuf/Compiler/PhpGenerator.php index 999922a..7e8ff3b 100644 --- a/library/DrSlump/Protobuf/Compiler/PhpGenerator.php +++ b/library/DrSlump/Protobuf/Compiler/PhpGenerator.php @@ -444,10 +444,35 @@ protected function compileStub(proto\ServiceDescriptorProto $service, $ns){ $s[]= ' * '; } - $s[]= ' * @param ' . $ns_input . ' $input'; - $s[]= ' */'; $server_stream = $method->getServerStreaming(); $client_stream = $method->getClientStreaming(); + + // Attach appropriate param/return types + if (! $client_stream) { + $s[]= ' * @param \\' . $ns_input . ' $argument'; + } + + if ($client_stream || $server_stream) { + $s[]= ' * @param array $metadata'; + $s[]= ' * @param array $options'; + } + + if ($client_stream) { + if ($server_stream) { + $s[]= ' * @return \Grpc\BidiStreamingCall' ; + } else { + $s[]= ' * @return \Grpc\ClientStreamingCall' ; + } + } else { + if ($server_stream) { + $s[]= ' * @return \Grpc\ServerStreamingCall' ; + } else { + $s[]= ' * @return \\' . $ns_output; + } + } + + $s[]= ' */'; + $service_fqn = $ns . '.' . $service->getName(); if($client_stream){ if($server_stream){