StandardLibrary.h
Go to the documentation of this file.00001 00015 #ifndef __StandardLibrary_H__ 00016 #define __StandardLibrary_H__ 00017 00024 int Round( 00025 float x 00026 ); 00027 00028 00032 const unsigned int RANDOM_MAX=0xffffffff; 00033 00034 00041 unsigned int Rand(); 00042 00043 00049 void SRand( 00050 unsigned int seed 00051 ); 00052 00053 00058 void Randomize(); 00059 00060 00064 int ToUpper( 00065 int c 00066 ); 00067 00068 00072 int ToLower( 00073 int c 00074 ); 00075 00076 00086 int StringToInt( 00087 const char* string 00088 ); 00089 00106 long StringToLong( 00107 const char* string 00108 ); 00109 00110 00129 double StringToDouble( 00130 const char* string 00131 ); 00132 00147 int SPrintF( 00148 char* buffer, 00149 const char* string, 00150 ... 00151 ); 00152 00153 00169 int SNPrintF( 00170 char* buffer, 00171 int maxLength, 00172 const char* string, 00173 ... 00174 ); 00175 00176 00184 char* StrDup( 00185 const char* string 00186 ); 00187 00188 00203 int StrNICmp( 00204 const char* string1, 00205 const char* string2, 00206 int count 00207 ); 00208 00209 00221 int StrICmp( 00222 const char* string1, 00223 const char* string2 00224 ); 00225 00226 00232 int StrCmp( 00233 const char* string1, 00234 const char* string2 00235 ); 00236 00237 00245 int StrNCmp( 00246 const char* string1, 00247 const char* string2, 00248 int count 00249 00250 ); 00251 00252 00262 unsigned int StrLen( 00263 const char* string 00264 ); 00265 00266 00276 char* StrCpy( 00277 char* strDestination, 00278 const char* strSource 00279 ); 00280 00281 00294 char* StrNCpy( 00295 char* strDestination, 00296 const char* strSource, 00297 int count 00298 ); 00299 00300 00309 char* StrCat( 00310 char* strDestination, 00311 const char* strSource 00312 ); 00313 00314 00329 char* StrNCat( 00330 char* strDestination, 00331 const char* strSource, 00332 int count 00333 ); 00334 00335 00342 char* StrUpr( 00343 char* string 00344 ); 00345 00346 00353 char* StrLwr( 00354 char* string 00355 ); 00356 00357 00364 const char* StrChr( 00365 const char* string, 00366 int c 00367 ); 00368 00369 00376 const char* StrRChr( 00377 const char* string, 00378 int c 00379 ); 00380 00381 00402 char* StrTok( 00403 char* strToken, 00404 const char* strDelimit 00405 ); 00406 00407 00415 const char* StrStr( 00416 const char* str1, 00417 const char* str2 00418 ); 00419 00420 00431 void* Malloc( 00432 unsigned int size 00433 ); 00434 00435 00443 void Free( 00444 void* memblock 00445 ); 00446 00447 00464 void* Realloc( 00465 void* memblock, 00466 unsigned int size 00467 ); 00468 00469 00477 void* MemCpy( 00478 void* dest, 00479 const void* src, 00480 unsigned int count 00481 ); 00482 00483 00491 void* MemSet( 00492 void* dest, 00493 int c, 00494 unsigned int count 00495 ); 00496 00497 00503 unsigned int MemCmp( 00504 const void* buf1, 00505 const void* buf2, 00506 unsigned int count 00507 ); 00508 00509 00525 void QSort( 00526 void* base, 00527 size_t num, 00528 size_t width, 00529 int (__cdecl* compare )(const void*, const void*) 00530 00531 00532 ); 00533 00534 00538 const float PI = 3.1415926535897932384626433832795f; 00539 00540 00544 const float TWO_PI = 2*PI; 00545 00546 00550 const float FLOAT_MAX = 3.402823466e+38f; 00551 00552 00556 const float FLOAT_MIN = 1.175494351e-38f; 00557 00558 00563 const float FLOAT_EPSILON = 1.192092896e-07f; 00564 00565 00569 const int MIN_INT = (-2147483647 - 1); 00570 00571 00575 const int MAX_INT = 2147483647; 00576 00577 00583 float ToRadians( 00584 float degrees // Angle to convert, in degrees 00585 ); 00586 00587 00593 float ToDegrees( 00594 float radians // Angle to convert, in radians 00595 ); 00596 00597 00604 float AngleDiff( 00605 float angleA, // First angle, in radians 00606 float angleB // Second angle, in radians 00607 ); 00608 00609 00615 float Abs( 00616 float x 00617 ); 00618 00619 00625 int Abs( 00626 int x 00627 ); 00628 00629 00635 int Pow( 00636 int x, 00637 int y 00638 ); 00639 00640 00646 float Pow( 00647 float x, 00648 float y 00649 ); 00650 00651 00658 float Log10( 00659 float x 00660 ); 00661 00662 00668 float Sqrt( 00669 float x 00670 ); 00671 00672 00678 float Mod( 00679 float x, 00680 float y 00681 ); 00682 00683 00690 float Sin( 00691 float x 00692 ); 00693 00694 00701 float ASin( 00702 float x 00703 ); 00704 00705 00712 float Cos( 00713 float x 00714 ); 00715 00716 00723 float ACos( 00724 float x 00725 ); 00726 00727 00734 float Tan( 00735 float x 00736 ); 00737 00738 00744 float ATan( 00745 float x 00746 ); 00747 00757 float Atan2( 00758 float x, 00759 float y 00760 ); 00761 00762 00769 float Exp( 00770 float x 00771 ); 00772 00773 00780 float Log( 00781 float x 00782 ); 00783 00784 00790 float Max( 00791 float a, 00792 float b 00793 ); 00794 00795 00801 float Min( 00802 float a, 00803 float b 00804 ); 00805 00806 00812 int Max( 00813 int a, 00814 int b 00815 ); 00816 00817 00823 int Min( 00824 int a, 00825 int b 00826 ); 00827 00828 00835 int Clamp( 00836 int value, 00837 int min, 00838 int max 00839 ); 00840 00841 00848 float Clamp( 00849 float value, 00850 float min, 00851 float max 00852 ); 00853 00854 00859 void Swap( 00860 int& x, 00861 int& y 00862 ); 00863 00864 00869 void Swap( 00870 unsigned int& x, 00871 unsigned int& y 00872 ); 00873 00874 00879 void Swap( 00880 float& x, 00881 float& y 00882 ); 00883 00884 00885 00886 00887 #endif /* __StandardLibrary_H__ */
Reproduction/republishing of any material on this site without permission is strictly prohibited.
