summaryrefslogtreecommitdiff
path: root/upb_context.h
diff options
context:
space:
mode:
authorJoshua Haberman <joshua@reverberate.org>2009-06-23 09:55:56 -0700
committerJoshua Haberman <joshua@reverberate.org>2009-06-23 09:55:56 -0700
commitb11730f2ed3b37af925a26b42b25689fd4769eef (patch)
treebee99d4b7260d37bc97247f83264ea1742c797b3 /upb_context.h
parentf8f689ad31bd3f70f163f9afe340989126f9f4d5 (diff)
Added a upb_context object, which is like an interpreter context.
Diffstat (limited to 'upb_context.h')
-rw-r--r--upb_context.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/upb_context.h b/upb_context.h
new file mode 100644
index 0000000..f2bb1df
--- /dev/null
+++ b/upb_context.h
@@ -0,0 +1,51 @@
+/*
+ * upb - a minimalist implementation of protocol buffers.
+ *
+ * A context represents a namespace of proto definitions, sort of like
+ * an interpreter's symbol table. It is empty when first constructed.
+ * Clients add definitions to the context by supplying serialized
+ * descriptors (as defined in descriptor.proto).
+ *
+ * Copyright (c) 2008 Joshua Haberman. See LICENSE for details.
+ */
+
+#ifndef UPB_PARSE_H_
+#define UPB_PARSE_H_
+
+#include "upb.h"
+#include "upb_table.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* High-level parsing interface. **********************************************/
+
+enum upb_symbol_type {
+ UPB_SYM_MESSAGE,
+ UPB_SYM_ENUM,
+ UPB_SYM_SERVICE,
+ UPB_SYM_EXTENSION
+};
+
+struct upb_symtab_entry {
+ struct upb_strtable_entry e;
+ enum upb_symbol_type type;
+ union {
+ struct upb_msg *msg;
+ struct upb_enum *_enum;
+ struct upb_svc *svc;
+ } p;
+}
+
+struct upb_context {
+ upb_strtable *symtab;
+};
+
+struct upb_symtab_entry *upb_context_findsym(struct upb_context *c, struct upb_string *s);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* UPB_PARSE_H_ */
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback