12#ifndef __Q_USEFUL_BUF_H__
13#define __Q_USEFUL_BUF_H__
15#include "qcbor/UsefulBuf.h"
30#define NULL_Q_USEFUL_BUF_C NULLUsefulBufC
32#define NULL_Q_USEFUL_BUF NULLUsefulBuf
35static inline int q_useful_buf_c_is_null(
struct q_useful_buf_c in)
37 return UsefulBuf_IsNULLC(in);
41static inline int q_useful_buf_is_null(
struct q_useful_buf in)
43 return UsefulBuf_IsNULL(in);
47static inline int q_useful_buf_c_is_empty(
struct q_useful_buf_c in)
49 return UsefulBuf_IsEmptyC(in);
52static inline int q_useful_buf_is_empty(
struct q_useful_buf in)
54 return UsefulBuf_IsEmpty(in);
58static inline int q_useful_buf_is_null_or_empty(
struct q_useful_buf in)
60 return UsefulBuf_IsNULLOrEmpty(in);
64static inline int q_useful_buf_c_is_null_or_empty(
struct q_useful_buf_c in)
66 return UsefulBuf_IsNULLOrEmptyC(in);
69static inline struct q_useful_buf_c q_usefulbuf_const(struct q_useful_buf ub)
71 return UsefulBuf_Const(ub);
75static inline struct q_useful_buf q_useful_buf_unconst(struct q_useful_buf_c in)
77 return UsefulBuf_Unconst(in);
80#define Q_USEFUL_BUF_FROM_SZ_LITERAL UsefulBuf_FROM_SZ_LITERAL
82#define Q_USEFUL_BUF_FROM_BYTE_ARRAY_LITERAL UsefulBuf_FROM_BYTE_ARRAY_LITERAL
84#define Q_USEFUL_BUF_MAKE_STACK_UB UsefulBuf_MAKE_STACK_UB
86#define Q_USEFUL_BUF_FROM_BYTE_ARRAY UsefulBuf_FROM_BYTE_ARRAY
89static inline struct q_useful_buf_c q_useful_buf_from_sz(const char *string)
91 return UsefulBuf_FromSZ(
string);
94static inline struct q_useful_buf_c
95useful_buf_copy_offset(struct q_useful_buf dest,
97 struct q_useful_buf_c src)
99 return UsefulBuf_CopyOffset(dest, offset, src);
104static inline struct q_useful_buf_c q_useful_buf_copy(struct q_useful_buf dest,
105 struct q_useful_buf_c src)
107 return UsefulBuf_Copy(dest, src);
111static inline struct q_useful_buf_c q_useful_buf_set(struct q_useful_buf dest,
114 return UsefulBuf_Set(dest, value);
118static inline struct q_useful_buf_c q_useful_buf_copy_ptr(struct q_useful_buf d,
122 return UsefulBuf_CopyPtr(d, ptr, len);
126static inline struct q_useful_buf_c q_useful_buf_head(struct q_useful_buf_c buf,
129 return UsefulBuf_Head(buf, amount);
132static inline struct q_useful_buf_c q_useful_buf_tail(struct q_useful_buf_c buf,
135 return UsefulBuf_Tail(buf, amount);
138static inline int q_useful_buf_compare(
const struct q_useful_buf_c buf1,
139 const struct q_useful_buf_c buf2)
141 return UsefulBuf_Compare(buf1, buf2);
144static inline size_t q_useful_buf_is_value(
const struct q_useful_buf_c buf,
147 return UsefulBuf_IsValue(buf, uValue);
151q_useful_buf_find_bytes(
const struct q_useful_buf_c bytes_to_search,
152 const struct q_useful_buf_c bytes_to_find)
154 return UsefulBuf_FindBytes(bytes_to_search, bytes_to_find);