summaryrefslogtreecommitdiff
path: root/upb/sink.h
diff options
context:
space:
mode:
authorJoshua Haberman <jhaberman@gmail.com>2019-01-12 20:02:52 -0800
committerJoshua Haberman <jhaberman@gmail.com>2019-01-12 20:02:52 -0800
commitef7c50223a9bd1ab451e82a31a93cab3272b497f (patch)
treef0456382a75803a776c9e9a8b1421e8fded4e848 /upb/sink.h
parent48863ea0be94ea3d3d61206ad7ce9ead206770fa (diff)
All tests pass again!
Diffstat (limited to 'upb/sink.h')
-rw-r--r--upb/sink.h41
1 files changed, 34 insertions, 7 deletions
diff --git a/upb/sink.h b/upb/sink.h
index 1359c5e..1855542 100644
--- a/upb/sink.h
+++ b/upb/sink.h
@@ -326,18 +326,37 @@ class upb::Sink {
*
* For StartString(), the function will write a sink for the string to "sub."
* The sub-sink must be used for any/all PutStringBuffer() calls. */
- bool StartString(HandlersPtr::Selector s, size_t size_hint, Sink* sub);
+ bool StartString(HandlersPtr::Selector s, size_t size_hint, Sink* sub) {
+ upb_sink sub_c;
+ bool ret = upb_sink_startstr(&sink_, s, size_hint, &sub_c);
+ *sub = sub_c;
+ return ret;
+ }
+
size_t PutStringBuffer(HandlersPtr::Selector s, const char *buf, size_t len,
- const upb_bufhandle *handle);
- bool EndString(HandlersPtr::Selector s);
+ const upb_bufhandle *handle) {
+ return upb_sink_putstring(&sink_, s, buf, len, handle);
+ }
+
+ bool EndString(HandlersPtr::Selector s) {
+ return upb_sink_endstr(&sink_, s);
+ }
/* For submessage fields.
*
* For StartSubMessage(), the function will write a sink for the string to
* "sub." The sub-sink must be used for any/all handlers called within the
* submessage. */
- bool StartSubMessage(HandlersPtr::Selector s, Sink* sub);
- bool EndSubMessage(HandlersPtr::Selector s);
+ bool StartSubMessage(HandlersPtr::Selector s, Sink* sub) {
+ upb_sink sub_c;
+ bool ret = upb_sink_startsubmsg(&sink_, s, &sub_c);
+ *sub = sub_c;
+ return ret;
+ }
+
+ bool EndSubMessage(HandlersPtr::Selector s) {
+ return upb_sink_endsubmsg(&sink_, s);
+ }
/* For repeated fields of any type, the sequence of values must be wrapped in
* these calls.
@@ -345,8 +364,16 @@ class upb::Sink {
* For StartSequence(), the function will write a sink for the string to
* "sub." The sub-sink must be used for any/all handlers called within the
* sequence. */
- bool StartSequence(HandlersPtr::Selector s, Sink* sub);
- bool EndSequence(HandlersPtr::Selector s);
+ bool StartSequence(HandlersPtr::Selector s, Sink* sub) {
+ upb_sink sub_c;
+ bool ret = upb_sink_startseq(&sink_, s, &sub_c);
+ *sub = sub_c;
+ return ret;
+ }
+
+ bool EndSequence(HandlersPtr::Selector s) {
+ return upb_sink_endseq(&sink_, s);
+ }
/* Copy and assign specifically allowed.
* We don't even bother making these members private because so many
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback