t_cose
Loading...
Searching...
No Matches
q_useful_buf.h
Go to the documentation of this file.
1/*
2 * q_useful_buf.h
3 *
4 * Copyright 2019, Laurence Lundblade
5 *
6 * SPDX-License-Identifier: BSD-3-Clause
7 *
8 * See BSD-3-Clause license in README.md
9 */
10
11
12#ifndef __Q_USEFUL_BUF_H__
13#define __Q_USEFUL_BUF_H__
14
15#include "qcbor/UsefulBuf.h"
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21
30#define NULL_Q_USEFUL_BUF_C NULLUsefulBufC
31
32#define NULL_Q_USEFUL_BUF NULLUsefulBuf
33
34
35static inline int q_useful_buf_c_is_null(struct q_useful_buf_c in)
36{
37 return UsefulBuf_IsNULLC(in);
38}
39
40
41static inline int q_useful_buf_is_null(struct q_useful_buf in)
42{
43 return UsefulBuf_IsNULL(in);
44}
45
46
47static inline int q_useful_buf_c_is_empty(struct q_useful_buf_c in)
48{
49 return UsefulBuf_IsEmptyC(in);
50}
51
52static inline int q_useful_buf_is_empty(struct q_useful_buf in)
53{
54 return UsefulBuf_IsEmpty(in);
55}
56
57
58static inline int q_useful_buf_is_null_or_empty(struct q_useful_buf in)
59{
60 return UsefulBuf_IsNULLOrEmpty(in);
61}
62
63
64static inline int q_useful_buf_c_is_null_or_empty(struct q_useful_buf_c in)
65{
66 return UsefulBuf_IsNULLOrEmptyC(in);
67}
68
69static inline struct q_useful_buf_c q_usefulbuf_const(struct q_useful_buf ub)
70{
71 return UsefulBuf_Const(ub);
72}
73
74
75static inline struct q_useful_buf q_useful_buf_unconst(struct q_useful_buf_c in)
76{
77 return UsefulBuf_Unconst(in);
78}
79
80#define Q_USEFUL_BUF_FROM_SZ_LITERAL UsefulBuf_FROM_SZ_LITERAL
81
82#define Q_USEFUL_BUF_FROM_BYTE_ARRAY_LITERAL UsefulBuf_FROM_BYTE_ARRAY_LITERAL
83
84#define Q_USEFUL_BUF_MAKE_STACK_UB UsefulBuf_MAKE_STACK_UB
85
86#define Q_USEFUL_BUF_FROM_BYTE_ARRAY UsefulBuf_FROM_BYTE_ARRAY
87
88
89static inline struct q_useful_buf_c q_useful_buf_from_sz(const char *string)
90{
91 return UsefulBuf_FromSZ(string);
92}
93
94static inline struct q_useful_buf_c
95useful_buf_copy_offset(struct q_useful_buf dest,
96 size_t offset,
97 struct q_useful_buf_c src)
98{
99 return UsefulBuf_CopyOffset(dest, offset, src);
100}
101
102
103
104static inline struct q_useful_buf_c q_useful_buf_copy(struct q_useful_buf dest,
105 struct q_useful_buf_c src)
106{
107 return UsefulBuf_Copy(dest, src);
108}
109
110
111static inline struct q_useful_buf_c q_useful_buf_set(struct q_useful_buf dest,
112 uint8_t value)
113{
114 return UsefulBuf_Set(dest, value);
115}
116
117
118static inline struct q_useful_buf_c q_useful_buf_copy_ptr(struct q_useful_buf d,
119 const void *ptr,
120 size_t len)
121{
122 return UsefulBuf_CopyPtr(d, ptr, len);
123}
124
125
126static inline struct q_useful_buf_c q_useful_buf_head(struct q_useful_buf_c buf,
127 size_t amount)
128{
129 return UsefulBuf_Head(buf, amount);
130}
131
132static inline struct q_useful_buf_c q_useful_buf_tail(struct q_useful_buf_c buf,
133 size_t amount)
134{
135 return UsefulBuf_Tail(buf, amount);
136}
137
138static inline int q_useful_buf_compare(const struct q_useful_buf_c buf1,
139 const struct q_useful_buf_c buf2)
140{
141 return UsefulBuf_Compare(buf1, buf2);
142}
143
144static inline size_t q_useful_buf_is_value(const struct q_useful_buf_c buf,
145 uint8_t uValue)
146{
147 return UsefulBuf_IsValue(buf, uValue);
148}
149
150static inline size_t
151q_useful_buf_find_bytes(const struct q_useful_buf_c bytes_to_search,
152 const struct q_useful_buf_c bytes_to_find)
153{
154 return UsefulBuf_FindBytes(bytes_to_search, bytes_to_find);
155}
156
157
158#ifdef __cplusplus
159}
160#endif
161
162#endif /* __Q_USEFUL_BUF_H__ */