您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ utf8_next_char函数代码示例

51自学网 2021-06-03 09:24:06
  C++
这篇教程C++ utf8_next_char函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中utf8_next_char函数的典型用法代码示例。如果您正苦于以下问题:C++ utf8_next_char函数的具体用法?C++ utf8_next_char怎么用?C++ utf8_next_char使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了utf8_next_char函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: isWhitespace

////////////////////////////////////////////////////////////////////////////////// Lexer::Type::tag//   ^ | <isWhiteSpace>    [ +|- ] <isIdentifierStart> [ <isIdentifierNext> ]*bool Lexer::isTag (std::string& token, Lexer::Type& type){  std::size_t marker = _cursor;  // Lookbehind: ^ | <isWhiteSpace>  if (marker > 0 &&      ! isWhitespace (_text[marker - 1]))    return false;  if (_text[marker] == '+' ||      _text[marker] == '-')  {    ++marker;    if (isIdentifierStart (_text[marker]))    {      utf8_next_char (_text, marker);      while (isIdentifierNext (_text[marker]))          utf8_next_char (_text, marker);      token = _text.substr (_cursor, marker - _cursor);      type = Lexer::Type::tag;      _cursor = marker;      return true;    }  }  return false;}
开发者ID:lowfatcomputing,项目名称:task,代码行数:33,


示例2: gui_input_delete_previous_word

voidgui_input_delete_previous_word (){    int length_deleted, size_deleted;    char *start, *string;        if (gui_current_window->buffer->input)    {        if (gui_current_window->buffer->input_buffer_pos > 0)        {            start = utf8_add_offset (gui_current_window->buffer->input_buffer,                                      gui_current_window->buffer->input_buffer_pos - 1);            string = start;            while (string && (string[0] == ' '))            {                string = utf8_prev_char (gui_current_window->buffer->input_buffer, string);            }            if (string)            {                while (string && (string[0] != ' '))                {                    string = utf8_prev_char (gui_current_window->buffer->input_buffer, string);                }                if (string)                {                    while (string && (string[0] == ' '))                    {                        string = utf8_prev_char (gui_current_window->buffer->input_buffer, string);                    }                }            }                        if (string)                string = utf8_next_char (utf8_next_char (string));            else                string = gui_current_window->buffer->input_buffer;                        size_deleted = utf8_next_char (start) - string;            length_deleted = utf8_strnlen (string, size_deleted);                        gui_input_clipboard_copy (string, size_deleted);                        gui_input_move (gui_current_window->buffer, string, string + size_deleted, strlen (string + size_deleted));                        gui_current_window->buffer->input_buffer_size -= size_deleted;            gui_current_window->buffer->input_buffer_length -= length_deleted;            gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '/0';            gui_current_window->buffer->input_buffer_pos -= length_deleted;            gui_input_optimize_size (gui_current_window->buffer);            gui_completion_stop (gui_current_window->buffer->completion, 1);            gui_input_text_changed_modifier_and_signal (gui_current_window->buffer);        }    }}
开发者ID:matsuu,项目名称:weechat,代码行数:54,


示例3: while

////////////////////////////////////////////////////////////////////////////////// Compares two strings with offsets, and returns the number bytes in common.//// left:   wonderful// l:      ^// right:  prowonderbread// r:         ^// returns:        ^ 6std::string::size_type Lexer::commonLength (  const std::string& left,  std::string::size_type l,  const std::string& right,  std::string::size_type r){  while (left[l] == right[r]        &&         utf8_next_char (left,  l)  &&         utf8_next_char (right, r))    ;  return l;}
开发者ID:austinwagner,项目名称:task,代码行数:21,


示例4: gui_chat_string_real_pos

intgui_chat_string_real_pos (const char *string, int pos){    const char *real_pos, *ptr_string;    int size_on_screen;        if (pos <= 0)        return 0;        real_pos = string;    ptr_string = string;    while (ptr_string && ptr_string[0] && (pos > 0))    {        ptr_string = gui_chat_string_next_char (NULL,                                                (unsigned char *)ptr_string,                                                0);        if (ptr_string)        {            size_on_screen = (((unsigned char)ptr_string[0]) < 32) ? 1 : utf8_char_size_screen (ptr_string);            if (size_on_screen > 0)                pos -= size_on_screen;            ptr_string = utf8_next_char (ptr_string);            real_pos = ptr_string;        }    }    return 0 + (real_pos - string);}
开发者ID:matsuu,项目名称:weechat,代码行数:27,


