|
STK++ 1.0
|
00001 /*--------------------------------------------------------------------*/ 00002 /* Copyright (C) 2004-2007 Serge Iovleff 00003 00004 This program is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU Lesser General Public License as 00006 published by the Free Software Foundation; either version 2 of the 00007 License, or (at your option) any later version. 00008 00009 This program 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 00012 GNU Lesser General Public License for more details. 00013 00014 You should have received a copy of the GNU Lesser General Public 00015 License along with this program; if not, write to the 00016 Free Software Foundation, Inc., 00017 59 Temple Place, 00018 Suite 330, 00019 Boston, MA 02111-1307 00020 USA 00021 00022 Contact : Serge.Iovleff@stkpp.org 00023 */ 00024 00025 /* 00026 * Project: Base 00027 * Purpose: Define the fundamental type Char. 00028 * Author: Serge Iovleff, serge.iovleff@stkpp.org 00029 * 00030 **/ 00031 00036 #ifndef STK_CHAR_H 00037 #define STK_CHAR_H 00038 00039 #include "STK_Arithmetic.h" 00040 #include "STK_IdTypeImpl.h" 00041 00042 namespace STK 00043 { 00044 00055 #ifdef STK_UNICODE 00056 00057 typedef wchar_t Char; 00058 00061 #define _T(x) L ## x 00062 00065 #define stk_cout std::wcout 00066 00069 #define stk_cin std::wcin 00070 00073 #define stk_cerr std::wcerr 00074 00077 #define stk_clog std::wclog 00078 00079 #else // !Unicode 00080 00081 typedef char Char; 00082 00085 #define _T(x) x 00086 00089 #define stk_cout std::cout 00090 00093 #define stk_cin std::cin 00094 00097 #define stk_cerr std::cerr 00098 00101 #define stk_log std::clog 00102 00103 #endif // STK_UNICODE 00104 00111 template<> 00112 struct Arithmetic<Char> : public std::numeric_limits<Char> 00113 { 00117 static Char NA() throw() 00118 { return static_cast<Char>(0); } 00119 00122 static const bool hasNA = false; 00123 00128 static bool isNA(const Char& x) throw() 00129 { return false; } 00130 00135 static bool isInfinite(const Char& x) throw() 00136 { return false; } 00137 00142 static bool isFinite(const Char& x) throw() 00143 { return true; } 00144 }; 00145 00151 template<> 00152 struct IdTypeImpl<Char> 00153 { 00157 static IdType returnType() 00158 { return(character);} 00159 }; 00160 00161 00162 } // namespace STK 00163 00164 #endif /*STK_CHAR_H*/