FirteX-高性能全文索引和检索平台API Documentation |
00001 // 00002 // Copyright(C) 2005--2006 Institute of Computing Tech, Chinese Academy of Sciences. 00003 // All rights reserved. 00004 // This file is part of FirteX (www.firtex.org) 00005 // 00006 // Use of the FirteX is subject to the terms of the software license set forth in 00007 // the LICENSE file included with this software, and also available at 00008 // http://www.firtex.org/license.html 00009 // 00010 // Author : 郭瑞杰(GuoRuijie) 00011 // Email : ruijieguo@software.ict.ac.cn,ruijieguo@gmail.com 00012 // Created : 2006/5/20 00013 // 00014 #ifndef HAVE_TCHAR_H 00015 #if defined(_UCS2) || defined(_UNICODE) 00016 00017 #undef _T //remove any previously defined _T - required for ppc os 00018 #define _T(x) L ## x 00019 00020 #define tchar wchar_t 00021 #define tstring std::wstring 00022 00023 //formatting functions 00024 #define _sntprintf swprintf //* make a formatted a string 00025 #define _tprintf wprintf //* print a formatted string 00026 00027 #define _vsntprintf vsnwprintf //* print a formatted string using variable arguments 00028 00029 #define _istalnum iswalnum //* alpha/numeric char check 00030 #define _istalpha iswalpha //* alpha char check 00031 #define _istspace iswspace //* space char check 00032 #define _istdigit iswdigit //* digit char check 00033 #define _totlower towlower //* convert char to lower case 00034 #define _totupper towupper //* convert char to lower case 00035 #define _tcslwr wcslwr //* convert string to lower case 00036 00037 #define _tcscpy wcscpy //copy a string to another string 00038 #define _tcsncpy wcsncpy //copy a specified amount of one string to another string. 00039 #define _tcscat wcscat //copy a string onto the end of the other string 00040 #define _tcschr wcschr //find location of one character 00041 #define _tcsstr wcsstr //find location of a string 00042 #define _tcslen wcslen //get length of a string 00043 #define _tcscmp wcscmp //case sensitive compare two strings 00044 #define _tcsncmp wcsncmp //case sensitive compare two strings 00045 #define _tcsnicmp wcsnicmp 00046 #define _tcscspn wcscspn //location of any of a set of character in a string 00047 00048 #define _tcsicmp wcsicmp //* case insensitive compare two string 00049 #define _stprintf swprintf 00050 00051 #define _ttoi _wtoi 00052 #define _ttoi64 wtoi64 00053 00054 /* Stdio functions */ 00055 #define _tfopen _wfopen 00056 #define _tfreopen _wfreopen 00057 00058 /* Io functions */ 00059 #define _taccess _waccess 00060 #define _tchmod _wchmod 00061 #define _tcreat _wcreat 00062 #define _tfindfirst _wfindfirst 00063 #define _tfindfirst64 _wfindfirst64 00064 #define _tfindfirsti64 _wfindfirsti64 00065 #define _tfindnext _wfindnext 00066 #define _tfindnext64 _wfindnext64 00067 #define _tfindnexti64 _wfindnexti64 00068 #define _tmktemp _wmktemp 00069 #define _topen _wopen 00070 #define _tremove _wremove 00071 #define _trename _wrename 00072 #define _tsopen _wsopen 00073 #define _tunlink _wunlink 00074 00075 #define _tfinddata_t _wfinddata_t 00076 #define _tfinddata64_t __wfinddata64_t 00077 #define _tfinddatai64_t _wfinddatai64_t 00078 00079 00080 /* Stat functions */ 00081 00082 #define _tstat _wstat 00083 #define _tstat64 _wstat64 00084 #define _tstati64 _wstati64 00085 00086 #define _stscanf swscanf 00087 00088 #define _tcsftime wcsftime 00089 00090 //conversion functions 00091 //#define _tcstod wcstod //convert a string to a double 00092 //#define _tcstoi64 wcstoll //* convers a string to an 64bit bit integer 00093 //#define _i64tot lltow //* converts a 64 bit integer to a string (with base) 00094 00095 #else //if defined(_ASCII) 00096 00097 #undef _T //remove any previously defined _T - required for ppc os 00098 #define _T(x) x 00099 00100 #define tchar char 00101 #define tstring std::string 00102 00103 //formatting functions 00104 #define _sntprintf snprintf 00105 #define _tprintf printf 00106 #define _vsntprintf vsnprintf 00107 00108 00109 #define _istalnum isalnum 00110 #define _istalpha isalpha 00111 #define _istspace isspace 00112 #define _istdigit isdigit 00113 #define _totlower tolower 00114 #define _totupper toupper 00115 #define _tcslwr strlwr 00116 00117 #define _ttoi atoi 00118 #ifdef WIN32 00119 #define _ttoi64 _atoi64 00120 #else 00121 #define _ttoi64 atoll 00122 #endif 00123 00124 00125 //these are the string handling functions 00126 #define _tcscpy strcpy 00127 #define _tcsncpy strncpy 00128 #define _tcscat strcat 00129 #define _tcschr strchr 00130 #define _tcsstr strstr 00131 #define _tcslen strlen 00132 #define _tcscmp strcmp 00133 #define _tcsncmp strncmp 00134 #define _tcsicmp strcasecmp 00135 #define _tcsnicmp strnicmp 00136 #define _tcscspn strcspn 00137 00138 #define _stscanf sscanf 00139 #define _stprintf sprintf 00140 00141 00142 /* Stdio functions */ 00143 00144 #define _tfopen fopen 00145 #define _tfreopen freopen 00146 00147 /* Io functions */ 00148 #define _tchmod _chmod 00149 #define _tcreat _creat 00150 #define _tfindfirst _findfirst 00151 #define _tfindfirst64 _findfirst64 00152 #define _tfindfirsti64 _findfirsti64 00153 #define _tfindnext _findnext 00154 #define _tfindnext64 _findnext64 00155 #define _tfindnexti64 _findnexti64 00156 #define _tmktemp _mktemp 00157 00158 #if (defined(_POSIX_) || !defined(WIN32)) 00159 #define _topen open 00160 #define _taccess access 00161 #else 00162 #define _topen _open 00163 #define _taccess _access 00164 #endif 00165 00166 #define _tremove remove 00167 #define _trename rename 00168 #define _tsopen _sopen 00169 #define _tunlink _unlink 00170 00171 #define _tfinddata_t _finddata_t 00172 #define _tfinddata64_t __finddata64_t 00173 #define _tfinddatai64_t _finddatai64_t 00174 00175 /* Stat functions */ 00176 00177 #define _tstat _stat 00178 #define _tstat64 __stat64 00179 #define _tstati64 _stati64 00180 00181 #define _tcsftime strftime 00182 00184 //#define _tcstod strtod 00185 //#define _tcstoi64 strtoll 00186 //#define _i64tot lltoa 00187 #endif 00188 00189 #else //HAVE_TCHAR_H 00190 00191 #include <tchar.h> 00192 00193 #if defined(_UCS2) || defined(_UNICODE) 00194 #define tstring std::wstring 00195 #define tchar wchar_t 00196 #else 00197 #define tstring std::string 00198 #define tchar char 00199 #endif 00200 00201 #endif
http://www.firtex.org http://www.sourceforge.net/projects/firtex