Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-03-07 19:55:12 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-03-07 19:55:12 +0400
commit00781668ce936db58681e2b49d635857e5b2d25e (patch)
tree5c85664835f8488b376a8424c49b1269d2951c3b /source/blender/blenlib/BLI_string_cursor_utf8.h
parentb41b19025ebcc86ea848a13fbe19e2f4b90bf25f (diff)
Unify string stepping delimiter code for text buttons, text editor and console (all had duplicate code).
this is also a step toward the console working with utf8 though many todo's remain.
Diffstat (limited to 'source/blender/blenlib/BLI_string_cursor_utf8.h')
-rw-r--r--source/blender/blenlib/BLI_string_cursor_utf8.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_string_cursor_utf8.h b/source/blender/blenlib/BLI_string_cursor_utf8.h
new file mode 100644
index 00000000000..4bdc7f612c6
--- /dev/null
+++ b/source/blender/blenlib/BLI_string_cursor_utf8.h
@@ -0,0 +1,62 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2011 Blender Foundation.
+ * All rights reserved.
+ *
+ * Contributor(s): Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __BLI_STRING_CURSOR_UTF8_H__
+#define __BLI_STRING_CURSOR_UTF8_H__
+
+/** \file BLI_string_utf8.h
+ * \ingroup bli
+ */
+
+typedef enum strCursorDelimType {
+ STRCUR_DELIM_NONE,
+ STRCUR_DELIM_ALPHA,
+ STRCUR_DELIM_PUNCT,
+ STRCUR_DELIM_BRACE,
+ STRCUR_DELIM_OPERATOR,
+ STRCUR_DELIM_QUOTE,
+ STRCUR_DELIM_WHITESPACE,
+ STRCUR_DELIM_OTHER
+} strCursorDelimType;
+
+typedef enum strCursorJumpType {
+ STRCUR_JUMP_NONE,
+ STRCUR_JUMP_DELIM,
+ STRCUR_JUMP_ALL
+} strCursorJumpType;
+
+typedef enum strCursorJumpDirection {
+ STRCUR_DIR_PREV,
+ STRCUR_DIR_NEXT
+} strCursorJumpDirection;
+
+int BLI_str_cursor_step_next_utf8(const char *str, size_t maxlen, short *pos);
+int BLI_str_cursor_step_prev_utf8(const char *str, size_t maxlen, short *pos);
+
+void BLI_str_cursor_step_utf8(const char *str, size_t maxlen,
+ short *pos, strCursorJumpDirection direction,
+ strCursorJumpType jump);
+
+#endif /* __BLI_STRING_CURSOR_UTF8_H__ */