y_hashmap.inc 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /**--------------------------------------------------------------------------**\
  2. ====================================
  3. y_hashmap - Link strings to values
  4. ====================================
  5. Description:
  6. Maps string indexes to integer indexes. Uses a fast hash to get an array
  7. slot, then a linked list to resolve collisions.
  8. Legal:
  9. Version: MPL 1.1
  10. The contents of this file are subject to the Mozilla Public License Version
  11. 1.1 (the "License"); you may not use this file except in compliance with
  12. the License. You may obtain a copy of the License at
  13. http://www.mozilla.org/MPL/
  14. Software distributed under the License is distributed on an "AS IS" basis,
  15. WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  16. for the specific language governing rights and limitations under the
  17. License.
  18. The Original Code is the YSI hashmap include.
  19. The Initial Developer of the Original Code is Alex "Y_Less" Cole.
  20. Portions created by the Initial Developer are Copyright (C) 2011
  21. the Initial Developer. All Rights Reserved.
  22. Contributors:
  23. ZeeX, koolk, JoeBullet/Google63, g_aSlice/Slice
  24. Thanks:
  25. JoeBullet/Google63 - Handy arbitrary ASM jump code using SCTRL.
  26. ZeeX - Very productive conversations.
  27. koolk - IsPlayerinAreaEx code.
  28. TheAlpha - Danish translation.
  29. breadfish - German translation.
  30. Fireburn - Dutch translation.
  31. yom - French translation.
  32. 50p - Polish translation.
  33. Zamaroht - Spanish translation.
  34. Dracoblue, sintax, mabako, Xtreme, other coders - Producing other modes
  35. for me to strive to better.
  36. Pixels^ - Running XScripters where the idea was born.
  37. Matite - Pestering me to release it and using it.
  38. Very special thanks to:
  39. Thiadmer - PAWN, whose limits continue to amaze me!
  40. Kye/Kalcor - SA:MP.
  41. SA:MP Team past, present and future - SA:MP.
  42. Version:
  43. 2.0
  44. Changelog:
  45. 23/06/13:
  46. First version.
  47. Functions:
  48. stock:
  49. HashMap_Init - Associate a hash map with an array.
  50. HashMap_Add - Add a value under a given string.
  51. HashMap_Get - Get a value from a string.
  52. HashMap_RemoveKey - Remove a string and its value from a hash map.
  53. HashMap_Set - Change the value associated with a key.
  54. Definitions:
  55. HASH_MAP_DATA - What should be added to enums to be hash map referenced.
  56. HashMap - Declare a new hash map.
  57. \**--------------------------------------------------------------------------**/
  58. #if defined _INC_y_hashmap
  59. #endinput
  60. #endif
  61. #define _INC_y_hashmap
  62. #include "..\amx\amx_memory"
  63. #include "..\YSI_Core\y_utils"
  64. #include "..\YSI_Storage\y_amx"
  65. #include "..\YSI_Coding\y_stringhash"
  66. #include "..\YSI_Internal\y_shortfunc"
  67. #include "y_hashmap/impl"
  68. // The hashmap tests are vast. Only include them when explicitly requested.
  69. #if defined YSI_TESTS && defined YSI_HASHMAP_TESTS
  70. #include "..\YSI_Core\y_testing"
  71. #include "y_hashmap/tests"
  72. #endif