filetype: Set "groovy" for Jenkinsfile
[vis.git] / text-util.h
blob709e2552edf58552c9eb965bfdcdbce6821f85c6
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 /* get intersection of two ranges */
17 Filerange text_range_intersect(const Filerange*, const Filerange*);
18 /* create new range [min(a,b), max(a,b)] */
19 Filerange text_range_new(size_t a, size_t b);
20 /* test whether two ranges are equal */
21 bool text_range_equal(const Filerange*, const Filerange*);
22 /* test whether two ranges overlap */
23 bool text_range_overlap(const Filerange*, const Filerange*);
24 /* test whether a given position is within a certain range */
25 bool text_range_contains(const Filerange*, size_t pos);
26 /* count the number of graphemes in data */
27 int text_char_count(const char *data, size_t len);
28 /* get the approximate display width of data */
29 int text_string_width(const char *data, size_t len);
31 #endif