#include "Tools.h"
Aller au code source de ce fichier.
Fonctions | |
char * | gettok (const char *pData, int iPos, char *pCar) |
Retourne un mots d'une phrase. | |
void | ItoA (int iNbr, char *pBuf) |
Convertie un nombre en carracteres. | |
int | AtoI (const char *pNbr) |
Convertie une chaine de carracteres en un nombre. | |
void | FtoA (float fNbr, char *pBuf) |
Convertie un nombre flotant en carracteres. | |
float | AtoF (const char *pNbr) |
Convertie une chaine de carracteres en un nombre flotant. | |
int | IsUInt (const char *pNbr) |
Vérifie si une chaine de carracteres est un nombre. | |
int | IsAlphaNum (const char *pBuf) |
Vérifie si une chaine de carracteres est alphanumérique. | |
int | IsAlphaNumCar (char cCar) |
Vérifie si un carractere est alphanumérique. | |
int | IsIn (char cCar, const char *pBuf) |
Vérifie si un carractére se trouve dans une chaine. | |
int | Replace (char cCar, char cNew, char *pBuf) |
Remplace des carractéres se trouvant dans une chaine. |
Définition dans le fichier Tools.c.
|
Convertie une chaine de carracteres ASCII en un nombre flotant signer ou non.
Définition à la ligne 105 du fichier Tools.c. Référencé par NetRequestParameter::GetAsFloat(). 00106 { 00107 float Total = 0, Float = 1; 00108 int Sign = 0; 00109 00110 if(*pNbr == '-') 00111 { 00112 Sign = 1; 00113 pNbr++; 00114 } 00115 00116 while((*pNbr >= '0') && (*pNbr <= '9')) 00117 Total = 10 * Total + (*pNbr++ - '0'); 00118 00119 if(*pNbr == '.') 00120 pNbr++; 00121 00122 while((*pNbr >= '0') && (*pNbr <= '9')) 00123 Total += (Float /= 10) * (*pNbr++ - '0'); 00124 00125 if(Sign) 00126 Total = -Total; 00127 00128 return Total; 00129 }
|
|
Convertie une chaine de carracteres ASCII en un nombre décimal signer ou non.
Définition à la ligne 75 du fichier Tools.c. Référencé par NetRequestParameter::GetAsInt(), ModuleDynamiqueModule::Load(), et Error::Perror(). 00076 { 00077 int Total = 0; 00078 int Sign = 0; 00079 00080 if(*pNbr == '-') 00081 { 00082 Sign = 1; 00083 pNbr++; 00084 } 00085 00086 while((*pNbr >= '0') && (*pNbr <= '9')) 00087 Total = 10 * Total + (*pNbr++ - '0'); 00088 00089 if(Sign) 00090 Total = -Total; 00091 00092 return Total; 00093 }
|
|
Convertie un nombre flotant signer ou non en carracteres ASCII.
Définition à la ligne 95 du fichier Tools.c. Références ItoA(). 00096 { 00097 char Float[6]; 00098 00099 ItoA((int)fNbr, pBuf); 00100 strcat(pBuf, ".\0"); 00101 ItoA((int)((fNbr - (int)fNbr) * 10000), Float); 00102 strcat(pBuf, Float); 00103 }
|
|
Retourne le mots à la position Pos dans une phrase pData avec comme carracteres entre les mots pCar.
Définition à la ligne 14 du fichier Tools.c. Référencé par NetParser::Parse(), et Error::Perror(). 00015 { 00016 static char Data[NBCHAR]; 00017 int c = 0, n = 0, l = 0; 00018 char *ppCar; 00019 00020 for(; *pData && (n <= iPos); pData++) 00021 { 00022 for(ppCar = pCar; *ppCar && (*ppCar != *pData); ppCar++); 00023 00024 if(*ppCar) 00025 { 00026 if(!l) 00027 { 00028 l = 1; 00029 n++; 00030 } 00031 } 00032 else 00033 { 00034 l = 0; 00035 if(iPos == n) 00036 Data[c++] = *pData; 00037 } 00038 } 00039 00040 Data[c] = 0; 00041 00042 return Data; 00043 }
|
|
Vérifie si une chaine de carracteres ASCII est une uniquement alphanumérique.
Définition à la ligne 140 du fichier Tools.c. 00141 { 00142 for(; *pBuf; *pBuf++) 00143 { 00144 if((*pBuf < 'a') || (*pBuf > 'z')) 00145 { 00146 if((*pBuf < 'A') || (*pBuf > 'Z')) 00147 { 00148 if((*pBuf < '0') || (*pBuf > '9')) 00149 return 0; 00150 } 00151 } 00152 } 00153 00154 return 1; 00155 }
|
|
Vérifie si un carractere ASCII est une uniquement alphanumérique.
Définition à la ligne 157 du fichier Tools.c. Référencé par XMLObjet::Load(), NetParser::Parse(), et Script::Parse(). 00158 { 00159 if((cCar < 'a') || (cCar > 'z')) 00160 { 00161 if((cCar < 'A') || (cCar > 'Z')) 00162 { 00163 if((cCar < '0') || (cCar > '9')) 00164 return 0; 00165 } 00166 } 00167 00168 return 1; 00169 }
|
|
Vérifie si le carractére cCar se trouve dans la chaine pBuf.
Définition à la ligne 171 du fichier Tools.c. 00172 { 00173 for(; *pBuf; *pBuf++) 00174 if(cCar == *pBuf) 00175 return 1; 00176 00177 return 0; 00178 }
|
|
Vérifie si une chaine de carracteres ASCII est un nombre décimal non signer et entier.
Définition à la ligne 131 du fichier Tools.c. 00132 { 00133 for(; *pNbr; *pNbr++) 00134 if((*pNbr < '0') || (*pNbr > '9')) 00135 return 0; 00136 00137 return 1; 00138 }
|
|
Convertie un nombre décimal signer ou non en carracteres ASCII.
Définition à la ligne 45 du fichier Tools.c. Référencé par FtoA(). 00046 { 00047 char Buffer[12]; 00048 char *ppBuf = pBuf; 00049 char *Temp = Buffer; 00050 00051 *Temp++; 00052 00053 if(iNbr < 0) 00054 { 00055 *Temp++ = '-'; 00056 iNbr = -1 * iNbr; 00057 } 00058 00059 do 00060 { 00061 *Temp++ = (char)((iNbr % 10) + '0'); 00062 iNbr /= 10; 00063 } 00064 while(iNbr > 0); 00065 00066 *Temp-- = 0; 00067 00068 do 00069 { 00070 *ppBuf++ = *Temp--; 00071 } 00072 while(*Temp); 00073 }
|
|
Remplace tous les carractéres cCar par le carractére cNew se trouve dans la chaine pBuf.
Définition à la ligne 180 du fichier Tools.c. 00181 { 00182 int i = 0; 00183 00184 for(; *pBuf; *pBuf++) 00185 { 00186 if(cCar == *pBuf) 00187 { 00188 *pBuf = cNew; 00189 i++; 00190 } 00191 } 00192 00193 return i; 00194 }
|