|
@@ -44,19 +44,19 @@ typedef enum {
|
|
} LSUP_TriplePos;
|
|
} LSUP_TriplePos;
|
|
|
|
|
|
|
|
|
|
-/** Initialize or reuse a buffer handle.
|
|
|
|
|
|
+/** @brief Initialize or reuse a buffer handle.
|
|
*
|
|
*
|
|
* The handle must have been created with #LSUP_buffer_new*().
|
|
* The handle must have been created with #LSUP_buffer_new*().
|
|
*
|
|
*
|
|
* The data block is resized without being freed first. The handle must be
|
|
* The data block is resized without being freed first. The handle must be
|
|
* eventually freed with #LSUP_buffer_done() after use.
|
|
* eventually freed with #LSUP_buffer_done() after use.
|
|
*
|
|
*
|
|
- * @param buf[in] A buffer handle obtained with #LSUP_buffer_new or by manual
|
|
|
|
|
|
+ * @param[in] buf A buffer handle obtained with #LSUP_buffer_new or by manual
|
|
* allocation.
|
|
* allocation.
|
|
*
|
|
*
|
|
- * @param size[in] New size.
|
|
|
|
|
|
+ * @param[in] size New size.
|
|
*
|
|
*
|
|
- * @param data[in] If not NULL, data to replace the existing ones. The size
|
|
|
|
|
|
+ * @param[in] data If not NULL, data to replace the existing ones. The size
|
|
* of the data to be copied is determined by the size parameter. If NULL, the
|
|
* of the data to be copied is determined by the size parameter. If NULL, the
|
|
* existing data are preserved as with a normal realloc().
|
|
* existing data are preserved as with a normal realloc().
|
|
*/
|
|
*/
|
|
@@ -71,9 +71,9 @@ LSUP_buffer_init (
|
|
*
|
|
*
|
|
* To copy a buffer just do buf2 = LSUP_buffer_new (buf1->addr, buf1->size);
|
|
* To copy a buffer just do buf2 = LSUP_buffer_new (buf1->addr, buf1->size);
|
|
*
|
|
*
|
|
- * @param size[in] Length of the data.
|
|
|
|
|
|
+ * @param[in] size Length of the data.
|
|
*
|
|
*
|
|
- * @param data[in] Optional data to initially populate the object with. If
|
|
|
|
|
|
+ * @param[in] data Optional data to initially populate the object with. If
|
|
* NULL, the buffer data are garbage.
|
|
* NULL, the buffer data are garbage.
|
|
*
|
|
*
|
|
* @return LSUP_Buffer pointer. It must be freed with #LSUP_buffer_free. NULL
|
|
* @return LSUP_Buffer pointer. It must be freed with #LSUP_buffer_free. NULL
|
|
@@ -132,7 +132,7 @@ void LSUP_buffer_print (const LSUP_Buffer *buf);
|
|
*
|
|
*
|
|
* The string has non-printable characters escaped as "\xNN".
|
|
* The string has non-printable characters escaped as "\xNN".
|
|
*
|
|
*
|
|
- * @param buf[in] Buffer to convert.
|
|
|
|
|
|
+ * @param[in] buf Buffer to convert.
|
|
*
|
|
*
|
|
* @return Formatted string. It must be freed with free().
|
|
* @return Formatted string. It must be freed with free().
|
|
*/
|
|
*/
|
|
@@ -169,15 +169,37 @@ inline bool LSUP_buffer_eq (const LSUP_Buffer *buf1, const LSUP_Buffer *buf2)
|
|
* Buffer triples.
|
|
* Buffer triples.
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
+/** @brief Create a new buffer triple.
|
|
|
|
+ *
|
|
|
|
+ * @important The triple must be freed with #LSUP_btriple_free().
|
|
|
|
+ *
|
|
|
|
+ * @param[in] sspo Serialized triple pointer to initialize.
|
|
|
|
+ *
|
|
|
|
+ * @param[in] s Subject as a serialized buffer.
|
|
|
|
+ *
|
|
|
|
+ * @param[in] p Predicate as a serialized buffer.
|
|
|
|
+ *
|
|
|
|
+ * @param[in] o Object as a serialized buffer.
|
|
|
|
+ *
|
|
|
|
+ * @return New triple.
|
|
|
|
+ */
|
|
LSUP_BufferTriple *
|
|
LSUP_BufferTriple *
|
|
LSUP_btriple_new(LSUP_Buffer *s, LSUP_Buffer *p, LSUP_Buffer *o);
|
|
LSUP_btriple_new(LSUP_Buffer *s, LSUP_Buffer *p, LSUP_Buffer *o);
|
|
|
|
|
|
|
|
|
|
/** @brief Initialize internal term pointers in a heap-allocated buffer triple.
|
|
/** @brief Initialize internal term pointers in a heap-allocated buffer triple.
|
|
*
|
|
*
|
|
- * The triple must be freed with #LSUP_btriple_free().
|
|
|
|
|
|
+ * @important The triple must be freed with #LSUP_btriple_free().
|
|
*
|
|
*
|
|
- * @param sspo[in] Serialized triple pointer to initialize.
|
|
|
|
|
|
+ * @param[in] sspo Serialized triple pointer to initialize.
|
|
|
|
+ *
|
|
|
|
+ * @param[in] s Subject as a serialized buffer.
|
|
|
|
+ *
|
|
|
|
+ * @param[in] p Predicate as a serialized buffer.
|
|
|
|
+ *
|
|
|
|
+ * @param[in] o Object as a serialized buffer.
|
|
|
|
+ *
|
|
|
|
+ * @return LSUP_OK on success.
|
|
*/
|
|
*/
|
|
LSUP_rc
|
|
LSUP_rc
|
|
LSUP_btriple_init (
|
|
LSUP_btriple_init (
|
|
@@ -187,7 +209,7 @@ LSUP_btriple_init (
|
|
|
|
|
|
/** @brief Free the internal pointers of a buffer triple.
|
|
/** @brief Free the internal pointers of a buffer triple.
|
|
*
|
|
*
|
|
- * @param sspo[in] Buffer triple to be freed.
|
|
|
|
|
|
+ * @param[in] sspo Buffer triple to be freed.
|
|
*/
|
|
*/
|
|
void
|
|
void
|
|
LSUP_btriple_done (LSUP_BufferTriple *sspo);
|
|
LSUP_btriple_done (LSUP_BufferTriple *sspo);
|
|
@@ -195,10 +217,10 @@ LSUP_btriple_done (LSUP_BufferTriple *sspo);
|
|
|
|
|
|
/** @brief Free a buffer triple and all its internal pointers.
|
|
/** @brief Free a buffer triple and all its internal pointers.
|
|
*
|
|
*
|
|
- * NOTE: If the buffer pointers are not to be freed (e.g. they are owned by a
|
|
|
|
- * back end), use a simple free(sspo) instead of this.
|
|
|
|
|
|
+ * @important If the buffer pointers are not to be freed (e.g. they are owned
|
|
|
|
+ * by a back end), use a simple free(sspo) instead of this.
|
|
*
|
|
*
|
|
- * @param sspo[in] Buffer triple to be freed.
|
|
|
|
|
|
+ * @param[in] sspo Buffer triple to be freed.
|
|
*/
|
|
*/
|
|
void
|
|
void
|
|
LSUP_btriple_free (LSUP_BufferTriple *sspo);
|
|
LSUP_btriple_free (LSUP_BufferTriple *sspo);
|
|
@@ -218,9 +240,9 @@ LSUP_btriple_free_shallow (LSUP_BufferTriple *sspo);
|
|
*
|
|
*
|
|
* Useful for looping over all terms.
|
|
* Useful for looping over all terms.
|
|
*
|
|
*
|
|
- * @param trp[in] Serialized triple pointer.
|
|
|
|
|
|
+ * @param[in] btrp Serialized triple pointer.
|
|
*
|
|
*
|
|
- * @param n[in] A number between 0÷2.
|
|
|
|
|
|
+ * @param[in] n A number between 0÷2.
|
|
*
|
|
*
|
|
* @return Corresponding serialized term or NULL if n is out of range.
|
|
* @return Corresponding serialized term or NULL if n is out of range.
|
|
*/
|
|
*/
|
|
@@ -237,7 +259,12 @@ LSUP_btriple_pos (const LSUP_BufferTriple *btrp, LSUP_TriplePos n)
|
|
|
|
|
|
/** @brief Hash a buffer triple.
|
|
/** @brief Hash a buffer triple.
|
|
*
|
|
*
|
|
- * TODO This doesn't handle blank nodes correctly.
|
|
|
|
|
|
+ * @todo This doesn't handle blank nodes correctly. RDF_Canon should be ported
|
|
|
|
+ * to this library.
|
|
|
|
+ *
|
|
|
|
+ * @param[in] strp Serialized triple to hash.
|
|
|
|
+ *
|
|
|
|
+ * @return Hash value.
|
|
*/
|
|
*/
|
|
inline LSUP_Key
|
|
inline LSUP_Key
|
|
LSUP_btriple_hash (const LSUP_BufferTriple *strp)
|
|
LSUP_btriple_hash (const LSUP_BufferTriple *strp)
|