summaryrefslogtreecommitdiff
path: root/bindings/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'bindings/cpp')
-rw-r--r--bindings/cpp/upb/def.hpp17
-rw-r--r--bindings/cpp/upb/handlers.hpp3
2 files changed, 14 insertions, 6 deletions
diff --git a/bindings/cpp/upb/def.hpp b/bindings/cpp/upb/def.hpp
index 6500243..d64625c 100644
--- a/bindings/cpp/upb/def.hpp
+++ b/bindings/cpp/upb/def.hpp
@@ -17,9 +17,14 @@ namespace upb {
class MessageDef : public upb_msgdef {
public:
+ // Converting from C types to C++ wrapper types.
static MessageDef* Cast(upb_msgdef *md) { return (MessageDef*)md; }
+ static const MessageDef* Cast(const upb_msgdef *md) {
+ return (const MessageDef*)md;
+ }
- void Unref() { return upb_msgdef_unref(this); }
+ void Ref() const { upb_msgdef_ref(this); }
+ void Unref() const { upb_msgdef_unref(this); }
private:
MessageDef();
@@ -28,14 +33,20 @@ class MessageDef : public upb_msgdef {
class SymbolTable : public upb_symtab {
public:
+ // Converting from C types to C++ wrapper types.
static SymbolTable* Cast(upb_symtab *s) { return (SymbolTable*)s; }
+ static const SymbolTable* Cast(const upb_symtab *s) {
+ return (SymbolTable*)s;
+ }
+
static SymbolTable* New() { return Cast(upb_symtab_new()); }
- void Unref() { return upb_symtab_unref(this); }
+ void Ref() const { upb_symtab_unref(this); }
+ void Unref() const { upb_symtab_unref(this); }
// If the given name refers to a message in this symbol table, returns a new
// ref to that MessageDef object, otherwise returns NULL.
- MessageDef* LookupMessage(const char *name) {
+ const MessageDef* LookupMessage(const char *name) const {
return MessageDef::Cast(upb_symtab_lookupmsg(this, name));
}
diff --git a/bindings/cpp/upb/handlers.hpp b/bindings/cpp/upb/handlers.hpp
index e72c0a4..07683f6 100644
--- a/bindings/cpp/upb/handlers.hpp
+++ b/bindings/cpp/upb/handlers.hpp
@@ -4,9 +4,6 @@
* Copyright (c) 2011 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*
- * Note! This file is a proof-of-concept for C++ wrappers and does not
- * yet build.
- *
* upb::Handlers is a generic visitor-like interface for iterating over a
* stream of protobuf data. You can register function pointers that will be
* called for each message and/or field as the data is being parsed or iterated
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback