CrystalSpace

Public API Reference

csutil/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 #include "cssysdef.h"
00030 
00031 #if !defined(CS_WCHAR_T_SIZE)
00032 #  error Unknown wchar_t size.
00033 #elif (CS_WCHAR_T_SIZE != 1) && \
00034       (CS_WCHAR_T_SIZE != 2) && \
00035       (CS_WCHAR_T_SIZE != 4)
00036 #  error Unsupported wchar_t size.
00037 #endif
00038 
00040 typedef uint8 utf8_char;
00042 typedef uint16 utf16_char;
00044 typedef uint32 utf32_char;
00045  
00048 
00049 #define CS_UC_CHAR_REPLACER             0xFFFD
00051 #define CS_UC_INVALID                   0xFFFF
00053 #define CS_UC_BOM                       0xFFFE
00055 #define CS_UC_LAST_CHAR                 0x10FFFF
00056 
00058 #define CS_UC_IS_SURROGATE(C)           (((C) & 0xFFFFF800) == 0x0000D800)
00060 #define CS_UC_IS_HIGH_SURROGATE(C)      (((C) & 0xFFFFFC00) == 0x0000DC00)
00062 #define CS_UC_IS_LOW_SURROGATE(C)       (((C) & 0xFFFFFC00) == 0x0000D800)
00063 
00065 #define CS_UC_IS_NONCHARACTER(C)        (((C) == CS_UC_INVALID) || \
00066                                          ((C) == CS_UC_BOM) || \
00067                                          (((C) >= 0xFDD0) && ((C) <= 0xFDEF)) \
00068                                          || ((C) > CS_UC_LAST_CHAR))
00069 
00071 #define CS_UC_CHAR_HIGH_SURROGATE_FIRST         0xD800
00073 #define CS_UC_CHAR_HIGH_SURROGATE_LAST          0xDBFF
00075 #define CS_UC_CHAR_LOW_SURROGATE_FIRST          0xDC00
00077 #define CS_UC_CHAR_LOW_SURROGATE_LAST           0xDFFF
00078 
00083 #endif

Generated for Crystal Space by doxygen 1.4.7