FifeGUI 0.2.0
A C++ GUI library designed for games.
utf8stringeditor.hpp
1// SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
2// SPDX-FileCopyrightText: 2004 - 2008 Olof Naessén and Per Larsson
3// SPDX-FileCopyrightText: 2013 - 2026 Fifengine contributors
4
5#ifndef INCLUDE_FIFECHAN_UTF8STRINGEDITOR_HPP_
6#define INCLUDE_FIFECHAN_UTF8STRINGEDITOR_HPP_
7
8// Standard C++ library includes
9#include <string>
10
11namespace fcn
12{
13
23 {
24 public:
32 static int nextChar(std::string const & text, int byteOffset);
33
41 static int prevChar(std::string const & text, int byteOffset);
42
50 static int eraseChar(std::string& text, int byteOffset);
51
60 static int insertChar(std::string& text, int byteOffset, int ch);
61
69 static int countChars(std::string const & text, int byteOffset);
70
81 static int getOffset(std::string const & text, int charIndex);
82 };
83
84}; // namespace fcn
85
86#endif // INCLUDE_FIFECHAN_UTF8STRINGEDITOR_HPP_
Utility for editing and handling UTF-8 encoded strings.
static int insertChar(std::string &text, int byteOffset, int ch)
Insert a character at specified byte offset.
static int countChars(std::string const &text, int byteOffset)
Counts characters up to byteOffset.
static int eraseChar(std::string &text, int byteOffset)
Erase character at specified byte offset.
static int getOffset(std::string const &text, int charIndex)
Gets byte offset for character index.
static int nextChar(std::string const &text, int byteOffset)
Returns byte offset of the next character.
static int prevChar(std::string const &text, int byteOffset)
Returns byte offset of the previous character.