Initial commit
[yaffs-website] / node_modules / node-sass / src / libsass / src / utf8_string.hpp
1 #ifndef SASS_UTF8_STRING_H
2 #define SASS_UTF8_STRING_H
3
4 #include <string>
5 #include "utf8.h"
6
7 namespace Sass {
8   namespace UTF_8 {
9
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)
14
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);
18
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);
21
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);
24
25     // function that will return a normalized index, given a crazy one
26     size_t normalize_index(int index, size_t len);
27
28     #ifdef _WIN32
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);
32     #endif
33
34   }
35 }
36
37 #endif