File: chewing-utf8-util.h

package info (click to toggle)
libchewing 0.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 14,220 kB
  • ctags: 10,179
  • sloc: ansic: 103,539; sh: 11,563; makefile: 316; python: 98
file content (56 lines) | stat: -rw-r--r-- 1,515 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
 * chewing-utf8-util.h
 *
 * Copyright (c) 2005, 2006, 2008, 2012
 *	libchewing Core Team. See ChangeLog for details.
 *
 * See the file "COPYING" for information on usage and redistribution
 * of this file.
 */

/* *INDENT-OFF* */
#ifndef CHEWING_UTF8_UTILS_H
#define CHEWING_UTF8_UTILS_H
/* *INDENT-ON* */

#include <stddef.h>

/* Return length of UTF-8 string */
int ueStrLen(const char *str);

/* Return bytes of a UTF-8 character */
int ueBytesFromChar(unsigned char b);

/* Return byets of a UTF-8 string until len position */
int ueStrNBytes(const char *, int);

#define STRNCPY_CLOSE 1
#define STRNCPY_NOT_CLOSE 0

/*!
 * Return how many bytes was copied
 * @param[out] dest 	The memory area to copy to.
 * @param[in] src 	The memory area to copy from.
 * @param[in] n 	The number to copy.
 * @param[in] end
 */
int ueStrNCpy(char dest[], const char *src, size_t n, int end);

/* Return address from n length after src */
char *ueStrSeek(char *src, size_t n);

/* Const version of ueStrSeek */
const char *ueConstStrSeek(const char *src, size_t n);

/*!
 * Locate a UTF-8 substring from UTF-8 string
 * @param[in] str     UTF-8 string from which substr is located
 * @param[in] lstr    Length of str in bytes.
 * @param[in] substr  UTF-8 string that is located in str.
 * @param[in] lsub    Length of substr in bytes.
 */
const char *ueStrStr(const char *str, size_t lstr, const char *substr, size_t lsub);

/* *INDENT-OFF* */
#endif                          /* CHEWING_UTF8_UTILS_H */
/* *INDENT-ON* */