aboutsummaryrefslogtreecommitdiff
path: root/dep/CascLib/src/common/Map.h
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2014-10-10 20:17:30 +0200
committerShauren <shauren.trinity@gmail.com>2014-10-10 20:17:30 +0200
commit88ae3da6373dee1f04d03b823ee63d6f1db1502e (patch)
treef9ac27f0a743a57b70e90b37f5971e024992eb00 /dep/CascLib/src/common/Map.h
parentbc97908822c4afa23740ce70151c2486c340e2c2 (diff)
Tools/Extractors: Updated map extractor
Diffstat (limited to 'dep/CascLib/src/common/Map.h')
-rw-r--r--dep/CascLib/src/common/Map.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/dep/CascLib/src/common/Map.h b/dep/CascLib/src/common/Map.h
new file mode 100644
index 00000000000..b4b9c918df3
--- /dev/null
+++ b/dep/CascLib/src/common/Map.h
@@ -0,0 +1,39 @@
+/*****************************************************************************/
+/* Map.h Copyright (c) Ladislav Zezula 2014 */
+/*---------------------------------------------------------------------------*/
+/* Interface of hash-to-ptr map for CascLib */
+/*---------------------------------------------------------------------------*/
+/* Date Ver Who Comment */
+/* -------- ---- --- ------- */
+/* 10.06.14 1.00 Lad The first version of Map.h */
+/*****************************************************************************/
+
+#ifndef __HASHTOPTR_H__
+#define __HASHTOPTR_H__
+
+//-----------------------------------------------------------------------------
+// Structures
+
+#define KEY_LENGTH_STRING 0xFFFFFFFF // Pass this to Map_Create as dwKeyLength when you want map of string->object
+
+typedef struct _CASC_MAP
+{
+ size_t TableSize;
+ size_t ItemCount; // Number of items in the map
+ size_t MemberOffset; // How far is the hash from the begin of the structure (in bytes)
+ size_t KeyLength; // Length of the hash key
+ void * HashTable[1]; // Pointer table
+
+} CASC_MAP, *PCASC_MAP;
+
+//-----------------------------------------------------------------------------
+// Functions
+
+PCASC_MAP Map_Create(DWORD dwMaxItems, DWORD dwKeyLength, DWORD dwMemberOffset);
+size_t Map_EnumObjects(PCASC_MAP pMap, void **ppvArray);
+void * Map_FindObject(PCASC_MAP pMap, void * pvIdentifier);
+bool Map_InsertObject(PCASC_MAP pMap, void * pvIdentifier);
+void Map_Sort(PCASC_MAP pMap);
+void Map_Free(PCASC_MAP pMap);
+
+#endif // __HASHTOPTR_H__