summaryrefslogtreecommitdiff
path: root/src/upb_stdio.h
diff options
context:
space:
mode:
authorJoshua Haberman <joshua@reverberate.org>2011-02-13 12:59:54 -0800
committerJoshua Haberman <joshua@reverberate.org>2011-02-13 12:59:54 -0800
commit6bdbb45e88e7b88b294dfb6e4cb493cbc3c8cf74 (patch)
tree0e00246fb124ebdf6a2210c816704c1d840e2138 /src/upb_stdio.h
parentee84a7da167d2211066c4a663d41febdf9544438 (diff)
Merged core/ and stream/ -> src/. The split wasn't worth it.
Diffstat (limited to 'src/upb_stdio.h')
-rw-r--r--src/upb_stdio.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/upb_stdio.h b/src/upb_stdio.h
new file mode 100644
index 0000000..fd71fdd
--- /dev/null
+++ b/src/upb_stdio.h
@@ -0,0 +1,42 @@
+/*
+ * upb - a minimalist implementation of protocol buffers.
+ *
+ * This file provides upb_bytesrc and upb_bytesink implementations for
+ * ANSI C stdio.
+ *
+ * Copyright (c) 2010 Joshua Haberman. See LICENSE for details.
+ */
+
+#include <stdio.h>
+#include "upb_stream.h"
+
+#ifndef UPB_STDIO_H_
+#define UPB_STDIO_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct upb_stdio;
+typedef struct upb_stdio upb_stdio;
+
+// Creation/deletion.
+upb_stdio *upb_stdio_new();
+void upb_stdio_free(upb_stdio *stdio);
+
+// Reset/initialize the object for use. The src or sink will call
+// fread()/fwrite()/etc. on the given FILE*.
+void upb_stdio_reset(upb_stdio *stdio, FILE* file);
+
+// Gets a bytesrc or bytesink for the given stdio. The returned pointer is
+// invalidated by upb_stdio_reset above. It is perfectly valid to get both
+// a bytesrc and a bytesink for the same stdio if the FILE* is open for reading
+// and writing.
+upb_bytesrc* upb_stdio_bytesrc(upb_stdio *stdio);
+upb_bytesink* upb_stdio_bytesink(upb_stdio *stdio);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback