Add ICU message format support
[chromium-blink-merge.git] / third_party / re2 / util / utf.h
blob06ff8f03eb4d281c40ad583051fa70cdf21f88b5
1 /*
2 * The authors of this software are Rob Pike and Ken Thompson.
3 * Copyright (c) 2002 by Lucent Technologies.
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose without fee is hereby granted, provided that this entire notice
6 * is included in all copies of any software which is or includes a copy
7 * or modification of this software and in all copies of the supporting
8 * documentation for such software.
9 * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
10 * WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE ANY
11 * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
12 * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
14 * This file and rune.cc have been converted to compile as C++ code
15 * in name space re2.
17 #ifndef RE2_UTIL_UTF_H__
18 #define RE2_UTIL_UTF_H__
20 #include <stdint.h>
22 namespace re2 {
24 typedef signed int Rune; /* Code-point values in Unicode 4.0 are 21 bits wide.*/
26 enum
28 UTFmax = 4, /* maximum bytes per rune */
29 Runesync = 0x80, /* cannot represent part of a UTF sequence (<) */
30 Runeself = 0x80, /* rune and UTF sequences are the same (<) */
31 Runeerror = 0xFFFD, /* decoding error in UTF */
32 Runemax = 0x10FFFF, /* maximum rune value */
35 int runetochar(char* s, const Rune* r);
36 int chartorune(Rune* r, const char* s);
37 int fullrune(const char* s, int n);
38 int utflen(const char* s);
39 char* utfrune(const char*, Rune);
41 } // namespace re2
43 #endif // RE2_UTIL_UTF_H__