From 8f2758dda2ba12b78ae8f8c7170decc5e88dd28c Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Sat, 3 Sep 2011 11:14:18 -0700 Subject: Work on C++ wrappers, added C++ test. --- bindings/cpp/upb/upb.hpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 bindings/cpp/upb/upb.hpp (limited to 'bindings/cpp/upb/upb.hpp') 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 + */ + +#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 -- cgit v1.2.3