From c886d489576cd0bc33d7d22d81981c794067946f Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 23 Oct 2022 13:41:15 -0400 Subject: Add path API --- src/index_range.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/index_range.h (limited to 'src/index_range.h') diff --git a/src/index_range.h b/src/index_range.h new file mode 100644 index 0000000..1e06e90 --- /dev/null +++ b/src/index_range.h @@ -0,0 +1,28 @@ +// Copyright 2022 David Robillard +// SPDX-License-Identifier: ISC + +#ifndef ZIX_INDEX_RANGE_H +#define ZIX_INDEX_RANGE_H + +#include +#include + +typedef struct { + size_t begin; ///< Index to the first character + size_t end; ///< Index one past the last character +} ZixIndexRange; + +static inline ZixIndexRange +zix_make_range(const size_t begin, const size_t end) +{ + const ZixIndexRange result = {begin, end}; + return result; +} + +static inline bool +zix_is_empty_range(const ZixIndexRange range) +{ + return range.begin == range.end; +} + +#endif // ZIX_INDEX_RANGE_H -- cgit v1.2.1