Home | History | Annotate | Download | only in protobuf_c

Lines Matching defs:handler

3889 template <class T> class Handler;
3900 /* The maximum depth that the handler graph can have. This is a resource limit
3936 /* A selector refers to a specific field handler in the Handlers object
3937 * (for example: the STARTSUBMSG handler for field "field15"). */
3976 /* A set of attributes that accompanies a handler's function pointer. */
3982 /* Sets the handler data that will be passed as the second parameter of the
3983 * handler. To free this pointer when the handlers are freed, call
3989 * all other closure types for handler that use the same closure.
3997 * type of any handlers that use it (for example, the StringBuf handler must
4002 /* Set to indicate that the handler always returns "ok" (either "true" or a
4028 * separately for each handler that must match).
4040 /* Extra information about a buffer that is passed to a StringBuf handler.
4042 * the handler invocation. */
4049 * passed to a StringBuf handler because the handler may receive data
4101 * The easiest way to create the *Handler objects needed by the Set* methods is
4108 typedef Handler<void *(*)(void *, const void *)> StartFieldHandler;
4109 typedef Handler<bool (*)(void *, const void *)> EndFieldHandler;
4110 typedef Handler<bool (*)(void *, const void *)> StartMessageHandler;
4111 typedef Handler<bool (*)(void *, const void *, Status*)> EndMessageHandler;
4112 typedef Handler<void *(*)(void *, const void *, size_t)> StartStringHandler;
4113 typedef Handler<size_t (*)(void *, const void *, const char *, size_t,
4117 typedef Handler<bool(*)(void *, const void *, T)> H;
4150 /* All handler registration functions return bool to indicate success or
4163 /* Freezes the given set of handlers. You may not freeze a handler without
4176 /* Sets the startmsg handler for the message, which is defined as follows:
4184 bool SetStartMessageHandler(const StartMessageHandler& handler);
4186 /* Sets the endmsg handler for the message, which is defined as follows:
4194 bool SetEndMessageHandler(const EndMessageHandler& handler);
4196 /* Sets the value handler for the given field, which is defined as follows
4210 * For example, a handler that takes an int32_t parameter may only be used for
4213 * Returns false if the handler failed to register; in this case the cleanup
4214 * handler (if any) will be called immediately.
4231 const typename ValueHandler<typename CanonicalType<T>::Type>::H& handler);
4273 /* Sets the startseq handler, which is defined as follows:
4289 /* Sets the startsubmsg handler for the given field, which is defined as
4306 /* Sets the endsubmsg handler for the given field, which is defined as
4319 /* Starts the endsubseq handler for the given field, which is defined as
4341 /* A selector refers to a specific field handler in the Handlers object
4342 * (for example: the STARTSUBMSG handler for field "field15").
4352 /* Returns the function pointer for this handler. It is the client's
4359 /* Returns the handler data that was registered with this handler. */
4385 upb_handlers_tabent table[1]; /* Dynamically-sized field handler array. */
4392 /* Convenience macros for creating a Handler object that is wrapped with a
4401 * // Handler that doesn't need any data bound to it.
4406 * // Handler that returns bool so it can return failure if necessary.
4412 * // Member function handler.
4456 /* Handler: a struct that contains the (handler, data, deleter) tuple that is
4459 template <class T> class Handler {
4461 /* The underlying, handler function signature that upb uses internally. */
4465 template <class F> Handler(F func);
4466 ~Handler();
4476 UPB_DISALLOW_COPY_AND_ASSIGN(Handler)
4493 /* Handler function typedefs. */
4614 /* Handler types for single fields.
4851 * These functions are not bound to a handler data so have no data or cleanup
4852 * handler. */
5362 /* Function that discards the handler data parameter. */
5396 /* Function that casts the handler data parameter. */
5421 /* For unbound functions, ignore the handler data. */
5435 /* For StringBuffer only; this ignores both the handler data and the
5451 /* For bound functions, cast the handler data. */
5491 const Handlers::utype ## Handler& handler) { \
5492 assert(!handler.registered_); \
5493 handler.AddCleanup(this); \
5494 handler.registered_ = true; \
5495 return upb_handlers_set##ltype(this, f, handler.handler_, &handler.attr_); \
5525 inline bool Handlers::Set##utype##Handler(const FieldDef *f, \
5526 const utype##Handler &h) { \
5568 inline Handler<T>::Handler(F func)
5603 inline Handler<T>::~Handler() {
5689 const Handlers::StartMessageHandler &handler) {
5690 assert(!handler.registered_);
5691 handler.registered_ = true;
5692 handler.AddCleanup(this);
5693 return upb_handlers_setstartmsg(this, handler.handler_, &handler.attr_);
5696 const Handlers::EndMessageHandler &handler) {
5697 assert(!handler.registered_);
5698 handler.registered_ = true;
5699 handler.AddCleanup(this);
5700 return upb_handlers_setendmsg(this, handler.handler_, &handler.attr_);
5703 const StartStringHandler &handler) {
5704 assert(!handler.registered_);
5705 handler.registered_ = true;
5706 handler.AddCleanup(this);
5707 return upb_handlers_setstartstr(this, f, handler.handler_, &handler.attr_);
5710 const EndFieldHandler &handler) {
5711 assert(!handler.registered_);
5712 handler.registered_ = true;
5713 handler.AddCleanup(this);
5714 return upb_handlers_setendstr(this, f, handler.handler_, &handler.attr_);
5717 const StringHandler& handler) {
5718 assert(!handler.registered_);
5719 handler.registered_ = true;
5720 handler.AddCleanup(this);
5721 return upb_handlers_setstring(this, f, handler.handler_, &handler.attr_);
5724 const FieldDef *f, const StartFieldHandler &handler) {
5725 assert(!handler.registered_);
5726 handler.registered_ = true;
5727 handler.AddCleanup(this);
5728 return upb_handlers_setstartseq(this, f, handler.handler_, &handler.attr_);
5731 const FieldDef *f, const StartFieldHandler &handler) {
5732 assert(!handler.registered_);
5733 handler.registered_ = true;
5734 handler.AddCleanup(this);
5735 return upb_handlers_setstartsubmsg(this, f, handler.handler_, &handler.attr_);
5738 const EndFieldHandler &handler) {
5739 assert(!handler.registered_);
5740 handler.registered_ = true;
5741 handler.AddCleanup(this);
5742 return upb_handlers_setendsubmsg(this, f, handler.handler_, &handler.attr_);
5745 const EndFieldHandler &handler) {
5746 assert(!handler.registered_);
5747 handler.registered_ = true;
5748 handler.AddCleanup(this);
5749 return upb_handlers_setendseq(this, f, handler.handler_, &handler.attr_);
5850 * pointer for any handler with handlers->GetHandler(selector), without having
5851 * to have a separate GetHandler() function for each handler type. The JIT
5853 * GetHandler() for every handler type.
5856 * instance. In other words, they allocate a number to every possible handler
5859 * us from compacting the handler table at Freeze() time. If the table is very
5968 template <class T> BytesSink(const BytesHandler* handler, T* closure);
5971 template <class T> void Reset(const BytesHandler* handler, T* closure);
5980 const upb_byteshandler *handler;
6019 s->handler = h;
6028 if (!s->handler) return true;
6029 start = (func *)s->handler->table[UPB_STARTSTR_SELECTOR].func;
6033 &s->handler->table[UPB_STARTSTR_SELECTOR].attr),
6043 if (!s->handler) return true;
6044 putbuf = (func *)s->handler->table[UPB_STRING_SELECTOR].func;
6048 &s->handler->table[UPB_STRING_SELECTOR].attr),
6055 if (!s->handler) return true;
6056 end = (func *)s->handler->table[UPB_ENDSTR_SELECTOR].func;
6061 &s->handler->table[UPB_ENDSTR_SELECTOR].attr));
6113 func *handler;
6116 handler = (func *)upb_handlers_gethandler(s->handlers, sel);
6118 if (!handler) return n;
6120 return handler(s->closure, hd, buf, n, handle);
6299 BytesSink::BytesSink(const BytesHandler* handler, T* closure) {
6300 Reset(handler, closure);
6304 void BytesSink::Reset(const BytesHandler *handler, T *closure) {
6305 upb_bytessink_reset(this, handler, closure);
6329 ** overhead of calling a handler can be significant. This file allows the
6333 ** handler.
6355 /* Sets a handler for the given field that writes the value to the given
6357 * true if the handler was set successfully. */
6360 /* If this handler is a shim, returns the corresponding upb::Shim::Data and
7811 /* The handler one calls to invoke this method. */
8320 /* If handler caching becomes a requirement we can add a code cache as in