summaryrefslogtreecommitdiff
path: root/bindings/cpp/upb/upb.hpp
diff options
context:
space:
mode:
authorJoshua Haberman <jhaberman@gmail.com>2011-09-03 11:14:18 -0700
committerJoshua Haberman <jhaberman@gmail.com>2011-09-03 11:14:18 -0700
commit8f2758dda2ba12b78ae8f8c7170decc5e88dd28c (patch)
treef9d03ca10244181f27591a0e8102ccb555d378de /bindings/cpp/upb/upb.hpp
parent4a8b9be46c9485a35383b52d400ba086d3f40ace (diff)
Work on C++ wrappers, added C++ test.
Diffstat (limited to 'bindings/cpp/upb/upb.hpp')
-rw-r--r--bindings/cpp/upb/upb.hpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/bindings/cpp/upb/upb.hpp b/bindings/cpp/upb/upb.hpp
new file mode 100644
index 0000000..460fb43
--- /dev/null
+++ b/bindings/cpp/upb/upb.hpp
@@ -0,0 +1,30 @@
+/*
+ * upb - a minimalist implementation of protocol buffers.
+ *
+ * Copyright (c) 2011 Google Inc. See LICENSE for details.
+ * Author: Josh Haberman <jhaberman@gmail.com>
+ */
+
+#ifndef UPB_HPP
+#define UPB_HPP
+
+#include "upb/upb.h"
+
+namespace upb {
+
+class Status : public upb_status {
+ public:
+ Status() { upb_status_init(this); }
+ ~Status() { upb_status_uninit(this); }
+
+ const char *GetString() const { return upb_status_getstr(this); }
+};
+
+INLINE std::ostream& operator<<(std::ostream& out, const Status& status) {
+ out << status.GetString();
+ return out;
+}
+
+} // namespace upb
+
+#endif
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback