Link to C API documentation of master branch
[vis.git] / text-util.h
blob86d330730082efa60b9b81cdc7ae0caa4c1dabf3
1 #ifndef TEXT_UTIL_H
2 #define TEXT_UTIL_H
4 #include <stdbool.h>
5 #include <stddef.h>
6 #include "text.h"
8 /* test whether the given range is valid (start <= end) */
9 bool text_range_valid(const Filerange*);
10 /* get the size of the range (end-start) or zero if invalid */
11 size_t text_range_size(const Filerange*);
12 /* create an empty / invalid range of size zero */
13 Filerange text_range_empty(void);
14 /* merge two ranges into a new one which contains both of them */
15 Filerange text_range_union(const Filerange*, const Filerange*);
16 /* create new range [min(a,b), max(a,b)] */
17 Filerange text_range_new(size_t a, size_t b);
18 /* test whether two ranges are equal */
19 bool text_range_equal(const Filerange*, const Filerange*);
20 /* test whether two ranges overlap */
21 bool text_range_overlap(const Filerange*, const Filerange*);
22 /* test whether a given position is within a certain range */
23 bool text_range_contains(const Filerange*, size_t pos);
24 /* count the number of graphemes in data */
25 int text_char_count(const char *data, size_t len);
26 /* get the approximate display width of data */
27 int text_string_width(const char *data, size_t len);
29 #endif