aboutsummaryrefslogtreecommitdiff
path: root/lpg/libqr/qr/bitstream.h
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2025-01-10 15:58:57 +0100
committerPřemysl Eric Janouch <p@janouch.name>2025-01-10 16:02:45 +0100
commit9319d14566e5d1bfec617c479b8543a9ee3ad4ea (patch)
treeb0130ae9e5ac2932c88ff99b83c83d23126d91bc /lpg/libqr/qr/bitstream.h
parent147b8805247ca23fb96e51694f78439ab24f93a2 (diff)
parentab64314222aca47dd7e52eca2d54d2fad0a58f6c (diff)
downloadpdf-simple-sign-9319d14566e5d1bfec617c479b8543a9ee3ad4ea.tar.gz
pdf-simple-sign-9319d14566e5d1bfec617c479b8543a9ee3ad4ea.tar.xz
pdf-simple-sign-9319d14566e5d1bfec617c479b8543a9ee3ad4ea.zip
Merge remote-tracking branch 'libqr/master'
Diffstat (limited to 'lpg/libqr/qr/bitstream.h')
-rw-r--r--lpg/libqr/qr/bitstream.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/lpg/libqr/qr/bitstream.h b/lpg/libqr/qr/bitstream.h
new file mode 100644
index 0000000..aa431e8
--- /dev/null
+++ b/lpg/libqr/qr/bitstream.h
@@ -0,0 +1,57 @@
+#ifndef QR_BITSTREAM_H
+#define QR_BITSTREAM_H
+
+#include <stddef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Note: when writing / reading multiple bits, the
+ * _most_ significant bits come first in the stream.
+ * (That is, the order you would naturally write the
+ * number in binary)
+ */
+
+struct qr_bitstream;
+
+struct qr_bitstream * qr_bitstream_create(void);
+int qr_bitstream_resize(struct qr_bitstream *, size_t bits);
+void qr_bitstream_destroy(struct qr_bitstream *);
+struct qr_bitstream * qr_bitstream_dup(const struct qr_bitstream *);
+
+void qr_bitstream_seek(struct qr_bitstream *, size_t pos);
+size_t qr_bitstream_tell(const struct qr_bitstream *);
+size_t qr_bitstream_remaining(const struct qr_bitstream *);
+size_t qr_bitstream_size(const struct qr_bitstream *);
+
+unsigned long qr_bitstream_read(struct qr_bitstream *, int bits);
+
+void qr_bitstream_unpack(struct qr_bitstream *,
+ unsigned int * result,
+ size_t count,
+ int bitsize);
+
+int qr_bitstream_write(struct qr_bitstream *,
+ unsigned long value,
+ int bits);
+
+int qr_bitstream_pack(struct qr_bitstream *,
+ const unsigned int * values,
+ size_t count,
+ int bitsize);
+
+int qr_bitstream_cat(struct qr_bitstream *,
+ const struct qr_bitstream * src);
+
+int qr_bitstream_copy(struct qr_bitstream * dest,
+ struct qr_bitstream * src,
+ size_t count);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+