示例5: obfuscateText

const std::string obfuscateText (const std::string& input){  std::stringstream output;  std::string::size_type i = 0;  int character;  bool inside = false;  while ((character = utf8_next_char (input, i)))  {    if (inside)    {      output << (char) character;      if (character == 'm')        inside = false;    }    else    {      if (character == 033)        inside = true;      if (inside || character == ' ')        output << (char) character;      else        output << 'x';    }  }  return output.str ();}
开发者ID:austinwagner,项目名称:task,代码行数:30,


示例6: gui_chat_string_real_pos

intgui_chat_string_real_pos (const char *string, int pos, int use_screen_size){    const char *real_pos, *real_pos_prev, *ptr_string;    int size_on_screen;    if (pos <= 0)        return 0;    real_pos = string;    real_pos_prev = string;    ptr_string = string;    while (ptr_string && ptr_string[0] && (pos >= 0))    {        ptr_string = gui_chat_string_next_char (NULL, NULL,                                                (unsigned char *)ptr_string,                                                0, 0, 0);        if (ptr_string)        {            size_on_screen = gui_chat_char_size_screen (ptr_string);            if (size_on_screen > 0)                pos -= (use_screen_size) ? size_on_screen : 1;            ptr_string = utf8_next_char (ptr_string);            real_pos_prev = real_pos;            real_pos = ptr_string;        }    }    if (pos < 0)        real_pos = real_pos_prev;    return 0 + (real_pos - string);}
开发者ID:Evalle,项目名称:weechat,代码行数:31,


示例7: longestWord

int longestWord (const std::string& input){  int longest = 0;  int length = 0;  std::string::size_type i = 0;  int character;  while ((character = utf8_next_char (input, i)))  {    if (character == ' ')    {      if (length > longest)        longest = length;      length = 0;    }    else      length += mk_wcwidth (character);  }  if (length > longest)    longest = length;  return longest;}
开发者ID:georgebrock,项目名称:task,代码行数:25,


示例8: gui_input_delete_next_word

voidgui_input_delete_next_word (){    int size_deleted, length_deleted;    char *start, *string;        if (gui_current_window->buffer->input)    {        start = utf8_add_offset (gui_current_window->buffer->input_buffer,                                 gui_current_window->buffer->input_buffer_pos);        string = start;        length_deleted = 0;        while (string[0])        {            if ((string[0] == ' ') && (string > start))                break;            string = utf8_next_char (string);            length_deleted++;        }        size_deleted = string - start;                gui_input_clipboard_copy (start, size_deleted);                gui_input_move (gui_current_window->buffer, start, string, strlen (string));                gui_current_window->buffer->input_buffer_size -= size_deleted;        gui_current_window->buffer->input_buffer_length -= length_deleted;        gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '/0';        gui_input_optimize_size (gui_current_window->buffer);        gui_completion_stop (gui_current_window->buffer->completion, 1);        gui_input_text_changed_modifier_and_signal (gui_current_window->buffer);    }}
开发者ID:matsuu,项目名称:weechat,代码行数:33,


示例9: gui_chat_get_word_info

voidgui_chat_get_word_info (struct t_gui_window *window,                        const char *data,                        int *word_start_offset, int *word_end_offset,                        int *word_length_with_spaces, int *word_length){    const char *start_data;    char *next_char, *next_char2;    int leading_spaces, char_size_screen;    *word_start_offset = 0;    *word_end_offset = 0;    *word_length_with_spaces = 0;    *word_length = 0;    start_data = data;    leading_spaces = 1;    while (data && data[0])    {        next_char = gui_chat_string_next_char (window, NULL,                                               (unsigned char *)data, 0, 0, 0);        if (next_char)        {            next_char2 = utf8_next_char (next_char);            if (next_char2)            {                if (next_char[0] != ' ')                {                    if (leading_spaces)                        *word_start_offset = next_char - start_data;                    leading_spaces = 0;                    *word_end_offset = next_char2 - start_data - 1;                    char_size_screen = gui_chat_char_size_screen (next_char);                    (*word_length_with_spaces) += char_size_screen;                    (*word_length) += char_size_screen;                }                else                {                    if (leading_spaces)                    {                        (*word_length_with_spaces)++;                        *word_end_offset = next_char2 - start_data - 1;                    }                    else                    {                        *word_end_offset = next_char - start_data - 1;                        return;                    }                }                data = next_char2;            }        }        else        {            *word_end_offset = data + strlen (data) - start_data - 1;            return;        }    }}
开发者ID:FauxFaux,项目名称:weechat_old,代码行数:60,


