Libecoli
0.11.5
Extensible COmmand LIne library
Toggle main menu visibility
Loading...
Searching...
No Matches
strvec.h
1
/* SPDX-License-Identifier: BSD-3-Clause
2
* Copyright 2016, Olivier MATZ <zer0@droids-corp.org>
3
*/
4
15
16
#pragma once
17
#include <stdio.h>
18
20
struct
ec_strvec
;
21
28
struct
ec_strvec
*
ec_strvec
(
void
);
29
39
#define EC_STRVEC(args...) \
40
({ \
41
const char *_arr[] = {args}; \
42
ec_strvec_from_array(_arr, EC_COUNT_OF(_arr)); \
43
})
44
57
struct
ec_strvec
*
ec_strvec_from_array
(
const
char
*
const
*strarr,
size_t
n);
58
62
typedef
enum
{
67
EC_STRVEC_STRICT
= 0x1,
72
EC_STRVEC_TRAILSP
= 0x2,
73
}
ec_strvec_flag_t
;
74
80
#define EC_STRVEC_ATTR_START "start"
82
#define EC_STRVEC_ATTR_END "end"
83
98
struct
ec_strvec
*
99
ec_strvec_sh_lex_str
(
const
char
*str,
ec_strvec_flag_t
flags,
char
*unclosed_quote);
100
113
int
ec_strvec_set
(
struct
ec_strvec
*strvec,
size_t
idx,
const
char
*s);
114
125
int
ec_strvec_add
(
struct
ec_strvec
*strvec,
const
char
*s);
126
135
int
ec_strvec_del_last
(
struct
ec_strvec
*strvec);
136
147
struct
ec_strvec
*
ec_strvec_dup
(
const
struct
ec_strvec
*strvec);
148
163
struct
ec_strvec
*
ec_strvec_ndup
(
const
struct
ec_strvec
*strvec,
size_t
off,
size_t
len);
164
171
void
ec_strvec_free
(
struct
ec_strvec
*strvec);
172
181
size_t
ec_strvec_len
(
const
struct
ec_strvec
*strvec);
182
194
const
char
*
ec_strvec_val
(
const
struct
ec_strvec
*strvec,
size_t
idx);
195
207
const
struct
ec_dict
*
ec_strvec_get_attrs
(
const
struct
ec_strvec
*strvec,
size_t
idx);
208
222
int
ec_strvec_set_attrs
(
struct
ec_strvec
*strvec,
size_t
idx,
struct
ec_dict
*attrs);
223
234
int
ec_strvec_cmp
(
const
struct
ec_strvec
*strvec1,
const
struct
ec_strvec
*strvec2);
235
246
void
ec_strvec_sort
(
struct
ec_strvec
*strvec,
int
(*str_cmp)(
const
char
*s1,
const
char
*s2));
247
256
void
ec_strvec_dump
(FILE *out,
const
struct
ec_strvec
*strvec);
257
ec_dict
struct ec_dict * ec_dict(void)
ec_strvec_set
int ec_strvec_set(struct ec_strvec *strvec, size_t idx, const char *s)
ec_strvec_cmp
int ec_strvec_cmp(const struct ec_strvec *strvec1, const struct ec_strvec *strvec2)
ec_strvec_from_array
struct ec_strvec * ec_strvec_from_array(const char *const *strarr, size_t n)
ec_strvec_sh_lex_str
struct ec_strvec * ec_strvec_sh_lex_str(const char *str, ec_strvec_flag_t flags, char *unclosed_quote)
ec_strvec_ndup
struct ec_strvec * ec_strvec_ndup(const struct ec_strvec *strvec, size_t off, size_t len)
ec_strvec_free
void ec_strvec_free(struct ec_strvec *strvec)
ec_strvec_set_attrs
int ec_strvec_set_attrs(struct ec_strvec *strvec, size_t idx, struct ec_dict *attrs)
ec_strvec_val
const char * ec_strvec_val(const struct ec_strvec *strvec, size_t idx)
ec_strvec_sort
void ec_strvec_sort(struct ec_strvec *strvec, int(*str_cmp)(const char *s1, const char *s2))
ec_strvec_del_last
int ec_strvec_del_last(struct ec_strvec *strvec)
ec_strvec_dump
void ec_strvec_dump(FILE *out, const struct ec_strvec *strvec)
ec_strvec_flag_t
ec_strvec_flag_t
Definition
strvec.h:62
ec_strvec
struct ec_strvec * ec_strvec(void)
ec_strvec_add
int ec_strvec_add(struct ec_strvec *strvec, const char *s)
ec_strvec_get_attrs
const struct ec_dict * ec_strvec_get_attrs(const struct ec_strvec *strvec, size_t idx)
ec_strvec_dup
struct ec_strvec * ec_strvec_dup(const struct ec_strvec *strvec)
ec_strvec_len
size_t ec_strvec_len(const struct ec_strvec *strvec)
EC_STRVEC_STRICT
@ EC_STRVEC_STRICT
Definition
strvec.h:67
EC_STRVEC_TRAILSP
@ EC_STRVEC_TRAILSP
Definition
strvec.h:72
ecoli
strvec.h
Generated by
1.17.0