Main Page Widgets Namespaces Book

# ustring.h File Reference

## Namespaces

namespace | Glib

## Classes

class | Glib::ustring_Iterator<T>
| The iterator type of Glib::ustring. More...
class | Glib::ustring
| Glib::ustring has much the same interface as std::string, but contains Unicode characters encoded as UTF-8. More...

## Functions

gunichar | get_unichar_from_std_iterator (std::string::const_iterator pos) G_GNUC_PURE
| Extract a UCS-4 character from UTF-8 data.

## Function Documentation

gunichar get_unichar_from_std_iterator | ( | std::string::const_iterator | pos | ) |

Extract a UCS-4 character from UTF-8 data.

Convert a single UTF-8 (multibyte) character starting at `pos` to a UCS-4 wide character. This may read up to 6 bytes after the start position, depending on the UTF-8 character width. You have to make sure the source contains at least one valid UTF-8 character.

This is mainly used by the implementation of Glib::ustring::iterator, but it might be useful as utility function if you prefer using std::string even for UTF-8 encoding.