示例10: uni_print_json

STATIC void uni_print_json(void (*print)(void *env, const char *fmt, ...), void *env, const byte *str_data, uint str_len) {    print(env, "/"");    const byte *s = str_data, *top = str_data + str_len;    while (s < top) {        unichar ch;        ch = utf8_get_char(s);        s = utf8_next_char(s);        if (ch == '"' || ch == '//' || ch == '/') {            print(env, "//%c", ch);        } else if (32 <= ch && ch <= 126) {            print(env, "%c", ch);        } else if (*s == '/b') {            print(env, "//b");        } else if (*s == '/f') {            print(env, "//f");        } else if (*s == '/n') {            print(env, "//n");        } else if (*s == '/r') {            print(env, "//r");        } else if (*s == '/t') {            print(env, "//t");        } else {            print(env, "//u%04x", ch);        }    }    print(env, "/"");}
开发者ID:karkoonzaid,项目名称:micropython,代码行数:27,


示例11: gui_input_move_previous_word

voidgui_input_move_previous_word (){    char *pos;        if (gui_current_window->buffer->input)    {        if (gui_current_window->buffer->input_buffer_pos > 0)        {            pos = utf8_add_offset (gui_current_window->buffer->input_buffer,                                   gui_current_window->buffer->input_buffer_pos - 1);            while (pos && (pos[0] == ' '))            {                pos = utf8_prev_char (gui_current_window->buffer->input_buffer, pos);            }            if (pos)            {                while (pos && (pos[0] != ' '))                {                    pos = utf8_prev_char (gui_current_window->buffer->input_buffer, pos);                }                if (pos)                    pos = utf8_next_char (pos);                else                    pos = gui_current_window->buffer->input_buffer;                gui_current_window->buffer->input_buffer_pos = utf8_pos (gui_current_window->buffer->input_buffer,                                                             pos - gui_current_window->buffer->input_buffer);            }            else                gui_current_window->buffer->input_buffer_pos = 0;                        gui_input_text_cursor_moved_signal ();        }    }}
开发者ID:matsuu,项目名称:weechat,代码行数:35,


示例12: gui_input_delete_next_char

voidgui_input_delete_next_char (){    char *pos, *pos_next;    int char_size, size_to_move;        if (gui_current_window->buffer->input)    {        if (gui_current_window->buffer->input_buffer_pos <            gui_current_window->buffer->input_buffer_length)        {            pos = utf8_add_offset (gui_current_window->buffer->input_buffer,                                   gui_current_window->buffer->input_buffer_pos);            pos_next = utf8_next_char (pos);            char_size = pos_next - pos;            size_to_move = strlen (pos_next);            gui_input_move (gui_current_window->buffer, pos, pos_next, size_to_move);            gui_current_window->buffer->input_buffer_size -= char_size;            gui_current_window->buffer->input_buffer_length--;            gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '/0';            gui_input_optimize_size (gui_current_window->buffer);            gui_completion_stop (gui_current_window->buffer->completion, 1);            gui_input_text_changed_modifier_and_signal (gui_current_window->buffer);        }    }}
开发者ID:matsuu,项目名称:weechat,代码行数:26,


示例13: istalk

int istalk(unsigned char* words) {    unsigned char* word = words;    while (*word) {        if (word[0] == '?' || word[0] == '/' || word[0] == 0x27 || word[0] == '+' ||                word[0] == ',') // || word[0] == ';' ) // 0x27 = '            ;        else if (word[0] == 0xef && word[1] == 0xbc && word[2] == 0x9f) //「?」            ;        else if (word[0] != 0xe3)            return 0;        else if (word[1] == 0x80 && (word[2] == 0x81 || word[2] == 0x82)) // 、。            ;        else if (word[1] == 0x83 && word[2] == 0xbc) // 
C++ utf8_strlen函数代码示例
C++ utf8_from_wstring函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。