Commit 5a4b21afe67473924978f240ba237a41e5125477

Thomas de Grivel 2024-11-27T23:32:46

wip serialize

diff --git a/libkc3/serialize.h b/libkc3/serialize.h
new file mode 100644
index 0000000..b925601
--- /dev/null
+++ b/libkc3/serialize.h
@@ -0,0 +1,35 @@
+/* kc3
+ * Copyright 2022,2023,2024 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+/**
+ * @file serialize.h
+ * @brief Serialization from tag to blob.
+ *
+ * Serialization is transforming memory data to a binary blob.
+ */
+#ifndef LIBKC3_SERIALIZE_H
+#define LIBKC3_SERIALIZE_H
+
+/* Stack-allocation compatible functions, call serialize_clean
+   after use. */
+void          serialize_clean (s_serialize *serialize);
+s_serialize * serialize_init (s_serialize *serialize);
+
+/* Observers. */
+s_str * serialize_to_buf (const s_serialize *serialize, s_buf *buf);
+s_str * serialize_to_str (const s_serialize *serialize, s_str *dest);
+
+/* Operators. */
+s_serialize * serialize_tag (s_serialize *serialize,
+                             s_tag *tag);
+
+#endif /* LIBKC3_SERIALIZE_H */