Files
test2/source/blender/blenlib/BLI_string_cursor_utf8.h
Sergey Sharybin c1bc70b711 Cleanup: Add a copyright notice to files and use SPDX format
A lot of files were missing copyright field in the header and
the Blender Foundation contributed to them in a sense of bug
fixing and general maintenance.

This change makes it explicit that those files are at least
partially copyrighted by the Blender Foundation.

Note that this does not make it so the Blender Foundation is
the only holder of the copyright in those files, and developers
who do not have a signed contract with the foundation still
hold the copyright as well.

Another aspect of this change is using SPDX format for the
header. We already used it for the license specification,
and now we state it for the copyright as well, following the
FAQ:

    https://reuse.software/faq/
2023-05-31 16:19:06 +02:00

69 lines
2.2 KiB
C

/* SPDX-FileCopyrightText: 2011 Blender Foundation
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
/** \file
* \ingroup bli
*/
#ifdef __cplusplus
extern "C" {
#endif
typedef enum eStrCursorJumpType {
STRCUR_JUMP_NONE,
STRCUR_JUMP_DELIM,
STRCUR_JUMP_ALL,
} eStrCursorJumpType;
typedef enum eStrCursorJumpDirection {
STRCUR_DIR_PREV,
STRCUR_DIR_NEXT,
} eStrCursorJumpDirection;
bool BLI_str_cursor_step_next_utf8(const char *str, size_t str_maxlen, int *pos);
bool BLI_str_cursor_step_prev_utf8(const char *str, size_t str_maxlen, int *pos);
bool BLI_str_cursor_step_next_utf32(const char32_t *str, size_t str_maxlen, int *pos);
bool BLI_str_cursor_step_prev_utf32(const char32_t *str, size_t str_maxlen, int *pos);
void BLI_str_cursor_step_utf8(const char *str,
size_t str_maxlen,
int *pos,
eStrCursorJumpDirection direction,
eStrCursorJumpType jump,
bool use_init_step);
void BLI_str_cursor_step_utf32(const char32_t *str,
size_t str_maxlen,
int *pos,
eStrCursorJumpDirection direction,
eStrCursorJumpType jump,
bool use_init_step);
/**
* Given a position within a string,
* return the start and end of the closest sequence of delimited characters.
* Typically a word, but can be a sequence of characters (including spaces).
*
* \note When used for word-selection the caller should set the cursor to `r_end` (by convention).
*
* \param str: The string with a cursor position
* \param str_maxlen: The maximum characters to consider
* \param pos: The starting cursor position.
* \param r_start: returned start of word/sequence boundary (0-based)
* \param r_end: returned end of word/sequence boundary (0-based)
*/
void BLI_str_cursor_step_bounds_utf8(
const char *str, const size_t str_maxlen, int pos, int *r_start, int *r_end);
/** A UTF32 version of #BLI_str_cursor_step_bounds_utf8 */
void BLI_str_cursor_step_bounds_utf32(
const char32_t *str, const size_t str_maxlen, int pos, int *r_start, int *r_end);
#ifdef __cplusplus
}
#endif