Home | History | Annotate | Download | only in include
      1 /*
      2  * Copyright (C) 2009 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 #ifndef PINYINIME_INCLUDE_UTF16CHAR_H__
     18 #define PINYINIME_INCLUDE_UTF16CHAR_H__
     19 
     20 #include <stdlib.h>
     21 
     22 namespace ime_pinyin {
     23 
     24 #ifdef __cplusplus
     25 extern "C" {
     26 #endif
     27 
     28   typedef unsigned short char16;
     29 
     30   // Get a token from utf16_str,
     31   // Returned pointer is a '\0'-terminated utf16 string, or NULL
     32   // *utf16_str_next returns the next part of the string for further tokenizing
     33   char16* utf16_strtok(char16 *utf16_str, size_t *token_size,
     34                        char16 **utf16_str_next);
     35 
     36   int utf16_atoi(const char16 *utf16_str);
     37 
     38   float utf16_atof(const char16 *utf16_str);
     39 
     40   size_t utf16_strlen(const char16 *utf16_str);
     41 
     42   int utf16_strcmp(const char16 *str1, const char16 *str2);
     43   int utf16_strncmp(const char16 *str1, const char16 *str2, size_t size);
     44 
     45   char16* utf16_strcpy(char16 *dst, const char16 *src);
     46   char16* utf16_strncpy(char16 *dst, const char16 *src, size_t size);
     47 
     48 
     49   char* utf16_strcpy_tochar(char *dst, const char16 *src);
     50 
     51 #ifdef __cplusplus
     52 }
     53 #endif
     54 }
     55 
     56 #endif  // PINYINIME_INCLUDE_UTF16CHAR_H__
     57