From b1302b29d9158bb62707203ea54fa5b13904ac15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Mon, 27 Jul 2015 11:56:20 +0200 Subject: text: move utility functions to separate file --- text-util.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 text-util.h (limited to 'text-util.h') diff --git a/text-util.h b/text-util.h new file mode 100644 index 0000000..d81c645 --- /dev/null +++ b/text-util.h @@ -0,0 +1,21 @@ +#ifndef TEXT_UTIL_H +#define TEXT_UTIL_H + +#include +#include +#include "text.h" + +/* test whether the given range is valid (start <= end) */ +bool text_range_valid(Filerange*); +/* get the size of the range (end-start) or zero if invalid */ +size_t text_range_size(Filerange*); +/* create an empty / invalid range of size zero */ +Filerange text_range_empty(void); +/* merge two ranges into a new one which contains both of them */ +Filerange text_range_union(Filerange*, Filerange*); +/* create new range [min(a,b), max(a,b)] */ +Filerange text_range_new(size_t a, size_t b); +/* test whether two ranges overlap */ +bool text_range_overlap(Filerange*, Filerange*); + +#endif \ No newline at end of file -- cgit v1.2.3