summaryrefslogtreecommitdiff
path: root/upb/def.h
diff options
context:
space:
mode:
authorPaul Yang <TeBoring@users.noreply.github.com>2018-08-29 15:57:00 -0700
committerGitHub <noreply@github.com>2018-08-29 15:57:00 -0700
commit6c4469e1895298f0965777b2f9597a82a480cebd (patch)
treef97dd2b88aa4567477497629af9a1d3df49d09fd /upb/def.h
parent62318cadcefec2d2bfd0d84fdd628be313ff6201 (diff)
Fix json encoding/decoding for duration. (#118)
* Fix json encoding/decoding for duration. * Use lld for int64_t * Cast int64_t to long
Diffstat (limited to 'upb/def.h')
-rw-r--r--upb/def.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/upb/def.h b/upb/def.h
index b6d1979..5b9e8e7 100644
--- a/upb/def.h
+++ b/upb/def.h
@@ -664,6 +664,10 @@ typedef upb_strtable_iter upb_msg_oneof_iter;
#define UPB_MAPENTRY_VALUE 2
/* Well-known field tag numbers for timestamp messages. */
+#define UPB_DURATION_SECONDS 1
+#define UPB_DURATION_NANOS 2
+
+/* Well-known field tag numbers for duration messages. */
#define UPB_TIMESTAMP_SECONDS 1
#define UPB_TIMESTAMP_NANOS 2
@@ -781,6 +785,9 @@ class upb::MessageDef {
void setmapentry(bool map_entry);
bool mapentry() const;
+ /* Is this message a duration? */
+ bool duration() const;
+
/* Is this message a timestamp? */
bool timestamp() const;
@@ -925,6 +932,7 @@ bool upb_msgdef_addoneof(upb_msgdef *m, upb_oneofdef *o, const void *ref_donor,
bool upb_msgdef_setfullname(upb_msgdef *m, const char *fullname, upb_status *s);
void upb_msgdef_setmapentry(upb_msgdef *m, bool map_entry);
bool upb_msgdef_mapentry(const upb_msgdef *m);
+bool upb_msgdef_duration(const upb_msgdef *m);
bool upb_msgdef_timestamp(const upb_msgdef *m);
bool upb_msgdef_setsyntax(upb_msgdef *m, upb_syntax_t syntax);
@@ -1865,6 +1873,9 @@ inline void MessageDef::setmapentry(bool map_entry) {
inline bool MessageDef::mapentry() const {
return upb_msgdef_mapentry(this);
}
+inline bool MessageDef::duration() const {
+ return upb_msgdef_duration(this);
+}
inline bool MessageDef::timestamp() const {
return upb_msgdef_timestamp(this);
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback