Blame src/utf8_string.hpp

Packit Service 7770af
#ifndef SASS_UTF8_STRING_H
Packit Service 7770af
#define SASS_UTF8_STRING_H
Packit Service 7770af
Packit Service 7770af
#include <string>
Packit Service 7770af
#include "utf8.h"
Packit Service 7770af
Packit Service 7770af
namespace Sass {
Packit Service 7770af
  namespace UTF_8 {
Packit Service 7770af
Packit Service 7770af
    // naming conventions:
Packit Service 7770af
    // offset: raw byte offset (0 based)
Packit Service 7770af
    // position: code point offset (0 based)
Packit Service 7770af
    // index: code point offset (1 based or negative)
Packit Service 7770af
Packit Service 7770af
    // function that will count the number of code points (utf-8 characters) from the beginning to the given end
Packit Service 7770af
    size_t code_point_count(const std::string& str, size_t start, size_t end);
Packit Service 7770af
    size_t code_point_count(const std::string& str);
Packit Service 7770af
Packit Service 7770af
    // function that will return the byte offset of a code point in a
Packit Service 7770af
    size_t offset_at_position(const std::string& str, size_t position);
Packit Service 7770af
Packit Service 7770af
    // function that returns number of bytes in a character in a string
Packit Service 7770af
    size_t code_point_size_at_offset(const std::string& str, size_t offset);
Packit Service 7770af
Packit Service 7770af
    // function that will return a normalized index, given a crazy one
Packit Service 7770af
    size_t normalize_index(int index, size_t len);
Packit Service 7770af
Packit Service 7770af
    #ifdef _WIN32
Packit Service 7770af
    // functions to handle unicode paths on windows
Packit Service 7770af
    std::string convert_from_utf16(const std::wstring& wstr);
Packit Service 7770af
    std::wstring convert_to_utf16(const std::string& str);
Packit Service 7770af
    #endif
Packit Service 7770af
Packit Service 7770af
  }
Packit Service 7770af
}
Packit Service 7770af
Packit Service 7770af
#endif