blob: 226859c4599813f0afccce3a1e0ccae91303d23a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
//
// 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"
#include <iostream>
namespace upb {
typedef upb_success_t Success;
class Status : public upb_status {
public:
Status() { upb_status_init(this); }
~Status() { upb_status_uninit(this); }
bool ok() const { return upb_ok(this); }
bool eof() const { return upb_eof(this); }
const char *GetString() const { return upb_status_getstr(this); }
void SetEof() { upb_status_seteof(this); }
void SetErrorLiteral(const char* msg) {
upb_status_seterrliteral(this, msg);
}
void Clear() { upb_status_clear(this); }
};
class Value : public upb_value {
public:
Value(const upb_value& val) { *this = val; }
Value() {}
};
INLINE std::ostream& operator<<(std::ostream& out, const Status& status) {
out << status.GetString();
return out;
}
} // namespace upb
#endif
|