summaryrefslogtreecommitdiff
path: root/upb/msg.h
diff options
context:
space:
mode:
Diffstat (limited to 'upb/msg.h')
-rw-r--r--upb/msg.h22
1 files changed, 18 insertions, 4 deletions
diff --git a/upb/msg.h b/upb/msg.h
index c72e9f0..6061470 100644
--- a/upb/msg.h
+++ b/upb/msg.h
@@ -21,9 +21,10 @@
#ifndef UPB_MSG_H_
#define UPB_MSG_H_
-#include "upb/def.h"
-#include "upb/handlers.h"
-#include "upb/sink.h"
+#include <stdint.h>
+#include <string.h>
+#include "upb/upb.h"
+#include "upb/structs.int.h"
#ifdef __cplusplus
@@ -36,10 +37,12 @@ class MessageLayout;
#endif
-UPB_DECLARE_TYPE(upb::Array, upb_array)
UPB_DECLARE_TYPE(upb::Map, upb_map)
UPB_DECLARE_TYPE(upb::MapIterator, upb_mapiter)
+struct upb_array;
+typedef struct upb_array upb_array;
+
/* TODO(haberman): C++ accessors */
UPB_BEGIN_EXTERN_C
@@ -87,6 +90,17 @@ UPB_INLINE upb_stringview upb_stringview_make(const char *data, size_t size) {
return ret;
}
+UPB_INLINE upb_stringview upb_stringview_makez(const char *data) {
+ return upb_stringview_make(data, strlen(data));
+}
+
+UPB_INLINE bool upb_stringview_eql(upb_stringview a, upb_stringview b) {
+ return a.size == b.size && memcmp(a.data, b.data, a.size) == 0;
+}
+
+#define UPB_STRINGVIEW_FORMAT "%.*s"
+#define UPB_STRINGVIEW_ARGS(view) view.size, view.data
+
#define UPB_STRINGVIEW_INIT(ptr, len) {ptr, len}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback