Code

unixsock, data: Moved sdb_unixsock_parse_cell() to sdb_data_parse().
[sysdb.git] / src / include / core / data.h
index da653ce3f47e1f9692584b016da5e3d176ac4f80..4d7fda31c11d590a865fc6aff0665292249f0014 100644 (file)
@@ -146,6 +146,26 @@ enum {
 int
 sdb_data_format(const sdb_data_t *datum, char *buf, size_t buflen, int quoted);
 
+/*
+ * sdb_data_parse:
+ * Parse the specified string into a datum using the specified type. The
+ * string value is expected to be a raw value of the specified type. Integer
+ * and decimal numbers may be signed or unsigned octal (base 8, if the first
+ * character of the string is "0"), sedecimal (base 16, if the string includes
+ * the "0x" prefix), or decimal. Decimal numbers may also be "infinity" or
+ * "NaN" or may use a decimal exponent. Date-time values are expected to be
+ * specified as (floating point) number of seconds since the epoch. For string
+ * and binary data, the input string is passed to the datum. The function does
+ * not allocate new memory for that purpose. Use sdb_data_copy() if you want
+ * to do that.
+ *
+ * Returns:
+ *  - 0 on success
+ *  - a negative value else
+ */
+int
+sdb_data_parse(char *str, int type, sdb_data_t *data);
+
 #ifdef __cplusplus
 } /* extern "C" */
 #endif