summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoshua Haberman <joshua@reverberate.org>2010-06-07 18:38:25 -0700
committerJoshua Haberman <joshua@reverberate.org>2010-06-07 18:38:25 -0700
commit0a57d07a07c7cb7d2eee1db0477254d0199eb435 (patch)
treec0e93e10f65d9e435d194d123844923c369e79d1 /src
parentfbc57ee4882eca6321f8e1f2f5a3b8fae448605b (diff)
Skeleton of upb_bytesrc.
Diffstat (limited to 'src')
-rw-r--r--src/upb_byteio.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/upb_byteio.h b/src/upb_byteio.h
new file mode 100644
index 0000000..69a28b3
--- /dev/null
+++ b/src/upb_byteio.h
@@ -0,0 +1,43 @@
+/*
+ * upb - a minimalist implementation of protocol buffers.
+ *
+ * This file contains upb_bytesrc and upb_bytesink implementations for common
+ * interfaces like strings, UNIX fds, and FILE*.
+ *
+ * Copyright (c) 2009-2010 Joshua Haberman. See LICENSE for details.
+ */
+
+#ifndef UPB_BYTEIO_H
+#define UPB_BYTEIO_H
+
+#include "upb_srcsink.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* upb_stringsrc **************************************************************/
+
+struct upb_stringsrc;
+typedef struct upb_stringsrc upb_stringsrc;
+
+// Create/free a stringsrc.
+upb_stringsrc *upb_stringsrc_new();
+void upb_stringsrc_free(upb_stringsrc *s);
+
+// Resets the stringsrc to a state where it will vend the given string. The
+// stringsrc will take a reference on the string, so the caller need not ensure
+// that it outlives the stringsrc. A stringsrc can be reset multiple times.
+void upb_stringsrc_reset(upb_stringsrc *s, upb_string *str);
+
+// Returns the upb_bytesrc* for this stringsrc. Invalidated by reset above.
+upb_bytesrc *upb_stringsrc_bytesrc();
+
+
+/* upb_fdsrc ******************************************************************/
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback