From 26d98ca94f2f049e8767b4a9a33d185a3d7ea0fd Mon Sep 17 00:00:00 2001 From: Josh Haberman Date: Thu, 24 Oct 2013 12:43:19 -0700 Subject: Merge from Google-internal development: - rewritten decoder; interpreted decoder is bytecode-based, JIT decoder no longer falls back to the interpreter. - C++ improvements: C++11-compatible iterators, upb::reffed_ptr for RAII refcounting, better upcast/downcast support. - removed the gross upb_value abstraction from public upb.h. --- upb/shim/shim.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'upb/shim/shim.h') diff --git a/upb/shim/shim.h b/upb/shim/shim.h index 98310d7..bc47bbb 100644 --- a/upb/shim/shim.h +++ b/upb/shim/shim.h @@ -37,9 +37,10 @@ struct Shim { // true if the handler was set successfully. static bool Set(Handlers *h, const FieldDef *f, size_t ofs, int32_t hasbit); - // If this handler is a shim, returns the corresponding upb::Shim::Data. - // Otherwise returns NULL. - static const Data* GetData(const Handlers* h, Handlers::Selector s); + // If this handler is a shim, returns the corresponding upb::Shim::Data and + // stores the type in "type". Otherwise returns NULL. + static const Data* GetData(const Handlers* h, Handlers::Selector s, + FieldDef::Type* type); }; } // namespace upb @@ -50,7 +51,8 @@ extern "C" { // C API. bool upb_shim_set(upb_handlers *h, const upb_fielddef *f, size_t offset, int32_t hasbit); -const upb_shim_data *upb_shim_getdata(const upb_handlers *h, upb_selector_t s); +const upb_shim_data *upb_shim_getdata(const upb_handlers *h, upb_selector_t s, + upb_fieldtype_t *type); #ifdef __cplusplus } // extern "C" @@ -62,9 +64,9 @@ inline bool Shim::Set(Handlers* h, const FieldDef* f, size_t ofs, int32_t hasbit) { return upb_shim_set(h, f, ofs, hasbit); } -inline const Shim::Data* Shim::GetData(const Handlers* h, - Handlers::Selector s) { - return upb_shim_getdata(h, s); +inline const Shim::Data* Shim::GetData(const Handlers* h, Handlers::Selector s, + FieldDef::Type* type) { + return upb_shim_getdata(h, s, type); } } // namespace -- cgit v1.2.3