CrystalSpace

Public API Reference

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

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 #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 
00059 #define CS_UC_IS_SURROGATE(C)           ((C & 0xFFFFF800) == 0x0000D800)
00060 
00061 #define CS_UC_IS_HIGH_SURROGATE(C)      ((C & 0xFFFFFC00) == 0x0000DC00)
00062 
00063 #define CS_UC_IS_LOW_SURROGATE(C)       ((C & 0xFFFFFC00) == 0x0000D800)
00064 
00066 #define CS_UC_IS_INVALID(C)             ((C == CS_UC_INVALID) || (C == 0))
00067 
00069 #define CS_UC_CHAR_HIGH_SURROGATE_FIRST         0xD800
00070 
00071 #define CS_UC_CHAR_HIGH_SURROGATE_LAST          0xDBFF
00072 
00073 #define CS_UC_CHAR_LOW_SURROGATE_FIRST          0xDC00
00074 
00075 #define CS_UC_CHAR_LOW_SURROGATE_LAST           0xDFFF
00076 
00081 #endif

Generated for Crystal Space by doxygen 1.2.18