From 969ba5ef86a951cb262929cb8a3fa31df6014517 Mon Sep 17 00:00:00 2001 From: Bo Yang Date: Mon, 13 Mar 2017 17:49:26 -0700 Subject: Add new file option php_class_prefix. This option will be prepended to all php generated classes. The PHP runtime needs to know this option to figure out the class name for specific message. --- upb/def.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'upb/def.h') diff --git a/upb/def.h b/upb/def.h index 9194a40..29bb3ea 100644 --- a/upb/def.h +++ b/upb/def.h @@ -1298,6 +1298,11 @@ class upb::FileDef { const char* package() const; bool set_package(const char* package, Status* s); + /* Sets the php class prefix which is prepended to all php generated classes + / from this .proto. Default is empty. */ + const char* phpprefix() const; + bool set_phpprefix(const char* phpprefix, Status* s); + /* Syntax for the file. Defaults to proto2. */ upb_syntax_t syntax() const; void set_syntax(upb_syntax_t syntax); @@ -1351,6 +1356,7 @@ UPB_REFCOUNTED_CMETHODS(upb_filedef, upb_filedef_upcast) const char *upb_filedef_name(const upb_filedef *f); const char *upb_filedef_package(const upb_filedef *f); +const char *upb_filedef_phpprefix(const upb_filedef *f); upb_syntax_t upb_filedef_syntax(const upb_filedef *f); size_t upb_filedef_defcount(const upb_filedef *f); size_t upb_filedef_depcount(const upb_filedef *f); @@ -1360,6 +1366,8 @@ const upb_filedef *upb_filedef_dep(const upb_filedef *f, size_t i); bool upb_filedef_freeze(upb_filedef *f, upb_status *s); bool upb_filedef_setname(upb_filedef *f, const char *name, upb_status *s); bool upb_filedef_setpackage(upb_filedef *f, const char *package, upb_status *s); +bool upb_filedef_setphpprefix(upb_filedef *f, const char *phpprefix, + upb_status *s); bool upb_filedef_setsyntax(upb_filedef *f, upb_syntax_t syntax, upb_status *s); bool upb_filedef_adddef(upb_filedef *f, upb_def *def, const void *ref_donor, @@ -2118,6 +2126,12 @@ inline const char* FileDef::package() const { inline bool FileDef::set_package(const char* package, Status* s) { return upb_filedef_setpackage(this, package, s); } +inline const char* FileDef::phpprefix() const { + return upb_filedef_phpprefix(this); +} +inline bool FileDef::set_phpprefix(const char* phpprefix, Status* s) { + return upb_filedef_setphpprefix(this, phpprefix, s); +} inline int FileDef::def_count() const { return upb_filedef_defcount(this); } -- cgit v1.2.3