1#ifndef SASS_UTF8_STRING_H
2#define SASS_UTF8_STRING_H
3
4#include <string>
5#include "utf8.h"
6#include "memory.hpp"
7
8namespace Sass {
9 namespace UTF_8 {
10
11 // naming conventions:
12 // offset: raw byte offset (0 based)
13 // position: code point offset (0 based)
14 // index: code point offset (1 based or negative)
15
16 // function that will count the number of code points (utf-8 characters) from the beginning to the given end
17 size_t code_point_count(const sass::string& str, size_t start, size_t end);
18 size_t code_point_count(const sass::string& str);
19
20 // function that will return the byte offset of a code point in a
21 size_t offset_at_position(const sass::string& str, size_t position);
22
23 // function that returns number of bytes in a character in a string
24 size_t code_point_size_at_offset(const sass::string& str, size_t offset);
25
26 // function that will return a normalized index, given a crazy one
27 size_t normalize_index(int index, size_t len);
28
29 #ifdef _WIN32
30 // functions to handle unicode paths on windows
31 sass::string convert_from_utf16(const std::wstring& wstr);
32 std::wstring convert_to_utf16(const sass::string& str);
33 #endif
34
35 }
36}
37
38#endif
39

source code of gtk/subprojects/libsass/src/utf8_string.hpp