summaryrefslogtreecommitdiff
path: root/upb/handlers.h
diff options
context:
space:
mode:
authorJoshua Haberman <jhaberman@gmail.com>2018-08-12 20:51:50 -0700
committerJoshua Haberman <jhaberman@gmail.com>2018-08-12 20:51:50 -0700
commit7059be68ae2cbd67fca4a5501d4324d44a3868cc (patch)
tree6be2b72de3eec671f482a9b8cb6c932a14dc01a6 /upb/handlers.h
parentc8f6a27e6b27ed5d51cf6c8da5ec080b9952fa99 (diff)
Re-add message handlers to upb/handlers.*.
These are still being used by the proto2 bindings.
Diffstat (limited to 'upb/handlers.h')
-rw-r--r--upb/handlers.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/upb/handlers.h b/upb/handlers.h
index 993af13..a4e2a04 100644
--- a/upb/handlers.h
+++ b/upb/handlers.h
@@ -799,6 +799,34 @@ UPB_INLINE upb_selector_t upb_handlers_getendselector(upb_selector_t start) {
uint32_t upb_handlers_selectorbaseoffset(const upb_fielddef *f);
uint32_t upb_handlers_selectorcount(const upb_fielddef *f);
+
+/** Message handlers ******************************************************************/
+
+/* These are the handlers used internally by upb_msgfactory_getmergehandlers().
+ * They write scalar data to a known offset from the message pointer.
+ *
+ * These would be trivial for anyone to implement themselves, but it's better
+ * to use these because some JITs will recognize and specialize these instead
+ * of actually calling the function. */
+
+/* Sets a handler for the given primitive field that will write the data at the
+ * given offset. If hasbit > 0, also sets a hasbit at the given bit offset
+ * (addressing each byte low to high). */
+bool upb_msg_setscalarhandler(upb_handlers *h,
+ const upb_fielddef *f,
+ size_t offset,
+ int32_t hasbit);
+
+/* If the given handler is a msghandlers_primitive field, returns true and sets
+ * *type, *offset and *hasbit. Otherwise returns false. */
+bool upb_msg_getscalarhandlerdata(const upb_handlers *h,
+ upb_selector_t s,
+ upb_fieldtype_t *type,
+ size_t *offset,
+ int32_t *hasbit);
+
+
+
UPB_END_EXTERN_C
#include "upb/handlers-inl.h"
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback