diff options
author | Josh Haberman <jhaberman@gmail.com> | 2016-04-06 14:28:45 -0700 |
---|---|---|
committer | Josh Haberman <jhaberman@gmail.com> | 2016-04-06 14:28:45 -0700 |
commit | f8c26358f0b87a9c90be3f038cdea5bdcae185a0 (patch) | |
tree | a51e3b278d368ebd4fc01b0fff68c8f3f0701299 /upb/def.h | |
parent | e9d79d2441732264e2b990a5b2dc76d13724db07 (diff) |
Changes for PR comments.
Diffstat (limited to 'upb/def.h')
-rw-r--r-- | upb/def.h | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -921,7 +921,6 @@ bool upb_msgdef_addfield(upb_msgdef *m, upb_fielddef *f, const void *ref_donor, upb_status *s); bool upb_msgdef_addoneof(upb_msgdef *m, upb_oneofdef *o, const void *ref_donor, upb_status *s); -void upb_msgdef_setprimitiveshavepresence(upb_msgdef *m, bool have_presence); /* Field lookup in a couple of different variations: * - itof = int to field @@ -1153,6 +1152,7 @@ class upb::OneofDef { * by name once added to a message def. */ const char* name() const; bool set_name(const char* name, Status* s); + bool set_name(const std::string& name, Status* s); /* Returns the number of fields currently defined in the oneof. */ int field_count() const; @@ -1306,7 +1306,8 @@ class upb::FileDef { /* Get/set name of the file (eg. "foo/bar.proto"). */ const char* name() const; - bool set_name(const char* fullname, Status* s); + bool set_name(const char* name, Status* s); + bool set_name(const std::string& name, Status* s); /* Package name for definitions inside the file (eg. "foo.bar"). */ const char* package() const; @@ -1900,6 +1901,9 @@ inline const char* OneofDef::name() const { inline bool OneofDef::set_name(const char* name, Status* s) { return upb_oneofdef_setname(this, name, s); } +inline bool OneofDef::set_name(const std::string& name, Status* s) { + return upb_oneofdef_setname(this, upb_safecstr(name), s); +} inline int OneofDef::field_count() const { return upb_oneofdef_numfields(this); } @@ -1979,6 +1983,9 @@ inline const char* FileDef::name() const { inline bool FileDef::set_name(const char* name, Status* s) { return upb_filedef_setname(this, name, s); } +inline bool FileDef::set_name(const std::string& name, Status* s) { + return upb_filedef_setname(this, upb_safecstr(name), s); +} inline const char* FileDef::package() const { return upb_filedef_package(this); } |