summaryrefslogtreecommitdiff
path: root/src/upb_text.h
diff options
context:
space:
mode:
authorJoshua Haberman <joshua@reverberate.org>2009-07-21 17:40:52 -0700
committerJoshua Haberman <joshua@reverberate.org>2009-07-21 17:40:52 -0700
commitc9105bbf58b7c98058ca2d2fe5dd7cd87e1554c7 (patch)
tree159f656b422fb70cb7a57cb31be2b42c9386a8c2 /src/upb_text.h
parenta1a9596d02f5297d60448edac994c2bcb56edc4a (diff)
Support for dumping protobufs in text format.
Diffstat (limited to 'src/upb_text.h')
-rw-r--r--src/upb_text.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/upb_text.h b/src/upb_text.h
new file mode 100644
index 0000000..b1dbf59
--- /dev/null
+++ b/src/upb_text.h
@@ -0,0 +1,37 @@
+/*
+ * upb - a minimalist implementation of protocol buffers.
+ *
+ * Copyright (c) 2009 Joshua Haberman. See LICENSE for details.
+ */
+
+#ifndef UPB_TEXT_H_
+#define UPB_TEXT_H_
+
+#include "upb.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct upb_text_printer {
+ int indent_depth;
+ bool single_line;
+};
+
+INLINE void upb_text_printer_init(struct upb_text_printer *p, bool single_line) {
+ p->indent_depth = 0;
+ p->single_line = single_line;
+}
+void upb_text_printval(upb_field_type_t type, union upb_value_ptr p, FILE *file);
+void upb_text_printfield(struct upb_text_printer *p, struct upb_string name,
+ upb_field_type_t valtype, union upb_value_ptr val,
+ FILE *stream);
+void upb_text_push(struct upb_text_printer *p, struct upb_string submsg_type,
+ FILE *stream);
+void upb_text_pop(struct upb_text_printer *p, FILE *stream);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* UPB_TEXT_H_ */
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback