1 #ifndef SASS_UTF8_STRING_H
2 #define SASS_UTF8_STRING_H
10 // naming conventions:
11 // offset: raw byte offset (0 based)
12 // position: code point offset (0 based)
13 // index: code point offset (1 based or negative)
15 // function that will count the number of code points (utf-8 characters) from the beginning to the given end
16 size_t code_point_count(const std::string& str, size_t start, size_t end);
17 size_t code_point_count(const std::string& str);
19 // function that will return the byte offset of a code point in a
20 size_t offset_at_position(const std::string& str, size_t position);
22 // function that returns number of bytes in a character in a string
23 size_t code_point_size_at_offset(const std::string& str, size_t offset);
25 // function that will return a normalized index, given a crazy one
26 size_t normalize_index(int index, size_t len);
29 // functions to handle unicode paths on windows
30 std::string convert_from_utf16(const std::wstring& wstr);
31 std::wstring convert_to_utf16(const std::string& str);