summaryrefslogtreecommitdiffstats
path: root/src/libply/ply-buffer.h
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2008-05-18 19:41:59 -0400
committerRay Strode <rstrode@redhat.com>2008-05-18 20:06:31 -0400
commit05dd70498594e6ba1da6c2f14a8820bdcc2eee41 (patch)
tree1eb2b137f051cce2eb6bc194ee6cf686699d0f38 /src/libply/ply-buffer.h
parent413270724bdcb3cf635efbd3874f76b11781dce9 (diff)
downloadplymouth-05dd70498594e6ba1da6c2f14a8820bdcc2eee41.tar.gz
plymouth-05dd70498594e6ba1da6c2f14a8820bdcc2eee41.tar.xz
plymouth-05dd70498594e6ba1da6c2f14a8820bdcc2eee41.zip
add new ply-buffer class
Copy and paste ply-logger into a more general ply-buffer class, so we have a facility to buffer key strokes and process them as necessary
Diffstat (limited to 'src/libply/ply-buffer.h')
-rw-r--r--src/libply/ply-buffer.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/libply/ply-buffer.h b/src/libply/ply-buffer.h
new file mode 100644
index 0000000..e73a47c
--- /dev/null
+++ b/src/libply/ply-buffer.h
@@ -0,0 +1,49 @@
+/* ply-buffer.h - facilities for buffering data
+ *
+ * Copyright (C) 2008 Ray Strode <rstrode@redhat.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+#ifndef PLY_BUFFER_H
+#define PLY_BUFFER_H
+
+#include <stdbool.h>
+#include <stdint.h>
+#include <string.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+typedef struct _ply_buffer ply_buffer_t;
+
+#ifndef PLY_HIDE_FUNCTION_DECLARATIONS
+ply_buffer_t *ply_buffer_new (void);
+void ply_buffer_free (ply_buffer_t *buffer);
+void ply_buffer_append_bytes (ply_buffer_t *buffer,
+ const void *bytes,
+ size_t number_of_bytes);
+#define ply_buffer_append(buffer, format, args...) \
+ ply_buffer_append_with_non_literal_format_string (buffer, \
+ format "", ##args)
+__attribute__((__format__ (__printf__, 2, 3)))
+void ply_buffer_append_with_non_literal_format_string (ply_buffer_t *buffer,
+ const char *format, ...);
+const char *ply_buffer_get_bytes (ply_buffer_t *buffer);
+size_t ply_buffer_get_size (ply_buffer_t *buffer);
+void ply_buffer_clear (ply_buffer_t *buffer);
+#endif
+
+#endif /* PLY_BUFFER_H */
+/* vim: set ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */