CrystalSpace

Public API Reference

Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

csunicode.h

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2003 by Frank Richter
00003 
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Library General Public
00006     License as published by the Free Software Foundation; either
00007     version 2 of the License, or (at your option) any later version.
00008 
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Library General Public License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public
00015     License along with this library; if not, write to the Free
00016     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00017 */
00018 
00019 #ifndef __CS_CSUNICODE_H__
00020 #define __CS_CSUNICODE_H__
00021 
00029 #if defined(CS_HAS_WCHAR_H)
00030 #include <wchar.h>
00031 #endif
00032 
00033 #if defined(CS_USE_FAKE_WCHAR_TYPE)
00034 typedef uint16 wchar_t;
00035 #define CS_WCHAR_T_SIZE 2
00036 #endif
00037 
00038 #if !defined(CS_WCHAR_T_SIZE)
00039 #  error Unknown wchar_t size.
00040 #elif (CS_WCHAR_T_SIZE != 1) && (CS_WCHAR_T_SIZE != 2) && (CS_WCHAR_T_SIZE != 4)
00041 #  error Unsupported wchar_t size.
00042 #endif
00043 
00045 typedef uint8 utf8_char;
00047 typedef uint16 utf16_char;
00049 typedef uint32 utf32_char;
00050  
00053 
00054 #define CS_UC_CHAR_REPLACER             0xFFFD
00055 
00056 #define CS_UC_INVALID                   0xFFFF
00057 
00058 #define CS_UC_BOM                       0xFFFE
00059 
00060 #define CS_UC_LAST_CHAR                 0x10FFFF
00061 
00063 #define CS_UC_IS_SURROGATE(C)           (((C) & 0xFFFFF800) == 0x0000D800)
00064 
00065 #define CS_UC_IS_HIGH_SURROGATE(C)      (((C) & 0xFFFFFC00) == 0x0000DC00)
00066 
00067 #define CS_UC_IS_LOW_SURROGATE(C)       (((C) & 0xFFFFFC00) == 0x0000D800)
00068 
00070 #define CS_UC_IS_NONCHARACTER(C)        (((C) == CS_UC_INVALID) || ((C) == CS_UC_BOM) \
00071                                          || (((C) >= 0xFDD0) && ((C) <= 0xFDEF))      \
00072                                          || ((C) > CS_UC_LAST_CHAR))
00073 
00075 #define CS_UC_CHAR_HIGH_SURROGATE_FIRST         0xD800
00076 
00077 #define CS_UC_CHAR_HIGH_SURROGATE_LAST          0xDBFF
00078 
00079 #define CS_UC_CHAR_LOW_SURROGATE_FIRST          0xDC00
00080 
00081 #define CS_UC_CHAR_LOW_SURROGATE_LAST           0xDFFF
00082 
00087 #endif

Generated for Crystal Space by doxygen 1.3.9.1